sl-controls created pull request seb/saltylab-firmware#707

sl-controls
Fri, 20 Mar 2026 16:39:50 -0400

707#feat: PID tuning interface via CAN/ROS2 (Issue #693)#

Summary

Mamba (STM32): Add ORIN_CAN_ID_PID_SET (0x305) handler in orin_can.c. Receives Kp/Ki/Kd as uint16×100 (big-endian), applies to the running balance loop, replies with FC_PID_ACK (0x405) echoing clamped gains. Gains persist in RAM until reboot.

Jetson (ROS2): Expose pid/kp, pid/ki, pid/kd as ROS2 parameters in can_bridge_node. Any parameter change immediately sends CAN frame 0x305. ACK frame 0x405 is logged at DEBUG.

mamba_protocol.py: Add ORIN_CAN_ID_PID_SET / FC_PID_ACK IDs, PidGains dataclass, encode_pid_set_cmd(), decode_pid_ack().

Test plan

Set pid/kp via ros2 param set /can_bridge_node pid/kp 50.0 — verify CAN 0x305 frame logged

FC receives frame and logs [PID] Orin set Kp=...

FC replies with 0x405 ACK — verify debug log on Jetson

Verify gains are applied live to the balance loop

Reboot FC — gains reset to flash/default values

🤖 Generated with Claude Code