feat: Jetson command protocol — /cmd_vel to STM32 (Phase 2) #34
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "sl-jetson/command-protocol"
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
Full bidirectional Jetson↔STM32 command protocol over the existing USB CDC connection.
STM32 firmware
include/jetson_cmd.h+src/jetson_cmd.c— new module, follows existing patterns:C<speed>,<steer>\n— drive command (speed/steer: -1000..+1000). Buffered in ISR, parsed with sscanf in main loop (same as PIDcdc_cmd_bufpattern)H\n— heartbeat. Timestamp updated in ISR. STM32 deactivates Jetson commands after 500ms silence → steer reverts to 0, setpoint offset removedbal.setpointoffset (±4°):jetson_cmd_sp_offset()applied aroundbalance_update(), restored after. Balance PID still has full authoritymotor_driver_update(…, jsteer, …)only when heartbeat alive; falls back to 0lib/USB_CDC/src/usbd_cdc_if.c—HandCcases added toCDC_Receiveswitchsrc/main.c—jetson_cmd_process()in main loop, setpoint offset, steer injectionROS2 (Jetson)
saltybot_cmd_node.py— full bidirectional node (recommended for Nav2):/dev/ttyACM0— do NOT run alongsideserial_bridge_node/cmd_vel→C<speed>,<steer>\n(Twist mapping:linear.x * speed_scale,angular.z * steer_scale)H\nC0,0\non shutdownserial_bridge_node.py— addedwrite_serial()helperlaunch/bridge.launch.py—mode:=bidirectional(default) ormode:=rx_onlyconfig/bridge_params.yaml—speed_scale,steer_scale,heartbeat_perioddocstest/test_cmd.py— 13 tests covering zero, full fwd/rev, clamping, combined motionTest plan
pytest test/— 21/21 pass (no ROS2 runtime needed)colcon build --packages-select saltybot_bridgesucceeds on Jetsonros2 launch saltybot_bridge bridge.launch.py→ saltybot_cmd_node startsros2 topic pub /cmd_vel … linear.x:=0.3→ robot leans forward🤖 Generated with Claude Code
Flash-tested, builds and streams clean.