# route_params.yaml — Route recording and replay configuration for SaltyBot
#
# "Ride once, replay forever."
#
# Flow:
#   1. Tee rides EUC, SaltyBot follows via UWB follow-me (PR #66)
#   2. route_recorder_node samples GPS + odom → /data/routes/<name>.jsonl
#   3. Next ride: route_replayer_node loads file → Nav2 navigate_through_poses
#
# GPS source: SIM7600X → /gps/fix (NavSatFix, ±2.5m CEP) — PR #65
# Heading:    D435i IMU → /imu/data, converted yaw → route waypoint heading_deg
# Odometry:   STM32 wheel encoders → /odom
# UWB:        /uwb/target (follow-me reference, logged for context)

route_recorder:
  ros__parameters:
    save_dir:           "/data/routes"
    route_name:         "route"            # override via param or launch arg
    waypoint_spacing_m: 2.0               # skip GPS samples closer than this
    sample_rate_hz:     1.0               # max recording frequency (GPS ~1Hz)
    min_fix_status:     0                 # 0=STATUS_FIX; reject STATUS_NO_FIX (-1)

route_replayer:
  ros__parameters:
    save_dir:             "/data/routes"
    route_name:           "route"
    replay_spacing_m:     3.0             # subsample waypoints for Nav2 (3m spacing)
    goal_tolerance_xy:    2.0             # metres — matches SIM7600X ±2.5m CEP
    replay_speed_factor:  1.0             # 1.0 = same speed as recorded
    map_frame:            "map"
    nav_timeout_s:        600.0           # 10 min max per nav batch

route_manager:
  ros__parameters:
    save_dir:    "/data/routes"
    route_name:  "route"

# ── Operational notes ─────────────────────────────────────────────────────────
#
# Recording a route (EUC follow-me session):
#   ros2 param set /route_recorder route_name "friday_loop"
#   ros2 service call /route/start_recording std_srvs/srv/Trigger '{}'
#   # ... follow Tee for the full route ...
#   ros2 service call /route/stop_recording std_srvs/srv/Trigger '{}'
#   ros2 service call /route/save std_srvs/srv/Trigger '{}'
#
# Replaying a route (autonomous):
#   ros2 param set /route_replayer route_name "friday_loop"
#   ros2 service call /route/load std_srvs/srv/Trigger '{}'
#   ros2 service call /route/start_replay std_srvs/srv/Trigger '{}'
#   ros2 topic echo /route/replay_status
#
# Listing routes:
#   ros2 service call /route/list std_srvs/srv/Trigger '{}'
#
# Route info:
#   ros2 param set /route_manager route_name "friday_loop"
#   ros2 service call /route/info std_srvs/srv/Trigger '{}'
#
# Delete route:
#   ros2 param set /route_manager route_name "friday_loop"
#   ros2 service call /route/delete std_srvs/srv/Trigger '{}'
#
# Emergency stop during replay:
#   ros2 service call /route/stop std_srvs/srv/Trigger '{}'
#   # or: ros2 topic pub /route/pause_cmd std_msgs/msg/Bool '{data: true}'
#
# ── File format (JSON Lines, .jsonl) ─────────────────────────────────────────
#
# {
#   "version": 1,
#   "name": "friday_loop",
#   "recorded_at": "2026-03-01T14:22:00+00:00",
#   "waypoint_count": 142,
#   "total_distance_m": 1240.5,
#   "duration_s": 820.3,
#   "waypoints": [
#     {"t": 1740839000.1, "lat": 37.7749, "lon": -122.4194,
#      "heading_deg": 45.0, "speed_mps": 1.2, "odom_x": 0.0, "odom_y": 0.0,
#      "gps_status": 0},
#     ...
#   ]
# }
