22 #ifndef MSLaneChanger_h 23 #define MSLaneChanger_h 57 MSLaneChanger(
const std::vector<MSLane*>* lanes,
bool allowChanging);
141 if (!ce->lane->myVehicles.empty()) {
142 return ce->lane->myVehicles.back();
154 virtual bool changeOpposite(std::pair<MSVehicle*, double> leader);
184 const std::pair<MSVehicle* const, double>& leader,
185 const std::vector<MSVehicle::LaneQ>& preb)
const;
192 const std::pair<MSVehicle* const, double>& leader,
193 const std::pair<MSVehicle* const, double>& neighLead,
194 const std::pair<MSVehicle* const, double>& neighFollow,
195 const std::vector<MSVehicle::LaneQ>& preb)
const;
203 std::pair<MSVehicle* const, double>
getRealFollower(
const ChangerIt& target)
const;
205 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
saves leader/follower vehicles and their distances relative to an ego vehicle
Representation of a vehicle in the micro simulation.
MSLane * lane
the lane the vehicle is on
MSLeaderDistanceInfo aheadNext
bool continueChange(MSVehicle *vehicle, ChangerIt &from)
continue a lane change maneuver and return whether the midpoint was passed in this step (used if gLan...
virtual 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.
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)
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