feat(controls): Autonomous/RC mode switch with 500ms blend ramp (Issue #104) #114
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "sl-controls/issue-104-mode-switch"
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
saltybot_mode_switchpackage: CH6 CRSF toggle + stick-override + SLAM-interlock state machine with 500 ms blend rampmode_switch_node: subscribes/rc/joy,/saltybot/balance_state,/slam_toolbox/pose_with_covariance_stamped; publishes/saltybot/control_mode(JSON) +/saltybot/led_patterncmd_vel_mux_node: scales autonomous/cmd_vel_autobyblend_alpha→/cmd_vel, giving the smooth handoffState machine
LED patterns
solid_yellowblink_green_slowsolid_greenblink_orange_fastblink_red_fastTest plan
cmd_vel_topic:=/cmd_vel_auto🤖 Generated with Claude Code
New package: saltybot_mode_switch mode_logic.py (pure, no ROS2 dep — 72/72 tests pass): State machine: RC → RAMP_TO_AUTO → AUTO → RAMP_TO_RC → RC • CH6 (axes[5] > 0.5) requests AUTO; CH6 low → RAMP_TO_RC • Stick >10% in AUTO/RAMP_TO_AUTO/RAMP_TO_RC → instant RC (no ramp) • Sticks neutral ≥ 2 s after override → override cleared → RAMP_TO_AUTO • RC link lost (Joy silent > 0.5 s) → instant RC from any state • SLAM fix lost → RAMP_TO_RC (graceful exit from AUTO) • No AUTO entry without slam_ok AND rc_link_ok blend_alpha: 0.0 (RC) → linear ramp over 500 ms → 1.0 (AUTO) led_pattern: solid_yellow(RC) | blink_green_slow(ramp) | solid_green(AUTO) | blink_orange_fast(slam lost) | blink_red_fast(RC link lost) mode_switch_node.py (ROS2, 20 Hz): Sub: /rc/joy (Joy), /saltybot/balance_state (String), /slam_toolbox/pose_with_covariance_stamped (PoseWithCovarianceStamped) Pub: /saltybot/control_mode (String JSON: mode+blend_alpha+slam_ok+rc_link_ok+override_active) /saltybot/led_pattern (String) cmd_vel_mux_node.py (ROS2, 20 Hz): Sub: /cmd_vel_auto (Twist from Nav2/follower), /saltybot/control_mode Pub: /cmd_vel (Twist to bridge, scaled by blend_alpha) Note: remap Nav2/follower output to /cmd_vel_auto in launch. Tests: 72/72 pass (no ROS2 runtime required). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>