racing_control:
  ros__parameters:
    # Startup
    auto_start: false
    frame_id: odom
    use_post_qr_pose: false
    split_qr_to_vlm_segment: true
    enable_vlm_image_relay: false
    enable_dynamic_replanning: false
    enable_recovery: true
    enable_candidate_waypoint_selection: true
    vlm_image_input_topic: /image
    vlm_image_output_topic: /vlm_image

    # Shared coordination topics
    sign_topic: /sign4return
    qr_result_topic: /qr_results
    vlm_result_topic: /vlm_result
    odom_topic: /odom_combined
    recovery_cmd_vel_topic: /cmd_vel
    global_costmap_topic: /global_costmap/costmap
    trajectory_guard_input_topic: /trajectory_guard/input_path

    # Nav2 actions and plugin IDs
    navigate_action: /navigate_to_pose
    compute_path_action: /compute_path_through_poses
    follow_path_action: /follow_path
    planner_id: GridBased
    controller_id: FollowPath
    goal_checker_id: ""
    use_trajectory_guard: false

    # Timeouts and settling waits, in seconds
    navigation_timeout_sec: 120.0
    path_planning_timeout_sec: 30.0
    circle_timeout_sec: 120.0
    qr_result_timeout_sec: 20.0
    profile_switch_wait_sec: 1.0
    post_qr_wait_sec: 1.0
    vlm_capture_wait_sec: 0.5
    dynamic_replan_interval_sec: 1.0
    dynamic_replan_stop_distance: 0.5
    dynamic_replan_max_consecutive_failures: 3
    recovery_backup_speed: -0.2
    recovery_backup_distance: 0.04
    recovery_backup_timeout_sec: 0.2
    # Used only when the initial ComputePathThroughPoses request fails.
    planning_failure_backup_speed: -0.1
    planning_failure_backup_distance: 0.03
    planning_failure_backup_timeout_sec: 0.3
    recovery_clear_wait_sec: 1.0
    recovery_search_radius_m: 1.0
    recovery_rear_clear_distance_m: 0.5
    # 最终回家保护：普通 Nav2/恢复失败后，低速直控回 home，同时定时探测 Nav2 是否恢复。
    enable_final_home_fallback: true
    final_home_distance_tolerance: 0.2
    final_home_yaw_tolerance: 0.3
    final_home_forward_speed: 0.12
    final_home_yaw_gain: 0.5
    final_home_max_turn_speed: 0.7
    final_home_nav_retry_interval_sec: 0.8
    global_costmap_clear_service: global_costmap/clear_entirely_global_costmap
    local_costmap_clear_service: local_costmap/clear_entirely_local_costmap
    max_recovery_attempts: 2
    circle_goal_tolerance: 0.50

    # VLM capture:
    #   stop         - stop at the VLM waypoint, trigger capture, then continue immediately.
    #   pass_through - keep following the full route and trigger capture while passing nearby.
    vlm_capture_mode: stop
    pass_through_vlm_trigger_radius: 0.35

    # /sign4return command values used by existing packages
    sign_qr_enable: 0
    sign_qr_disable: 5
    sign_vlm_trigger: 9
    sign_profile_normal: 10
    sign_profile_task2: 11
    vlm_trigger_repeat_count: 5
    vlm_trigger_interval_sec: 0.5

    # Candidate waypoint JSONs reuse the saved-point format.
    # home is intentionally never replaced.
    candidate_waypoint_json_dir: /home/sunrise/yiliao_ws/src/racing_control/config/waypoints
    qr_candidate_group_name: qr
    entry_candidate_group_name: entry
    # Task-two route candidates are selected by point name only:
    #   clockwise waypoint N        -> goal_NNN_1
    #   counterclockwise waypoint N -> goal_NNN_2
    # The VLM capture point is still selected by vlm_waypoint_number.

    # Pose parameters are flat x/y/yaw-radians triples in frame_id.
    qr_pose: [4.333107888975101, 1.028867429995691, 1.1383894869544392]
    post_qr_pose: [2.504811372926262, 2.2798075935366624, 1.520115031774562]
    entry_pose: [2.504811372926262, 2.2798075935366624, 1.520115031774562]

    # The route's Nth waypoint is used as the VLM capture point.
    # For the current point set, the 2nd waypoint is the VLM point.
    vlm_waypoint_number: 2

    # main_1.json: clockwise route, excluding home.
    clockwise_waypoints:
      - 0.7534956931109804
      - 3.766501234923627
      - 1.5592359900104606
      - 3.8567885105264077
      - 4.329424195458402
      - 0.03997856199797794
      - 2.5144339572664096
      - 2.4337692660037766
      - -1.6101462328054222
    clockwise_home_pose: [0.536986899408154, 0.1772662932069835, -1.652041913138445]

    # main_2.json: counterclockwise route, excluding home.
    counterclockwise_waypoints:
      - 4.2128251001861265
      - 3.7376334819031842
      - 1.5450283923222128
      - 1.1720794040064113
      - 4.319801449605877
      - 3.1112984779040144
      - 2.4951887885861144
      - 2.318297930897253
      - -1.539556591616333
    counterclockwise_home_pose: [0.536986899408154, 0.1772662932069835, -1.652041913138445]
