Check chassis footprint and bound pending route exploration (#114)
Reject narrow corridors, recheck motion clearance, and wait for footprint data before flooding the shared query budget. Co-Authored-By: Codex GPT-6 Luna <noreply@openai.com>
This commit is contained in:
@@ -48,7 +48,7 @@ impl Sim {
|
||||
return false;
|
||||
}
|
||||
sam.dest = Some(to);
|
||||
let route = route::Route::new(sam.pos, to, slack, sam.kind.climbs(), self.tick);
|
||||
let route = route::Route::new(sam.pos, to, slack, sam.kind, self.tick);
|
||||
self.routes.map.insert(sam.id, route);
|
||||
sam.target = None;
|
||||
sam.gun_target = None;
|
||||
@@ -102,7 +102,7 @@ impl Sim {
|
||||
sam.march = sam.kind.march_ticks();
|
||||
continue;
|
||||
};
|
||||
let route = routes.map.entry(sam.id).or_insert_with(|| route::Route::new(sam.pos, to, 0.0, sam.kind.climbs(), now));
|
||||
let route = routes.map.entry(sam.id).or_insert_with(|| route::Route::new(sam.pos, to, 0.0, sam.kind, now));
|
||||
let (go, last) = match route.drive(ground, now, sam.pos, share) {
|
||||
route::Drive::Wait(why) => {
|
||||
if route.waited(now) > 40 && !route.told {
|
||||
@@ -145,7 +145,8 @@ impl Sim {
|
||||
let turning = angle_diff(sam.heading, heading_of(flat)).abs();
|
||||
let step = SPEED * sam.drive_speed() * (1.0 - turning / std::f64::consts::PI).max(0.2);
|
||||
let next = sam.pos + ahead * step;
|
||||
// The column ahead: a wall or a drop the grid missed turns the vehicle back to the planner.
|
||||
// The column and chassis clearance ahead: a wall, low ceiling or a change after planning
|
||||
// turns the vehicle back to the planner. Unknown voxels remain a wait, never a drive.
|
||||
let Some(y) = ground.at(next, now) else {
|
||||
if route.wait_ahead() {
|
||||
out.messages.push(format!("{} №{}: {}", sam.kind.name(), n + 1, route::Why::NoMap.text()));
|
||||
@@ -156,6 +157,23 @@ impl Sim {
|
||||
}
|
||||
continue;
|
||||
};
|
||||
match route.clearance(ground, next, now) {
|
||||
route::Clearance::Clear => {}
|
||||
route::Clearance::Pending => {
|
||||
if route.wait_ahead() {
|
||||
out.messages.push(format!("{} №{}: {}", sam.kind.name(), n + 1, route::Why::NoMap.text()));
|
||||
routes.map.remove(&sam.id);
|
||||
sam.dest = None;
|
||||
sam.state = SamState::Deploying;
|
||||
sam.march = sam.kind.march_ticks();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
route::Clearance::Blocked => {
|
||||
route.blocked_ahead(next, sam.pos);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
route.ahead_ok();
|
||||
let rise = y - sam.pos.y;
|
||||
if rise > route::STEP_UP || rise < -route::STEP_DOWN {
|
||||
|
||||
Reference in New Issue
Block a user