23 #ifndef MSLaneChanger_h 24 #define MSLaneChanger_h 58 MSLaneChanger(
const std::vector<MSLane*>* lanes,
bool allowChanging,
bool allowSwap);
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
Representation of a vehicle in the micro simulation.
MSLane * lane
the lane the vehicle is on
std::pair< MSVehicle *const, SUMOReal > getRealLeader(const ChangerIt &target) const
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.
int checkChangeWithinEdge(int laneOffset, const std::pair< MSVehicle *const, SUMOReal > &leader, const std::vector< MSVehicle::LaneQ > &preb) const
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)
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
Performs lane changing of vehicles.
std::pair< MSVehicle *const, SUMOReal > getRealFollower(const ChangerIt &target) const
virtual void updateChanger(bool vehHasChanged)
Changer::const_iterator ConstChangerIt
the iterator moving over the ChangeElems
virtual bool changeOpposite(std::pair< MSVehicle *, SUMOReal > leader)
void addLink(MSLink *link)
MSLaneChanger()
Default constructor.
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
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.
bool myAllowsSwap
Whether blocking vehicles may be swapped.
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
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.