feat(env_monitor): snap điểm thoát sang ô free trước khi kết luận mất liên thông; bật lại kUnreachable
- CostToGoParams::target_snap / geometry/target_snap 0,5 m: T (2 m dọc plan) không free và lùi dọc plan không thoát thì dịch ngang sang ô free gần nhất (Target::kSnapped), arc_rest vẫn theo index; chỉ khi snap thất bại mới kBlockedExit. Run 6/9 10:15: mọi "unreachable" đều là T nằm trong vành 0,48 m vì SBPL vẽ plan ôm mép vật cản giữa hành lang rộng 1,55 m — không phải mất liên thông. - unreachable/action: recover, static_on 1,5 s. - Test: grid_analysis +2 (plan ôm tường snap ra và có đường; cụm chắn ngang vẫn bịt với snap 0,5). Sim 6/9 10:38: 0 cờ unreachable, 0 cờ oan, 2 mission tới goal, 2 detour đều của PRIEST. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017xXjFjr2DQ6rhmhHSW4fk4
This commit is contained in:
@@ -352,6 +352,7 @@ void readEnvMonitor(robot::NodeHandle& nh, MoveBase2Config& config)
|
||||
readDouble(geo_nh, "track_back", s.track_back);
|
||||
readDouble(geo_nh, "track_ahead", s.track_ahead);
|
||||
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);
|
||||
|
||||
@@ -186,10 +186,10 @@ bool EnvSamplingConfig::validate(std::string& error) const
|
||||
!std::isfinite(corridor_margin) || corridor_margin < 0.0 || !std::isfinite(corridor_cap) ||
|
||||
corridor_cap <= 0.0 || !std::isfinite(target_backoff) || target_backoff < 0.0 ||
|
||||
!std::isfinite(track_back) || track_back < 0.0 || !std::isfinite(track_ahead) || track_ahead <= 0.0 ||
|
||||
!std::isfinite(exit_ahead) || exit_ahead < 0.0 ||
|
||||
!std::isfinite(exit_ahead) || exit_ahead < 0.0 || !std::isfinite(target_snap) || target_snap < 0.0 ||
|
||||
!std::isfinite(robot_snap) || robot_snap < 0.0)
|
||||
{
|
||||
error = "env_monitor: padding/corridor_margin/target_backoff/robot_snap/track_back/exit_ahead >= 0, "
|
||||
error = "env_monitor: padding/corridor_margin/target_backoff/robot_snap/track_back/exit_ahead/target_snap >= 0, "
|
||||
"horizon/corridor_cap/track_ahead > 0 [m]";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -513,7 +513,20 @@ CostToGoResult costToGo(const std::vector<robot_geometry_msgs::PoseStamped>& pla
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!backed)
|
||||
bool snapped = false;
|
||||
if (!backed && params.target_snap > 0.0)
|
||||
{
|
||||
// Lùi dọc plan không thoát khỏi vành (plan ôm tường suốt đoạn): dịch T ngang sang ô free gần nhất.
|
||||
unsigned int fx = 0;
|
||||
unsigned int fy = 0;
|
||||
if (nearestFreeCell(s, tx, ty, params.target_snap, fx, fy))
|
||||
{
|
||||
tx = fx;
|
||||
ty = fy;
|
||||
snapped = true;
|
||||
}
|
||||
}
|
||||
if (!backed && !snapped)
|
||||
{
|
||||
r.conclusive = true;
|
||||
r.reachable = false;
|
||||
@@ -522,7 +535,7 @@ CostToGoResult costToGo(const std::vector<robot_geometry_msgs::PoseStamped>& pla
|
||||
r.arc_rest = total - arc_ti;
|
||||
return r;
|
||||
}
|
||||
r.target = CostToGoResult::Target::kBackedOff;
|
||||
r.target = backed ? CostToGoResult::Target::kBackedOff : CostToGoResult::Target::kSnapped;
|
||||
}
|
||||
r.target_index = ti;
|
||||
r.arc_rest = std::max(0.0, total - arc_ti);
|
||||
|
||||
@@ -244,6 +244,7 @@ bool CostmapEnvironment::sampleGeometry(const EnvGeometryRequest& r, EnvGeometry
|
||||
cost_params.target_backoff = r.sampling->target_backoff;
|
||||
cost_params.robot_snap = r.sampling->robot_snap;
|
||||
cost_params.exit_ahead = r.sampling->exit_ahead;
|
||||
cost_params.target_snap = r.sampling->target_snap;
|
||||
out.cost = costToGo(*r.plan, r.from_index, gx, gy, cost_params, plan_to_grid, scratch_);
|
||||
CorridorParams corridor_params;
|
||||
corridor_params.horizon = r.sampling->horizon;
|
||||
|
||||
Reference in New Issue
Block a user