Files
mission_adapters/test/config/mission_adapters_params.yaml
duongtd ab0bed7248 feat(rotate): đọc angle_deg từ actionParameters, quy sang relative_yaw
- Mission: thêm relative_yaw [rad], NaN = không dùng, đi kèm được với
  relative_distance (khác cặp goal_frame/relative_distance vốn loại
  trừ nhau) — chặng quay tại chỗ là distance 0 + góc khác 0.

- Step: thêm turn_param (cùng vai trò move_to_param — bảng compound chỉ
  giữ cấu trúc, số đo tới từ actionParameters của order). Validate lúc
  boot: turn_param gắn vào profile khác rotate thì configure() từ chối.

- expandCompound(): parseTurnDegrees() đọc actionParameters theo
  turn_param, parse ĐỘ bằng std::stod (bắt hết ký tự đuôi rác kiểu
  "90abc"), validate biên [-180,180] — vượt biên thì TỪ CHỐI thay vì
  normalize âm thầm, vì goal là một pose chỉ diễn tả được hướng cuối,
  không diễn tả được chiều/số vòng quay. Quy sang rad, log cả hai đơn
  vị. Thiếu khoá/parse hỏng/ngoài biên đều bỏ CẢ message, đúng pattern
  move_to_param đã có.

- 7 test mới: chuyển đổi độ->rad, giữ dấu, thiếu tham số, tham số không
  phải số, vượt biên (cả hai đầu + đúng biên), compound khác không đụng
  relative_yaw, turn_param sai profile trượt lúc boot.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-11 10:46:31 +07:00

141 lines
5.1 KiB
YAML

# Config CHỈ dùng cho test của gói. Bản runtime nằm ở
# `pnkx_nav_core/config/mission_adapters_params.yaml` (C2) — sửa tham số vận hành thì sửa ở đó.
#
# Chạy test kèm: PNKX_NAV_CORE_CONFIG_DIR=src/AMR_T800/Test/mission_adapters/test/config
mission_adapters:
# Nguồn mission. Thêm loại mới chỉ cần thêm một entry ở đây + một plugin .so.
mission_sources:
- {name: goal_src, type: GoalSourceAdapter}
- {name: vda5050_src, type: VDA5050SourceAdapter}
- {name: instant_src, type: InstantActionSourceAdapter}
mission_timeout: 0.0 # [s] 0 = tắt
clear_queue_on_failure: false # false = chỉ bỏ chặng lỗi, giữ phần còn lại của order
# Bảng symbol -> thư viện cho Boost.DLL. Thiếu khoá library_path là nguyên nhân phổ biến nhất của
# lỗi "plugin build xong nhưng runtime báo không tìm thấy".
GoalSourceAdapter:
library_path: libmission_adapters_goal_source
VDA5050SourceAdapter:
library_path: libmission_adapters_vda5050_source
# Cùng .so, alias thứ hai. plugin_registry_test khoá đúng điểm này: hai symbol khác nhau trong một
# thư viện phải nạp được thành hai adapter với hai schema khác nhau.
InstantActionSourceAdapter:
library_path: libmission_adapters_vda5050_source
# ── Các case lỗi mà plugin_registry_test cố ý dựng ra ────────────────────────────────────────────
#
# Mỗi case là một namespace riêng để test gọi loadFromConfig(nh, "<namespace>") mà không phải sinh
# file YAML lúc chạy.
registry_test_missing_library_path:
mission_sources:
- {name: bad_src, type: MissingLibraryPathAdapter}
registry_test_missing_library_file:
mission_sources:
- {name: bad_src, type: MissingLibraryFileAdapter}
registry_test_wrong_symbol:
mission_sources:
- {name: bad_src, type: WrongSymbolAdapter}
registry_test_duplicate_schema:
mission_sources:
- {name: goal_a, type: GoalSourceAdapter}
- {name: goal_b, type: GoalSourceAdapter}
registry_test_entry_without_type:
mission_sources:
- {name: nameless_src}
registry_test_empty:
mission_timeout: 0.0
# Khai trong mission_sources nhưng KHÔNG có khoá library_path.
MissingLibraryPathAdapter:
description: "cố ý thiếu library_path"
# library_path trỏ tới file không tồn tại.
MissingLibraryFileAdapter:
library_path: libmission_adapters_does_not_exist
# Thư viện có thật nhưng symbol không tồn tại trong đó.
WrongSymbolAdapter:
library_path: libmission_adapters_goal_source
# ── Compound action: action "phải dò rồi mới biết đích" ─────────────────────────────────────────
#
# Bảng chỉ giữ CẤU TRÚC; frame cụ thể tới từ actionParameters của chính order.
vda5050_src:
global_frame: map
compound_actions:
charge:
steps:
- {action: DetectCharger}
- {move_to_param: goal_frame, profile: docking, marker: charger}
- {action: startCharging}
UnDockFromStation:
steps:
- {move: -1.0, profile: go_straight}
FixedDock:
steps:
- {move_to: dock_target, profile: docking, marker: trolley}
# Quay tại chỗ: không tịnh tiến, góc [deg] lấy từ actionParameters['angle_deg'] của order.
rotate:
steps:
- {move: 0.0, profile: rotate, turn_param: angle_deg}
# turn_param gắn vào profile không phải rotate -> configure() phải từ chối lúc boot.
vda5050_bad_turn_param:
compound_actions:
Spin:
steps:
- {move: 1.0, profile: go_straight, turn_param: angle_deg}
# Step có hai từ khoá -> configure() phải từ chối lúc boot.
vda5050_bad_step:
compound_actions:
charge:
steps:
- {action: DetectCharger, move: -1.0}
# Compound sinh ra một actionType cũng là compound -> đệ quy.
vda5050_recursive:
compound_actions:
charge:
steps:
- {action: PickUp}
PickUp:
steps:
- {move: 0.5}
# Profile chỉ có nghĩa trên step navigation và phải thuộc bốn profile runtime.
vda5050_bad_profile:
compound_actions:
invalid_name:
steps:
- {move: 0.5, profile: dock}
# ── instant_src ───────────────────────────────────────────────────────────────────────────────────
#
# CỐ Ý không khai `compound_actions` ở đây: adapter phải đọc bảng của `vda5050_src`. Khai bảng thứ
# hai là đúng cái bệnh hai-bản-lệch-nhau mà việc dùng chung sinh ra để tránh.
instant_src:
compound_actions_from: vda5050_src
# Trỏ tới một nguồn không khai bảng nào: hợp lệ, adapter chạy không có compound action nào.
instant_src_no_table:
compound_actions_from: registry_test_empty
# compound_actions_from rỗng -> configure() phải trượt ngay lúc boot.
instant_src_empty_source:
compound_actions_from: ""