feat: bring the move_base2 cancel/pause/resume lifecycle fix onto new-1.0

Bumps 7 submodule pointers to the same fix already on T800_ws (branch
dev_recovery_and_manager_mission there, this repo is on new-1.0 — the two
branches share no common history, so this is a submodule pull + a manual
reapply of two new headers, not a merge or cherry-pick):

  sbpl                 ca1ba36 -> bd89924  (SBPLPlanner abort flag)
  sbpl_lattice_planner 9c1667e -> 7456e99  (Preemptable + shared search budget)
  recovery_core        c03d16f -> 254c7fc  (onCancelRequested + ABI guard)
  sbpl_recovery        8f9326b -> ea79686  (detour search on a worker thread)
  action_core          a6bc3df -> 669c3f7  (pause/resume + kCancelled + ABI guard)
  dock_pattern_action  302dd11 -> cc1ea74  (pause/resume)
  move_base2           7d00c5a -> 8bc4895  (the lifecycle contract itself)

pnkx_nav_core's own two new in-tree headers (robot_nav_core::Preemptable,
move_base_core::component_status_probe.h) are added here by hand, same
content as T800_ws commit 2b0993b — required for sbpl_lattice_planner and
move_base2 (now pulled above) to even compile; not a cherry-pick since
new-1.0 and dev_recovery_and_manager_mission have no common ancestor.

config/runtime/move_base_common_params.yaml: added the new keys only, every
existing value (planner_patience 2.0, max_planning_retries 0, twist
semantics, recovery_behavior_enabled false, ...) is untouched.
settle_timeout: 2.0 and the two stopped_measured_*_eps keys are on, same as
the dev tree — this is the correctness fix itself (cancel/pause now wait
for real quiescence instead of reporting done while a component is still
unwinding), and it changes report timing only, not any commanded velocity.
The watchdog block is added but left OFF (watchdog_period: 0.0, dev tree
has 0.1) — allocated_time: 10.0 in this tree's own sbpl_global_params.yaml
means a legitimate long search could trip a naive planner_timeout as a
false "hung"; leaving a brand-new diagnostic capability off until it's
calibrated against real search/recovery/action timing on this robot matches
the policy for new features in this config tree.

Not brought over (flagged for a separate decision, see chat):
nav_c_api_2.h/.cpp changes from T800_ws commit 2b0993b — this repo has no
config/move_base_common_params.yaml at the top level (only config/runtime/),
so it may not run the standalone c_api tree at all; and the two branches'
disjoint history makes a blind reapply of an EXISTING file's diff riskier
than the two brand-new headers above. Needs a decision, not a mechanical
pull.

Not pushed to origin/new-1.0 — local commit only, pending confirmation.
This commit is contained in:
2026-09-12 22:20:57 +07:00
parent 418686ff29
commit 9095e58dec
10 changed files with 165 additions and 7 deletions

View File

@@ -142,6 +142,28 @@ oscillation_distance: 0.5
# Phải <= oscillation_distance, không thì runtime từ chối config.
recovery_reset_min_travel: 0.10
# [s] Trần chờ ở CANCELLING và PAUSING cho tới khi runtime IM HẲN rồi mới báo CANCELLED/PREEMPTED
# hoặc PAUSED ra host (trong lúc PAUSING host vẫn thấy tên state cũ + feed_back_str "pausing…").
# "Im hẳn" = ba điều kiện cùng đúng: (1) lệnh vận tốc = 0 VÀ odom đọc ≈ 0 (xem hai khoá dưới),
# (2) thread global planner rảnh và recovery đã dừng — kể cả lượt makePlan đã bị huỷ mà plugin không cắt được (SBPL
# hiện chạy tới hết `allocated_time`), (3) action đang chạy đã trả terminal. Host đọc PREEMPTED là
# "xong rồi, gửi goal kế được" — báo sớm thì goal kế bị `startPlan()` từ chối vì thread còn bận.
# ► Chỉnh: mặc định 2.0. TĂNG (5–10) nếu SBPL `allocated_time` lớn và chưa có preempt (pha 2) — quá
# trần vẫn CANCELLED nhưng runtime in LỖI "cancel settle timeout", không tắt được. 0 = TẮT: kết
# thúc ngay khi lệnh = 0 như trước 11/9/2026 (host dễ gửi goal kế lúc planner còn bận).
settle_timeout: 2.0
# [m/s] Ngưỡng coi robot ĐÃ DỪNG theo vận tốc ĐO ĐƯỢC (odom), dùng cho điều kiện (1) ở trên.
# Lệnh về 0 không có nghĩa bánh xe đã đứng — driver còn giảm tốc; PREEMPTED báo lúc đó là báo cho
# một robot đang trượt. Chỉ có tác dụng khi host đẩy odom vào (`addOdometry`); không có odom thì
# tự lùi về đo bằng lệnh đã phát.
# ► Chỉnh: TĂNG (0.05) nếu odom nhiễu giữ CANCELLING tới tận `settle_timeout` dù robot đã
# đứng (xem log lỗi settle timeout với robot_stopped=no). 0 = bỏ odom, chỉ nhìn lệnh.
stopped_measured_linear_eps: 0.02
# [rad/s] Như trên cho trục quay.
stopped_measured_angular_eps: 0.02
# =================================================================================================
# Giới hạn vận tốc — hàng rào CUỐI trước khi Twist rời runtime (VelocityArbiter)
#
@@ -233,6 +255,47 @@ recovery_behavior_enabled: false
MoveBase:
library_path: libmove_base2
# =================================================================================================
# Watchdog thành phần (2026-09-11) — thread riêng đọc bảng trạng thái, kết luận "TREO"
#
# Mỗi thành phần (global planner, local planner, recovery, action, control loop) tự khai nó đang
# bận/dừng/rảnh và "nhích" mỗi nhịp. Watchdog chạy trên thread riêng — control thread treo thì
# không tự phát hiện được chính nó — và kết luận treo khi một hàng BẬN mà KHÔNG NHÍCH quá ngân sách.
# Treo → in LỖI một lần (không tắt được); control loop treo → host đọc navigation_state = LOST và
# phải tự đưa cmd_vel về 0. Đây là chẩn đoán, không phải điều khiển: state machine không đổi gì.
#
# ► Đang để TẮT trên bản robot thật (khác cây dev): watchdog vừa nạp (chưa chạy thử trên hiện
# trường), và `sbpl_global_params.yaml: allocated_time: 10.0` ở đây trùng cây dev — một lượt SBPL
# hợp lệ (goal xa) có thể chạm gần trần đó, nên bật ngay dễ báo TREO oan cho một lượt chỉ đang
# chậm. Bật (đặt lại `watchdog_period` > 0) sau khi đo thời gian lập plan/recovery/action thật
# trên robot và canh `planner_timeout` theo số đo đó (xem ► Chỉnh ngay dưới).
# =================================================================================================
# [s] Chu kỳ kiểm của watchdog. 0 = TẮT watchdog (không có thread, không phát hiện treo).
watchdog_period: 0.0
# [s] Trần MỘT lượt makePlan trên thread planner trước khi kết luận global planner TREO. Từ 11/9/2026
# khoá này mới có tác dụng (trước đó đọc mà không dùng). PHẢI LỚN HƠN thời gian một lượt hợp lệ dài
# nhất: với SBPL là `allocated_time` trong sbpl_global_params.yaml (đã là trần chung cho cả 3 lượt
# replan nội bộ). ► Chỉnh: đặt ≈ allocated_time + 1. 0 = không giám sát hàng này.
planner_timeout: 15.0
# [s] Trần MỘT lời gọi computeVelocityCommands của local planner. Priest 30–48 ms, Hybrid < 10 ms;
# 0.5 s là "chắc chắn có gì đó hỏng" chứ không phải chậm. 0 = không giám sát.
local_planner_call_budget: 0.5
# [s] Recovery behavior bận mà không nhích (không tick, worker detour không về) quá đây = treo.
recovery_stall_budget: 5.0
# [s] Action handler bận mà không nhích quá đây = treo. 0 = TẮT (mặc định): handler tự timeout
# theo thiết bị của nó (tầng 1), `action_patience` là tầng 2 — không cần tầng thứ ba.
action_stall_budget: 0.0
# [s] Control thread không kết thúc được một cycle nào trong quãng này = TREO → host thấy LOST.
# 0.5 s = 15 cycle @ 30 Hz. GIẢM (0.2) nếu host cần phản ứng nhanh hơn; không đặt < 3 cycle vì
# một lượt detour/solve dài hợp lệ sẽ bị báo nhầm.
control_loop_stall_budget: 0.5
# --- Công tắc log chẩn đoán --------------------------------------------------------------------
#
# Mọi dòng `[move_base2][debug]` trước đây in VÔ ĐIỀU KIỆN. Trên robot chạy cả ca, phần lớn chúng