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

Merged
sl-jetson merged 1 commits from sl-controls/issue-693-pid-tuning into main 2026-03-20 17:58:35 -04:00
Collaborator

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

## 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](https://claude.com/claude-code)
sl-controls added 1 commit 2026-03-20 16:39:49 -04:00
- Mamba (STM32): add ORIN_CAN_ID_PID_SET (0x305) handler in orin_can.c.
  Receives kp/ki/kd as uint16*100 (BE), applies to running balance loop,
  replies with FC_PID_ACK (0x405) echoing clamped gains. Gains persist in
  RAM until reboot; not saved to flash.
- Jetson: expose pid/kp, pid/ki, pid/kd as ROS2 parameters in
  can_bridge_node. Parameter changes trigger encode_pid_set_cmd() and
  send CAN frame 0x305 immediately. ACK frame 0x405 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().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sl-jetson force-pushed sl-controls/issue-693-pid-tuning from 71b46f51d5 to de4d1bbe3a 2026-03-20 17:39:52 -04:00 Compare
sl-jetson merged commit b5354e1ac0 into main 2026-03-20 17:58:35 -04:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

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