Files
move_base2/config/runtime/custom_global_params.yaml
duongtd d10c240395 Feed per-marker docking parameters to the global planner
A docking global planner has no way to learn which marker the leg is for:
BaseGlobalPlanner::initialize() takes only the plugin name and the costmap,
and the plugin builds its own NodeHandle to read parameters. The only channel
left is the parameter tree, so copy the marker's keys into the planner's
namespace before the instance is built - the same shape as
Costmap2DROBOT::copyParentParameters() pouring parameters into each layer.

PlannerPort::bindDockingMarker() is called at the request gate, right before
swapPlanner(), because swapPlanner is where the instance is built and reads
its parameters. Copying afterwards would be a no-op: initialize() runs once.

- The destination is whatever global_planner the profile names, so a marker
  bound to a planner other than DockPlanner writes into that planner's
  namespace. Only DockPlanner reads footprint_dock today; the config
  documents that the value is inert elsewhere.
- The namespace is verified after construction. robot::NodeHandle silently
  falls back to its parent when a namespace does not resolve, so a mistyped
  marker would otherwise read footprint from ROOT - the robot footprint -
  and use it as the dock's size.
- The cached instance is rebuilt when the marker changes, and swapPlanner no
  longer short-circuits on an unchanged planner name, otherwise the second
  dock would run with the first dock's geometry. Rebuilds are skipped when
  the same marker is bound again.
- The replaced instance is retired rather than destroyed: the planner thread
  captures the active pointer and releases the mutex before calling into the
  plugin, so destroying it from the control thread is a use-after-free.

Add eight PlannerRunner tests. The test plugin now exports its initialize()
count and the footprint it read, which is the only way to observe from
outside that the rebuild actually happened.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-12 21:53:12 +07:00

36 lines
1.6 KiB
YAML

# 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).
CustomPlanner:
library_path: libcustom_planner
# [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