# mode_switch_params.yaml — saltybot_mode_switch
#
# Launch with:
#   ros2 launch saltybot_mode_switch mode_switch.launch.py
#
# Topic wiring:
#   /rc/joy                          → mode_switch_node (CRSF channels)
#   /saltybot/balance_state          → mode_switch_node (STM32 state)
#   /slam_toolbox/pose_with_covariance_stamped → mode_switch_node (SLAM fix)
#   /saltybot/control_mode           ← mode_switch_node (JSON mode + alpha)
#   /saltybot/led_pattern            ← mode_switch_node (LED name)
#
#   /cmd_vel_auto                    → cmd_vel_mux_node  (from Nav2/follower)
#   /saltybot/control_mode           → cmd_vel_mux_node
#   /cmd_vel                         ← cmd_vel_mux_node  (to bridge)
#
# IMPORTANT: remap Nav2 and person_follower to publish /cmd_vel_auto:
#   ros2 launch saltybot_bringup nav2.launch.py cmd_vel_topic:=/cmd_vel_auto

# ── CRSF channel mapping ──────────────────────────────────────────────────────
# Joy axes index for the AUX2 / CH6 mode-toggle switch.
# Typical CRSF→Joy mapping: CH1=axes[0] … CH6=axes[5].
ch6_axis: 5

# Space-separated Joy axes indices for the four control sticks (roll/pitch/throttle/yaw).
# These are monitored for the 10% override threshold.
stick_axes: "0 1 2 3"

# ── Override / return-to-auto ──────────────────────────────────────────────────
# Stick magnitude (0–1) that triggers instant RC override while in AUTO.
# 10% (0.10) per spec — change only if stick noise causes false triggers.
override_threshold: 0.10

# Seconds sticks must remain neutral before AUTO re-engages after an override.
return_delay_s: 2.0

# ── Ramp ──────────────────────────────────────────────────────────────────────
# RC↔AUTO blend ramp duration (seconds). cmd_vel_mux scales by blend_alpha
# so autonomous commands are eased in/out over this window.
ramp_duration_s: 0.5

# ── RC link health ────────────────────────────────────────────────────────────
# Seconds of Joy silence before RC link is declared lost → force RC mode.
rc_link_timeout_s: 0.5

# ── SLAM fix ──────────────────────────────────────────────────────────────────
# ROS2 topic providing the SLAM localisation pose. Any message received within
# slam_fix_timeout_s counts as a valid fix.
slam_fix_topic: "/slam_toolbox/pose_with_covariance_stamped"

# Seconds after the last SLAM pose before fix is considered lost.
slam_fix_timeout_s: 3.0

# ── Control loop ──────────────────────────────────────────────────────────────
control_rate: 20.0    # Hz

# ── cmd_vel_mux ───────────────────────────────────────────────────────────────
cmd_vel_timeout_s: 0.5   # deadman: zero output if /cmd_vel_auto goes silent
