2. Microcontrollers - leggedrobotics/hardware_time_sync GitHub Wiki
A Microcontroller Unit (MCU) is used to create the trigger signal and record the time.
Selecting an MCU
It's important to select a microcontroller with many high resolution timers. Triggering sensors should be done in an ISR configured for one of these timers.
Microcontroller | Logic Voltage | Timers (8b/16b/32b) | SRAM |
---|---|---|---|
Arduino Uno | 5v | 2/1/0 | 2k |
Arduino Mega | 5v | 2/4/0 | 8k |
Arduino Due | 3.3v | 0/0/9 | 96k |
Teensy 3.2 | 3.3v | 0/3/4 | 64k |
Serial communication
Data will be passed over serial from the MCU, likely through a USB converter. The baud rate must be as high as possible to pass along the time info at a reasonable rate.
rosserial_python
A server must run on the PC side to communicate with the MCU over USB and relay the ROS messages. For this we use rosserial_python which supports service calls and is more stable than rosserial_server.