refactor: xoá PathMonitor và PathCheckPort, EnvMonitor là bộ giám sát duy nhất; gộp refreshSnapshot

Xoá hạ tầng giám sát cũ đã tắt từ 5/9 (path_monitor/enabled: false), −2947 dòng:
- ControlLoop: PathMonitorConfig, updatePathMonitor / updateProgressMonitor / applyCollisionGuard /
  planIsBlocked / resetPathMonitor / rebuildPlanArcLength, toàn bộ member bốn phép đo, luật "plan
  mới bẩn thì giữ plan cũ" trong collectPlannerResult. Bốn cổng StateMachineInput giữ nguyên
  (off_path không còn nguồn, đặt false).
- ports/path_check_port.h, CostmapPathCheck trong NavigationRuntime.
- plan_inspector: bỏ checkPlan / checkMotion / PlanBlockResult / MotionCheckParams /
  MotionBlockResult; giữ planarTransform, nearestIndex, trackedNearestIndex, crossTrackError.
- Config: readPathMonitor, MoveBase2Config::path_monitor, validate; xoá
  config/runtime/path_monitor_params.yaml; comment YAML/state_machine đổi sang tên verdict EnvMonitor.
- Test: FakePathCheckPort, 30 test WalkingSkeletonPathMonitor/CollisionGuard, 13 test
  PlanInspectorCheck/Motion, 2 test validate thân guard.

P0(b): ControlLoop::step() gọi EnvironmentPort::refresh() một lần đầu cycle (không phụ thuộc
env_monitor/enabled); ControllerRunner::setSnapshotRefreshedByLoop(true) làm ba refreshSnapshot()
trong runner thành no-op — monitor và controller đọc cùng một lưới, một bản copy mỗi cycle.

Test: env_monitor 43, grid_analysis 33, plan_inspector 11, walking_skeleton 57, config_validation 32,
scenario 12, state_machine 100, navigation_server 56, controller_runner 28, velocity_arbiter 29,
planner_runner 31 — pass.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017xXjFjr2DQ6rhmhHSW4fk4
This commit is contained in:
2026-09-06 10:55:15 +07:00
parent 62692838d6
commit c0a04b29ad
22 changed files with 85 additions and 3316 deletions

View File

@@ -1,7 +1,7 @@
# =================================================================================================
# env_monitor_params.yaml — EnvMonitor: giám sát môi trường quanh robot để gọi recovery (thay PathMonitor)
# Ngày lập: 2026-09-05 (Test/ENV_MONITOR_PLAN.md). Giai đoạn hiện tại: P4 BƯỚC 5 (6/9 10:35) — CẢ BA VERDICT BẬT THẬT
# (unreachable bật lại cùng target_snap); PathMonitor cũ TẮT HẲN (path_monitor/enabled: false), EnvMonitor là bộ giám sát duy nhất.
# (unreachable bật lại cùng target_snap); PathMonitor cũ ĐÃ XOÁ (P5, 6/9), EnvMonitor là bộ giám sát duy nhất.
# stall cổng dịch chuyển thực (disp_*) là định nghĩa "bế tắc thật"; geodesic là điều kiện thứ hai + để ghi.
# contact action recover + apply_command true: bao tốc độ, phanh chỉ khi vượt bao, cờ collision, đứng ra sau detour
# vô ích. Run 23:32: khe 1,25 m đi qua 0,5 m/s, 0 phanh, 0 ABORT (plan §4.12).
@@ -121,7 +121,7 @@ env_monitor:
enabled: true
action: recover # cờ collision (route collision). P4 bước 1: bật thật.
apply_command: true # true = phanh + bao tốc độ thật (P4). false = SHADOW: chỉ ghi "sẽ phanh/kẹp bao nhiêu", KHÔNG đụng lệnh.
# Khi true PHẢI tắt path_monitor/collision_enabled: hai chủ thể cùng phanh là deadlock 2/9 quay lại.
# Chủ thể phanh duy nhất trong move_base2 (guard cũ đã xoá); cổng dừng trong PRIEST vẫn phải để tắt.
# Phanh mà cờ collision đã giơ nhưng route khoá -> controller bị báo "không có lệnh" -> controller_patience
# -> controlling_failed (cùng luật guard cũ), robot không đứng chết im lặng.
use_local_plan: auto # auto = dùng quỹ đạo local planner khi qua kiểm hợp lệ (pose đầu cách robot <= local_plan_start_tol),
@@ -149,7 +149,7 @@ env_monitor:
min_speed: 0.05 # [m/s] bao tốc độ không kẹp thấp hơn đây; thấp hơn là dừng hẳn.
min_check_speed: 0.10 # [m/s] |v_cmd|, |v_đo| VÀ |v controller muốn| (trước bao/phanh) đều dưới đây mà chưa phanh = đang
# xoay tại chỗ / bò: KHÔNG phanh, KHÔNG cờ — góc thân quét vào ô kề bên khi xoay là việc của local
# planner (cùng vai path_monitor/collision_min_speed cũ). Tính cả "lệnh controller muốn" vì bao tốc
# planner (cùng vai collision_min_speed của guard cũ). Tính cả "lệnh controller muốn" vì bao tốc
# độ kẹp lệnh về 0 trong margin: nếu chỉ nhìn lệnh đã kẹp thì robot dừng câm không cờ. Shadow 5/9:
# 3 lần "braking to zero" ngay đầu chặng (v 0.00–0.07) là nổ oan kiểu này; mọi tiếp xúc thật đều ở
# v >= 0.25. HẠ xuống 0 = dò cả khi xoay -> robot đứng cạnh vật bị ghim rồi gọi detour từ đó (churn).