Declare the new dock_planner and custom_planner parameters

The bumped planners read a config schema this tree did not have yet. Every new
key is optional and falls back to a built-in default, so nothing was failing to
load - but the values were invisible here and could not be tuned.

dock_global_params.yaml
  Add approach/* and sampling/*. Drop MyGlobalPlanner and global_costmap:
  nothing in dock_planner ever read them.

custom_global_params.yaml
  Add the eleven keys CustomPlannerConfig reads. Drop the twelve SBPL-era keys
  (environment_type, planner_type, allocated_time, ...); grep over this tree
  finds no reader for any of them, and the real SBPL parameters live in
  sbpl_global_params.yaml.

maker_sources.yaml
  Add dock_anchor per marker. footprint_dock is deliberately left commented
  out: this file drives the real robot, and declaring a dock size nobody has
  measured moves the stopping point by half that length. Absent means the dock
  contributes 0 m, which is exactly what this robot does today. dock_anchor
  center-without-footprint and face are both 0 m contributions, so behaviour is
  unchanged either way.

Kept as-is because they are field settings, not missing schema: the allow-list
still carries undock_station / dock_station_2 / undock_station_2,
local_planner stays StanleyLocalPlanner, and every marker stays on DockPlanner.
action_handlers, compound_actions and recovery_behaviors are untouched - their
differences are this robot's tuning, not stale schema.

Verified: all three files parse, the merged parameter tree resolves each new
key, and no new root-key collision is introduced.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-12 22:23:20 +07:00
parent 4f5b94a58f
commit e75f164d02
3 changed files with 125 additions and 26 deletions

View File

@@ -1,16 +1,42 @@
# custom_planner — tham số runtime, đọc qua robot::NodeHandle("CustomPlanner").
# Thiếu key nào thì dùng default trong CustomPlannerConfig (cùng giá trị ghi ở đây).
#
# Khối cũ (environment_type, planner_type, allocated_time, initial_epsilon,
# force_scratch_limit, forward_search, nominalvel_mpersecs,
# timetoturn45degsinplace_secs, allow_unknown, directory_to_save_paths,
# pathway_filename, current_pose_topic_name) đã bỏ: không chỗ nào trong cây này
# đọc chúng — đó là tham số SBPL còn sót từ thời CustomPlanner chưa có config
# riêng. Tham số SBPL thật nằm ở sbpl_global_params.yaml.
CustomPlanner: CustomPlanner:
library_path: libcustom_planner library_path: libcustom_planner
environment_type: XYThetaLattice
planner_type: ARAPlanner
allocated_time: 10.0
initial_epsilon: 1.0
force_scratch_limit: 10000
forward_search: false
nominalvel_mpersecs: 0.8
timetoturn45degsinplace_secs: 1.31 # = 0.6 rad/s
allow_unknown: true
directory_to_save_paths: "/init/paths"
pathway_filename: "pathway.txt"
current_pose_topic_name: "/amcl_pose"
# [m] start/goal cách pathway dưới ngưỡng này thì coi là đã bám vào pathway
# (quyết định cách nối NURBS start/goal vào tuyến).
pathway_attach_distance: 0.1
# [m] order không có node/edge (goal trần): chỉ nhận khi start-goal gần hơn
# ngưỡng này, ngược lại trả false để move_base2 dùng backup planner.
bare_goal_max_distance: 0.2
# Bước tham số u trong [0,1] khi đo chiều dài NURBS một cạnh (không phải mét).
nurbs_length_t_interval: 0.01
# [m] khoảng cách mong muốn giữa hai pose khi lấy mẫu NURBS nối start/goal.
nurbs_point_spacing: 0.05
# [rad] hai cạnh thẳng đầu gãy dưới góc này thì bỏ cạnh đầu khi tính yaw.
skip_edge_angle: 0.4712 # = 0.15*pi
# [rad] góc nối giữa hai cạnh <= tight: gãy gắt (cost 20); < wide: gãy vừa (cost 10).
cost_angle_tight: 0.3142 # = 0.1*pi
cost_angle_wide: 1.4137 # = 0.45*pi
# [rad] cửa sổ góc đổi hướng cần chèn chuỗi pose xoay tại chỗ giữa hai cạnh.
rotation_insert_min: 1.4137 # = 0.45*pi
rotation_insert_max: 2.6704 # = 0.85*pi
# [rad] bước yaw giữa hai pose xoay tại chỗ được chèn.
rotation_step: 0.1571 # = 0.05*pi
# [rad] |yaw goal - hướng cạnh cuối| vượt ngưỡng này thì đoạn cuối đi lùi.
backward_decision_angle: 1.5708 # = 0.5*pi

View File

@@ -1,11 +1,47 @@
# DockPlanner plugin and approach-curve parameters.
#
# Collision/free-space checking is intentionally not configured here yet:
# DockPlanner currently generates geometry only. Do not add cost_threshold,
# allow_unknown, or check_free_space until the collision checker is implemented.
#
# The MyGlobalPlanner and global_costmap blocks that used to sit here were
# dropped: nothing in dock_planner ever read them. The planner reads exactly the
# keys below plus dock_anchor and footprint_dock, which move_base2 copies in per
# marker from maker_sources.yaml.
DockPlanner: DockPlanner:
# Boost.DLL library containing the exported symbol "DockPlanner".
library_path: libdock_planner library_path: libdock_planner
MyGlobalPlanner:
cost_threshold: 200 # Ngưỡng chi phí vật cản (0-255) approach:
safety_distance: 2 # Khoảng cách an toàn (cells) # [m] Extra straight alignment distance beyond half the combined robot/dock
use_dijkstra: false # Sử dụng Dijkstra thay vì A* # X extents. Increase if the robot must align earlier before entering a dock.
alignment_distance_padding: 0.0
# File: config/costmap_params.yaml
global_costmap: # [m] Lateral-distance range used to interpolate angle_threshold_*.
inflation_radius: 0.3 # Bán kính phình vật cản # Values outside this range are clamped, so behavior remains bounded.
cost_scaling_factor: 10.0 # Hệ số tỷ lệ chi phí lateral_distance_near: 0.10
lateral_distance_far: 1.00
# [rad] Permitted joining angle at the near/far lateral-distance limits.
# Required relation: 0 < far < near < pi.
angle_threshold_near: 2.35619449019 # 0.75*pi
angle_threshold_far: 1.09955742876 # 0.35*pi
# [rad] Relaxes the forward direction test relative to the reverse test.
# Required: 0 <= value < angle_threshold_far.
direction_angle_hysteresis: 0.05
# [m] Distance margin used when rejecting a reference-path joining point
# that is already too close to the end of the approach curve.
direction_distance_tolerance: 0.10
sampling:
# [m] Target spacing between generated path poses. The curve is sampled by
# arc-length estimate and always includes both endpoints.
path_point_spacing: 0.05
# footprint_dock is intentionally not declared here. It describes the
# physical dock, not the robot, and move_base2 copies the value selected from
# docking_marker_profiles/<marker>/footprint_dock into this namespace before
# constructing the planner. If absent, dock size contributes 0 m to approach
# geometry and DockPlanner emits a warning.

View File

@@ -22,19 +22,56 @@ maker_sources: trolley charger dock_station undock_station dock_station_2 undock
# Marker có entry ở đây dùng CẶP PLANNER RIÊNG. Marker rỗng, hoặc chỉ có trong `maker_sources` mà # Marker có entry ở đây dùng CẶP PLANNER RIÊNG. Marker rỗng, hoặc chỉ có trong `maker_sources` mà
# không nằm trong bảng này, sẽ dùng cặp `docking` mặc định của move_base_common_params.yaml. # không nằm trong bảng này, sẽ dùng cặp `docking` mặc định của move_base_common_params.yaml.
# #
# ► Chỉnh: chỉ khai marker nào THỰC SỰ cần planner khác mặc định — ba entry dưới đây đang trùng y # ► Chỉnh: chỉ khai marker nào THỰC SỰ cần planner khác mặc định. Tham số của planner nằm ở YAML
# hệt cặp mặc định, tức chúng không đổi hành vi gì, giữ lại chỉ để làm chỗ móc khi cần tách sau # riêng của plugin (dock_global_params.yaml, stanley_local_planner_params.yaml), KHÔNG khai ở đây —
# này. Tham số của planner nằm ở YAML riêng của plugin (dock_global_params.yaml, # trừ `dock_anchor` và `footprint_dock` dưới đây.
# hybrid_local_planner_params.yaml), KHÔNG khai ở đây. #
# ── dock_anchor ───────────────────────────────────────────────────────────────────────────────────
#
# Goal pose của marker nằm ở đâu trên đối tượng dock:
# center — goal ở tâm footprint dock; DockPlanner cộng thêm extent từ tâm tới mặt tiếp cận
# (lấy từ footprint_dock). Mặc định khi không khai — giữ nguyên hành vi cũ.
# face — goal đã nằm ngay tâm MẶT tiếp cận; dock không đóng góp vào khoảng dừng,
# footprint_dock bị bỏ qua hoàn toàn (DockPlanner log info nếu vẫn khai).
#
# ── footprint_dock ────────────────────────────────────────────────────────────────────────────────
#
# Đa giác của ĐỐI TƯỢNG DOCK (kệ / trạm sạc), [m], trong frame của goal pose. KHÔNG phải footprint
# robot: footprint robot khai ở costmap và dùng cho collision check, còn khoá này vào khoảng dừng
# của DockCalc — điểm robot bắt đầu đoạn căn thẳng trước dock:
#
# alignment_distance = <extent mép robot dẫn đầu> + <extent tâm dock → mặt gần> + padding
#
# Chỉ dùng khi `dock_anchor: center`. Khai thiếu = dock bị coi là một điểm, robot tiến sát hơn dự
# tính đúng extent tới mặt gần.
#
# ⚠ CHƯA KHAI TRÊN ROBOT NÀY — cố ý. Không khai = giữ đúng hành vi đang chạy ngoài hiện trường;
# khai một con số chưa đo là dịch điểm dừng của robot đi đúng nửa chiều dài số đó.
# ► Chỉnh: đo kích thước THẬT của từng loại kệ/trạm rồi mở comment. Trục x là hướng robot tiến
# vào. Chúng khác nhau theo loại — để trùng số là mất tác dụng của việc khai theo marker.
#
# Hai khoá trên là các khoá DUY NHẤT trong bảng này được rót xuống plugin:
# `PlannerRunner::bindDockingMarker()` chép chúng sang namespace của `global_planner` khai ngay bên
# trên, TRƯỚC khi instance được dựng, rồi dựng lại instance khi marker đổi.
#
# ⚠ Chỉ `DockPlanner` đọc hai khoá này. Marker nào khai global planner khác thì giá trị vẫn được
# chép sang namespace đó nhưng không ai đọc — không lỗi, không log, chỉ là không có tác dụng.
docking_marker_profiles: docking_marker_profiles:
trolley: trolley:
global_planner: DockPlanner global_planner: DockPlanner
local_planner: StanleyLocalPlanner local_planner: StanleyLocalPlanner
# Goal ở trọng tâm xe trolley (robot chui gầm) → cộng extent tâm→mặt từ footprint_dock.
dock_anchor: center
# footprint_dock: [[x,-y],[x,y],[-x,y],[-x,-y]] # đo rồi mở
charger: charger:
global_planner: DockPlanner global_planner: DockPlanner
local_planner: StanleyLocalPlanner local_planner: StanleyLocalPlanner
# Goal teach ngay tâm mặt trạm sạc → dock không đóng góp khoảng dừng.
dock_anchor: face
dock_station: dock_station:
global_planner: DockPlanner global_planner: DockPlanner
local_planner: StanleyLocalPlanner local_planner: StanleyLocalPlanner
dock_anchor: center
# footprint_dock: [[x,-y],[x,y],[-x,y],[-x,-y]] # đo rồi mở