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:
@@ -99,6 +99,32 @@ struct MoveBase2Config
|
||||
*/
|
||||
double sensor_store_report_period = 0.0;
|
||||
|
||||
// --- 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 là tiếng ồn: chúng mô tả đường đi BÌNH THƯỜNG, 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, để bật/tắt là lựa chọn có ý thức chứ không phải thứ đổi sau lưng người
|
||||
// đang dựa vào log để debug. Tắt bớt khi đã hiểu hệ thống và cần log sạch.
|
||||
|
||||
/// Chuyển trạng thái của state machine (`state -> CONTROLLING: ...`).
|
||||
///
|
||||
/// In khi ĐỔI trạng thái, không phải mỗi chu kỳ — nên nó rẻ và thường là dòng đáng giữ nhất:
|
||||
/// nó nói tại sao đổi, và trạng thái của từng runner lúc đó.
|
||||
bool debug_state = true;
|
||||
|
||||
/// Nhận/từ chối plan, và path do recovery sinh ra.
|
||||
///
|
||||
/// Một dòng cho mỗi lần lập plan. Tắt khi chạy mission dài và không quan tâm tuyến đi.
|
||||
bool debug_plan = true;
|
||||
|
||||
/// Vì sao controller bị bỏ qua trong lúc CONTROLLING (thiếu pose, costmap cũ, không có lệnh hợp lệ).
|
||||
///
|
||||
/// Nhóm ồn nhất trong ba nhóm — nó 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 ai báo lỗi", nên đừng tắt khi đang truy lỗi.
|
||||
bool debug_skip = true;
|
||||
|
||||
// --- Ánh xạ profile -> planner ----------------------------------------------------------------
|
||||
|
||||
ProfileBinding position;
|
||||
|
||||
@@ -95,6 +95,11 @@ struct ControlLoopConfig
|
||||
/// [s] Chu kỳ danh nghĩa, chỉ dùng cho dt của cycle ĐẦU TIÊN khi chưa có mốc thời gian trước đó.
|
||||
double nominal_control_period = 0.05;
|
||||
|
||||
/// Công tắc log chẩn đoán. Xem `MoveBase2Config::debug_*` để biết từng nhóm in cái gì.
|
||||
bool debug_state = true;
|
||||
bool debug_plan = true;
|
||||
bool debug_skip = true;
|
||||
|
||||
/// Frame gắn với thân robot. Lệnh vận tốc phát ra được đóng dấu bằng frame này — cmd_vel là vận
|
||||
/// tốc trong hệ thân xe, không phải hệ bản đồ hay odom.
|
||||
std::string robot_base_frame = "base_link";
|
||||
|
||||
Reference in New Issue
Block a user