- ActionStatus::kCancelled (new, string "CANCELLED"): the missing "stopped on request" terminal status — previously a cancelled action only had Running/Succeeded/Failed to report through, so move_base2's state machine couldn't tell a cancelled action from a failed one. - ActionHandler::cancelNeedsTicks() (default false), pause(now) and resume(now) (default no-ops): lets a handler opt into "I need more ticks to actually stop" (device handshake) instead of being torn down immediately, and gives handlers a real pause/resume contract instead of move_base2 having to freeze/unfreeze them from outside. - action_abi.h (new) + ACTION_CORE_EXPORT_HANDLER macro, same pattern as recovery_core commit 254c7fc: exports a version symbol next to the factory alias; action_registry.cpp refuses a handler .so whose version doesn't match instead of dlsym+reinterpret_cast blindly onto a grown vtable. - frame_sampler / wait / noop handlers implement pause/resume via paused_at_ / started_at_ += (now - paused_at_) so their own internal timers don't count paused time; paused_ is reset on start() so a reused handler instance can't come up already paused. - test/plugins/stale_abi_action_handler.cpp (new) for the registry refusal test. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
218 lines
7.2 KiB
YAML
218 lines
7.2 KiB
YAML
# Config CHỈ dùng cho test của gói. Bản runtime nằm trong cây config của nav core (C2) — sửa tham
|
|
# số vận hành thì sửa ở đó, đừng sửa bản này.
|
|
#
|
|
# Chạy test kèm: PNKX_NAV_CORE_CONFIG_DIR=src/AMR_T800/Test/action_core/test/config
|
|
# (binary test tự setenv qua ACTION_CORE_TEST_CONFIG_DIR nên chạy được thẳng qua ctest.)
|
|
|
|
actions:
|
|
handlers:
|
|
- {name: quick, type: NoopActionHandler}
|
|
- {name: slow, type: NoopActionHandler}
|
|
|
|
quick:
|
|
action_types: [wait, pick]
|
|
duration: 0.0 # [s] xong ngay ở tick đầu
|
|
timeout: 30.0 # [s] timeout tầng 1, của chính handler
|
|
|
|
slow:
|
|
action_types: [charge]
|
|
duration: 1.0 # [s]
|
|
timeout: 10.0 # [s]
|
|
|
|
# Hai handler cùng nhận một actionType: registry phải TỪ CHỐI cái thứ hai thay vì ghi đè im lặng.
|
|
actions_duplicate_type:
|
|
handlers:
|
|
- {name: first, type: NoopActionHandler}
|
|
- {name: second, type: NoopActionHandler}
|
|
|
|
first:
|
|
action_types: [pick]
|
|
second:
|
|
action_types: [pick]
|
|
|
|
# Handler treo vĩnh viễn mà lại tắt timeout — configure() phải từ chối.
|
|
actions_hang_forever:
|
|
handlers:
|
|
- {name: ghost, type: NoopActionHandler}
|
|
|
|
ghost:
|
|
action_types: [wait]
|
|
hang: true
|
|
timeout: 0.0
|
|
|
|
# Type không khai library_path ở đâu cả.
|
|
actions_missing_library:
|
|
handlers:
|
|
- {name: nowhere, type: MissingActionHandler}
|
|
|
|
# Không có khoá `handlers`: hợp lệ, chỉ nghĩa là hệ không có thiết bị nào.
|
|
actions_empty:
|
|
something_else: 1
|
|
|
|
# ABI guard (2026-09-11): plugin giả export `_abi` = 1 (lệch) và một alias không có `_abi`.
|
|
# Registry phải từ chối cả hai, log lỗi, không crash.
|
|
actions_stale_abi:
|
|
handlers:
|
|
- {name: stale, type: StaleAbiActionHandler}
|
|
actions_no_abi:
|
|
handlers:
|
|
- {name: ancient, type: NoAbiActionHandler}
|
|
|
|
# Bộ handler default, mỗi cái một namespace riêng để test nạp độc lập.
|
|
actions_wait:
|
|
handlers:
|
|
- {name: waiter, type: WaitActionHandler}
|
|
|
|
waiter:
|
|
action_types: [wait]
|
|
default_duration: 0.0 # [s] khi order không kèm tham số `duration`
|
|
max_duration: 5.0 # [s] trần cứng; vượt trần thì action THẤT BẠI, không bị cắt ngắn
|
|
|
|
actions_log:
|
|
handlers:
|
|
- {name: reporter, type: LogReportActionHandler}
|
|
|
|
reporter:
|
|
action_types: [logReport]
|
|
|
|
# Handler dò — lấy mẫu frame thô, lọc, ghi ra frame ổn định.
|
|
actions_detect:
|
|
handlers:
|
|
- {name: detect, type: FrameSamplerActionHandler}
|
|
|
|
detect:
|
|
action_types: [DetectCharger]
|
|
output_frame: dock_target
|
|
settle_delay: 0.2 # [s]
|
|
sample_window: 1.0 # [s] độ dài cửa sổ trượt
|
|
min_samples: 10 # số mẫu tối thiểu TRONG cửa sổ
|
|
max_spread_xy: 0.03 # [m]
|
|
max_spread_yaw: 0.05 # [rad]
|
|
timeout: 5.0 # [s] hết giờ mà chưa cửa sổ nào đạt -> kFailed
|
|
|
|
# hold_time > 0: cửa sổ phải giữ trạng thái đạt liên tục mới được chốt. Chặn cửa sổ tình cờ chụm
|
|
# giữa lúc dò đang dao động.
|
|
actions_detect_hold:
|
|
handlers:
|
|
- {name: detect, type: FrameSamplerActionHandler}
|
|
detect:
|
|
action_types: [DetectCharger]
|
|
output_frame: dock_target
|
|
settle_delay: 0.2 # [s]
|
|
sample_window: 1.0 # [s]
|
|
min_samples: 10
|
|
max_spread_xy: 0.03 # [m]
|
|
max_spread_yaw: 0.05 # [rad]
|
|
hold_time: 0.5 # [s]
|
|
timeout: 5.0 # [s]
|
|
|
|
# Lọc cụm chống TF nhảy: mẫu gom theo khoảng cách tới TÂM cụm, chỉ cụm quá bán còn tươi được chốt.
|
|
actions_detect_cluster:
|
|
handlers:
|
|
- {name: detect, type: FrameSamplerActionHandler}
|
|
detect:
|
|
action_types: [DetectCharger]
|
|
output_frame: dock_target
|
|
settle_delay: 0.2 # [s]
|
|
sample_window: 1.0 # [s]
|
|
min_samples: 10
|
|
max_spread_xy: 0.03 # [m]
|
|
max_spread_yaw: 0.05 # [rad]
|
|
timeout: 5.0 # [s]
|
|
jump_threshold: 0.15 # [m] > max_spread_xy; TF nhảy trong test là 0.55 m
|
|
cluster_recency: 0.3 # [s]
|
|
min_cluster_fraction: 0.6
|
|
min_cluster_samples: 5
|
|
|
|
# jump_threshold <= max_spread_xy: mẫu tốt trong tolerance bị xé cụm -> configure() phải từ chối.
|
|
actions_detect_cluster_bad_threshold:
|
|
handlers:
|
|
- {name: detect, type: FrameSamplerActionHandler}
|
|
detect:
|
|
action_types: [DetectCharger]
|
|
output_frame: dock_target
|
|
max_spread_xy: 0.03
|
|
jump_threshold: 0.02
|
|
|
|
# min_cluster_fraction phải > 0.5 — đúng 0.5 thì hai cụm 50/50 cùng đạt, mất tính duy nhất.
|
|
actions_detect_cluster_bad_fraction:
|
|
handlers:
|
|
- {name: detect, type: FrameSamplerActionHandler}
|
|
detect:
|
|
action_types: [DetectCharger]
|
|
output_frame: dock_target
|
|
jump_threshold: 0.15
|
|
min_cluster_fraction: 0.5
|
|
|
|
# Sàn cụm cao hơn min_samples: dữ liệu hoàn hảo cũng không bao giờ chốt được -> từ chối.
|
|
actions_detect_cluster_bad_floor:
|
|
handlers:
|
|
- {name: detect, type: FrameSamplerActionHandler}
|
|
detect:
|
|
action_types: [DetectCharger]
|
|
output_frame: dock_target
|
|
min_samples: 10
|
|
jump_threshold: 0.15
|
|
min_cluster_samples: 20
|
|
|
|
# Bỏ lọc có chủ đích: chốt ngay mẫu THỨ HAI, không cửa sổ, không độ tản.
|
|
actions_detect_unfiltered:
|
|
handlers:
|
|
- {name: detect, type: FrameSamplerActionHandler}
|
|
detect:
|
|
action_types: [DetectCharger]
|
|
output_frame: dock_target
|
|
filter_enabled: false
|
|
settle_delay: 0.2 # [s]
|
|
timeout: 5.0 # [s]
|
|
|
|
# output_frame trùng input_frame -> configure() phải từ chối.
|
|
actions_detect_same_frame:
|
|
handlers:
|
|
- {name: detect, type: FrameSamplerActionHandler}
|
|
detect:
|
|
action_types: [DetectCharger]
|
|
input_frame: charger_raw
|
|
output_frame: charger_raw
|
|
|
|
# timeout ngắn hơn settle_delay + sample_window -> action LUÔN hỏng, phải chặn lúc boot.
|
|
actions_detect_bad_timeout:
|
|
handlers:
|
|
- {name: detect, type: FrameSamplerActionHandler}
|
|
detect:
|
|
action_types: [DetectCharger]
|
|
output_frame: dock_target
|
|
settle_delay: 1.0
|
|
sample_window: 2.0
|
|
timeout: 1.0
|
|
|
|
# Bypass perception có chủ đích cho test sim: pose giả là offset trong base_link nhưng output vẫn
|
|
# phải là frame tĩnh trong map, nếu không đích sẽ chạy theo robot và docking không thể hoàn tất.
|
|
actions_detect_simulated:
|
|
handlers:
|
|
- {name: detect, type: FrameSamplerActionHandler}
|
|
detect:
|
|
action_types: [DetectPallet]
|
|
output_frame: dock_target
|
|
use_simulated_goal: true
|
|
simulated_parent_frame: base_link
|
|
simulated_offset_x: -1.5
|
|
simulated_offset_y: 0.2
|
|
simulated_offset_yaw: 0.0
|
|
|
|
NoopActionHandler:
|
|
library_path: libaction_core_noop_action_handler
|
|
StaleAbiActionHandler:
|
|
library_path: libaction_core_test_stale_abi_handler
|
|
NoAbiActionHandler:
|
|
library_path: libaction_core_test_stale_abi_handler
|
|
|
|
FrameSamplerActionHandler:
|
|
library_path: libaction_core_frame_sampler_action_handler
|
|
|
|
WaitActionHandler:
|
|
library_path: libaction_core_wait_action_handler
|
|
|
|
LogReportActionHandler:
|
|
library_path: libaction_core_log_report_action_handler
|