Skip to content

Commit

Permalink
Rescue lane for emergency vehicles, make clean up more efficient, refs
Browse files Browse the repository at this point in the history
  • Loading branch information
lbieker committed Jul 4, 2018
1 parent 93de28d commit 73cbe6e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/microsim/devices/MSDevice_Bluelight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,17 @@ MSDevice_Bluelight::notifyMove(SUMOVehicle& veh, double /* oldPos */,

}
else {//if vehicle is passed all vehicles which had to react should get their state back after they leave the communication range
double distanceDelta = veh.getPosition().distanceTo(veh2->getPosition());
if (distanceDelta > 25 && veh.getID() != veh2->getID() && influencedVehicles.count(veh2->getID()) > 0) {
influencedVehicles.erase(veh2->getID());
MSVehicleType& t = static_cast<MSVehicle*>(veh2)->getSingularType();
std::map<std::string, LateralAlignment>::iterator it = influenced.find(veh2->getID());
if (it != influenced.end()) {
//it->second();
std::cout << "Change allingnment for" << veh2->getID() << "\n";
t.setPreferredLateralAlignment(LATALIGN_CENTER);
if (influencedVehicles.count(veh2->getID()) > 0) {
double distanceDelta = veh.getPosition().distanceTo(veh2->getPosition());
if (distanceDelta > 25 && veh.getID() != veh2->getID()) {
influencedVehicles.erase(veh2->getID());
MSVehicleType& t = static_cast<MSVehicle*>(veh2)->getSingularType();
std::map<std::string, LateralAlignment>::iterator it = influenced.find(veh2->getID());
if (it != influenced.end()) {
std::cout << "Change allingnment for: " << it->first << ":" << it->second << "\n";
t.setPreferredLateralAlignment(static_cast<LateralAlignment>(it->second));
}
}

}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/microsim/devices/MSDevice_Bluelight.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,12 @@ class MSDevice_Bluelight : public MSDevice {
// @brief collects all vehicleIDs which had to react to the emergency vehicle
std::set<std::string> influencedVehicles;

// @brief collects all LateralAlignments of the vehicles which had to react to the emergency vehicle
std::map<std::string, LateralAlignment> influenced;

// @brief collects all LateralAlignments of the vehicles which had to react to the emergency vehicle
std::map<std::string, MSVehicleType> influencedTypes;

/// @brief a value which is initialised based on a commandline/configuration option
double myCustomValue1;

Expand Down

0 comments on commit 73cbe6e

Please sign in to comment.