Firmware flashing and teleoperation
Compile and flash the Teensy firmware
Build and upload the microcontroller firmware for closed‑loop control.
The closed‑loop motor controller firmware for the robot runs on a Teensy 4.0 microcontroller. Follow these steps to compile and upload the firmware using arduino-cli and teensy_loader_cli.
cd ~/repos/common_platform/firmware/closed_loop
rm -rf build
mkdir build
arduino-cli compile --fqbn teensy:avr:teensy40 -e -o build
SERIAL_TEENSY_DEVICE=$(ls -1 /dev/serial/by-id/ | grep -i teensy | head -n1)
echo $SERIAL_TEENSY_DEVICE
sudo stty -F /dev/serial/by-id/${SERIAL_TEENSY_DEVICE} 9600
sudo teensy_loader_cli -v -w build/*.hex
Monitor Teensy debug output
Connect to the Teensy serial port to view debug information.
The firmware prints diagnostic messages over USB serial. Use Python’s serial tools to open the port and inspect output.
SERIAL_NUM=$(ls /dev/serial/by-id/ | grep -i teensy | head -n1)
SERIAL_DEV=/dev/serial/by-id/${SERIAL_NUM}
echo $SERIAL_DEV
python3 -m serial.tools.miniterm $SERIAL_DEV 115200
Start the micro‑ROS agent
Run the micro‑ROS serial agent in a Docker container to bridge the Teensy with ROS 2.
The Teensy communicates with ROS 2 via a micro‑ROS agent, which runs in a Docker container. Launch the agent on your development computer, passing it the serial device.
sudo docker run -it --rm --network host --privileged microros/micro-ros-agent:kilted serial --dev $SERIAL_DEV
Launch keyboard teleoperation node
Use your keyboard to manually control the robot via evdev_teleop.
After the micro‑ROS agent is running, you can manually control the robot using a keyboard. Launch the evdev_teleop package from within the common_platform workspace.
cd ~/repos/common_platform/common_platform_ws
source install/setup.bash
ros2 launch evdev_teleop evdev_teleop.launch.py