feat: gate the move_base2 diagnostic logs behind config switches

Seven [move_base2][debug] lines printed unconditionally on every cycle. On a
robot running a full shift that is noise: they describe the normal path, and
constant noise buries the one line that is actually abnormal.

Three switches, grouped by what they answer, all defaulting to on so turning
them off is a deliberate act rather than something that changes behind whoever
is relying on the log:

  debug/state  state machine transitions, printed on change, not per cycle
  debug/plan   controller accepting or rejecting a plan, recovery paths
  debug/skip   why the controller was skipped while CONTROLLING

The abort-detail line stays unconditional and loses its [debug] tag. It is the
reason a mission failed and prints once per abort; a config that can silence it
is a config in which the robot fails silently.

The read path runs YAML debug/{state,plan,skip} into MoveBase2Config, which
carries it to ControlLoopConfig. describe() prints the resulting state at boot
so nobody has to guess why a log went quiet.

Nothing computes differently: stripping every log statement from the old and
new control_loop.cpp leaves a three-line difference, and all three are comments.
The gated arguments are pure reads.
This commit is contained in:
2026-08-27 13:21:58 +07:00
parent bb030d9ff7
commit d0c8a0bcdc
5 changed files with 144 additions and 47 deletions

View File

@@ -303,3 +303,27 @@ mission_layer_enabled: true
# 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".
MoveBase:
library_path: libmove_base2
# --- Công tắc log chẩn đoán ----------------------------------------------------------------------
#
# Ba nhóm dưới đây gom toàn bộ dòng `[move_base2][debug]`. Trước đây chúng in VÔ ĐIỀU KIỆN, không
# có cách nào tắt — trên robot chạy cả ca thì phần lớn là tiếng ồn, và tiếng ồn thường trực làm
# dòng thật sự bất thường trôi mất giữa hàng nghìn dòng giống hệt nhau.
#
# ► Mặc định BẬT cả ba. Tắt là lựa chọn có ý thức, không phải thứ đổi sau lưng người đang dựa vào
# log để debug.
debug:
# Chuyển trạng thái của state machine: `state -> CONTROLLING: valid plan available (...)`.
# ► Chỉ in khi ĐỔI trạng thái, không phải mỗi chu kỳ — rẻ, và thường là dòng đáng giữ nhất vì nó
# nói TẠI SAO đổi cùng trạng thái của từng runner lúc đó. Giữ bật trừ khi thật sự cần log sạch.
state: true
# Controller nhận/từ chối plan, và path do recovery sinh ra.
# ► Một dòng mỗi lần lập plan. Tắt khi chạy mission dài và không quan tâm tuyến đi.
plan: true
# Vì sao controller bị bỏ qua trong lúc CONTROLLING: thiếu pose, costmap quá hạn, hoặc controller
# không trả về lệnh hợp lệ.
# ► Nhóm ỒN NHẤT — có thể in mỗi chu kỳ khi có gì đó sai kéo dài. Nhưng cũng chính là nhóm trả
# lời câu "robot đứng im mà không tầng nào báo lỗi", nên ĐỪNG tắt khi đang truy lỗi.
skip: true