mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-11-25 11:44:25 +03:00
dont stop at stop signs for priority turns
This commit is contained in:
parent
c3d7595fc3
commit
6eb935a88d
@ -243,24 +243,29 @@ impl StopSign {
|
||||
}
|
||||
|
||||
fn step(&mut self, time: Tick, map: &Map, control_map: &ControlMap, info: &AgentInfo) {
|
||||
let ss = &control_map.stop_signs[&self.id];
|
||||
|
||||
// If anybody is stopped, promote them.
|
||||
// TODO retain() would rock
|
||||
let mut newly_stopped: Vec<Request> = Vec::new();
|
||||
for req in self.approaching_agents.iter() {
|
||||
// TODO tmpish debug
|
||||
if !info.speeds.contains_key(&req.agent) {
|
||||
println!("no speed for {:?}", req);
|
||||
// TODO or not blocked by somebody unaccepted
|
||||
if !info.leaders.contains(&req.agent) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO and the agent is at the end? maybe easier than looking at their speed
|
||||
// TODO with lane-changing, somebody could cut in front of them when they're stopped.
|
||||
if info.leaders.contains(&req.agent)
|
||||
&& info.speeds[&req.agent] <= kinematics::EPSILON_SPEED
|
||||
{
|
||||
let should_promote = if ss.get_priority(req.turn) == TurnPriority::Stop {
|
||||
// TODO and the agent is at the end? maybe easier than looking at their speed
|
||||
// TODO with lane-changing, somebody could cut in front of them when they're stopped.
|
||||
info.speeds[&req.agent] <= kinematics::EPSILON_SPEED
|
||||
} else {
|
||||
true
|
||||
};
|
||||
if should_promote {
|
||||
self.started_waiting_at.insert(req.clone(), time);
|
||||
newly_stopped.push(req.clone());
|
||||
if self.debug {
|
||||
println!("{:?} is now considered stopped", req);
|
||||
println!("{:?} is promoted from approaching to waiting", req);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -278,7 +283,6 @@ impl StopSign {
|
||||
continue;
|
||||
}
|
||||
|
||||
let ss = &control_map.stop_signs[&self.id];
|
||||
if self.conflicts_with_waiting_with_higher_priority(turn, map, ss) {
|
||||
continue;
|
||||
}
|
||||
|
@ -28,3 +28,6 @@ fn aorta_model_completes() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO other tests (not completion) to add:
|
||||
// - different behavior (stopping or not) at stop signs
|
||||
|
Loading…
Reference in New Issue
Block a user