Skip to content

Commit

Permalink
Reduced speed for emergency vehicles during the use of a rescue lane,…
Browse files Browse the repository at this point in the history
… refs #1967
  • Loading branch information
lbieker committed Jul 4, 2019
1 parent 4eae248 commit 8933d44
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/microsim/devices/MSDevice_Bluelight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ MSDevice_Bluelight::notifyMove(SUMOTrafficObject& veh, double /* oldPos */,
continue;
}
double distanceDelta = veh.getPosition().distanceTo(veh2->getPosition());
//emergency vehicle has to slow down when entering the resuce lane
if (distanceDelta <= 10 && veh.getID() != veh2->getID() && influencedVehicles.count(veh2->getID()) > 0 && veh2->getSpeed() < 1) {
// set ev speed to 20 km/h 0 5.56 m/s
std::vector<std::pair<SUMOTime, double> > speedTimeLine;
speedTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep(), veh.getSpeed()));
speedTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep() + TIME2STEPS(2), 5.56));
redLight.setSpeedTimeLine(speedTimeLine);
}

// the perception of the sound of the siren should be around 25 meters
// todo only vehicles in front of the emergency vehicle should react
if (distanceDelta <= 25 && veh.getID() != veh2->getID() && influencedVehicles.count(veh2->getID()) == 0) {
Expand Down

0 comments on commit 8933d44

Please sign in to comment.