23 #ifndef MSLaneChanger_h 24 #define MSLaneChanger_h 58 MSLaneChanger(
const std::vector<MSLane*>* lanes,
bool allowChanging);
131 if (!ce->lane->myVehicles.empty()) {
132 return ce->lane->myVehicles.back();
144 virtual bool changeOpposite(std::pair<MSVehicle*, double> leader);
165 const std::pair<MSVehicle* const, double>& leader,
166 const std::vector<MSVehicle::LaneQ>& preb)
const;
173 const std::pair<MSVehicle* const, double>& leader,
174 const std::pair<MSVehicle* const, double>& neighLead,
175 const std::pair<MSVehicle* const, double>& neighFollow,
176 const std::vector<MSVehicle::LaneQ>& preb)
const;
184 std::pair<MSVehicle* const, double>
getRealFollower(
const ChangerIt& target)
const;
186 std::pair<MSVehicle* const, double>
getRealLeader(
const ChangerIt& target)
const;
void laneChange(SUMOTime t)
Start lane-change-process for all vehicles on the edge'e lanes.
MSVehicle * firstBlocked
the first vehicle on this edge that wants to change to this lane
static MSVehicle * getCloserFollower(const double maxPos, MSVehicle *follow1, MSVehicle *follow2)
return the closer follower of ego
Representation of a vehicle in the micro simulation.
MSLane * lane
the lane the vehicle is on
bool continueChange(MSVehicle *vehicle, ChangerIt &from)
continue a lane change maneuver and return whether the midpoint was passed in this step (used if gLan...
void initChanger()
Initialize the changer before looping over all vehicles.
virtual bool changeOpposite(std::pair< MSVehicle *, double > leader)
const bool myAllowsChanging
bool mayChange(int direction) const
whether changing to the lane in the given direction should be considered
const bool myChangeToOpposite
whether this edge allows changing to the opposite direction edge
MSVehicle * veh(ConstChangerIt ce) const
void startChange(MSVehicle *vehicle, ChangerIt &from, int direction)
start the lane change maneuver (and finish it instantly if gLaneChangeDuration == 0) ...
MSVehicle * lead
the vehicle in front of the current vehicle
ChangeElem(MSLane *_lane)
ChangerIt findCandidate()
Find current candidate. If there is none, myChanger.end() is returned.
Performs lane changing of vehicles.
virtual void updateChanger(bool vehHasChanged)
Changer::const_iterator ConstChangerIt
the iterator moving over the ChangeElems
static void computeOvertakingTime(const MSVehicle *vehicle, const MSVehicle *leader, double gap, double &timeToOvertake, double &spaceToOvertake)
Compute the time and space required for overtaking the given leader.
void addLink(MSLink *link)
MSLaneChanger()
Default constructor.
void updateLanes(SUMOTime t)
MSVehicle * lastBlocked
the vehicle that really wants to change to this lane
std::vector< ChangeElem > Changer
The list of changers; For each lane, a ChangeElem is being build.
int checkChange(int laneOffset, const MSLane *targetLane, const std::pair< MSVehicle *const, double > &leader, const std::pair< MSVehicle *const, double > &neighLead, const std::pair< MSVehicle *const, double > &neighFollow, const std::vector< MSVehicle::LaneQ > &preb) const
MSLaneChanger & operator=(const MSLaneChanger &)
Assignment operator.
virtual ~MSLaneChanger()
Destructor.
Changer::iterator ChangerIt
the iterator moving over the ChangeElems
Changer myChanger
Container for ChangeElemements, one for every lane in the edge.
void registerUnchanged(MSVehicle *vehicle)
std::pair< MSVehicle *const, double > getRealFollower(const ChangerIt &target) const
MSVehicle * hoppedVeh
last vehicle that changed into this lane
bool vehInChanger() const
Check if there is a single change-candidate in the changer. Returns true if there is one...
Representation of a lane in the micro simulation.
int checkChangeWithinEdge(int laneOffset, const std::pair< MSVehicle *const, double > &leader, const std::vector< MSVehicle::LaneQ > &preb) const
std::pair< MSVehicle *const, double > getRealLeader(const ChangerIt &target) const