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>
This commit is contained in:
@@ -68,9 +68,9 @@ actions:
|
||||
# Để true trên robot thật = robot tiến vào một điểm bịa.
|
||||
use_simulated_goal: true
|
||||
simulated_parent_frame: base_link
|
||||
simulated_offset_x: -1.5 # [m] ► Chỉnh: chỉ có nghĩa khi use_simulated_goal: true.
|
||||
simulated_offset_y: 0.2 # [m] Đặt theo vị trí vật thể giả trong world Gazebo.
|
||||
simulated_offset_yaw: 0.0 # [rad]
|
||||
simulated_offset_x: -1.0 # [m] ► Chỉnh: chỉ có nghĩa khi use_simulated_goal: true.
|
||||
simulated_offset_y: 0.0 # [m] Đặt theo vị trí vật thể giả trong world Gazebo.
|
||||
simulated_offset_yaw: 0.05 # [rad]
|
||||
|
||||
# [s] Chờ robot đứng hẳn trước khi lấy mẫu — pose lúc vừa dừng còn dao động cơ khí.
|
||||
# ► Chỉnh: TĂNG nếu robot nặng/treo mềm và mẫu đầu bị lệch. GIẢM để rút ngắn chu kỳ dock.
|
||||
@@ -84,7 +84,7 @@ actions:
|
||||
# Số mẫu tối thiểu phải thu được trong cửa sổ, nếu không -> kFailed.
|
||||
# ► Chỉnh: đặt ~= (tần số publish của perception) x `sample_window` x 0.5 để còn dư địa. Đặt cao
|
||||
# quá là action fail dù frame vẫn tốt.
|
||||
min_samples: 20
|
||||
min_samples: 5
|
||||
|
||||
# Độ tản tối đa của tập mẫu. Tản hơn -> kFailed, KHÔNG lùi vào.
|
||||
# ► Chỉnh: đây là chốt AN TOÀN, không phải nút để "cho qua". Nới ra nghĩa là chấp nhận tiến vào
|
||||
|
||||
Reference in New Issue
Block a user