Sensor data entered this runtime and disappeared into the costmap. At 0.05 m with inflation the costmap has destroyed ray order and object shape, so a dock detector fitting lines to find a V plate cannot reconstruct what the laser saw - two 0.2 m wings on that grid are one blob. A reinforcement-learning local planner wants the raw scan for the same reason. Neither had a route: ActionContext held only TF, and LocalPlanner::initialize takes only a costmap. NavigationServer now owns a SensorStore and feeds it from all five doors, handing a read-only port to the action registry and to the controller runner. The store gets the reading BEFORE the filter. Anything that wants filtering filters upstream; the store does not know a filter exists. With laser SOR on, the store and the costmap deliberately see different data - one wants outliers gone, the other wants the true shape - and the comment at addLaserScan now says so, because the one it replaces claimed the opposite. remove* mirrors into the store, dropping readings while keeping the topic declared. A host that has disowned data while the store still serves it means the two disagree about what the robot can currently see, and max_age only covers the tail of that. Reaching a local planner without breaking every other one: widening LocalPlanner::initialize would break hybrid, mppi, priest, stanley and deep_mpc at once for the sake of one planner. A planner that wants sensor data inherits SensorConsumer instead, and ControllerRunner finds out with a dynamic_cast after loading it, at all three sites that build an instance and always before initialize(). Planners that do not inherit it cast to null and nothing happens, so nothing needs rebuilding. That cast crosses a .so boundary and depends on matching RTTI, which a green build does not prove - hence the log line, and hence TestControllerSensorProbe, dlopen'd like a real plugin, to check it actually matches. sensor_store/report_period prints what the store holds every N seconds, off by default. Until a consumer exists it is the only way to see whether data arrives at all, and it is what separates a mistyped topic from a dead sensor - without it the two look identical. It reads age from the control loop's clock, not robot::Time::now(), which is the wall clock while a simulated scan is not. Config is refused at boot, not at first use: an unknown data_type, a short name two packages share, a duplicate topic, a capacity below 1, a max_age that is not positive. Declaring no sensor at all is valid and leaves the store empty and silent - a runtime with no consumer of raw data holds nothing, which is an answer rather than a reason to refuse to start. robot_nav_msgs/OccupancyGrid is registered here rather than in robot_sensor_ports, which ships only its own package's types; pulling robot_nav_msgs into every translation unit that touches the store would be the cost of doing otherwise.
332 lines
12 KiB
YAML
332 lines
12 KiB
YAML
# Config CHỈ dùng cho test của gói. Bản runtime nằm ở `pnkx_nav_core/config/` (C2).
|
|
#
|
|
# Chạy test kèm: PNKX_NAV_CORE_CONFIG_DIR=src/AMR_T800/Test/move_base2/test/config
|
|
|
|
# --- Tham số runtime, dùng cho config_validation_test ----------------------------------------
|
|
move_base2:
|
|
docking_requires_marker: false
|
|
controller_frequency: 20.0 # [Hz]
|
|
planner_frequency: 0.0 # [Hz] 0 = chỉ lập plan khi cần
|
|
planner_timeout: 5.0 # [s]
|
|
|
|
planner_patience: 5.0 # [s]
|
|
controller_patience: 15.0 # [s]
|
|
oscillation_timeout: 0.0 # [s] 0 = tắt
|
|
oscillation_distance: 0.5 # [m]
|
|
action_patience: 0.0 # [s] 0 = tắt; lưới cuối, không phải cơ chế timeout chính
|
|
max_planning_retries: -1 # < 0 = không giới hạn
|
|
recovery_behavior_enabled: true
|
|
|
|
max_vel_x: 0.5 # [m/s] tiến
|
|
min_vel_x: -0.2 # [m/s] lùi, ÂM
|
|
max_vel_theta: 1.0 # [rad/s]
|
|
acc_lim_x: 1.0 # [m/s^2]
|
|
acc_lim_theta: 2.0 # [rad/s^2]
|
|
|
|
global_frame: map
|
|
robot_base_frame: base_link
|
|
|
|
sensors:
|
|
laser_sor_enabled: true # lọc outlier laser TRƯỚC khi vào costmap
|
|
laser_sor_mean_k: 8 # [điểm] số láng giềng gần nhất dùng để ước lượng
|
|
laser_sor_stddev_mul: 1.5 # [-] ngưỡng = mean + hệ_số * stddev
|
|
|
|
# Kho cảm biến THÔ dùng chung — đường thứ hai, KHÔNG đi qua bộ lọc ở khối `sensors` bên trên.
|
|
sensor_store:
|
|
report_period: 2.5 # [s] 0 = tắt
|
|
sensors:
|
|
- topic: /b_scan
|
|
data_type: LaserScan # dạng ngắn
|
|
capacity: 3
|
|
max_age: 0.4 # [s]
|
|
- topic: /camera/depth/points_proc
|
|
data_type: robot_sensor_msgs/PointCloud2 # dạng đầy đủ
|
|
|
|
recovery_namespace: recovery
|
|
action_namespace: actions
|
|
mission_namespace: mission_adapters
|
|
backup_global_planner: TestBackupGlobalPlanner
|
|
|
|
position:
|
|
base_global_planner: TestGlobalPlanner
|
|
base_local_planner: TestLocalPlanner
|
|
|
|
docking:
|
|
base_global_planner: TestDockPlanner
|
|
base_local_planner: TestLocalPlanner
|
|
|
|
docking_marker_profiles:
|
|
trolley:
|
|
global_planner: TestTrolleyDockPlanner
|
|
local_planner: TestTrolleyDockLocalPlanner
|
|
|
|
# --- Schema runtime root-profile ---------------------------------------------------------------
|
|
# Đây là schema dùng bởi move_base_common_params.yaml của move_base2. Không có adapter gen-1.
|
|
root_profiles:
|
|
controller_frequency: 30.0
|
|
planner_frequency: 0.0
|
|
planner_patience: 2.0
|
|
controller_patience: 0.033333333
|
|
max_planning_retries: 0
|
|
recovery_behavior_enabled: true
|
|
docking_requires_marker: false
|
|
backup_global_planner: TestBackupGlobalPlanner
|
|
|
|
position:
|
|
global_planner: TestGlobalPlanner
|
|
local_planner: TestLocalPlanner
|
|
|
|
docking:
|
|
global_planner: TestDockPlanner
|
|
local_planner: TestLocalPlanner
|
|
|
|
docking_marker_profiles:
|
|
trolley:
|
|
global_planner: TestTrolleyDockPlanner
|
|
local_planner: TestTrolleyDockLocalPlanner
|
|
|
|
go_straight:
|
|
global_planner: TestStraightPlanner
|
|
local_planner: TestStraightLocalPlanner
|
|
|
|
rotate:
|
|
global_planner: TestRotatePlanner
|
|
local_planner: TestRotateLocalPlanner
|
|
|
|
# --- Cấu hình sai, dùng cho test đường lỗi -----------------------------------------------------
|
|
move_base2_bad_frequency:
|
|
controller_frequency: 0.0 # phải bị từ chối
|
|
|
|
move_base2_bad_frames:
|
|
controller_frequency: 20.0
|
|
global_frame: base_link # trùng robot_base_frame -> pose robot luôn là gốc toạ độ
|
|
robot_base_frame: base_link
|
|
position:
|
|
base_local_planner: TestLocalPlanner
|
|
|
|
move_base2_no_planner:
|
|
controller_frequency: 20.0 # không profile nào có base_local_planner
|
|
|
|
# report_period âm -> validate() phải chặn boot.
|
|
move_base2_bad_sensor_store_report:
|
|
controller_frequency: 20.0
|
|
position:
|
|
base_local_planner: TestLocalPlanner
|
|
sensor_store:
|
|
report_period: -1.0
|
|
|
|
# data_type không có thật -> validate() phải chặn boot, không im lặng chạy với kho rỗng.
|
|
move_base2_bad_sensor_store_type:
|
|
controller_frequency: 20.0
|
|
position:
|
|
base_local_planner: TestLocalPlanner
|
|
sensor_store:
|
|
sensors:
|
|
- topic: /b_scan
|
|
data_type: LazerScan
|
|
|
|
move_base2_bad_sensors:
|
|
controller_frequency: 20.0
|
|
position:
|
|
base_local_planner: TestLocalPlanner
|
|
sensors:
|
|
laser_sor_enabled: true
|
|
laser_sor_mean_k: 1 # < 2 -> vô nghĩa, phải bị từ chối
|
|
|
|
# --- Recovery behavior cho recovery_runner_test ------------------------------------------------
|
|
#
|
|
# Chỉ khai behavior họ kNone: họ velocity cần Costmap2DROBOT thật (TF + chuỗi layer) nên được kiểm
|
|
# ở tầng tích hợp, không kiểm bằng fake ở đây.
|
|
recovery:
|
|
behaviors:
|
|
- {name: wait_short, type: WaitRecovery}
|
|
- {name: wait_long, type: WaitRecovery}
|
|
|
|
routes:
|
|
planning_failed: [wait_short]
|
|
controlling_failed: [wait_long, wait_short]
|
|
oscillation: [wait_long]
|
|
# Lặp behavior trong một route là HỢP LỆ (2026-08-05): mỗi lần xuất hiện là một lượt thử —
|
|
# ngân sách cho vòng "thử — chờ — nhích lại gần — thử lại" của giám sát tuyến.
|
|
path_blocked: [wait_short, wait_long, wait_short]
|
|
|
|
wait_short:
|
|
wait_duration: 1.0 # [s]
|
|
wait_long:
|
|
wait_duration: 5.0 # [s]
|
|
timeout: 3.0 # [s] cố ý NGẮN HƠN wait_duration -> lượt này luôn kết thúc bằng timeout
|
|
|
|
recovery_empty:
|
|
behaviors: []
|
|
|
|
recovery_missing_library:
|
|
behaviors:
|
|
- {name: ghost, type: GhostRecovery}
|
|
|
|
# Mô phỏng config được commit trước plugin DetourPathRecovery. `configure()` báo partial failure,
|
|
# nhưng configureRoutes() phải bỏ detour_path thay vì đưa index không tồn tại sang StateMachine.
|
|
recovery_missing_detour:
|
|
behaviors:
|
|
- {name: wait_short, type: WaitRecovery}
|
|
- {name: detour_path, type: DetourPathRecovery}
|
|
|
|
routes:
|
|
planning_failed: [wait_short]
|
|
controlling_failed: [detour_path, wait_short]
|
|
oscillation: [detour_path, wait_short]
|
|
|
|
# --- Recovery THẬT cho kịch bản có vật cản (RecoveryScenarioDriver) ----------------------------
|
|
#
|
|
# Namespace riêng, KHÔNG dùng chung với `recovery` ở trên: hai bộ test hỏi hai câu khác nhau. Bộ kia
|
|
# kiểm chỗ nối RecoveryPort <-> recovery_core bằng behavior họ kNone; bộ này kiểm hành vi an toàn
|
|
# THẬT của BackUpRecovery trên lưới có vật cản.
|
|
recovery_scenario:
|
|
behaviors:
|
|
- {name: back_up, type: BackUpRecovery}
|
|
|
|
back_up:
|
|
backup_distance: 0.50 # [m] quãng lùi mong muốn
|
|
backup_distance_max: 1.0 # [m] trần cứng
|
|
linear_speed: 0.15 # [m/s] độ lớn; dấu âm do plugin đặt (lùi)
|
|
acc_lim_x: 1.0 # [m/s^2]
|
|
timeout: 15.0 # [s]
|
|
|
|
WaitRecovery:
|
|
library_path: librecovery_core_wait_recovery
|
|
|
|
BackUpRecovery:
|
|
library_path: librecovery_core_back_up_recovery
|
|
|
|
# GhostRecovery cố ý KHÔNG khai library_path.
|
|
|
|
# --- Action handler cho action_runner_test -----------------------------------------------------
|
|
actions:
|
|
handlers:
|
|
- {name: noop, type: NoopActionHandler}
|
|
noop:
|
|
action_types: [wait, pick, drop]
|
|
duration: 2.0 # [s]
|
|
timeout: 10.0 # [s] tầng 1 — trách nhiệm của chính handler
|
|
|
|
actions_slow:
|
|
handlers:
|
|
- {name: noop, type: NoopActionHandler}
|
|
noop:
|
|
action_types: [wait]
|
|
hang: true # mô phỏng thiết bị không bao giờ trả lời
|
|
timeout: 3.0 # [s] handler tự cắt, không chờ state machine
|
|
|
|
actions_hang_forever:
|
|
handlers:
|
|
- {name: noop, type: NoopActionHandler}
|
|
noop:
|
|
action_types: [wait]
|
|
hang: true
|
|
timeout: 0.0 # tắt timeout + treo = chạy vĩnh viễn -> phải bị chặn lúc configure
|
|
|
|
actions_bad:
|
|
handlers:
|
|
- {name: noop, type: NoopActionHandler}
|
|
noop:
|
|
action_types: [wait]
|
|
duration: 10.0 # [s]
|
|
timeout: 5.0 # [s] <= duration -> action LUÔN hỏng; phải bị chặn lúc configure
|
|
|
|
actions_empty:
|
|
handlers: []
|
|
|
|
actions_missing_library:
|
|
handlers:
|
|
- {name: ghost, type: GhostActionHandler}
|
|
|
|
NoopActionHandler:
|
|
library_path: libaction_core_noop_action_handler
|
|
|
|
# --- Profile marker docking ở ROOT, cho PlannerRunner::bindDockingMarker ------------------------
|
|
#
|
|
# Ở runtime bảng này nằm tại ROOT (maker_sources.yaml) và `PlannerRunner` đọc nó qua NodeHandle gốc,
|
|
# khác với bản lồng trong `move_base2:`/`root_profiles:` ở trên — bản đó là đầu vào của
|
|
# MoveBase2Config, dùng cho config_validation_test. Hai bản cố ý tách nhau: chúng kiểm hai đường đọc
|
|
# khác nhau của cùng một khái niệm.
|
|
docking_marker_profiles:
|
|
dock_a:
|
|
global_planner: TestPlannerOk
|
|
local_planner: TestControllerOk
|
|
footprint_dock: [[0.5, -0.4], [0.5, 0.4], [-0.5, 0.4], [-0.5, -0.4]] # [m]
|
|
terminal_direction: forward
|
|
|
|
dock_b:
|
|
global_planner: TestPlannerOk
|
|
local_planner: TestControllerOk
|
|
footprint_dock: [[0.2, -0.15], [0.2, 0.15], [-0.2, 0.15], [-0.2, -0.15]] # [m], nhỏ hơn dock_a
|
|
|
|
# Có profile nhưng KHÔNG khai footprint_dock: bindDockingMarker phải chấp nhận và không đánh dấu
|
|
# phải dựng lại instance.
|
|
dock_no_footprint:
|
|
global_planner: TestPlannerOk
|
|
local_planner: TestControllerOk
|
|
|
|
# --- Global planner giả cho planner_runner_test -------------------------------------------------
|
|
#
|
|
# Bốn alias cùng nằm trong một thư viện; mỗi alias là một hành vi mà PlannerRunner phải xử lý đúng.
|
|
TestPlannerOk:
|
|
library_path: libmove_base2_test_global_planner
|
|
TestPlannerEmptyPlan:
|
|
library_path: libmove_base2_test_global_planner
|
|
TestPlannerThrowing:
|
|
library_path: libmove_base2_test_global_planner
|
|
TestPlannerInitFails:
|
|
library_path: libmove_base2_test_global_planner
|
|
|
|
# TestPlannerMissingLibrary cố ý KHÔNG khai library_path.
|
|
|
|
# GhostActionHandler cố ý KHÔNG khai library_path.
|
|
|
|
# --- Local planner giả cho controller_runner_test ------------------------------------------------
|
|
TestControllerOk:
|
|
library_path: libmove_base2_test_local_planner
|
|
TestControllerSecondary:
|
|
library_path: libmove_base2_test_local_planner
|
|
TestControllerNoCommand:
|
|
library_path: libmove_base2_test_local_planner
|
|
TestControllerNaN:
|
|
library_path: libmove_base2_test_local_planner
|
|
TestControllerThrowing:
|
|
library_path: libmove_base2_test_local_planner
|
|
TestControllerRefusesLimits:
|
|
library_path: libmove_base2_test_local_planner
|
|
TestControllerMarkerProbe:
|
|
library_path: libmove_base2_test_local_planner
|
|
TestControllerFootprintProbe:
|
|
library_path: libmove_base2_test_local_planner
|
|
# Planner duy nhất kế thừa robot_sensor_ports::SensorConsumer — dùng để kiểm dynamic_cast qua .so.
|
|
TestControllerSensorProbe:
|
|
library_path: libmove_base2_test_local_planner
|
|
|
|
# Danh sách marker cho test đường docking (setDockingMarker) — format chuỗi cách nhau bằng space,
|
|
# đúng như maker_sources.yaml production.
|
|
maker_sources: dock_a dock_b
|
|
|
|
# TestControllerMissing cố ý KHÔNG khai library_path.
|
|
|
|
# --- Schema gen-1 (move_base_common_params.yaml) cho test đường legacy --------------------------
|
|
legacy_move_base:
|
|
controller_frequency: 20.0 # [Hz]
|
|
planner_frequency: 0.0 # [Hz]
|
|
planner_patience: 0.0 # gen-1: "fail -> recovery NGAY", KHÔNG phải "tắt"
|
|
controller_patience: 15.0 # [s]
|
|
oscillation_timeout: 0.0 # [s]
|
|
oscillation_distance: 0.5 # [m]
|
|
max_planning_retries: 0
|
|
recovery_behavior_enabled: true
|
|
|
|
base_global_planner: SBPLLatticePlanner
|
|
base_local_planner: LocalPlannerAdapter # phải bị BỎ QUA có log
|
|
|
|
position_planner_name: HybridLocalPlanner
|
|
docking_planner_name: DockLocalPlanner
|
|
|
|
# Global planner riêng của profile nằm trong namespace mang tên chính planner đó.
|
|
DockLocalPlanner:
|
|
base_global_planner: DockPlanner
|