feat: Orin motor control daemon (Issue #523) #527

Closed
sl-jetson wants to merge 0 commits from sl-jetson/issue-523-motor-daemon into main
Collaborator

Summary

  • Add saltybot_motor_daemon ROS2 package: Python daemon subscribing to /cmd_vel and sending W<speed>,<steer>\n to FC over /dev/ttyTHS1 at 921600 baud
  • Fixed 50 Hz TX rate (independent of /cmd_vel rate) via timer
  • 200ms safety watchdog: zeroes motors if no /cmd_vel received
  • Twist → ESC conversion: speed = clamp(linear.x * 1000, -1000, 1000), steer = clamp(angular.z * -500, -1000, 1000)
  • FC ack parsing (W:<speed>,<steer>\n) and periodic ? status queries
  • /saltybot/motor_daemon/status publisher (JSON FC status) + /diagnostics
  • Auto-reconnect on serial disconnect

Files

  • jetson/ros2_ws/src/saltybot_motor_daemon/saltybot_motor_daemon/motor_daemon_node.py — main daemon
  • config/motor_daemon_params.yaml — all tunable parameters
  • launch/motor_daemon.launch.py — parameterised launch
  • test/test_motor_daemon.py — 25 unit tests (all passing)

Test plan

  • python3 -m pytest test/test_motor_daemon.py — 25 tests pass
  • ros2 launch saltybot_motor_daemon motor_daemon.launch.py — node starts, logs serial open
  • Send ros2 topic pub /cmd_vel geometry_msgs/Twist ... — verify W commands on ttyTHS1
  • Verify FC acks logged at DEBUG level
  • Stop publishing cmd_vel — verify W0,0 sent after 200ms
  • Verify ? query sent every 1s, FC status published on /saltybot/motor_daemon/status

🤖 Generated with Claude Code

## Summary - Add `saltybot_motor_daemon` ROS2 package: Python daemon subscribing to `/cmd_vel` and sending `W<speed>,<steer>\n` to FC over `/dev/ttyTHS1` at 921600 baud - Fixed 50 Hz TX rate (independent of `/cmd_vel` rate) via timer - 200ms safety watchdog: zeroes motors if no `/cmd_vel` received - Twist → ESC conversion: `speed = clamp(linear.x * 1000, -1000, 1000)`, `steer = clamp(angular.z * -500, -1000, 1000)` - FC ack parsing (`W:<speed>,<steer>\n`) and periodic `?` status queries - `/saltybot/motor_daemon/status` publisher (JSON FC status) + `/diagnostics` - Auto-reconnect on serial disconnect ## Files - `jetson/ros2_ws/src/saltybot_motor_daemon/saltybot_motor_daemon/motor_daemon_node.py` — main daemon - `config/motor_daemon_params.yaml` — all tunable parameters - `launch/motor_daemon.launch.py` — parameterised launch - `test/test_motor_daemon.py` — 25 unit tests (all passing) ## Test plan - [ ] `python3 -m pytest test/test_motor_daemon.py` — 25 tests pass - [ ] `ros2 launch saltybot_motor_daemon motor_daemon.launch.py` — node starts, logs serial open - [ ] Send `ros2 topic pub /cmd_vel geometry_msgs/Twist ...` — verify W commands on ttyTHS1 - [ ] Verify FC acks logged at DEBUG level - [ ] Stop publishing cmd_vel — verify W0,0 sent after 200ms - [ ] Verify `?` query sent every 1s, FC status published on `/saltybot/motor_daemon/status` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sl-jetson added 1 commit 2026-03-06 23:04:35 -05:00
Add saltybot_motor_daemon ROS2 package — Python daemon that subscribes
to /cmd_vel and drives the FC via W<speed>,<steer>\n over /dev/ttyTHS1
at 921600 baud.

- motor_daemon_node.py: 50 Hz fixed-rate TX, 200ms safety watchdog,
  Twist→ESC conversion (±1000 range), FC ack parsing (W:<s>,<st>),
  periodic ? status query, /diagnostics publisher, auto-reconnect
- config/motor_daemon_params.yaml: all tunable params with comments
- launch/motor_daemon.launch.py: parameterised launch file
- test/test_motor_daemon.py: 25 unit tests (all passing)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sl-jetson closed this pull request 2026-03-07 09:20:15 -05:00

Pull request closed

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#527
No description provided.