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