feat: STM32 serial bridge — USB CDC to ROS2 topics #16
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "sl-jetson/stm32-serial-bridge"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
ROS2 Python package
saltybot_bridgethat bridges the STM32F722 USB CDC telemetry stream to ROS2 topics for the SLAM/nav stack.src/main.c):{"p","r","e","ig","m","s","y"}— all ×10 integers at 50Hz/saltybot/imu(sensor_msgs/Imu) — pitch/roll/yaw asangular_velocity(rad);orientation_covariance[0]=-1signals orientation unknown (for robot_localization EKF)/saltybot/balance_state(std_msgs/String) — full PID diagnostics as JSON: pitch, roll, yaw, pid_error, integral, motor_cmd, state label/diagnostics(diagnostic_msgs/DiagnosticArray) — OK=ARMED, WARN=DISARMED, ERROR=TILT_FAULT or IMU faultlaunch/bridge.launch.pywithserial_portandbaud_rateargsconfig/bridge_params.yamldefaults:/dev/ttyACM0@ 921600 baudTest plan
colcon build --packages-select saltybot_bridgesucceedspytest test/test_parse.py— 8/8 pass (runs without ROS2 runtime)ros2 launch saltybot_bridge bridge.launch.pystarts node/saltybot/imupublishes at ~50Hz/saltybot/balance_stateJSON contains expected fields/diagnosticsshows ERROR level🤖 Generated with Claude Code
saltybot_bridge ROS2 Python package (ament_python): - serial_bridge_node.py: reads USB CDC JSON telemetry from STM32F722 at 50Hz Parses exact firmware format: {"p","r","e","ig","m","s","y"} (all ×10 ints) State enum: 0=DISARMED, 1=ARMED, 2=TILT_FAULT (matched to balance_state_t) - Publishes sensor_msgs/Imu on /saltybot/imu (pitch/roll/yaw as angular_velocity) - Publishes std_msgs/String on /saltybot/balance_state (full PID JSON diagnostics) - Publishes diagnostic_msgs/DiagnosticArray on /diagnostics (OK/WARN/ERROR by state) - Auto-reconnects on serial disconnect; IMU fault frames → ERROR diagnostic - launch/bridge.launch.py with serial_port + baud_rate launch args - config/bridge_params.yaml (921600 baud, /dev/ttyACM0) - test/test_parse.py: 8 unit tests covering normal, fault, edge cases (all pass) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>Reviewed, looks good.