# cmd_vel_bridge_params.yaml
<<<<<<< HEAD
# Configuration for cmd_vel_bridge_node — Nav2 /cmd_vel → ESP32 BALANCE autonomous drive.
=======
# Configuration for cmd_vel_bridge_node — Nav2 /cmd_vel → ESP32-S3 autonomous drive.
>>>>>>> 291dd68 (feat: remove all STM32/Mamba/BlackPill references — ESP32-S3 only)
#
# Run with:
#   ros2 launch saltybot_bridge cmd_vel_bridge.launch.py
# Or override individual params:
#   ros2 launch saltybot_bridge cmd_vel_bridge.launch.py max_linear_vel:=0.3

# ── Serial ─────────────────────────────────────────────────────────────────────
# Use /dev/esp32-bridge if udev rule from jetson/docs/pinout.md is applied.
serial_port:      /dev/ttyACM0
baud_rate:        921600
timeout:          0.05       # serial readline timeout (s)
reconnect_delay:  2.0        # seconds between reconnect attempts

# ── Heartbeat ──────────────────────────────────────────────────────────────────
<<<<<<< HEAD
# ESP32 BALANCE jetson_cmd module reverts steer to 0 after JETSON_HB_TIMEOUT_MS (500ms).
=======
# ESP32-S3 jetson_cmd module reverts steer to 0 after JETSON_HB_TIMEOUT_MS (500ms).
>>>>>>> 291dd68 (feat: remove all STM32/Mamba/BlackPill references — ESP32-S3 only)
# Keep heartbeat well below that threshold.
heartbeat_period: 0.2        # seconds (200ms)

# ── Velocity limits ────────────────────────────────────────────────────────────
# Hard caps applied BEFORE scaling. Prevents Nav2 planner or param tuning errors
# from commanding unsafe speeds on the balance robot.
#
# Conservative defaults — increase only after verifying balance stability.
max_linear_vel:   0.5        # m/s  (0.5 = cautious first deployment)
max_angular_vel:  2.0        # rad/s

# ── Scaling: physical units → ESC counts (-1000..+1000) ───────────────────────
# speed = clamp(linear.x  * speed_scale, -1000, 1000)   [after limit clamp]
# steer = clamp(angular.z * steer_scale, -1000, 1000)
#
# speed_scale: 1000.0 means 1 m/s → 1000 ESC units (full scale at max_linear_vel=1.0)
#   At max_linear_vel=0.5: max speed output = 500 ESC units.
# steer_scale: negative because ROS2 +angular.z = CCW (left) but ESC positive
#   steer typically means right-turn. Flip sign if robot steers backwards.
speed_scale:      1000.0
steer_scale:      -500.0

# ── Acceleration ramp ──────────────────────────────────────────────────────────
# Maximum ESC-unit change per second (applied to both speed and steer).
# Control loop runs at 50 Hz → step per tick = ramp_rate / 50.
#
#   ramp_rate=500: 0 → 500 ESC (= 0.5 m/s at speed_scale=1000) takes 1.0s
#   ramp_rate=250: same ramp takes 2.0s (gentler, safer for tuning)
#
# Lower values = smoother but slower response to Nav2 waypoint commands.
ramp_rate:        500        # ESC units/second

# ── Deadman switch ─────────────────────────────────────────────────────────────
# If /cmd_vel is not received for this many seconds, target speed/steer are
# zeroed immediately. The ramp then drives the robot to a stop.
<<<<<<< HEAD
# 500ms matches the ESP32 BALANCE jetson heartbeat timeout for consistency.
=======
# 500ms matches the ESP32-S3 jetson heartbeat timeout for consistency.
>>>>>>> 291dd68 (feat: remove all STM32/Mamba/BlackPill references — ESP32-S3 only)
cmd_vel_timeout:  0.5        # seconds
