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:
2026-09-06 10:45:52 +07:00
parent 261cc20ad4
commit 62692838d6
8 changed files with 90 additions and 11 deletions

View File

@@ -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);