After some work doing the math and the simulator, we finally got real-time communication going between our simulator and the platform. But, not before re-orienting some of the servo horns (because the AX-12A motors only rotate about 300°), and writing some code to transform angles into AX12-A motor commands.

Here is a video with the screenshot of the simulator plus the platform.

The code for testing the motors using the simulator is on github. It uses OSC to send motor angle packets to the Raspberry Pi controlling the platform.

We’re still figuring out how to make the movements more continuous, as we keep improving and fixing the servo library for python. For example, we noticed that some commands weren’t getting to the motors, and as a result we were getting timeout errors while waiting for their response. We’re still not sure what causes some commands to never get to the motors (it might have something to do with the timing of the Rx/Tx direction signal), but we can decrease the number of missed commands by catching a timeout exception, and resending the command. In order for this to work we had to decrease the serial port timeout delay in the library. It turns out it’s better to timeout after 1ms and re-send, then to wait 500ms for a reply. Duh !