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

sl-controls
Mon, 02 Mar 2026 08:39:24 -0500

114#feat(controls): Autonomous/RC mode switch with 500ms blend ramp (Issue #104)#

Summary

saltybot_mode_switch package: CH6 CRSF toggle + stick-override + SLAM-interlock state machine with 500 ms blend ramp

mode_switch_node: subscribes /rc/joy, /saltybot/balance_state, /slam_toolbox/pose_with_covariance_stamped; publishes /saltybot/control_mode (JSON) + /saltybot/led_pattern

cmd_vel_mux_node: scales autonomous /cmd_vel_auto by blend_alpha → /cmd_vel, giving the smooth handoff

State machine

RC ──(ch6↑+slam_ok)──> RAMP_TO_AUTO ──(done)──> AUTO
│                            │                    │
│             ←──(ch6↓/slam lost)──────────> RAMP_TO_RC ──> RC
└──────── instant RC on: stick>10% | RC link lost ─────────────┘

Sticks neutral ≥ 2 s after stick-override → override cleared → re-enters RAMP_TO_AUTO

RC link lost (Joy silent > 0.5 s) → instant RC from any state

No AUTO without valid SLAM fix

LED patterns

State | Pattern
RC | solid_yellow
RAMP_TO_AUTO | blink_green_slow
AUTO | solid_green
AUTO (SLAM lost) | blink_orange_fast
RC link lost | blink_red_fast

Test plan

72/72 unit tests pass (no ROS2 runtime)

All 4 state transitions covered

Safety interlocks: stick override instant, RC link lost instant, no AUTO without SLAM

Blend alpha monotonically increasing (RAMP_TO_AUTO) / decreasing (RAMP_TO_RC)

Nav2 remapping: launch Nav2/follower with cmd_vel_topic:=/cmd_vel_auto

🤖 Generated with Claude Code