Close
0%
0%

StackMod: Modular Robotics Design Simplified

StackMod is a simple communications protocol and a case study in modular robotic systems design.

Similar projects worth following

Who is this for?

On a high level, this is for anyone who finds it useful -- that's the ultimate goal of an open platform! With that said, I designed this protocol and the accompanying case study with the idea of making robotics more accessible to those who are just starting out in robotics and those without an engineering background by abstracting the technical aspects and demonstrating the ideas and guiding principles behind modular systems design that leads to resilient and inter-operable systems. 

I am using a lot of off-the-shelf parts in this case study because this is not meant to be an advanced electronics tutorial but instead is meant to show a higher level picture of robotic systems design. 

What is StackMod?

StackMod is a simple human-readable communications protocol created to help simplify the passing of data between modules in a robotic system. StackMod was designed for use over I2C or Serial. My focus in robotics has been in designing small to medium sized autonomous vehicles so this protocol and the accompanying case study are geared towards developing a robotic vehicle. 

How simple is StackMod? Even without knowing anything about this protocol, you can probably figure out what this command does: 

{@$MTR2+078} 

Yep, that sets the speed of motor 2 to 78 arbitrary units.

Why StackMod?

Modular design in robotics requires the compartmentalization of behaviors and functions into discrete and, ideally, interchangeable modules. As I started building more complex systems with multiple "brains" working together (Raspberry Pis, BeagleBones, and Arduinos), I eventually created a language that could be used to more easily facilitate communication among to all these controllers over I2C. After tweaking that language for various projects, I decided to standardize it and create a formalized protocol, which I am releasing for anyone to use.

There are a lot of full-featured and extensive protocols and libraries out there (Firmata being at the top) and this does not attempt to replace or compete with those. It's a simple single-purpose protocol with the sole focus of use for robotic systems with no overhead or fancy features.

  • 1
    Writing a Protocol

    A big disclaimer to start with: I'm not an advanced developer/programmer -- I'm just an EE with a propensity for programming!

    This is also my first shot at writing a complete protocol so I'm sure there is quite a lot I'm missing but I approached this with just a few requirements. The protocol had to be:

    1. Simple and human readable.
    2. Extensible.
    3. Suitable for transmission over I2C and Serial.

    Packet Structure

    <START><ADDRESS><ACTION><COMMAND><DATA><END><CHECKSUM>

    • The START byte is ASCII "{" (123 decimal, 0x7B).
    • The ADDRESS byte is any value from 64 to 95 decimal (0x40 to 0x5F, ASCII “@” to “_”).
    • The ACTION byte is an ASCII “?” for GET and ASCII “$” for SET.
    • The COMMAND bytes are three characters.
    • The DATA bytes are variable length and are described in the Data section.
    • The END byte is ASCII "}" (125 decimal, 0x7D).
    • The CHECKSUM is calculated by subtracting 32 from all the characters in the packet (excluding the checksum) and summing them. The modulo 95 of this value is then calculated and 32 is added back to that value.

    Available Commands

    Command

    Description

    ARM

    Arm / Disarm System

    MTR

    Motor Speed

    SRV

    Servo Position / Speed

    ULT

    Ultrasonic Distance

    IRS

    IR Value

    DGT

    Digital Pin

    ANL

    Analog Pin

View all instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates