Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
MSLaneChanger Class Reference

Performs lane changing of vehicles. More...

#include <MSLaneChanger.h>

Inheritance diagram for MSLaneChanger:
[legend]

Data Structures

struct  ChangeElem
 

Public Types

typedef std::vector< ChangeElemChanger
 The list of changers; For each lane, a ChangeElem is being build.
 
typedef Changer::iterator ChangerIt
 the iterator moving over the ChangeElems
 
typedef Changer::const_iterator ConstChangerIt
 the iterator moving over the ChangeElems
 

Public Member Functions

ChangergetChanger ()
 return changer (only to be used by MSLaneChangerSublane from another instance)
 
void laneChange (SUMOTime t)
 Start lane-change-process for all vehicles on the edge'e lanes.
 
 MSLaneChanger (const std::vector< MSLane * > *lanes, bool allowChanging)
 Constructor.
 
virtual ~MSLaneChanger ()
 Destructor.
 

Protected Member Functions

bool applyTraCICommands (MSVehicle *vehicle)
 Execute TraCI LC-commands.
 
bool avoidDeadlock (MSVehicle *vehicle, std::pair< MSVehicle *, double > neighLead, std::pair< MSVehicle *, double > overtaken, std::pair< MSVehicle *, double > leader)
 avoid opposite-diretion deadlock when vehicles are stopped on both sides of the road The method may call saveBlockerLength to affect vehicle speed in the next step
 
virtual bool change ()
 
bool changeOpposite (MSVehicle *vehicle, std::pair< MSVehicle *, double > leader, MSVehicle *lastStopped)
 
int checkChange (int laneOffset, const MSLane *targetLane, const std::pair< MSVehicle *const, double > &leader, const std::pair< MSVehicle *const, double > &follower, const std::pair< MSVehicle *const, double > &neighLead, const std::pair< MSVehicle *const, double > &neighFollow, const std::vector< MSVehicle::LaneQ > &preb) const
 
virtual bool checkChangeOpposite (MSVehicle *vehicle, int laneOffset, 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)
 
int checkChangeWithinEdge (int laneOffset, const std::pair< MSVehicle *const, double > &leader, const std::vector< MSVehicle::LaneQ > &preb) const
 
bool checkOppositeStop (MSVehicle *vehicle, const MSLane *oncomingLane, const MSLane *opposite, std::pair< MSVehicle *, double > leader)
 decide whether to change (back or forth) for an opposite stop
 
void checkTraCICommands (MSVehicle *vehicle)
 Take into account traci LC-commands.
 
double computeSafeOppositeLength (MSVehicle *vehicle, double oppositeLength, const MSLane *source, double usableDist, std::pair< MSVehicle *, double > oncoming, double vMax, double oncomingSpeed, std::pair< MSVehicle *, double > neighLead, std::pair< MSVehicle *, double > overtaken, std::pair< MSVehicle *, double > neighFollow, double surplusGap, const MSLane *opposite, bool canOvertake)
 determine for how long the vehicle can drive safely on the opposite side
 
bool continueChange (MSVehicle *vehicle, ChangerIt &from)
 continue a lane change maneuver and return whether the vehicle has completely moved onto the new lane (used if gLaneChangeDuration > 0)
 
ChangerIt findCandidate ()
 Find current candidate. If there is none, myChanger.end() is returned.
 
std::pair< MSVehicle *const, double > getOncomingOppositeVehicle (const MSVehicle *vehicle, std::pair< MSVehicle *, double > overtaken, double searchDist)
 
std::pair< MSVehicle *const, double > getOncomingVehicle (const MSLane *opposite, std::pair< MSVehicle *, double > neighOncoming, double searchDist, double &vMax, const MSVehicle *overtaken=nullptr, MSLane::MinorLinkMode mLinkMode=MSLane::MinorLinkMode::FOLLOW_NEVER)
 
std::pair< MSVehicle *const, double > getRealFollower (const ChangerIt &target) const
 
std::pair< MSVehicle *const, double > getRealLeader (const ChangerIt &target) const
 
virtual void initChanger ()
 Initialize the changer before looping over all vehicles.
 
bool mayChange (int direction) const
 whether changing to the lane in the given direction should be considered
 
void registerUnchanged (MSVehicle *vehicle)
 
bool resolveDeadlock (MSVehicle *vehicle, std::pair< MSVehicle *const, double > leader, std::pair< MSVehicle *, double > neighLead, std::pair< MSVehicle *, double > overtaken)
 keep stopping to resolve opposite-diretion deadlock while there is oncoming traffic The method may call saveBlockerLength to affect vehicle speed in the next step
 
bool startChange (MSVehicle *vehicle, ChangerIt &from, int direction)
 
virtual void updateChanger (bool vehHasChanged)
 
void updateLanes (SUMOTime t)
 
MSVehicleveh (ConstChangerIt ce) const
 
bool vehInChanger () const
 Check if there is a single change-candidate in the changer. Returns true if there is one.
 
bool yieldToDeadlockOncoming (const MSVehicle *vehicle, const MSVehicle *stoppedNeigh, double dist)
 check whether to keep stopping for oncoming vehicles in the deadlock zone
 
bool yieldToOppositeWaiting (const MSVehicle *vehicle, const MSVehicle *stoppedNeigh, double dist, SUMOTime deltaWait=0)
 check whether to yield for oncoming vehicles that have waited longer for opposite overtaking
 

Static Protected Member Functions

static void computeOvertakingTime (const MSVehicle *vehicle, double vMax, const MSVehicle *leader, double gap, double &timeToOvertake, double &spaceToOvertake)
 Compute the time and space required for overtaking the given leader.
 
static double computeSurplusGap (const MSVehicle *vehicle, const MSLane *opposite, std::pair< MSVehicle *, double > oncoming, double timeToOvertake, double spaceToOvertake, double &oncomingSpeed, bool oncomingOpposite=false)
 
static bool foundHilltop (MSVehicle *vehicle, bool foundHill, double searchDist, const std::vector< MSLane * > &bestLanes, int view, double pos, double lastMax, double hilltopThreshold)
 
static std::vector< MSVehicle::LaneQgetBestLanesOpposite (MSVehicle *vehicle, const MSLane *stopLane, double oppositeLength)
 add LaneQ for opposite lanes
 
static MSVehiclegetCloserFollower (const double maxPos, MSVehicle *follow1, MSVehicle *follow2)
 return the closer follower of ego
 
static std::pair< MSVehicle *, double > getColumnleader (double &maxSpace, MSVehicle *vehicle, std::pair< MSVehicle *, double > leader, double maxLookAhead=std::numeric_limits< double >::max())
 return leader vehicle that is to be overtaken
 
static const MSLanegetLaneAfter (const MSLane *lane, const std::vector< MSLane * > &conts, bool allowMinor, bool &contsEnd)
 return the next lane in conts beyond lane or nullptr
 
static double getMaxOvertakingSpeed (const MSVehicle *vehicle, double maxSpaceToOvertake)
 compute maximum maneuver speed
 
static bool hasOppositeStop (MSVehicle *vehicle)
 whether vehicle has an opposite-direction stop within relevant range
 

Protected Attributes

const bool myAllowsChanging
 
ChangerIt myCandi
 
Changer myChanger
 Container for ChangeElemements, one for every lane in the edge.
 
const bool myChangeToOpposite
 whether this edge allows changing to the opposite direction edge
 

Private Member Functions

 MSLaneChanger ()
 Default constructor.
 
 MSLaneChanger (const MSLaneChanger &)
 Copy constructor.
 
MSLaneChangeroperator= (const MSLaneChanger &)
 Assignment operator.
 

Detailed Description

Performs lane changing of vehicles.

Definition at line 45 of file MSLaneChanger.h.

Member Typedef Documentation

◆ Changer

typedef std::vector< ChangeElem > MSLaneChanger::Changer

The list of changers; For each lane, a ChangeElem is being build.

Definition at line 108 of file MSLaneChanger.h.

◆ ChangerIt

typedef Changer::iterator MSLaneChanger::ChangerIt

the iterator moving over the ChangeElems

Definition at line 111 of file MSLaneChanger.h.

◆ ConstChangerIt

typedef Changer::const_iterator MSLaneChanger::ConstChangerIt

the iterator moving over the ChangeElems

Definition at line 114 of file MSLaneChanger.h.

Constructor & Destructor Documentation

◆ MSLaneChanger() [1/3]

MSLaneChanger::MSLaneChanger ( const std::vector< MSLane * > *  lanes,
bool  allowChanging 
)

Constructor.

Definition at line 104 of file MSLaneChanger.cpp.

References myChanger.

◆ ~MSLaneChanger()

MSLaneChanger::~MSLaneChanger ( )
virtual

Destructor.

Definition at line 136 of file MSLaneChanger.cpp.

◆ MSLaneChanger() [2/3]

MSLaneChanger::MSLaneChanger ( )
private

Default constructor.

◆ MSLaneChanger() [3/3]

MSLaneChanger::MSLaneChanger ( const MSLaneChanger )
private

Copy constructor.

Member Function Documentation

◆ applyTraCICommands()

bool MSLaneChanger::applyTraCICommands ( MSVehicle vehicle)
protected

Execute TraCI LC-commands.

Note
This is currently only used within non-actionsteps for the non-sublane model.
Returns
whether lane was changed

Definition at line 425 of file MSLaneChanger.cpp.

References continueChange(), MSVehicle::getLaneChangeModel(), MSAbstractLaneChangeModel::getOwnState(), LCA_BLOCKED, LCA_LEFT, LCA_RIGHT, myCandi, and MSAbstractLaneChangeModel::startLaneChangeManeuver().

Referenced by change().

Here is the caller graph for this function:

◆ avoidDeadlock()

bool MSLaneChanger::avoidDeadlock ( MSVehicle vehicle,
std::pair< MSVehicle *, double >  neighLead,
std::pair< MSVehicle *, double >  overtaken,
std::pair< MSVehicle *, double >  leader 
)
protected

avoid opposite-diretion deadlock when vehicles are stopped on both sides of the road The method may call saveBlockerLength to affect vehicle speed in the next step

Definition at line 1630 of file MSLaneChanger.cpp.

References DEBUG_COND, MSVehicle::getBestLanes(), MSVehicle::getBestLanesContinuation(), MSVehicle::getBrakeGap(), Named::getID(), Named::getIDSecure(), MSLane::getIndex(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSVehicleType::getLengthWithGap(), MSVehicleType::getMinGap(), MSVehicle::getPositionOnLane(), MSBaseVehicle::getVehicleType(), MSBaseVehicle::getWaitingSeconds(), MSAbstractLaneChangeModel::isOpposite(), MAX2(), OPPOSITE_OVERTAKING_DEADLOCK_WAIT, MSAbstractLaneChangeModel::saveBlockerLength(), SIMTIME, and yieldToDeadlockOncoming().

Referenced by changeOpposite().

Here is the caller graph for this function:

◆ change()

◆ changeOpposite()

bool MSLaneChanger::changeOpposite ( MSVehicle vehicle,
std::pair< MSVehicle *, double >  leader,
MSVehicle lastStopped 
)
protected

try changing to the opposite direction edge.

Definition at line 1189 of file MSLaneChanger.cpp.

References MSLane::allowsChangingLeft(), MSLane::allowsVehicleClass(), avoidDeadlock(), checkChangeOpposite(), checkOppositeStop(), computeOvertakingTime(), computeSafeOppositeLength(), computeSurplusGap(), DEBUG_COND, MSLane::FOLLOW_ONCOMING, foundHilltop(), gDebugFlag5, MSVehicle::getBackPositionOnLane(), MSVehicle::getBestLanes(), MSVehicle::getBestLanesContinuation(), getBestLanesOpposite(), getColumnleader(), MSLink::getDirection(), Named::getID(), Named::getIDSecure(), MSVehicle::getInfluencer(), MSNet::getInstance(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSVehicle::Influencer::getLaneTimeLineDuration(), MSLane::getLeader(), MSLane::getLength(), MSVehicleType::getLength(), MSLane::getLinkTo(), getMaxOvertakingSpeed(), MSVehicleType::getMinGap(), MSVehicle::getMutableLane(), getOncomingOppositeVehicle(), getOncomingVehicle(), MSLane::getOpposite(), MSLane::getOppositeFollower(), MSLane::getOppositeLeader(), MSLane::getOppositePos(), MSAbstractLaneChangeModel::getOppositeSafetyFactor(), MSLane::getParallelLane(), MSVehicle::getPosition(), MSVehicle::getPositionOnLane(), MSVehicle::Influencer::getRespectJunctionPriority(), MSVehicle::getSlope(), MSLane::getSpeedLimit(), MSLink::getState(), MSBaseVehicle::getVClass(), MSVehicleType::getVehicleClass(), MSLane::getVehicleMaxSpeed(), MSBaseVehicle::getVehicleType(), MSLink::getViaLaneOrLane(), MSBaseVehicle::getWaitingSeconds(), MSGlobals::gLefthand, MSNet::hasElevation(), MSVehicle::hasInfluencer(), hasOppositeStop(), MSLink::havePriority(), MSLink::haveRed(), MSLink::haveYellow(), MSVehicle::ignoreRed(), MSVehicle::influenceChangeDecision(), MSLane::isInternal(), MSAbstractLaneChangeModel::isOpposite(), MSBaseVehicle::isStopped(), LCA_LEFT, LCA_TRACI, LINKSTATE_ZIPPER, MAX2(), MIN2(), myChangeToOpposite, MSVehicle::nextStopDist(), OPPOSITE_OVERTAKING_DEADLOCK_WAIT, OPPOSITE_OVERTAKING_HILLTOP_THRESHOHOLD, OPPOSITE_OVERTAKING_MAX_SPACE_TO_OVERTAKE, OPPOSITE_OVERTAKING_ONCOMING_LOOKAHEAD, resolveDeadlock(), SIMTIME, STEPS2TIME, STRAIGHT, SVC_EMERGENCY, TIME2STEPS, toString(), TS, MSVehicle::VEH_SIGNAL_BLINKER_LEFT, MSVehicle::VEH_SIGNAL_BLINKER_RIGHT, yieldToOppositeWaiting(), and Position::z().

Referenced by change(), and MSLaneChangerSublane::change().

Here is the caller graph for this function:

◆ checkChange()

int MSLaneChanger::checkChange ( int  laneOffset,
const MSLane targetLane,
const std::pair< MSVehicle *const, double > &  leader,
const std::pair< MSVehicle *const, double > &  follower,
const std::pair< MSVehicle *const, double > &  neighLead,
const std::pair< MSVehicle *const, double > &  neighFollow,
const std::vector< MSVehicle::LaneQ > &  preb 
) const
protected

Definition at line 744 of file MSLaneChanger.cpp.

References ACCEL2SPEED, MSCFModel::brakeGap(), MSAbstractLaneChangeModel::checkChangeBeforeCommitting(), DEBUG_COND, DELTA_T, MSAbstractLaneChangeModel::estimateLCDuration(), MSVehicle::getAcceleration(), MSVehicle::getActionStepLength(), MSAbstractLaneChangeModel::getAssumedDecelForLaneChangeDuration(), MSVehicle::getBackPositionOnLane(), MSVehicle::getBestLanesContinuation(), MSVehicle::getCarFollowModel(), MSLane::getCriticalLeader(), MSLane::getEdge(), MSCFModel::getHeadwayTime(), Named::getID(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSLane::getLeader(), MSLane::getLength(), MSVehicleType::getLengthWithGap(), MSCFModel::getMaxDecel(), MSVehicleType::getMinGap(), MSLane::getParallelLane(), MSVehicle::getPositionOnLane(), MSVehicle::getRightSideOnLane(), MSAbstractLaneChangeModel::getSafetyFactor(), MSCFModel::getSecureGap(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), MSLane::getWidth(), MSVehicleType::getWidth(), MSGlobals::gLaneChangeDuration, MSLane::hasPedestrians(), MSVehicle::influenceChangeDecision(), MSEdge::isInternal(), MSLane::isLinkEnd(), MSAbstractLaneChangeModel::isOpposite(), LCA_BLOCKED, LCA_BLOCKED_BY_LEFT_FOLLOWER, LCA_BLOCKED_BY_LEFT_LEADER, LCA_BLOCKED_BY_RIGHT_FOLLOWER, LCA_BLOCKED_BY_RIGHT_LEADER, LCA_INSUFFICIENT_SPACE, LCA_INSUFFICIENT_SPEED, LCA_OVERLAPPING, LCA_URGENT, LCA_WANTS_LANECHANGE, LEFT, MAX2(), MIN2(), myCandi, MSLane::nextBlocking(), MSAbstractLaneChangeModel::NO_NEIGHBOR, RIGHT, MSAbstractLaneChangeModel::saveLCState(), MSAbstractLaneChangeModel::saveNeighbors(), MSAbstractLaneChangeModel::setFollowerGaps(), MSAbstractLaneChangeModel::setLeaderGaps(), MSAbstractLaneChangeModel::setOrigLeaderGaps(), SIMTIME, MSLane::succLinkSec(), toString(), TS, MSVehicle::unsafeLinkAhead(), veh(), and MSAbstractLaneChangeModel::wantsChange().

Referenced by checkChangeOpposite(), and checkChangeWithinEdge().

Here is the caller graph for this function:

◆ checkChangeOpposite()

bool MSLaneChanger::checkChangeOpposite ( MSVehicle vehicle,
int  laneOffset,
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 
)
protectedvirtual

◆ checkChangeWithinEdge()

int MSLaneChanger::checkChangeWithinEdge ( int  laneOffset,
const std::pair< MSVehicle *const, double > &  leader,
const std::vector< MSVehicle::LaneQ > &  preb 
) const
protected

Definition at line 726 of file MSLaneChanger.cpp.

References checkChange(), getRealFollower(), getRealLeader(), and myCandi.

Referenced by change().

Here is the caller graph for this function:

◆ checkOppositeStop()

◆ checkTraCICommands()

void MSLaneChanger::checkTraCICommands ( MSVehicle vehicle)
protected

Take into account traci LC-commands.

Note
This is currently only used within non-actionsteps.

Definition at line 404 of file MSLaneChanger.cpp.

References MSAbstractLaneChangeModel::checkTraCICommands(), DEBUG_COND, Named::getID(), MSVehicle::getLaneChangeModel(), MSAbstractLaneChangeModel::getOwnState(), LCA_BLOCKED, LCA_OVERLAPPING, SIMTIME, and toString().

Referenced by change(), and MSLaneChangerSublane::change().

Here is the caller graph for this function:

◆ computeOvertakingTime()

void MSLaneChanger::computeOvertakingTime ( const MSVehicle vehicle,
double  vMax,
const MSVehicle leader,
double  gap,
double &  timeToOvertake,
double &  spaceToOvertake 
)
staticprotected

Compute the time and space required for overtaking the given leader.

Parameters
[in]vehicleThe vehicle that wants to overtake
[in]leaderThe vehicle to be overtaken
[in]gapThe gap between vehicle and leader
[out]timeToOvertakeThe time for overtaking
[out]spaceToOvertakeThe space for overtaking

XXX ignore speed limit when overtaking through the opposite lane?

Definition at line 2196 of file MSLaneChanger.cpp.

References DEBUG_COND, MSVehicle::getAcceleration(), MSVehicle::getCarFollowModel(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSVehicleType::getLength(), MSVehicleType::getLengthWithGap(), MSCFModel::getMaxAccel(), MSCFModel::getMaxDecel(), MSVehicleType::getMaxSpeedLat(), MSVehicleType::getMinGap(), MSAbstractLaneChangeModel::getOppositeSafetyFactor(), MSCFModel::getSecureGap(), MSVehicle::getSpeed(), MSBaseVehicle::getStopDuration(), MSLane::getVehicleMaxSpeed(), MSBaseVehicle::getVehicleType(), MSLane::getWidth(), MSGlobals::gSublane, MAX2(), OPPOSITE_OVERTAKING_SAFE_TIMEGAP, OPPOSITE_OVERTAKING_SAFETY_FACTOR, STEPS2TIME, and TS.

Referenced by changeOpposite().

Here is the caller graph for this function:

◆ computeSafeOppositeLength()

double MSLaneChanger::computeSafeOppositeLength ( MSVehicle vehicle,
double  oppositeLength,
const MSLane source,
double  usableDist,
std::pair< MSVehicle *, double >  oncoming,
double  vMax,
double  oncomingSpeed,
std::pair< MSVehicle *, double >  neighLead,
std::pair< MSVehicle *, double >  overtaken,
std::pair< MSVehicle *, double >  neighFollow,
double  surplusGap,
const MSLane opposite,
bool  canOvertake 
)
protected

determine for how long the vehicle can drive safely on the opposite side

Definition at line 1871 of file MSLaneChanger.cpp.

References MSCFModel::brakeGap(), DEBUG_COND, MSVehicle::getCarFollowModel(), Named::getID(), MSVehicle::getLaneChangeModel(), MSCFModel::getMaxDecel(), MSLane::getOppositeFollower(), MSLane::getOppositePos(), MSVehicle::getPositionOnLane(), MSAbstractLaneChangeModel::getShadowLane(), MSVehicle::getSpeed(), MSAbstractLaneChangeModel::isOpposite(), MSBaseVehicle::isStopped(), MAX2(), MIN2(), MSVehicle::nextStopDist(), SIMTIME, TIME2STEPS, and yieldToOppositeWaiting().

Referenced by changeOpposite().

Here is the caller graph for this function:

◆ computeSurplusGap()

double MSLaneChanger::computeSurplusGap ( const MSVehicle vehicle,
const MSLane opposite,
std::pair< MSVehicle *, double >  oncoming,
double  timeToOvertake,
double  spaceToOvertake,
double &  oncomingSpeed,
bool  oncomingOpposite = false 
)
staticprotected

◆ continueChange()

◆ findCandidate()

MSLaneChanger::ChangerIt MSLaneChanger::findCandidate ( )
protected

Find current candidate. If there is none, myChanger.end() is returned.

Definition at line 217 of file MSLaneChanger.cpp.

References Named::getID(), MSVehicle::getPositionOnLane(), MSVehicle::isFrontOnLane(), myChanger, SIMTIME, and veh().

Referenced by change(), and MSLaneChangerSublane::change().

Here is the caller graph for this function:

◆ foundHilltop()

bool MSLaneChanger::foundHilltop ( MSVehicle vehicle,
bool  foundHill,
double  searchDist,
const std::vector< MSLane * > &  bestLanes,
int  view,
double  pos,
double  lastMax,
double  hilltopThreshold 
)
staticprotected

Definition at line 2101 of file MSLaneChanger.cpp.

References DEBUG_COND, foundHilltop(), Named::getID(), MSLane::getShape(), MSLane::interpolateGeometryPosToLanePos(), and SIMTIME.

Referenced by changeOpposite(), and foundHilltop().

Here is the caller graph for this function:

◆ getBestLanesOpposite()

std::vector< MSVehicle::LaneQ > MSLaneChanger::getBestLanesOpposite ( MSVehicle vehicle,
const MSLane stopLane,
double  oppositeLength 
)
staticprotected

◆ getChanger()

Changer & MSLaneChanger::getChanger ( )
inline

return changer (only to be used by MSLaneChangerSublane from another instance)

Definition at line 117 of file MSLaneChanger.h.

References myChanger.

Referenced by MSLaneChangerSublane::startChangeSublane().

Here is the caller graph for this function:

◆ getCloserFollower()

MSVehicle * MSLaneChanger::getCloserFollower ( const double  maxPos,
MSVehicle follow1,
MSVehicle follow2 
)
staticprotected

return the closer follower of ego

Definition at line 711 of file MSLaneChanger.cpp.

References MSVehicle::getPositionOnLane().

Referenced by getRealFollower().

Here is the caller graph for this function:

◆ getColumnleader()

std::pair< MSVehicle *, double > MSLaneChanger::getColumnleader ( double &  maxSpace,
MSVehicle vehicle,
std::pair< MSVehicle *, double >  leader,
double  maxLookAhead = std::numeric_limits<double>::max() 
)
staticprotected

return leader vehicle that is to be overtaken

Parameters
[out]maxSpaceThe maxium space that can be used for the overtaking maneuver (limits speed)
[in]vehicleThe vehicle that wants to overtake
[in]leaderThe vehicle to be overtaken and the gap to this vehicle
[in]maxLookAheadThe maximum lookahead distance

This methods calls itself recursively to find the leader of a column of vehicles to be overtaken (if there is no sufficient gap for stopping in between)

Definition at line 2319 of file MSLaneChanger.cpp.

References MSCFModel::brakeGap(), DEBUG_COND, MSVehicle::getBackPositionOnLane(), MSVehicle::getBestLanesContinuation(), MSVehicle::getCarFollowModel(), getColumnleader(), MSLane::getEdge(), Named::getID(), Named::getIDSecure(), MSVehicle::getLane(), getLaneAfter(), MSVehicle::getLaneChangeModel(), MSLane::getLastAnyVehicle(), MSLane::getLength(), MSVehicleType::getLengthWithGap(), MSCFModel::getMaxDecel(), MSAbstractLaneChangeModel::getOppositeSafetyFactor(), MSVehicle::getPositionOnLane(), MSCFModel::getSecureGap(), MSVehicle::getSpeed(), MSVehicleType::getVehicleClass(), MSLane::getVehicleMaxSpeed(), MSBaseVehicle::getVehicleType(), MAX2(), OPPOSITE_OVERTAKING_MAX_LOOKAHEAD, OPPOSITE_OVERTAKING_MAX_LOOKAHEAD_EMERGENCY, OPPOSITE_OVERTAKING_SAFETY_FACTOR, SVC_EMERGENCY, and toString().

Referenced by changeOpposite(), and getColumnleader().

Here is the caller graph for this function:

◆ getLaneAfter()

const MSLane * MSLaneChanger::getLaneAfter ( const MSLane lane,
const std::vector< MSLane * > &  conts,
bool  allowMinor,
bool &  contsEnd 
)
staticprotected

return the next lane in conts beyond lane or nullptr

Definition at line 2508 of file MSLaneChanger.cpp.

References MSLane::getLinkTo(), and MSLink::havePriority().

Referenced by getColumnleader().

Here is the caller graph for this function:

◆ getMaxOvertakingSpeed()

double MSLaneChanger::getMaxOvertakingSpeed ( const MSVehicle vehicle,
double  maxSpaceToOvertake 
)
staticprotected

compute maximum maneuver speed

Definition at line 2529 of file MSLaneChanger.cpp.

References MSVehicle::getCarFollowModel(), MSCFModel::getMaxAccel(), and MSCFModel::getMaxDecel().

Referenced by changeOpposite().

Here is the caller graph for this function:

◆ getOncomingOppositeVehicle()

std::pair< MSVehicle *const, double > MSLaneChanger::getOncomingOppositeVehicle ( const MSVehicle vehicle,
std::pair< MSVehicle *, double >  overtaken,
double  searchDist 
)
protected

Definition at line 2022 of file MSLaneChanger.cpp.

References gDebugFlag5, MSVehicle::getBestLanesContinuation(), Named::getID(), Named::getIDSecure(), MSVehicle::getLane(), MSLane::getLeader(), MSVehicleType::getLengthWithGap(), MSVehicle::getPositionOnLane(), MSBaseVehicle::getVehicleType(), and SIMTIME.

Referenced by changeOpposite(), and resolveDeadlock().

Here is the caller graph for this function:

◆ getOncomingVehicle()

std::pair< MSVehicle *const, double > MSLaneChanger::getOncomingVehicle ( const MSLane opposite,
std::pair< MSVehicle *, double >  neighOncoming,
double  searchDist,
double &  vMax,
const MSVehicle overtaken = nullptr,
MSLane::MinorLinkMode  mLinkMode = MSLane::MinorLinkMode::FOLLOW_NEVER 
)
protected

Definition at line 1983 of file MSLaneChanger.cpp.

References gDebugFlag5, MSLane::getFollower(), MAX2(), MIN2(), and SIMTIME.

Referenced by changeOpposite(), and checkOppositeStop().

Here is the caller graph for this function:

◆ getRealFollower()

std::pair< MSVehicle *const, double > MSLaneChanger::getRealFollower ( const ChangerIt target) const
protected

Definition at line 633 of file MSLaneChanger.cpp.

References DEBUG_COND, MSVehicle::getBackPositionOnLane(), getCloserFollower(), Named::getID(), MSVehicleType::getLength(), MSVehicleType::getMinGap(), MSVehicle::getPositionOnLane(), MSBaseVehicle::getVehicleType(), myCandi, SIMTIME, and veh().

Referenced by checkChangeWithinEdge().

Here is the caller graph for this function:

◆ getRealLeader()

std::pair< MSVehicle *const, double > MSLaneChanger::getRealLeader ( const ChangerIt target) const
protected

◆ hasOppositeStop()

bool MSLaneChanger::hasOppositeStop ( MSVehicle vehicle)
staticprotected

whether vehicle has an opposite-direction stop within relevant range

Definition at line 1083 of file MSLaneChanger.cpp.

References MSBaseVehicle::getNextStop(), MSBaseVehicle::hasStops(), MSStop::isOpposite, MSVehicle::nextStopDist(), and OPPOSITE_OVERTAKING_MAX_LOOKAHEAD.

Referenced by change(), MSLaneChangerSublane::change(), and changeOpposite().

Here is the caller graph for this function:

◆ initChanger()

void MSLaneChanger::initChanger ( )
protectedvirtual

Initialize the changer before looping over all vehicles.

Reimplemented in MSLaneChangerSublane.

Definition at line 164 of file MSLaneChanger.cpp.

References myChanger.

Referenced by MSLaneChangerSublane::initChanger(), and laneChange().

Here is the caller graph for this function:

◆ laneChange()

void MSLaneChanger::laneChange ( SUMOTime  t)

Start lane-change-process for all vehicles on the edge'e lanes.

Definition at line 141 of file MSLaneChanger.cpp.

References change(), initChanger(), myChanger, updateChanger(), updateLanes(), and vehInChanger().

Referenced by MSEdge::changeLanes().

Here is the caller graph for this function:

◆ mayChange()

bool MSLaneChanger::mayChange ( int  direction) const
protected

whether changing to the lane in the given direction should be considered

Definition at line 256 of file MSLaneChanger.cpp.

References MSBaseVehicle::getVClass(), myAllowsChanging, myCandi, and veh().

Referenced by change(), MSLaneChangerSublane::change(), MSLaneChangerSublane::checkChangeHelper(), MSLaneChangerSublane::checkChangeOpposite(), MSLaneChangerSublane::checkChangeToNewLane(), and MSLaneChangerSublane::startChangeSublane().

Here is the caller graph for this function:

◆ operator=()

MSLaneChanger & MSLaneChanger::operator= ( const MSLaneChanger )
private

Assignment operator.

◆ registerUnchanged()

void MSLaneChanger::registerUnchanged ( MSVehicle vehicle)
protected

Update changer for vehicles that did not change

Definition at line 394 of file MSLaneChanger.cpp.

References MSVehicle::getLaneChangeModel(), MSVehicleType::getLengthWithGap(), MSBaseVehicle::getVehicleType(), myCandi, MSAbstractLaneChangeModel::unchanged(), and veh().

Referenced by change(), MSLaneChangerSublane::change(), and startChange().

Here is the caller graph for this function:

◆ resolveDeadlock()

bool MSLaneChanger::resolveDeadlock ( MSVehicle vehicle,
std::pair< MSVehicle *const, double >  leader,
std::pair< MSVehicle *, double >  neighLead,
std::pair< MSVehicle *, double >  overtaken 
)
protected

keep stopping to resolve opposite-diretion deadlock while there is oncoming traffic The method may call saveBlockerLength to affect vehicle speed in the next step

Definition at line 1799 of file MSLaneChanger.cpp.

References DEBUG_COND, MSVehicle::getBestLanes(), Named::getID(), Named::getIDSecure(), MSLane::getIndex(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSVehicleType::getLengthWithGap(), MSVehicleType::getMinGap(), getOncomingOppositeVehicle(), MSVehicle::getPositionOnLane(), MSBaseVehicle::getVehicleType(), MSBaseVehicle::getWaitingSeconds(), OPPOSITE_OVERTAKING_DEADLOCK_WAIT, MSAbstractLaneChangeModel::saveBlockerLength(), SIMTIME, UNUSED_PARAMETER, and yieldToDeadlockOncoming().

Referenced by changeOpposite().

Here is the caller graph for this function:

◆ startChange()

bool MSLaneChanger::startChange ( MSVehicle vehicle,
ChangerIt from,
int  direction 
)
protected

Definition at line 447 of file MSLaneChanger.cpp.

References continueChange(), MSVehicle::getLaneChangeModel(), MSVehicle::isRemoteControlled(), myCandi, registerUnchanged(), and MSAbstractLaneChangeModel::startLaneChangeManeuver().

Referenced by change().

Here is the caller graph for this function:

◆ updateChanger()

void MSLaneChanger::updateChanger ( bool  vehHasChanged)
protectedvirtual

After the possible change, update the changer.

Reimplemented in MSLaneChangerSublane.

Definition at line 181 of file MSLaneChanger.cpp.

References myCandi, and veh().

Referenced by laneChange(), and MSLaneChangerSublane::updateChanger().

Here is the caller graph for this function:

◆ updateLanes()

void MSLaneChanger::updateLanes ( SUMOTime  t)
protected

During lane-change a temporary vehicle container is filled within the lanes (bad practice to modify foreign members, I know). Swap this container with the real one.

Definition at line 199 of file MSLaneChanger.cpp.

References myChanger.

Referenced by laneChange().

Here is the caller graph for this function:

◆ veh()

MSVehicle * MSLaneChanger::veh ( ConstChangerIt  ce) const
inlineprotected

Returns the furthes unhandled vehicle on this change-elements lane or 0 if there is none.

Definition at line 141 of file MSLaneChanger.h.

Referenced by change(), MSLaneChangerSublane::change(), checkChange(), MSLaneChangerSublane::checkChangeSublane(), findCandidate(), MSLaneChangerSublane::getLeaders(), getRealFollower(), getRealLeader(), mayChange(), registerUnchanged(), updateChanger(), and vehInChanger().

Here is the caller graph for this function:

◆ vehInChanger()

bool MSLaneChanger::vehInChanger ( ) const
inlineprotected

Check if there is a single change-candidate in the changer. Returns true if there is one.

Definition at line 128 of file MSLaneChanger.h.

References myChanger, and veh().

Referenced by laneChange().

Here is the caller graph for this function:

◆ yieldToDeadlockOncoming()

bool MSLaneChanger::yieldToDeadlockOncoming ( const MSVehicle vehicle,
const MSVehicle stoppedNeigh,
double  dist 
)
protected

check whether to keep stopping for oncoming vehicles in the deadlock zone

Definition at line 1748 of file MSLaneChanger.cpp.

References DEBUG_COND, MSVehicle::getFollower(), Named::getID(), Named::getIDSecure(), MSVehicleType::getLengthWithGap(), MSBaseVehicle::getVehicleType(), MSBaseVehicle::getWaitingSeconds(), OPPOSITE_OVERTAKING_DEADLOCK_WAIT, and SIMTIME.

Referenced by avoidDeadlock(), and resolveDeadlock().

Here is the caller graph for this function:

◆ yieldToOppositeWaiting()

bool MSLaneChanger::yieldToOppositeWaiting ( const MSVehicle vehicle,
const MSVehicle stoppedNeigh,
double  dist,
SUMOTime  deltaWait = 0 
)
protected

check whether to yield for oncoming vehicles that have waited longer for opposite overtaking

Definition at line 1776 of file MSLaneChanger.cpp.

References DEBUG_COND, MSVehicle::getFollower(), Named::getID(), MSBaseVehicle::getWaitingSeconds(), MSVehicle::getWaitingTime(), SIMTIME, and STEPS2TIME.

Referenced by changeOpposite(), and computeSafeOppositeLength().

Here is the caller graph for this function:

Field Documentation

◆ myAllowsChanging

const bool MSLaneChanger::myAllowsChanging
protected

Definition at line 320 of file MSLaneChanger.h.

Referenced by change(), and mayChange().

◆ myCandi

◆ myChanger

◆ myChangeToOpposite

const bool MSLaneChanger::myChangeToOpposite
protected

whether this edge allows changing to the opposite direction edge

Definition at line 323 of file MSLaneChanger.h.

Referenced by MSLaneChangerSublane::change(), and changeOpposite().


The documentation for this class was generated from the following files: