feat: Nav2 cmd_vel to STM32 autonomous drive bridge #46

Merged
seb merged 1 commits from sl-controls/cmd-vel-bridge into main 2026-02-28 22:58:42 -05:00
Collaborator

Summary

Adds cmd_vel_bridge_node — a standalone ROS2 Humble node for Nav2 autonomous drive integration.

What it does

  • Subscribes to /cmd_vel (Nav2 output) and drives the STM32 over USB CDC
  • Hard velocity limits: max_linear_vel=0.5 m/s, max_angular_vel=2.0 rad/s
  • Smooth ramp: 500 ESC-units/s rate limit, 50 Hz control loop
  • Deadman switch: zeros speed/steer if /cmd_vel silent >500 ms
  • Mode gate: sends drive commands only when STM32 reports md=2 (AUTONOMOUS); resets ramp state in other modes
  • Telemetry RX: parses STM32 JSON → /saltybot/imu, /saltybot/balance_state, /diagnostics
  • Heartbeat TX: H\n every 200 ms

Files

File Purpose
saltybot_bridge/cmd_vel_bridge_node.py ROS2 node implementation
config/cmd_vel_bridge_params.yaml Tunable parameters with comments
launch/cmd_vel_bridge.launch.py Standalone launch file (all params as launch args)
test/test_cmd_vel_bridge.py 37 pytest unit tests — no ROS2 runtime needed
setup.py Entry point + data files registration

Usage

# Defaults (0.5 m/s, 2.0 rad/s, 1s ramp, 500ms deadman):
ros2 launch saltybot_bridge cmd_vel_bridge.launch.py

# Cautious tuning:
ros2 launch saltybot_bridge cmd_vel_bridge.launch.py max_linear_vel:=0.3

# Run tests:
pytest jetson/ros2_ws/src/saltybot_bridge/test/test_cmd_vel_bridge.py

Do NOT run alongside

serial_bridge_node or saltybot_cmd_node on the same serial port — they conflict.

Part of Phase 2b autonomous drive integration.

## Summary Adds `cmd_vel_bridge_node` — a standalone ROS2 Humble node for Nav2 autonomous drive integration. ### What it does - Subscribes to `/cmd_vel` (Nav2 output) and drives the STM32 over USB CDC - **Hard velocity limits**: `max_linear_vel=0.5 m/s`, `max_angular_vel=2.0 rad/s` - **Smooth ramp**: 500 ESC-units/s rate limit, 50 Hz control loop - **Deadman switch**: zeros speed/steer if `/cmd_vel` silent >500 ms - **Mode gate**: sends drive commands only when STM32 reports `md=2` (AUTONOMOUS); resets ramp state in other modes - **Telemetry RX**: parses STM32 JSON → `/saltybot/imu`, `/saltybot/balance_state`, `/diagnostics` - **Heartbeat TX**: `H\n` every 200 ms ### Files | File | Purpose | |------|---------| | `saltybot_bridge/cmd_vel_bridge_node.py` | ROS2 node implementation | | `config/cmd_vel_bridge_params.yaml` | Tunable parameters with comments | | `launch/cmd_vel_bridge.launch.py` | Standalone launch file (all params as launch args) | | `test/test_cmd_vel_bridge.py` | 37 pytest unit tests — no ROS2 runtime needed | | `setup.py` | Entry point + data files registration | ### Usage ```bash # Defaults (0.5 m/s, 2.0 rad/s, 1s ramp, 500ms deadman): ros2 launch saltybot_bridge cmd_vel_bridge.launch.py # Cautious tuning: ros2 launch saltybot_bridge cmd_vel_bridge.launch.py max_linear_vel:=0.3 # Run tests: pytest jetson/ros2_ws/src/saltybot_bridge/test/test_cmd_vel_bridge.py ``` ### Do NOT run alongside `serial_bridge_node` or `saltybot_cmd_node` on the same serial port — they conflict. Part of Phase 2b autonomous drive integration.
sl-webui added 1 commit 2026-02-28 22:50:34 -05:00
Adds cmd_vel_bridge_node — a standalone ROS2 node that subscribes to
Nav2 /cmd_vel and drives the STM32 over USB CDC with:
  - Hard velocity limits (max_linear_vel=0.5 m/s, max_angular_vel=2.0 rad/s)
  - Smooth ESC ramp (500 ESC-units/s, 50 Hz control loop)
  - Deadman switch: zeros targets if /cmd_vel silent >500 ms
  - Mode gate: sends drive only when STM32 reports md=2 (AUTONOMOUS)
  - Telemetry RX → /saltybot/imu, /saltybot/balance_state, /diagnostics
  - Heartbeat TX every 200 ms (H\n)

Deliverables:
  saltybot_bridge/cmd_vel_bridge_node.py   — node implementation
  config/cmd_vel_bridge_params.yaml        — tunable parameters
  launch/cmd_vel_bridge.launch.py          — standalone launch file
  test/test_cmd_vel_bridge.py              — 37 pytest unit tests (no ROS2)
  setup.py                                 — register node + new data files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
seb merged commit 03045b063f into main 2026-02-28 22:58:42 -05:00
seb deleted branch sl-controls/cmd-vel-bridge 2026-02-28 22:58:42 -05:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: seb/saltylab-firmware#46
No description provided.