feat: priest fallback, evade recovery and env_monitor_core detectors

Submodules:
- priest_mpcc_local_planner 56bcf84 -> 91e3303: crawl replaced by a
  PRIEST fallback (body-clearance speed envelope, K3 candidate choice),
  continuous escalation instead of alternating zero commands
- recovery_core 0726abb -> 001489c: EvadeRecovery plugin
- move_base2 605dbc8 -> ab9ed67: EnvMonitor hosted from env_monitor_core
  with per-detector routes, recovery resume during detour_path
- new submodule env_monitor_core 92b9bcc (detector plugins contact,
  stall, unreachable, intrusion); CMakeLists adds it before move_base2

Config (new keys at T800 values, docs in doc/config_guide):
- priest_fallback_*, debug/priest_fallback; crawl_* and debug/crawl removed
- recovery_resume_*; env_monitor detectors, intrusion, routes; evade
  behavior, its params and the intrusion route

Robot tuning:
- mpcc_blocked_timeout 0.02, mpcc_priest_wait_timeout 0,
  mpcc_priest_wait_static_time 0
- env_monitor contact apply_command false, stall idle_window_s 15,
  intrusion on /f_scan only (rear lidar silent), max_scan_age 0.5
- routes controlling_failed, path_blocked, collision start with evade
This commit is contained in:
2026-11-27 22:32:36 +07:00
parent 82e2b53d1f
commit 2d978a8eb5
14 changed files with 302 additions and 84 deletions

View File

@@ -2,6 +2,11 @@
env_monitor:
enabled: true # [bool] bật EnvMonitor
profiles: [position] # [-] danh sách profile được giám sát
detectors:
- {name: intrusion, type: IntrusionDetector} # detector vật mới sát thân
- {name: contact, type: ContactDetector} # detector tiếp xúc
- {name: stall, type: StallDetector} # detector kẹt
- {name: unreachable, type: UnreachableDetector} # detector mất liên thông
check_period: 0.2 # [s] chu kỳ tính EnvMonitor
grace_after_new_plan: 1.0 # [s] thời gian bỏ qua sau plan mới
pose_jump_reject: 0.5 # [m] ngưỡng phát hiện pose nhảy
@@ -25,6 +30,9 @@ env_monitor:
track_ahead: 3.0 # [m] khoảng tìm index plan về phía trước
stall:
route: oscillation # [-] route recovery của detector
route_mode: step # [-] mỗi lần kích hoạt chạy một behavior kế tiếp
on_exhausted: abort # [-] cách xử lý khi hết route
enabled: true # [bool] bật phát hiện stall
action: recover # [-] hành động khi stall
window_s: 4.0 # [s] cửa sổ đo eff_geo = (cost_to_go giảm) / (lệnh tích luỹ)
@@ -41,7 +49,7 @@ env_monitor:
disp_window_s: 12.0 # [s] cửa sổ đo dịch chuyển
disp_min: 0.6 # [m] dịch chuyển thực dưới đây = không đi được đâu
disp_min_commanded: 1.5 # [m] lệnh tối thiểu để xét dịch chuyển
idle_window_s: 25.0 # [s] cửa sổ phát hiện đứng yên
idle_window_s: 15.0 # [s] cửa sổ phát hiện đứng yên
confine_window_s: 20.0 # [s] cửa sổ xét giam vùng
confine_radius: 1.2 # [m] vùng lớn hơn đây không gọi là giam
confine_cmd_factor: 1.5 # [-] lệnh phải gấp chừng này lần đường kính vùng
@@ -49,16 +57,42 @@ env_monitor:
retry_backoff: 3.0 # [s] sau một lượt recovery HỎNG không tích bằng chứng (thay cho behavior wait)
unreachable:
route: path_blocked # [-] route recovery của detector
route_mode: step # [-] mỗi lần kích hoạt chạy một behavior kế tiếp
on_exhausted: lock # [-] cách xử lý khi hết route
enabled: true # [bool] bật phát hiện unreachable
action: recover # [-] hành động khi unreachable
static_on: 1.5 # [s] thời gian mất liên thông để kích hoạt
clean_start_margin: 0.20 # [m] thân còn cách vật ít nhất chừng này mới gọi replan (SBPL cần chỗ bắt đầu)
retry_backoff: 2.0 # [s] thời gian nghỉ sau recovery hỏng
intrusion:
route: intrusion # [-] route recovery khi phát hiện xâm nhập
route_mode: step # [-] mỗi lần phát hiện chạy một behavior kế tiếp
on_exhausted: lock # [-] khóa detector khi hết route
enabled: true # [bool] bật phát hiện vật mới sát thân
action: recover # [-] recover gọi route; log chỉ ghi sự kiện
topics: [/f_scan] # [-] LaserScan dùng để so sánh theo từng cảm biến
zone_distance: 0.10 # [m] khoảng cách tính từ mép footprint; tăng làm phát hiện sớm hơn
compare_age: 0.3 # [s] tuổi tối thiểu của scan tham chiếu; phải nhỏ hơn history_max_age
free_margin: 0.05 # [m] khoảng tia cũ đi xuyên qua điểm mới; tăng giúp giảm nhiễu
min_points: 3 # [điểm] số điểm mới tối thiểu mỗi scan; tăng giảm nhạy
confirm_scans: 2 # [scan] số scan liên tiếp xác nhận; tăng giảm báo nhầm
history_max_age: 1.0 # [s] thời gian giữ lịch sử; phải lớn hơn compare_age
max_scan_age: 0.5 # [s] tuổi scan tối đa; scan cũ bị bỏ
max_check_speed: 0.15 # [m/s] tốc độ dịch chuyển tối đa khi so scan; tăng dễ báo nhầm
max_check_yaw_rate: 0.3 # [rad/s] tốc độ quay tối đa khi so scan; tăng dễ báo nhầm
max_tf_gap: 0.1 # [s] sai lệch thời gian TF mới nhất được chấp nhận; quá thì bỏ scan
debug:
events: true # [bool] bật log sự kiện phát hiện xâm nhập
contact:
route: collision # [-] route recovery của detector
route_mode: step # [-] mỗi lần kích hoạt chạy một behavior kế tiếp
on_exhausted: lock # [-] cách xử lý khi hết route
enabled: true # [bool] bật giám sát tiếp xúc
action: recover # [-] hành động khi contact
apply_command: true # [bool] true = phanh + bao tốc độ thật (P4)
apply_command: false # [bool] true = phanh + bao tốc độ thật (P4)
use_local_plan: auto # [-] chế độ dùng quỹ đạo local planner
local_plan_start_tol: 0.15 # [m] độ lệch pose đầu local plan tối đa
lookahead: 1.5 # [m] quãng quỹ đạo cần dò
@@ -85,3 +119,15 @@ env_monitor:
enabled: false # [bool] bật ghi log replay JSONL
log_dir: /tmp/env_monitor # [-] thư mục ghi JSONL
flush_period: 1.0 # [s] chu kỳ flush log JSONL
ContactDetector:
library_path: libenv_monitor_core_contact_detector # [-] thư viện plugin ContactDetector
IntrusionDetector:
library_path: libenv_monitor_core_intrusion_detector # [-] thư viện plugin IntrusionDetector
StallDetector:
library_path: libenv_monitor_core_stall_detector # [-] thư viện plugin StallDetector
UnreachableDetector:
library_path: libenv_monitor_core_unreachable_detector # [-] thư viện plugin UnreachableDetector

View File

@@ -49,6 +49,11 @@ mission_namespace: mission_adapters # [-] namespace mission layer
global_frame: map # [frame] frame goal của navigation
require_current_costmap: true # [bool] chặn controller khi costmap stale
recovery_behavior_enabled: true # [bool] Bật/tắt toàn bộ recovery
recovery_resume_enabled: true # [bool] thử tiếp tục khi recovery được phép đang đứng yên
recovery_resume_behaviors: [detour_path] # [-] chỉ thử các behavior đứng yên trong danh sách
recovery_resume_confirm_cycles: 3 # [chu kỳ] số lệnh hợp lệ liên tiếp trước khi tiếp tục
recovery_resume_min_speed: 0.05 # [m/s] độ lớn tốc độ lệnh thử tối thiểu
recovery_resume_max_per_leg: 3 # [lần/chặng] số lần tiếp tục tối đa; 0 là không tiếp tục
MoveBase:
library_path: libmove_base2 # [-] thư viện plugin move_base2

View File

@@ -82,12 +82,12 @@ PriestMpccLocalPlanner:
reference_hold_time: 1.0 # [s] (mpcc) thời gian cam kết với quỹ đạo vừa nhận khi nó còn qua cổng
global_max_offset: 0.5 # [m] độ lệch global path để chuyển tham chiếu
gate_hysteresis: 0.03 # [m] độ trễ hysteresis của cổng tham chiếu
gate_body_clearance: true # [bool] cổng tham chiếu và kiểm tham chiếu bò đo thân tới tâm ô như PRIEST
gate_body_clearance: true # [bool] cổng tham chiếu đo thân tới tâm ô như PRIEST
gate_body_tolerance: 0.01 # [m] tham chiếu mới được thấp hơn r_o của PRIEST chừng này
gate_partial_min_ahead: 0.6 # [m] khoảng chờ trước điểm chặn xa
mpcc_blocked_timeout: 2.0 # [s] thời gian chờ MPCC bị chặn
mpcc_priest_wait_timeout: 5.0 # [s] thời gian chờ khi PRIEST còn quỹ đạo
mpcc_priest_wait_static_time: 3.0 # [s] thời gian chờ vật cản tĩnh
mpcc_blocked_timeout: 0.02 # [s] thời gian chờ MPCC bị chặn
mpcc_priest_wait_timeout: 0.0 # [s] thời gian chờ khi PRIEST còn quỹ đạo
mpcc_priest_wait_static_time: 0.0 # [s] thời gian chờ vật cản tĩnh
turn_min_clearance: 0.02 # [m] khoảng hở tối thiểu khi quay chậm
turn_slow_yawrate: 0.3 # [rad/s] (mpcc, F1) trần tốc độ quay khi quay sát vật
narrow_min_clearance: 0.02 # [m] sàn khoảng hở rollout trong khe hẹp
@@ -95,22 +95,13 @@ PriestMpccLocalPlanner:
contact_escape_depth: 0.03 # [m] độ lấn tối đa khi thoát tiếp xúc
contact_escape_time: 1.5 # [s] thời gian tối đa để thoát tiếp xúc
priest_candidates: 4 # [quỹ đạo] số ứng viên PRIEST dự phòng
crawl_enabled: true # [bool] cho phép bò theo quỹ đạo PRIEST khi MPCC không có lệnh
crawl_speed: 0.12 # [m/s] trần tốc độ bò
crawl_entry_cycles: 2 # [chu kỳ] số lần MPCC không có lệnh trước khi bò
crawl_progress_speed: 0.06 # [m/s] tốc độ tối thiểu để MPCC được tính là tiến
crawl_entry_window: 1.0 # [s] khoảng tối đa giữa hai lần MPCC không có lệnh
crawl_exit_cycles: 3 # [chu kỳ] số lần MPCC tiến liên tiếp trước khi trả quyền
crawl_margin: 0.02 # [m] khoảng hở tối thiểu của thân dọc quỹ đạo bò
crawl_check_length: 1.5 # [m] chiều dài đầu quỹ đạo phải kiểm
crawl_stop_margin: 0.01 # [m] khoảng hở tối thiểu khi dự đoán dừng
crawl_stop_horizon: 0.3 # [s] thời gian giữ lệnh trong dự đoán trước khi phanh
crawl_max_distance: 2.0 # [m] quãng đường tối đa mỗi lượt bò
crawl_max_time: 20.0 # [s] thời gian tối đa mỗi lượt bò
priest_fallback_enabled: true # [bool] MPCC hết lệnh thì cho phép chạy PRIEST có bao tốc độ
priest_fallback_min_clearance: 0.015 # [m] khoảng hở thân tối thiểu; giảm cho phép đi sát hơn
priest_fallback_check_length: 1.5 # [m] chiều dài quỹ đạo PRIEST cần kiểm phía trước
debug: true # [bool] bật log hybrid
debug:
crawl: true # [bool] log khi bắt đầu/kết thúc bò
priest_fallback: true # [bool] bật log trạng thái fallback PRIEST
debug_level: 2 # [-] mức log chẩn đoán
debug_solve: true # [bool] bật log solver
debug_obstacles: true # [bool] bật log vật cản

View File

@@ -6,14 +6,16 @@ recovery:
- {name: detour_path, type: DetourPathRecovery} # instance và symbol
- {name: rotate, type: RotateRecovery} # instance và symbol
- {name: back_up, type: BackUpRecovery} # instance và symbol
- {name: evade, type: EvadeRecovery} # instance và symbol
routes:
planning_failed: [wait, clear] # chuỗi recovery khi lập đường thất bại
controlling_failed: [clear, detour_path] # chuỗi recovery khi controller không ra lệnh
oscillation: [detour_path] # chuỗi recovery khi phát hiện dao động
path_blocked: [detour_path] # chuỗi recovery khi đường bị chặn
off_path: [detour_path] # chuỗi recovery cho sự kiện lệch đường
collision: [detour_path] # chuỗi recovery khi phát hiện va chạm
planning_failed: [wait, clear] # chuỗi recovery khi lập đường thất bại
controlling_failed: [evade, detour_path] # chuỗi recovery khi controller không ra lệnh
oscillation: [detour_path] # chuỗi recovery khi phát hiện dao động
path_blocked: [evade, detour_path] # chuỗi recovery khi đường bị chặn
off_path: [detour_path] # chuỗi recovery cho sự kiện lệch đường
collision: [evade, detour_path] # chuỗi recovery khi phát hiện va chạm
intrusion: [evade, evade, evade] # chuỗi né khi vật mới xâm nhập sát thân
wait:
wait_duration: 3.0 # [s] thời gian đứng yên
@@ -49,6 +51,24 @@ recovery:
acc_lim_x: 0.3 # [m/s^2] ramp gia tốc
timeout: 15.0 # [s] thời hạn tối đa
evade:
scan_topics: [/f_scan, /b_scan] # [-] LaserScan để kiểm vật cản; thiếu scan thì không né mù
max_scan_age: 0.5 # [s] tuổi scan tối đa; dữ liệu cũ bị từ chối
max_tf_gap: 0.2 # [s] sai lệch tối đa giữa TF mới nhất và thời điểm scan
view_loss_timeout: 1.0 # [s] thời gian dừng chờ dữ liệu mới; phải nhỏ hơn timeout
backup_distance: 0.20 # [m] quãng lùi; tăng cần khoảng trống phía sau dài hơn
backup_speed: 0.15 # [m/s] độ lớn tốc độ lùi; tăng kéo dài quãng phanh
rotate_speed: 0.5 # [rad/s] độ lớn tốc độ quay né
acc_lim_x: 0.3 # [m/s^2] giới hạn gia tốc khi lùi
acc_lim_theta: 0.8 # [rad/s^2] giới hạn gia tốc khi quay
heading_step_deg: 10.0 # [deg] bước lấy mẫu hướng trống; giảm làm chọn hướng mịn hơn
motion_margin: 0.05 # [m] biên an toàn theo chiều chuyển động; tăng cần chỗ rộng hơn
min_free_distance: 0.30 # [m] quãng trống tối thiểu; không lớn hơn max_probe_distance
max_probe_distance: 1.0 # [m] chiều dài tối đa dò hướng trống
timeout: 15.0 # [s] thời hạn tối đa của behavior
debug:
decision: true # [bool] bật log lựa chọn động tác né
WaitRecovery:
library_path: librecovery_core_wait_recovery # thư viện chứa plugin
@@ -61,6 +81,9 @@ RotateRecovery:
BackUpRecovery:
library_path: librecovery_core_back_up_recovery # thư viện chứa plugin
EvadeRecovery:
library_path: librecovery_core_evade_recovery # [-] thư viện plugin EvadeRecovery
DetourPathRecovery:
library_path: libsbpl_recovery # thư viện chứa plugin