Copies the per-marker cusp-to-goal cap to the DockPlanner namespace and clears it
with YAML null when the next marker does not declare it. dock_global_params.yaml
gets the default maneuver/maximum_cusp_distance: 0.0 (no cap).
A docking marker profile can now override DockPlanner's
terminal/straight_length with dock_straight_length (dock_planner c94c5b2).
It goes through the same path as dock_face_offset and
dock_pivot_safety_margin: copied into the planner namespace when the marker
declares it, written as YAML null when the next marker does not, so one
marker's value never leaks into another and the global default stays
untouched. Valid for every dock_anchor.
- Test: copied for the marker that declares it, null and rebuilt for the
next marker, restored when the first marker comes back, and
terminal/straight_length is never written.
- maker_sources.yaml / dock_global_params.yaml: document the key.
Two new DockPlanner keys, valid only with dock_anchor: mating_edge, are copied from
docking_marker_profiles/<marker> into the planner namespace like footprint_dock and
dock_anchor.
Unlike those two, the new keys are optional. A marker that does not declare one would keep
the value bound by the previous marker, so the charger's smaller pivot margin could leak
into a later trolley docking. When the marker lacks a key that the planner namespace still
holds, the binder writes a YAML null, which DockPlanner reads as unset, and counts it as a
change so that the instance is rebuilt. footprint_dock and dock_anchor keep their old
behaviour.
PlannerRunner truoc gio giu Costmap2D mutex suot makePlan() (giao thuc gen-1) - SBPL search
6-14s la costmap update thread bi block het tung do. Them capability boost::dll
"<alias>ExternalGrid" (cung mau sbpl_recovery dang dung) de planner nhan ban chup thay vi
lock song. threadBody(): planner co setter + costmap bat snapshot_for_readers thi
refreshSnapshot() + dua ban chup vao, khong lock; khong thi rot ve giu mutex nhu cu (rollback
khong build lai). SBPLLatticePlanner them setExternalGrid()/activeGrid(); sua luon check
size external_grid_ so voi grid (grid = activeGrid() nen so voi chinh no, khong bao gio bat
duoc lech) - so dung costmap_robot_->getCostmap() (luoi song).
Test: ReportsExternalGridCapabilityPerPlanner, ExternalGridIsNotCalledWhileTheCostmapLockIsDisabled.
config/runtime: bat snapshot_for_readers: true (cay sim). docs/THREADING.md: bang so sanh khoa
dai vs ban chup.
Root cause (from a C++ host log, 2026-09-11): cancel during PLANNING only set
a discard flag on the planner thread, which ran to allocated_time before
CANCELLED could be reported; a queued next mission landed on a still-busy
planner and timed out too. Same class of bug existed for pause, recovery, and
implicitly for a legitimate ABORTED read while a component was still
unwinding. Full audit, decisions, and phased design in
docs/PLAN_LIFECYCLE_CANCEL_PAUSE_RESUME.md; old-vs-new behaviour per state in
docs/LIFECYCLE_BEHAVIOUR_MATRIX.md.
Runtime quiescence, not just "command sent":
- kPausing (new state) mirrors kCancelling: PAUSED/CANCELLED is only entered
once planner and recovery are idle, the action reports terminal, and the
robot is stopped per odometry (robot_stopped, stopped_measured_linear/
angular_eps) — not merely "the command we sent was zero". settle_timeout
bounds the wait; exceeding it still finishes but logs an ungated error
naming which component was still busy, so a plugin that doesn't honour
cancel/pause is visible instead of silently swallowed.
- PlannerRunner::running_planner_ (new): the instance the planner thread is
actually inside makePlan() with, tracked separately from active_ — active_
can already point at a different instance after swapPlanner() while the
old attempt is still running. cancelPlan(), swapPlanner() (when a job is
running_ or only pending_ and not yet picked up), and the destructor all
preempt through this pointer now; the old code preempted through active_
and could silently preempt the wrong (idle) instance after a profile swap.
- ComponentStatusBoard + per-component ComponentPhase (idle/busy/stopping/
paused/hung), read by PlannerRunner, RecoveryRunner, ActionRunner and
ControlLoop instead of ad hoc bools — this is what makes "did everything
actually stop" answerable at all, and what the new Watchdog thread reads
to flag a component busy-without-progress as hung (logged once at the
edge) without the control loop needing to detect its own stall.
- Resume: PLANNING replans from the current pose. CONTROLLING re-issues
setPlan() with the plan already in hand (decided: setPlan again, not a
fresh plan) — the local planner needs nothing else since it already runs
once per control cycle; a fresh plan on resume was considered and
rejected as unnecessary work for a plan that's still valid.
- Command-to-zero on cancel/pause stays immediate (no deceleration ramp) —
existing VelocityArbiter behaviour, left as is per a scoped decision.
Depends on: Test/sbpl (bd89924), pnkx_nav_core (2b0993b, robot_nav_core::
Preemptable + component_status_probe.h), Test/sbpl_lattice_planner (7456e99),
Test/recovery_core (254c7fc, onCancelRequested + ABI guard), Test/
sbpl_recovery (ea79686, worker-thread cancel), Test/action_core (669c3f7,
pause/resume + kCancelled), Test/dock_pattern_action (cc1ea74).
Verified: 13 gtest binaries / 528 tests, 0 failures. Runtime on the dev
machine (Gazebo + real ROS host + VDA5050 over MQTT), 6 scenarios — cancel
during PLANNING, pause/resume during PLANNING and CONTROLLING (incl.
submit-while-still-winding-down), pause-then-cancel during PLANNING and
CONTROLLING: no ABORTED/RECOVERING in any run, preempt lands within
hundredths of a millisecond of entering CANCELLING/PAUSING, PAUSED/CANCELLED
only reported once the robot is actually stopped per odometry. Full numbers
in the plan doc section 6.
Excluded from this commit (pre-existing, unrelated):
config/runtime/recovery_behaviors_params.yaml (allocated_time 1.0->2.0,
SBPLDetourPlanner tuning predating this work).
Not yet done (see plan doc "Trạng thái"): config tuning (phase 0, pending
per a scoping decision); runtime scenarios for cancel mid-detour and a 30 s
pause mid-action; commit to rb_ws is a separate step, not done here.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Nothing reads the key. DockPlanner's config takes dock_anchor, the footprint
and the drive model; terminal_direction was copied down into the planner
namespace and sat there.
The direction of the final straight leg is derived instead: dock_calc tries
nose-first and reverse and keeps whichever needs the smaller pivot, so the side
the robot stands on carries the intent. The layer above has already offset the
goal so base_link ends up on it, which means a marker key forcing the other
direction would contradict the goal position it was handed. Docking in reverse
is a different goal, not a different flag.
Leaving it in the allow-list makes the planner namespace advertise a live key
that does nothing, and a config that lies is worse than one that lacks the key.
The fixture test now asserts the allow-list stays closed instead: the marker
profile also carries global_planner and local_planner, and copying the whole
block down would put meaningless keys into the planner namespace where they can
shadow real ones.
Third per-marker key alongside footprint_dock and dock_anchor, so a marker can
override which direction the final straight leg into the dock is driven.
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>