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*, SUMOReal> leader);
165 const std::pair<MSVehicle* const, SUMOReal>& leader,
166 const std::vector<MSVehicle::LaneQ>& preb)
const;
173 const std::pair<MSVehicle* const, SUMOReal>& leader,
174 const std::pair<MSVehicle* const, SUMOReal>& neighLead,
175 const std::pair<MSVehicle* const, SUMOReal>& neighFollow,
176 const std::vector<MSVehicle::LaneQ>& preb)
const;
184 std::pair<MSVehicle* const, SUMOReal>
getRealFollower(
const ChangerIt& target)
const;
186 std::pair<MSVehicle* const, SUMOReal>
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
std::pair< MSVehicle *const, SUMOReal > getRealLeader(const ChangerIt &target) const
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.
MSVehicle * veh(ConstChangerIt ce) const
const bool myChangeToOpposite
whether this edge allows changing to the opposite direction edge
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)
static void computeOvertakingTime(const MSVehicle *vehicle, const MSVehicle *leader, SUMOReal gap, SUMOReal &timeToOvertake, SUMOReal &spaceToOvertake)
Compute the time and space required for overtaking the given leader.
ChangerIt findCandidate()
Find current candidate. If there is none, myChanger.end() is returned.
static MSVehicle * getCloserFollower(const SUMOReal maxPos, MSVehicle *follow1, MSVehicle *follow2)
return the closer follower of ego
bool vehInChanger() const
Check if there is a single change-candidate in the changer. Returns true if there is one...
Performs lane changing of vehicles.
virtual void updateChanger(bool vehHasChanged)
Changer::const_iterator ConstChangerIt
the iterator moving over the ChangeElems
virtual bool changeOpposite(std::pair< MSVehicle *, SUMOReal > leader)
int checkChangeWithinEdge(int laneOffset, const std::pair< MSVehicle *const, SUMOReal > &leader, const std::vector< MSVehicle::LaneQ > &preb) const
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.
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)
MSVehicle * hoppedVeh
last vehicle that changed into this lane
int checkChange(int laneOffset, const MSLane *targetLane, const std::pair< MSVehicle *const, SUMOReal > &leader, const std::pair< MSVehicle *const, SUMOReal > &neighLead, const std::pair< MSVehicle *const, SUMOReal > &neighFollow, const std::vector< MSVehicle::LaneQ > &preb) const
Representation of a lane in the micro simulation.
std::pair< MSVehicle *const, SUMOReal > getRealFollower(const ChangerIt &target) const
bool mayChange(int direction) const
whether changing to the lane in the given direction should be considered