line_follow_debug.yaml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # This node is visualisation-only: it never publishes /cmd_vel.
  2. image_topic: /usb_cam/image_raw
  3. # Metric inverse-perspective mapping (IPM), calibrated on 2026-08-10 with
  4. # four ground marks measured from the vehicle-front centre. The raw USB
  5. # camera is horizontally mirrored, so its physical left marks appear at the
  6. # right side of the source image. The matching destinations undo that mirror.
  7. # Point order: near-left, near-right, far-right, far-left.
  8. use_perspective_transform: true
  9. perspective_reference_size: [640, 480]
  10. src_pts: [[562, 304], [75, 307], [193, 240], [466, 237]]
  11. dst_pts: [[240, 360], [400, 360], [400, 120], [240, 120]]
  12. # Process at half resolution for real-time control, then scale debug views
  13. # back to the display size. Published error is converted back to 640-pixel
  14. # coordinates, so the controller parameters do not need changing.
  15. processing_scale: 0.5
  16. # GUI is intentionally slower than perception. It must never throttle the
  17. # messages consumed by the controller.
  18. display_rate: 10.0
  19. # Legacy scanline-offset compensation remains disabled. The controller now
  20. # uses a metric target point on the fitted IPM centreline.
  21. use_camera_front_offset: false
  22. camera_to_front_offset_m: 0.125
  23. # Zero means calculate automatically from camera_to_front_offset_m and the
  24. # metric IPM scale. A positive value overrides it in 640x480 reference pixels.
  25. camera_front_offset_px: 0
  26. metric_scale_px_per_m: 400.0
  27. metric_origin_px: [320, 480]
  28. # Pure-pursuit target geometry. The calibrated IPM origin is treated as
  29. # 125 mm ahead of the robot control centre; the desired target lies 300 mm
  30. # ahead of that control centre. When the nearest reliable curve sample is
  31. # farther away, continue only its tangent toward the vehicle by at most 250 mm.
  32. lookahead_distance_m: 0.30
  33. # Keep 0.30 m for LEFT/RIGHT routes and before the second maneuver. Once the
  34. # STRAIGHT route completes its fixed second right turn and enters
  35. # FOLLOW_AFTER_SECOND, automatically use 0.35 m without restarting this node.
  36. task_state_topic: /traffic_line_task/state
  37. normal_lookahead_distance_m: 0.30
  38. after_second_lookahead_distance_m: 0.35
  39. # Only after the second fixed right turn, move a curved lookahead target 25 mm
  40. # farther toward that curve's inside. Near-straight targets remain centred.
  41. after_second_inner_offset_m: 0.025
  42. inner_offset_activation_m: 0.015
  43. ipm_origin_ahead_of_control_m: 0.125
  44. max_near_target_extrapolation_m: 0.25
  45. lookahead_frame_id: base_link
  46. # Ordered click targets: near-left, near-right, far-right, far-left.
  47. # Each is [forward metres from vehicle-front centre, left metres]. These
  48. # values are the four marks used for the current src_pts/dst_pts calibration.
  49. calibration_markers_m: [[0.30, 0.20], [0.30, -0.20], [0.90, -0.20], [0.90, 0.20]]
  50. # OpenCV HSV white-line threshold. The upper scene (LED board, wall and desk)
  51. # is excluded by roi_top_ratio before any line candidates are selected.
  52. hsv_lower: [0, 0, 180]
  53. hsv_upper: [180, 60, 255]
  54. # In the real first/second junction images, the white route boundaries occupy
  55. # approximately y=200..330 of a 480-pixel image. Do not start at y=249: that
  56. # misses the branches entirely.
  57. roi_top_ratio: 0.42
  58. # Several horizontal bands are checked from near to far. At the first and
  59. # second forks the visible white lines move high in the image, so one fixed
  60. # scanline is not reliable.
  61. scanline_ratios: [0.82, 0.79, 0.76, 0.73, 0.70, 0.66, 0.62, 0.58, 0.54, 0.50, 0.46]
  62. scanline_half_height: 5
  63. min_run_width: 3
  64. # Discard isolated white connected components smaller than this area (pixels).
  65. # Route boundaries in the collected images are long components, while floor
  66. # speckles and LED artifacts are much smaller.
  67. min_component_area: 30
  68. # connectedComponentsWithStats is too slow on the vehicle at 640x480. The
  69. # 3x3 morphology above remains enabled; turn this on only for offline tuning.
  70. use_component_filter: false
  71. # Do not mask the image centre. Set this above zero only if a later test
  72. # confirms that LED reflection must be excluded again.
  73. center_reflection_half_width_ratio: 0.0
  74. # The metric calibration maps a 410 mm lane to about 25% of the processing
  75. # image width. Run centres and tape thickness can make the measured value a
  76. # few pixels smaller, and some route sections are narrower, so keep margin.
  77. min_lane_width_ratio: 0.18
  78. max_lane_width_ratio: 0.98
  79. morphology_kernel: 3
  80. # A bend can temporarily hide its inner boundary. Remember the most recent
  81. # two-boundary width and infer the midpoint from the remaining outer boundary.
  82. # The real finish bend hides its inner boundary for several seconds. Continue
  83. # only while the same outer boundary remains visible, with an eight-second hard
  84. # limit; complete/ambiguous line loss still publishes lane_valid=false.
  85. use_single_boundary_fallback: true
  86. single_boundary_timeout: 8.0
  87. # Preserve the physical side identity briefly when the curved outer line
  88. # crosses the image centre or one camera frame is missed.
  89. single_boundary_side_memory_timeout: 0.75
  90. lane_width_alpha: 0.2
  91. # Fit a curved centreline through all usable near/far scan bands. The fitted
  92. # tangent remains available for diagnostics, while the metric point on this
  93. # curve is published as /line_follow_debug/lookahead_target.
  94. max_centerline_heading_rad: 0.70