From bb030d9ff763c2bdd6a06ed335549854f4bd5665 Mon Sep 17 00:00:00 2001 From: duongtd Date: Thu, 27 Aug 2026 12:15:44 +0700 Subject: [PATCH] Remove the temporary cmd_vel diagnostic It was added to find why the robot stood still while every layer reported normal, and it answered that: the host drops a command whose stamp is older than its freshness window, and publishCommand freezes that stamp whenever no request is active. With the answer in hand the line is pure cost - it printed every control cycle at 20 Hz, and at idle every one of those lines says the same expected thing. --- src/navigation_server.cpp | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/navigation_server.cpp b/src/navigation_server.cpp index 87615e4..edef143 100644 --- a/src/navigation_server.cpp +++ b/src/navigation_server.cpp @@ -260,29 +260,6 @@ void NavigationServer::publishCommand() twist_.header.stamp = cycle_time; } - // TẠM THỜI — chẩn đoán "robot đứng im mà mọi lớp đều báo bình thường". - // - // Host loại lệnh có stamp cũ hơn 0.05 s (amr_publiser.cpp:361), và stamp chỉ được đóng khi - // `commanding`. Nếu `commanding` tắt trong lúc state machine vẫn ở CONTROLLING thì stamp đóng - // băng, host ngừng phát /cmd_vel, còn controller vẫn cần mẫn tính lệnh cho không ai nghe — và - // không tầng nào báo lỗi, vì controller vẫn trả về lệnh HỢP LỆ. - // - // In MỖI CHU KỲ, không throttle: `log_*_throttle` giữ trạng thái bằng static local nên nhiều - // điểm gọi giẫm lên nhau, đúng thứ đang cần đọc thì lại bị nuốt. - // - // ► GỠ DÒNG NÀY sau khi truy xong. Ở 20 Hz nó sinh 72000 dòng mỗi giờ. - { - const robot::Time host_now = robot::Time::now(); - const double stamp_age = (host_now - twist_.header.stamp).toSec(); - robot::log_info("[move_base2][cmdvel] commanding=%d active_req=%d grace=%.2f " - "stamp_age=%.4f s (cua host 0.05) v=%.3f w=%.3f -> host %s\n", - commanding ? 1 : 0, loop_.hasActiveRequest() ? 1 : 0, - last_command_active_time_.isZero() - ? -1.0 - : (cycle_time - last_command_active_time_).toSec(), - stamp_age, twist_.velocity.x, twist_.velocity.theta, - stamp_age < 0.05 ? "PHAT" : "BO"); - } // Không commanding: giữ nguyên stamp cũ — host thấy lệnh quá hạn và nhường /cmd_vel cho nguồn khác. }