# 四角 LiDAR + 车端标定球外部真值定位配置模板。
# 该文件只定义现场配置边界，真实数值必须由现场测量和安装标定得到。

reference_source_name: workshop_four_lidar_ball_truth
workcell_zone_id: workshop_external_lidar_zone_a
output_topic: /workshop/external_localization/vehicle/pose
diagnostics_topic: /workshop/external_localization/diagnostics
publish_hz: 20.0
max_frame_age_ms: 100.0
max_points_per_frame: 20000

# 现场配置强校验。
# 四角 LiDAR 正式落地时建议四台全部在线；如果现场允许降级，可在真实配置中调低。
config_validation:
  min_enabled_lidar_count: 4
  min_required_ball_count: 2

# 外部定位观测落盘配置。
# session_dir 表示本次标定会话根目录；以下三个文件会被写入 dataset_index.yaml 的 data_inputs.external。
recording:
  enabled: true
  session_id: replace_with_session_id
  site_id: replace_with_site_or_line_id
  vehicle_id: replace_with_real_vehicle_id
  session_dir: /data/agv_calib/replace_with_site_or_line_id/session_xxx
  dataset_index_path: /data/agv_calib/replace_with_site_or_line_id/session_xxx/dataset_index.yaml
  external_observation_file: external/external_observations.csv
  marker_observation_file: external/marker_observations.jsonl
  time_sync_diagnostic_file: external/time_sync_diagnostics.jsonl
  dataset_index_update_every_n_samples: 20

# 四台固定 LiDAR 的现场安装位姿。
# workshop_pose 表示 LiDAR 坐标系在车间坐标系下的位姿。
# message_type 支持 pointcloud2 或 laser_scan。
lidars:
  - lidar_id: corner_front_left
    enabled: true
    topic: /site/lidar/corner_front_left/points
    message_type: pointcloud2
    frame_id: lidar_corner_front_left
    workshop_pose:
      x_m: 0.0
      y_m: 0.0
      z_m: 1.2
      roll_rad: 0.0
      pitch_rad: 0.0
      yaw_rad: 0.0

  - lidar_id: corner_front_right
    enabled: true
    topic: /site/lidar/corner_front_right/points
    message_type: pointcloud2
    frame_id: lidar_corner_front_right
    workshop_pose:
      x_m: 8.0
      y_m: 0.0
      z_m: 1.2
      roll_rad: 0.0
      pitch_rad: 0.0
      yaw_rad: 3.1415926536

  - lidar_id: corner_rear_left
    enabled: true
    topic: /site/lidar/corner_rear_left/points
    message_type: pointcloud2
    frame_id: lidar_corner_rear_left
    workshop_pose:
      x_m: 0.0
      y_m: 6.0
      z_m: 1.2
      roll_rad: 0.0
      pitch_rad: 0.0
      yaw_rad: 0.0

  - lidar_id: corner_rear_right
    enabled: true
    topic: /site/lidar/corner_rear_right/points
    message_type: pointcloud2
    frame_id: lidar_corner_rear_right
    workshop_pose:
      x_m: 8.0
      y_m: 6.0
      z_m: 1.2
      roll_rad: 0.0
      pitch_rad: 0.0
      yaw_rad: 3.1415926536

# 车端标定球在 base_link 下的安装坐标。
# 只有一个球通常只能确定位置，无法唯一确定车辆 yaw。
# 需要输出完整车辆位姿时，建议至少配置两个球，三球及以上更稳健。
ball_targets:
  - ball_id: front_ball
    radius_m: 0.075
    required: true
    center_in_base_link:
      x_m: 0.6
      y_m: 0.0
      z_m: 0.8
      roll_rad: 0.0
      pitch_rad: 0.0
      yaw_rad: 0.0

  - ball_id: rear_ball
    radius_m: 0.075
    required: true
    center_in_base_link:
      x_m: -0.6
      y_m: 0.0
      z_m: 0.8
      roll_rad: 0.0
      pitch_rad: 0.0
      yaw_rad: 0.0

# 算法实现者可使用这些阈值生成 quality_score、tracking_loss_ratio 和诊断信息。
quality_thresholds:
  min_visible_ball_count: 2
  max_position_stddev_m: 0.02
  max_yaw_stddev_rad: 0.01
  max_time_sync_offset_ms: 20.0
  min_quality_score: 0.8
