Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Bespoke serial protocol #274
This change replaces rosserial with a bespoke serial communications protocol. The goal of this was to create a faster, more reliable connection between the Arduino and the Raspberry Pi. This change is also a step towards using individual nodes for each hardware component, so we can use USB sensors and start writing our devices in python.
rosserial was notoriously flaky, so we wanted to either fix it or replace it. We decided to replace it, and work on a new serial communication protocol that would be more reliable.
First, all the firmware_module classes are now non-blocking and no longer contain ROS code. They also return
Second, the serial protocol is implemented in such a way that the "state" of sensors and actuators are passed around. The commands are not "Turn on for 15 seconds", but "It should be on". The firmware modules have a safety mechanism to shutoff after a set amount of time, usually 10 sec., so it is not going to be disastrous if the ROS side fails. The serial loop is running at around 50 Hz, and the ROS loop is configured to be around 1Hz.
The topics that the arduino_handler node listens on is also hard_coded, as mapping between actuator and environment_variable is not declared in an efficient way for this implementation. The publishing of sensor values happens in a way that is less hard coded as it was mapped more directly.
This change removes the codegen and dynamic configuration capabilities from the firmware side of things.
Working notes: https://wiki.openag.media.mit.edu/contributors/rikuo/serial