Interfacing a Pololu Maestro
/For interfacing the ESCs which control the thrusters, we bought two devices from Pololu-- a Micro Maestro (6-channel), and a Mini Maestro (12-channel). You can find most pertinent information about these devices on Pololu's website. Pololu does provide source code for their sample programs, but 1) it's written in C#, and 2) it's not ROSified. I wrote a C++ ROS version, and here are the takeaways:
Mini Maestros (devices 12 channels or more) have a special command to control all channels, with one message, simultaneously. Using this message, as opposed to the single target position message, saves milliseconds per message. This doesn't sound like much, but with control rates up to 333Hz, a noticeable latency will result. Use the Mini Maestro with command COMMAND_SET_ALL_TARGETS.
Only expose as much control to the user as is necessary. The Blue Robotics T200 thrusters do not report velocity, so the number that controls the thrusters' thrust becomes somewhat arbitrary. For our application, we define a speed control interface, per thruster, of a value between -100 (backward) and 100 (forward), inclusive. The values represent a nice, clean percentage of thrust. Additionally, they abstract away device-specific position values, leaving the path open for other PWM hub devices.
There will exist a bottleneck. Some link in the chain will prove to be the slowest, but make that predictable if you can. It's reasonable to assume that the Maestro interface software is going to be the bottleneck. The Afro ESC 30A accepts inputs at 1kHz. The Pololu Maestro accepts inputs at 333Hz. The Arm7 processor on the Odroid could undoubtedly handle 333Hz, but the physical update rate on the thruster velocities will depend somewhat upon the physical properties of the thruster motor. The software-- receiving, buffering, processing sensor data, and then sending thruster commands-- I suspect will operate around 50Hz.
Send a HOME command to the device once it's powered on with the PWM devices connected. The Maestro needs this to calibrate its current positions against the connected devices. Otherwise, you'll not be able to control those devices.