refactor: host EnvMonitor from env_monitor_core, route per detector
EnvMonitor and its detectors now live in env_monitor_core. NavigationRuntime owns the monitor; StateMachine runs each detector's own route (step or sequence, lock or abort on exhaustion) with a cursor per detector. RecoveryRunner accepts named routes for detectors outside the six built-in triggers.
This commit is contained in:
@@ -248,12 +248,11 @@ void readDebug(robot::NodeHandle& nh, MoveBase2Config& config)
|
||||
void readEnvMonitor(robot::NodeHandle& nh, MoveBase2Config& config)
|
||||
{
|
||||
robot::NodeHandle env_nh(nh, "env_monitor");
|
||||
EnvMonitorConfig& m = config.env_monitor;
|
||||
EnvSamplingConfig& s = config.env_sampling;
|
||||
|
||||
readBool(env_nh, "enabled", m.enabled);
|
||||
readDouble(env_nh, "grace_after_new_plan", m.grace_after_new_plan);
|
||||
readDouble(env_nh, "pose_jump_reject", m.pose_jump_reject);
|
||||
// Phần chung và từng detector (stall / unreachable / contact / replan_budget / detectors) do
|
||||
// env_monitor_core::EnvMonitor::initialize() đọc. Ở đây chỉ phần lấy mẫu của move_base2.
|
||||
readBool(env_nh, "enabled", config.env_monitor_enabled);
|
||||
readDouble(env_nh, "check_period", s.check_period);
|
||||
|
||||
robot::NodeHandle body_nh(env_nh, "body");
|
||||
@@ -274,62 +273,11 @@ void readEnvMonitor(robot::NodeHandle& nh, MoveBase2Config& config)
|
||||
readDouble(geo_nh, "exit_ahead", s.exit_ahead);
|
||||
readDouble(geo_nh, "target_snap", s.target_snap);
|
||||
|
||||
robot::NodeHandle stall_nh(env_nh, "stall");
|
||||
readBool(stall_nh, "enabled", m.stall.enabled);
|
||||
readString(stall_nh, "action", m.stall.action);
|
||||
readDouble(stall_nh, "window_s", m.stall.window_s);
|
||||
readDouble(stall_nh, "window_m", m.stall.window_m);
|
||||
readDouble(stall_nh, "min_commanded", m.stall.min_commanded);
|
||||
readDouble(stall_nh, "eff_on", m.stall.eff_on);
|
||||
readDouble(stall_nh, "eff_off", m.stall.eff_off);
|
||||
readDouble(stall_nh, "confirm", m.stall.confirm);
|
||||
readDouble(stall_nh, "goal_zone", m.stall.goal_zone);
|
||||
readDouble(stall_nh, "slip_on", m.stall.slip_on);
|
||||
readDouble(stall_nh, "slip_time", m.stall.slip_time);
|
||||
readDouble(stall_nh, "min_commanded_since_goal", m.stall.min_commanded_since_goal);
|
||||
readDouble(stall_nh, "retry_backoff", m.stall.retry_backoff);
|
||||
readDouble(stall_nh, "jump_reject", m.stall.jump_reject);
|
||||
readDouble(stall_nh, "disp_window_s", m.stall.disp_window_s);
|
||||
readDouble(stall_nh, "disp_min", m.stall.disp_min);
|
||||
readDouble(stall_nh, "disp_min_commanded", m.stall.disp_min_commanded);
|
||||
readDouble(stall_nh, "idle_window_s", m.stall.idle_window_s);
|
||||
readDouble(stall_nh, "confine_window_s", m.stall.confine_window_s);
|
||||
readDouble(stall_nh, "confine_radius", m.stall.confine_radius);
|
||||
readDouble(stall_nh, "confine_cmd_factor", m.stall.confine_cmd_factor);
|
||||
readBool(stall_nh, "progress_veto", m.stall.progress_veto);
|
||||
|
||||
robot::NodeHandle unreach_nh(env_nh, "unreachable");
|
||||
readBool(unreach_nh, "enabled", m.unreachable.enabled);
|
||||
readString(unreach_nh, "action", m.unreachable.action);
|
||||
readDouble(unreach_nh, "static_on", m.unreachable.static_on);
|
||||
readDouble(unreach_nh, "clean_start_margin", m.unreachable.clean_start_margin);
|
||||
readDouble(unreach_nh, "retry_backoff", m.unreachable.retry_backoff);
|
||||
|
||||
// Khối `contact` mang cả cách lấy quỹ đạo để sweep (của move_base2) lẫn tham số detector (của env_monitor_core).
|
||||
robot::NodeHandle contact_nh(env_nh, "contact");
|
||||
readBool(contact_nh, "enabled", m.contact.enabled);
|
||||
readString(contact_nh, "action", m.contact.action);
|
||||
readBool(contact_nh, "apply_command", m.contact.apply_command);
|
||||
readString(contact_nh, "use_local_plan", s.use_local_plan);
|
||||
readDouble(contact_nh, "local_plan_start_tol", s.local_plan_start_tol);
|
||||
readDouble(contact_nh, "lookahead", s.contact_lookahead);
|
||||
readInt(contact_nh, "confirm_cycles", m.contact.confirm_cycles);
|
||||
readDouble(contact_nh, "trigger_static_time", m.contact.trigger_static_time);
|
||||
readDouble(contact_nh, "clean_start_margin", m.contact.clean_start_margin);
|
||||
readDouble(contact_nh, "brake_decel", m.contact.brake_decel);
|
||||
readDouble(contact_nh, "min_speed", m.contact.min_speed);
|
||||
readDouble(contact_nh, "min_check_speed", m.contact.min_check_speed);
|
||||
readDouble(contact_nh, "release_hysteresis", m.contact.release_hysteresis);
|
||||
readInt(contact_nh, "release_confirm_cycles", m.contact.release_confirm_cycles);
|
||||
readDouble(contact_nh, "envelope_margin", m.contact.envelope_margin);
|
||||
readDouble(contact_nh, "standdown_min_travel", m.contact.standdown_min_travel);
|
||||
readDouble(contact_nh, "standdown_travel", m.contact.standdown_travel);
|
||||
readBool(contact_nh, "envelope", m.contact.envelope);
|
||||
|
||||
robot::NodeHandle budget_nh(env_nh, "replan_budget");
|
||||
readDouble(budget_nh, "min_travel", m.replan.min_travel);
|
||||
readDouble(budget_nh, "escalate_factor", m.replan.escalate_factor);
|
||||
readDouble(budget_nh, "escalate_window_m", m.replan.escalate_window_m);
|
||||
readDouble(budget_nh, "escalate_max", m.replan.escalate_max);
|
||||
|
||||
robot::NodeHandle logger_nh(env_nh, "logger");
|
||||
readBool(logger_nh, "enabled", config.env_logger.enabled);
|
||||
@@ -491,9 +439,9 @@ bool MoveBase2Config::validate(std::string& error) const
|
||||
return false;
|
||||
}
|
||||
|
||||
if (env_monitor.enabled)
|
||||
if (env_monitor_enabled)
|
||||
{
|
||||
if (!env_monitor.validate(error) || !env_sampling.validate(error) || !env_logger.validate(error))
|
||||
if (!env_sampling.validate(error) || !env_logger.validate(error))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -755,7 +703,6 @@ ControlLoopConfig MoveBase2Config::toControlLoopConfig() const
|
||||
config.go_straight = go_straight;
|
||||
config.rotate = rotate;
|
||||
config.backup_global_planner_name = backup_global_planner_name;
|
||||
config.env_monitor = env_monitor;
|
||||
config.env_sampling = env_sampling;
|
||||
config.env_logger = env_logger;
|
||||
config.debug_env = debug_env;
|
||||
|
||||
Reference in New Issue
Block a user