FrameSamplerActionHandler already builds a precise reason for each way it can fail: too few samples, detection too scattered, could not publish the output frame, raw frame never appeared. All four reached the log as the same four words, because control_loop read the tick, kept only the status, and dropped the message, while the state machine passed a hard-coded string to finish(). Three field runs in a row could not be diagnosed for that reason: the detector was healthy, the host confirmed pallet_raw was published and resolvable, and the only thing navigation said was "action failed". The handler message now travels through StateMachineInput into the terminal reason, so it reaches the host feedback as well as the log, and control_loop logs it directly - as an error when the action fails, as info when it succeeds, where it carries the sample count worth comparing against the next failure. StateMachineOutput::reason is a const char* and enter() stores the pointer rather than copying, so the composed string lives in a StateMachine member. Building it in a local would return a pointer into destroyed memory - every other reason in that class is a string literal, so nothing had hit this before. Two tests cover it: the message reaches the reason, and the reason survives the StateMachineInput that carried it. Config in this tree follows the same split as the robot: per-marker dock_anchor and footprint_dock in maker_sources.yaml, detect handlers separated into detect_charger and detect_pallet.
87 lines
5.4 KiB
YAML
87 lines
5.4 KiB
YAML
# =================================================================================================
|
|
# move_base2 — danh sách marker docking hợp lệ và cặp planner riêng của từng marker.
|
|
#
|
|
# Quy ước comment: dòng mô tả = LÀ GÌ / vì sao; `► Chỉnh:` = sửa thế nào cho đúng.
|
|
#
|
|
# Danh sách cho phép, dùng cho `BaseNavigation::dockTo(marker, ...)`.
|
|
#
|
|
# move_base2 docking quy `goal_frame` thành pose TUYỆT ĐỐI rồi chạy DockPlanner + local planner
|
|
# docking. Nó KHÔNG đọc bộ tham số per-marker của PNKXDockingLocalPlanner cũ (plugins,
|
|
# maker_goal_frame, delay, timeout, velocity, tolerance, lookahead) — những khoá đó nếu còn sót lại
|
|
# ở đâu đó cũng không có tác dụng.
|
|
# =================================================================================================
|
|
|
|
# Marker mà host được phép gửi xuống. Đây là ALLOW-LIST: tên không có trong dòng này bị từ chối
|
|
# ngay tại `dockTo`, không đi tới planner.
|
|
#
|
|
# ► Chỉnh: chỉ thêm/bớt TÊN, cách nhau bằng khoảng trắng. Giữ danh sách tối thiểu — mỗi tên thừa là
|
|
# một đường vào chưa được kiểm chứng. Sẽ bỏ hẳn khi `dockTo` được chuyển sang dock_sequences khai
|
|
# báo trong compound_actions_params.yaml.
|
|
maker_sources: trolley charger dock_station pallet
|
|
|
|
# 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.
|
|
#
|
|
# ► 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
|
|
# riêng của plugin (dock_global_params.yaml, hybrid_local_planner_params.yaml), KHÔNG khai ở đây —
|
|
# trừ `footprint_dock` dưới đây.
|
|
#
|
|
# ── 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.
|
|
#
|
|
# ── 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).
|
|
#
|
|
# 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: TwoPointsPlanner` 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.
|
|
#
|
|
# ► Chỉnh: đo kích thước THẬT của từng loại kệ/trạm — chúng khác nhau, để trùng số là mất tác dụng
|
|
# của việc khai theo marker. Trục x là hướng robot tiến vào. Chọn `dock_anchor` theo cách teach
|
|
# goal của từng loại: goal teach ở mặt (pallet, charger) → face; goal teach ở tâm (trolley chui
|
|
# gầm) → center.
|
|
docking_marker_profiles:
|
|
trolley:
|
|
global_planner: DockPlanner
|
|
local_planner: StanleyDockingLocalPlanner
|
|
# 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: [[0.583,-0.48],[0.583,0.48],[-0.583,0.48],[-0.583,-0.48]]
|
|
|
|
charger:
|
|
global_planner: TwoPointsPlanner
|
|
local_planner: StanleyDockingLocalPlanner
|
|
# Goal teach ngay tâm mặt trạm sạc. Chỉ có tác dụng nếu đổi sang DockPlanner.
|
|
dock_anchor: face
|
|
footprint_dock: [[0.583,-0.48],[0.583,0.48],[-0.583,0.48],[-0.583,-0.48]]
|
|
|
|
dock_station:
|
|
global_planner: TwoPointsPlanner
|
|
local_planner: StanleyDockingLocalPlanner
|
|
dock_anchor: center
|
|
footprint_dock: [[0.583,-0.48],[0.583,0.48],[-0.583,0.48],[-0.583,-0.48]]
|
|
|
|
pallet:
|
|
global_planner: DockPlanner
|
|
local_planner: StanleyDockingLocalPlanner
|
|
# Goal teach ở tâm mặt pallet → dock không đóng góp khoảng dừng, footprint_dock bị bỏ qua.
|
|
dock_anchor: face
|
|
footprint_dock: [[0.9,-0.8],[0.9,0.8],[-0.9,0.8],[-0.9,-0.8]]
|