48 MSLaneChanger(
const std::vector<MSLane*>* lanes,
bool allowChanging);
132 if (!ce->lane->myVehicles.empty()) {
133 return ce->lane->myVehicles.back();
145 virtual bool changeOpposite(std::pair<MSVehicle*, double> leader);
175 const std::pair<MSVehicle* const, double>& leader,
176 const std::vector<MSVehicle::LaneQ>& preb)
const;
183 const std::pair<MSVehicle* const, double>& leader,
184 const std::pair<MSVehicle* const, double>& neighLead,
185 const std::pair<MSVehicle* const, double>& neighFollow,
186 const std::vector<MSVehicle::LaneQ>& preb)
const;
215 static std::pair<MSVehicle*, double>
getColumnleader(
MSVehicle* vehicle, std::pair<MSVehicle*, double> leader,
double maxLookAhead = std::numeric_limits<double>::max());
Performs lane changing of vehicles.
virtual ~MSLaneChanger()
Destructor.
bool applyTraCICommands(MSVehicle *vehicle)
Execute TraCI LC-commands.
bool continueChange(MSVehicle *vehicle, ChangerIt &from)
continue a lane change maneuver and return whether the vehicle has completely moved onto the new lane...
const bool myChangeToOpposite
whether this edge allows changing to the opposite direction edge
MSLaneChanger(const MSLaneChanger &)
Copy constructor.
static std::pair< MSVehicle *, double > getColumnleader(MSVehicle *vehicle, std::pair< MSVehicle *, double > leader, double maxLookAhead=std::numeric_limits< double >::max())
MSLaneChanger()
Default constructor.
void checkTraCICommands(MSVehicle *vehicle)
Take into account traci LC-commands.
void laneChange(SUMOTime t)
Start lane-change-process for all vehicles on the edge'e lanes.
virtual void initChanger()
Initialize the changer before looping over all vehicles.
bool vehInChanger() const
Check if there is a single change-candidate in the changer. Returns true if there is one.
std::pair< MSVehicle *const, double > getRealFollower(const ChangerIt &target) const
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
bool startChange(MSVehicle *vehicle, ChangerIt &from, int direction)
const bool myAllowsChanging
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.
int checkChangeWithinEdge(int laneOffset, const std::pair< MSVehicle *const, double > &leader, const std::vector< MSVehicle::LaneQ > &preb) const
MSVehicle * veh(ConstChangerIt ce) const
Changer myChanger
Container for ChangeElemements, one for every lane in the edge.
virtual bool changeOpposite(std::pair< MSVehicle *, double > leader)
ChangerIt findCandidate()
Find current candidate. If there is none, myChanger.end() is returned.
bool mayChange(int direction) const
whether changing to the lane in the given direction should be considered
Changer::const_iterator ConstChangerIt
the iterator moving over the ChangeElems
static MSVehicle * getCloserFollower(const double maxPos, MSVehicle *follow1, MSVehicle *follow2)
return the closer follower of ego
MSLaneChanger & operator=(const MSLaneChanger &)
Assignment operator.
void registerUnchanged(MSVehicle *vehicle)
void updateLanes(SUMOTime t)
std::pair< MSVehicle *const, double > getRealLeader(const ChangerIt &target) const
Changer::iterator ChangerIt
the iterator moving over the ChangeElems
static MSLane * getLaneAfter(const MSLane *lane, const std::vector< MSLane * > &conts)
return the next lane in conts beyond lane or nullptr
virtual void updateChanger(bool vehHasChanged)
Representation of a lane in the micro simulation.
saves leader/follower vehicles and their distances relative to an ego vehicle
Representation of a vehicle in the micro simulation.
std::vector< int > siblings
bool mayChangeRight
whether changing is possible to either direction
MSVehicle * lead
the leader vehicle for the current change candidate
MSLeaderDistanceInfo aheadNext
ChangeElem(MSLane *_lane)
MSLane * lane
the lane corresponding to this ChangeElem (the current change candidate is on this lane)
MSVehicle * lastBlocked
the next vehicle downstream of the ego vehicle that is blocked from changing to this lane
MSVehicle * firstBlocked
the farthest downstream vehicle on this edge that is blocked from changing to this lane
void registerHop(MSVehicle *vehicle)
Register that vehicle belongs to Changer Item to after LC decisions.
MSVehicle * hoppedVeh
last vehicle that changed into this lane