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:
@@ -68,6 +68,8 @@ void readBinding(robot::NodeHandle& nh, const std::string& ns, ProfileBinding& b
|
||||
}
|
||||
|
||||
void readSensors(robot::NodeHandle& nh, SensorGatewayConfig& sensors);
|
||||
void readDebug(robot::NodeHandle& nh, MoveBase2Config& config);
|
||||
|
||||
void readSensorStore(robot::NodeHandle& nh, MoveBase2Config& config);
|
||||
|
||||
/// Đọc cặp planner runtime trực tiếp, không có adapter gen-1 ở giữa.
|
||||
@@ -234,6 +236,7 @@ void readMoveBase2Fields(robot::NodeHandle& nh, MoveBase2Config& config)
|
||||
|
||||
readSensors(nh, config.sensors);
|
||||
readSensorStore(nh, config);
|
||||
readDebug(nh, config);
|
||||
readPathMonitor(nh, config.path_monitor);
|
||||
readBool(nh, "docking_requires_marker", config.docking_requires_marker);
|
||||
|
||||
@@ -277,6 +280,15 @@ void readSensorStore(robot::NodeHandle& nh, MoveBase2Config& config)
|
||||
readDouble(store_nh, "report_period", config.sensor_store_report_period);
|
||||
}
|
||||
|
||||
/// Đọc công tắc log chẩn đoán từ namespace con `debug`.
|
||||
void readDebug(robot::NodeHandle& nh, MoveBase2Config& config)
|
||||
{
|
||||
robot::NodeHandle debug_nh(nh, "debug");
|
||||
readBool(debug_nh, "state", config.debug_state);
|
||||
readBool(debug_nh, "plan", config.debug_plan);
|
||||
readBool(debug_nh, "skip", config.debug_skip);
|
||||
}
|
||||
|
||||
/// Đọc cấu hình đường vào cảm biến từ namespace con `sensors`.
|
||||
void readSensors(robot::NodeHandle& nh, SensorGatewayConfig& sensors)
|
||||
{
|
||||
@@ -503,6 +515,9 @@ std::string MoveBase2Config::describe() const
|
||||
describeBinding(out, "rotate", rotate);
|
||||
out << " backup_global_planner: '" << backup_global_planner_name << "'"
|
||||
<< (backup_global_planner_name.empty() ? " (off)\n" : "\n");
|
||||
out << " debug: state=" << (debug_state ? "on" : "off")
|
||||
<< " plan=" << (debug_plan ? "on" : "off")
|
||||
<< " skip=" << (debug_skip ? "on" : "off") << "\n";
|
||||
out << state_machine.describe();
|
||||
out << velocity.describe();
|
||||
out << sensors.describe();
|
||||
@@ -666,6 +681,9 @@ MoveBase2Config MoveBase2Config::load(robot::NodeHandle& root_nh)
|
||||
ControlLoopConfig MoveBase2Config::toControlLoopConfig() const
|
||||
{
|
||||
ControlLoopConfig config;
|
||||
config.debug_state = debug_state;
|
||||
config.debug_plan = debug_plan;
|
||||
config.debug_skip = debug_skip;
|
||||
config.state_machine = state_machine;
|
||||
config.velocity = velocity;
|
||||
config.nominal_control_period =
|
||||
|
||||
Reference in New Issue
Block a user