# outdoor_nav_params.yaml — Outdoor navigation configuration for SaltyBot
#
# Hardware: Jetson Orin Nano Super / SIM7600X cellular GPS (±2.5 m CEP)
# RTK upgrade: u-blox ZED-F9P → ±2 cm CEP (set use_rtk: true when installed)
#
# ── GPS quality notes ────────────────────────────────────────────────────────
# SIM7600X reports STATUS_FIX (0) in open sky, STATUS_NO_FIX (-1) indoors.
# RTK ZED-F9P reports STATUS_GBAS_FIX (2) when corrections received.
# Goal tolerance automatically tightens from 2.0m (cellular) to 0.3m (RTK).
#
# ── RTK upgrade procedure ────────────────────────────────────────────────────
# 1. Connect ZED-F9P to /dev/ttyTHS0 (Orin 40-pin UART, pins 8/10)
# 2. Set NTRIP credentials in rtk_gps.launch.py
# 3. Run: ros2 launch saltybot_outdoor rtk_gps.launch.py
# 4. Verify: ros2 topic echo /gps/fix | grep status
#    → status.status == 2 (STATUS_GBAS_FIX) = RTK fixed
#
# References:
#   SparkFun RTK Express: https://docs.sparkfun.com/SparkFun_RTK_Everywhere_Firmware/
#   NTRIP caster list: https://rtk2go.com/sample-map/
# ─────────────────────────────────────────────────────────────────────────────

osm_router:
  ros__parameters:
    overpass_url:       "https://overpass-api.de/api/interpreter"
    query_radius_m:     1500.0      # fetch OSM ways within this radius of midpoint
    simplify_eps_m:     5.0         # Douglas–Peucker waypoint spacing (metres)
    cache_dir:          "/data/osm_cache"
    use_cache:          true
    map_frame:          "map"
    # Default goal — override at launch or via parameter set:
    #   ros2 param set /osm_router goal_lat 48.8566
    #   ros2 param set /osm_router goal_lon 2.3522
    goal_lat:           0.0
    goal_lon:           0.0

gps_waypoint_follower:
  ros__parameters:
    map_frame:            "map"
    min_fix_status:       0         # 0=STATUS_FIX; -1=NO_FIX; 2=RTK_FIXED
    # Goal tolerance for SIM7600X (±2.5m CEP) — auto-tightens with RTK
    goal_tolerance_xy:    2.0       # metres (outdoor vs 0.25m indoor)
    goal_tolerance_yaw:   3.14159   # radians — don't constrain heading outdoors
    nav_timeout_s:        300.0     # 5 min max per navigate_through_poses call
    waypoint_spacing_m:   5.0       # skip waypoints closer than this

geofence:
  ros__parameters:
    check_rate_hz:  2.0
    stop_on_exit:   true
    # fence_vertices: flat list of lat,lon pairs forming the boundary polygon.
    # Leave empty to disable geofence (WARNING: no safety boundary).
    # Example — 100m × 100m test square (replace with real boundary):
    fence_vertices: []
    map_frame: "map"

# ── Outdoor Nav2 parameter overrides ────────────────────────────────────────
# These supplement jetson/config/nav2_params.yaml for outdoor operation.
# Apply by passing this file as an additional params_file to nav2.launch.py.
#
# Key differences from indoor config:
#   - No static_layer (no SLAM map — GPS provides global position only)
#   - Wider inflation radius (outdoor = wider obstacles / kerbs)
#   - Higher max velocity (clear sidewalks vs cluttered indoor)
#   - GPS costmap uses wider observation sources
# ─────────────────────────────────────────────────────────────────────────────

# Outdoor controller overrides
controller_server:
  ros__parameters:
    FollowPath:
      max_vel_x:   1.5      # m/s (indoor: 1.0)
      max_speed_xy: 1.5
      sim_time:    2.0      # seconds lookahead (longer for faster speeds)
      # Larger goal tolerance at waypoints (GPS ±2.5m)
    general_goal_checker:
      xy_goal_tolerance:  2.0    # metres (indoor: 0.25)
      yaw_goal_tolerance: 3.14   # don't constrain heading at GPS waypoints

# Outdoor local costmap overrides
local_costmap:
  local_costmap:
    ros__parameters:
      width:  5        # metres (wider window for outdoor speeds)
      height: 5
      inflation_layer:
        inflation_radius: 0.50   # metres (indoor: 0.55, similar but explicit)

# Outdoor global costmap overrides
# Key: remove static_layer (no SLAM map), keep obstacle layers
global_costmap:
  global_costmap:
    ros__parameters:
      plugins: ["obstacle_layer", "inflation_layer"]  # no static_layer outdoors
      inflation_layer:
        inflation_radius: 0.50
      obstacle_layer:
        observation_sources: scan surround_cameras
