debug a car in a different color

This commit is contained in:
Dustin Carlino 2018-08-22 10:01:36 -07:00
parent cca0915ff3
commit 0e2ae49596
5 changed files with 14 additions and 1 deletions

View File

@ -234,6 +234,12 @@
0.0,
1.0
],
"DebugCar": [
0.0,
0.0,
1.0,
0.8
],
"MovingCar": [
0.0,
1.0,

View File

@ -55,6 +55,7 @@ pub enum Colors {
YieldTurn,
StopTurn,
DebugCar,
MovingCar,
StuckCar,
ParkedCar,

View File

@ -370,6 +370,7 @@ impl UI {
return c;
}
match self.sim_ctrl.sim.get_car_state(id) {
CarState::Debug => ezgui::shift_color(self.cs.get(Colors::DebugCar), id.0),
CarState::Moving => ezgui::shift_color(self.cs.get(Colors::MovingCar), id.0),
CarState::Stuck => ezgui::shift_color(self.cs.get(Colors::StuckCar), id.0),
CarState::Parked => ezgui::shift_color(self.cs.get(Colors::ParkedCar), id.0),

View File

@ -162,6 +162,8 @@ impl Car {
}
constraints.push(accel);
} else if self.debug {
println!(" {} is {} behind {}. Lookahead dist {} + following dist {} is less than that, so ignore them", self.id, dist_behind_other, other.id, dist_to_lookahead, other_vehicle.following_dist());
}
}
@ -475,7 +477,9 @@ impl DrivingSimState {
pub fn get_car_state(&self, c: CarID) -> CarState {
if let Some(driving) = self.cars.get(&c) {
if driving.speed > kinematics::EPSILON_SPEED {
if driving.debug {
CarState::Debug
} else if driving.speed > kinematics::EPSILON_SPEED {
CarState::Moving
} else {
CarState::Stuck

View File

@ -233,6 +233,7 @@ pub enum CarState {
Moving,
Stuck,
Parked,
Debug,
}
// TODO Don't just alias types; assert that time, dist, and speed are always positive