Close

Protocol Changes Implemented

A project log for Stubby the (Teaching) Hexapod

100% open source robot platform with accessability and affordability in mind: teaching children of all ages about robots & programming

the-big-oneThe Big One 09/03/2014 at 02:510 Comments

This evening I have finished implementing the changes to the Universal Controller / Stubby protocol; I changed from using a single byte per message to using a multi-byte framed packet per message.  This allows me to send more complicated information (such as strings, debug messages, double values, etc) and also gives me the flexibility to have more commands defined (which is essential for the planned Processing API additions).

As of now, Stubby can talk to the Universal Controller using the new protocol, and can do everything that it was previously able to do (walk, rotate, body translation X/Y/Z, body rotation X/Y/Z).  Next step is to add support for the Processing API; however since both pieces are now speaking the same language, it is pretty easy to add a few more conditionals to the message dispatching function.

For other projects looking for a simple, multi byte framed protocol, take a look at the library in lib/avr/protocol - this includes documentation of the protocol as well as a C implementation (for AVR, but trivially ported to other platforms or even languages).  Using the library on an AVR is easy; implement a few functions, as defined in the protocol.h file, and watch the messages as they come into the dispatch function.  For an even easier implementation, if you are using my serial library, you can just substitute serial_async_rx.c for protocol_serial.c in your Makefile.

Cheers

Discussions