Files
move_base2/config/runtime/dock_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

43 lines
1.9 KiB
YAML

# 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.
DockPlanner:
# Boost.DLL library containing the exported symbol "DockPlanner".
library_path: libdock_planner
approach:
# [m] Extra straight alignment distance beyond half the combined robot/dock
# X extents. Increase if the robot must align earlier before entering a dock.
alignment_distance_padding: 0.0
# [m] Lateral-distance range used to interpolate angle_threshold_*.
# Values outside this range are clamped, so behavior remains bounded.
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.