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

Performs lane changing of vehicles. More...

#include <MSLaneChangerSublane.h>

Inheritance diagram for MSLaneChangerSublane:
[legend]
Collaboration diagram for MSLaneChangerSublane:
[legend]

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)
std::pair< double, SUMOTimegetLastBlocked (int index) const
 retrieve properties of a blocked vehicle that wants to chane to the lane with the given index
void laneChange (SUMOTime t)
 Start lane-change-process for all vehicles on the edge'e lanes.
 MSLaneChangerSublane (const std::vector< MSLane * > *lanes, bool allowChanging)
 Constructor.
 ~MSLaneChangerSublane ()
 Destructor.

Protected Types

typedef MSAbstractLaneChangeModel::StateAndDist StateAndDist

Protected Member Functions

void abortLCManeuver (MSVehicle *vehicle)
 immediately stop lane-changing and register vehicle as unchanged
void addOutsideLeaders (const MSVehicle *vehicle, MSLeaderDistanceInfo &leaders) const
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
StateAndDist checkChangeHelper (MSVehicle *vehicle, int laneOffset, LaneChangeAction alternatives)
 helper function that calls checkChangeSublane and sets blocker information
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 checkChangeSublane (int laneOffset, LaneChangeAction alternatives, const std::vector< MSVehicle::LaneQ > &preb, double &latDist, double &maneuverDist) const
 check whether sub-lane changing in the given direction is desirable and possible
bool checkChangeToNewLane (MSVehicle *vehicle, const int direction, ChangerIt from, ChangerIt to)
 check whether the given vehicle has entered the new lane 'to->lane' during a sublane LC-step
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)
bool continueChangeSublane (MSVehicle *vehicle, ChangerIt &from)
 Continue a sublane-lane change maneuver and return whether the midpoint was passed in this step.
ChangerIt findCandidate ()
 Find current candidate. If there is none, myChanger.end() is returned.
MSLeaderDistanceInfo getLeaders (const ChangerIt &target, const MSVehicle *ego) const
 get leaders for ego on the given lane
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 outputLCEnded (MSVehicle *vehicle, ChangerIt &from, ChangerIt &to, int direction)
 optional output for end of lane-change maneuvre
void outputLCStarted (MSVehicle *vehicle, ChangerIt &from, ChangerIt &to, int direction, double maneuverDist)
 optional output for start of lane-change maneuvre
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)
bool startChangeSublane (MSVehicle *vehicle, ChangerIt &from, double latDist, double maneuverDist)
 change by the specified amount and return whether a new lane was entered
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 std::pair< MSVehicle *, double > findClosestLeader (const MSLeaderDistanceInfo &leaders, const MSVehicle *vehicle)
 find the closest leader that prevents ego vehicle from passing on the current lane
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
bool myCheckedChangeOpposite
 whether checkChangeOpposite was called for the current vehicle

Private Member Functions

 MSLaneChangerSublane ()
 Default constructor.
 MSLaneChangerSublane (const MSLaneChangerSublane &)
 Copy constructor.
MSLaneChangerSublaneoperator= (const MSLaneChangerSublane &)
 Assignment operator.

Detailed Description

Performs lane changing of vehicles.

Definition at line 40 of file MSLaneChangerSublane.h.

Member Typedef Documentation

◆ Changer

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

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

Definition at line 117 of file MSLaneChanger.h.

◆ ChangerIt

typedef Changer::iterator MSLaneChanger::ChangerIt
inherited

the iterator moving over the ChangeElems

Definition at line 120 of file MSLaneChanger.h.

◆ ConstChangerIt

typedef Changer::const_iterator MSLaneChanger::ConstChangerIt
inherited

the iterator moving over the ChangeElems

Definition at line 123 of file MSLaneChanger.h.

◆ StateAndDist

Constructor & Destructor Documentation

◆ MSLaneChangerSublane() [1/3]

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

Constructor.

Definition at line 54 of file MSLaneChangerSublane.cpp.

References MSLaneChanger::MSLaneChanger(), and MSLaneChanger::myChanger.

Referenced by MSLaneChangerSublane(), and operator=().

Here is the caller graph for this function:

◆ ~MSLaneChangerSublane()

MSLaneChangerSublane::~MSLaneChangerSublane ( )

Destructor.

Definition at line 70 of file MSLaneChangerSublane.cpp.

◆ MSLaneChangerSublane() [2/3]

MSLaneChangerSublane::MSLaneChangerSublane ( )
private

Default constructor.

◆ MSLaneChangerSublane() [3/3]

MSLaneChangerSublane::MSLaneChangerSublane ( const MSLaneChangerSublane & )
private

Copy constructor.

References MSLaneChangerSublane().

Member Function Documentation

◆ abortLCManeuver()

void MSLaneChangerSublane::abortLCManeuver ( MSVehicle * vehicle)
protected

◆ addOutsideLeaders()

◆ applyTraCICommands()

bool MSLaneChanger::applyTraCICommands ( MSVehicle * vehicle)
protectedinherited

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 450 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 )
protectedinherited

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 1668 of file MSLaneChanger.cpp.

References DEBUG_COND, MSVehicle::getBestLanes(), MSVehicle::getBestLanesContinuation(), 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()

bool MSLaneChangerSublane::change ( )
protectedvirtual

Find a new candidate and try to change it.

myAllowsChanging

Reimplemented from MSLaneChanger.

Definition at line 114 of file MSLaneChangerSublane.cpp.

References abortLCManeuver(), MSVehicle::adaptBestLanesOccupation(), MSAbstractLaneChangeModel::alreadyChanged(), MSLaneChanger::changeOpposite(), checkChangeHelper(), MSLaneChanger::checkTraCICommands(), MSAbstractLaneChangeModel::clearNeighbors(), continueChangeSublane(), DEBUG_COND, MSAbstractLaneChangeModel::debugVehicle(), MSAbstractLaneChangeModel::decideDirection(), MSAbstractLaneChangeModel::StateAndDist::dir, MSLaneChanger::findCandidate(), findClosestLeader(), Named::getID(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), getLeaders(), MSAbstractLaneChangeModel::getManeuverDist(), MSAbstractLaneChangeModel::getSpeedLat(), MSBaseVehicle::getVClass(), MSLaneChanger::hasOppositeStop(), MSLeaderInfo::hasVehicles(), MSVehicle::influenceChangeDecision(), MSVehicle::isActive(), MSAbstractLaneChangeModel::isChangingLanes(), MSAbstractLaneChangeModel::isOpposite(), MSVehicle::isStoppedOnLane(), MSAbstractLaneChangeModel::StateAndDist::latDist, LCA_BLOCKED, LCA_LEFT, LCA_NONE, LCA_RIGHT, LCA_URGENT, LCA_WANTS_LANECHANGE, MSAbstractLaneChangeModel::StateAndDist::maneuverDist, MSLaneChanger::mayChange(), MSLaneChanger::myCandi, MSLaneChanger::myChanger, MSLaneChanger::myChangeToOpposite, myCheckedChangeOpposite, MSLaneChanger::registerUnchanged(), MSAbstractLaneChangeModel::setOwnState(), SIMTIME, startChangeSublane(), MSAbstractLaneChangeModel::StateAndDist::state, SVC_EMERGENCY, toString(), MSVehicle::updateBestLanes(), MSAbstractLaneChangeModel::updateExpectedSublaneSpeeds(), and MSLaneChanger::veh().

◆ changeOpposite()

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

try changing to the opposite direction edge.

Definition at line 1226 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(), MSLane::getVehicleMaxSpeed(), MSBaseVehicle::getVehicleType(), MSLink::getViaLaneOrLane(), MSBaseVehicle::getWaitingSeconds(), MSGlobals::gLefthand, 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
protectedinherited

Definition at line 769 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, myChanger, 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:

◆ checkChangeHelper()

MSLaneChangerSublane::StateAndDist MSLaneChangerSublane::checkChangeHelper ( MSVehicle * vehicle,
int laneOffset,
LaneChangeAction alternatives )
protected

helper function that calls checkChangeSublane and sets blocker information

Definition at line 293 of file MSLaneChangerSublane.cpp.

References checkChangeSublane(), MSVehicle::getBestLanes(), MSLaneChanger::getBestLanesOpposite(), MSVehicle::getLaneChangeModel(), MSAbstractLaneChangeModel::isOpposite(), LCA_BLOCKED, LCA_URGENT, LCA_WANTS_LANECHANGE, MSLaneChanger::mayChange(), and MSLaneChanger::myCandi.

Referenced by change().

Here is the caller graph for this function:

◆ checkChangeOpposite()

bool MSLaneChangerSublane::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

◆ checkChangeSublane()

int MSLaneChangerSublane::checkChangeSublane ( int laneOffset,
LaneChangeAction alternatives,
const std::vector< MSVehicle::LaneQ > & preb,
double & latDist,
double & maneuverDist ) const
protected

check whether sub-lane changing in the given direction is desirable and possible

Parameters
[in]laneOffsetThe direction in which changing should be checked
[in]leadersThe candidate vehicle's leaders
[in]prebThe bestLanse of the candidaet vehicle
[out]latDistThe distance by which the vehicle changes laterally
[out]maneuverDistThe lateral distance for the complete envisioned maneuver (used for maneuver continuation in non-actionsteps).

Definition at line 645 of file MSLaneChangerSublane.cpp.

References MSLeaderDistanceInfo::addLeaders(), addOutsideLeaders(), DEBUG_COND, MSVehicle::getBackPositionOnLane(), MSAbstractLaneChangeModel::getCanceledState(), Named::getID(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSLane::getRightSideOnEdge(), MSLane::getWidth(), MSLeaderInfo::hasVehicles(), MSVehicle::influenceChangeDecision(), MSLeaderDistanceInfo::moveSamePosTo(), MSLaneChanger::myCandi, MSAbstractLaneChangeModel::saveLCState(), MSAbstractLaneChangeModel::saveNeighbors(), SIMTIME, MSLeaderDistanceInfo::toString(), toString(), MSLaneChanger::veh(), and MSAbstractLaneChangeModel::wantsChangeSublane().

Referenced by checkChangeHelper().

Here is the caller graph for this function:

◆ checkChangeToNewLane()

bool MSLaneChangerSublane::checkChangeToNewLane ( MSVehicle * vehicle,
const int direction,
ChangerIt from,
ChangerIt to )
protected

◆ checkChangeWithinEdge()

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

Definition at line 751 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)
protectedinherited

Take into account traci LC-commands.

Note
This is currently only used within non-actionsteps.

Definition at line 429 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 )
staticprotectedinherited

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 2234 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 )
protectedinherited

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

Definition at line 1909 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 )
staticprotectedinherited

◆ continueChange()

◆ continueChangeSublane()

bool MSLaneChangerSublane::continueChangeSublane ( MSVehicle * vehicle,
ChangerIt & from )
protected

Continue a sublane-lane change maneuver and return whether the midpoint was passed in this step.

Definition at line 318 of file MSLaneChangerSublane.cpp.

References MSAbstractLaneChangeModel::computeSpeedLat(), DEBUG_COND, Named::getID(), MSVehicle::getLaneChangeModel(), MSAbstractLaneChangeModel::getManeuverDist(), LCA_URGENT, SIMTIME, SPEED2DIST, and startChangeSublane().

Referenced by change().

Here is the caller graph for this function:

◆ findCandidate()

MSLaneChanger::ChangerIt MSLaneChanger::findCandidate ( )
protectedinherited

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

Definition at line 242 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:

◆ findClosestLeader()

std::pair< MSVehicle *, double > MSLaneChangerSublane::findClosestLeader ( const MSLeaderDistanceInfo & leaders,
const MSVehicle * vehicle )
staticprotected

find the closest leader that prevents ego vehicle from passing on the current lane

Definition at line 856 of file MSLaneChangerSublane.cpp.

References MSVehicle::getCenterOnEdge(), MSVehicle::getLane(), MSVehicleType::getMinGapLat(), MSBaseVehicle::getVehicleType(), MSLane::getWidth(), MSVehicleType::getWidth(), MSBaseVehicle::isSelected(), MSLeaderInfo::numSublanes(), and SIMTIME.

Referenced by 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 )
staticprotectedinherited

Definition at line 2139 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 )
staticprotectedinherited

◆ getChanger()

Changer & MSLaneChanger::getChanger ( )
inlineinherited

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

Definition at line 126 of file MSLaneChanger.h.

References myChanger.

◆ getCloserFollower()

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

return the closer follower of ego

Definition at line 736 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() )
staticprotectedinherited

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 2357 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(), MSBaseVehicle::getVClass(), 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 )
staticprotectedinherited

return the next lane in conts beyond lane or nullptr

Definition at line 2546 of file MSLaneChanger.cpp.

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

Referenced by getColumnleader().

Here is the caller graph for this function:

◆ getLastBlocked()

std::pair< double, SUMOTime > MSLaneChanger::getLastBlocked ( int index) const
inherited

retrieve properties of a blocked vehicle that wants to chane to the lane with the given index

Definition at line 2577 of file MSLaneChanger.cpp.

References myChanger.

◆ getLeaders()

MSLeaderDistanceInfo MSLaneChangerSublane::getLeaders ( const ChangerIt & target,
const MSVehicle * ego ) const
protected

get leaders for ego on the given lane

Definition at line 597 of file MSLaneChangerSublane.cpp.

References DEBUG_COND, MSVehicle::getBackPositionOnLane(), Named::getID(), MSVehicle::getLane(), MSVehicle::getLeftSideOnLane(), MSVehicleType::getMinGap(), MSVehicle::getPositionOnLane(), MSVehicle::getRightSideOnLane(), MSBaseVehicle::getVehicleType(), MSGlobals::gLateralResolution, SIMTIME, toString(), and MSLaneChanger::veh().

Referenced by change(), and checkChangeToNewLane().

Here is the caller graph for this function:

◆ getMaxOvertakingSpeed()

double MSLaneChanger::getMaxOvertakingSpeed ( const MSVehicle * vehicle,
double maxSpaceToOvertake )
staticprotectedinherited

compute maximum maneuver speed

Definition at line 2567 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 )
protectedinherited

Definition at line 2060 of file MSLaneChanger.cpp.

References gDebugFlag5, MSVehicle::getBestLanesContinuation(), Named::getID(), Named::getIDSecure(), MSVehicle::getLane(), MSLane::getLeader(), MSVehicle::getPositionOnLane(), 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 )
protectedinherited

Definition at line 2021 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
protectedinherited

Definition at line 658 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
protectedinherited

◆ hasOppositeStop()

bool MSLaneChanger::hasOppositeStop ( MSVehicle * vehicle)
staticprotectedinherited

whether vehicle has an opposite-direction stop within relevant range

Definition at line 1120 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 MSLaneChangerSublane::initChanger ( )
protectedvirtual

Initialize the changer before looping over all vehicles.

Reimplemented from MSLaneChanger.

Definition at line 73 of file MSLaneChangerSublane.cpp.

References MSLaneChanger::initChanger(), and MSLaneChanger::myChanger.

◆ laneChange()

void MSLaneChanger::laneChange ( SUMOTime t)
inherited

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

Definition at line 160 of file MSLaneChanger.cpp.

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

◆ mayChange()

bool MSLaneChanger::mayChange ( int direction) const
protectedinherited

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

Definition at line 281 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=()

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

Assignment operator.

References MSLaneChangerSublane().

◆ outputLCEnded()

void MSLaneChangerSublane::outputLCEnded ( MSVehicle * vehicle,
ChangerIt & from,
ChangerIt & to,
int direction )
protected

◆ outputLCStarted()

void MSLaneChangerSublane::outputLCStarted ( MSVehicle * vehicle,
ChangerIt & from,
ChangerIt & to,
int direction,
double maneuverDist )
protected

◆ registerUnchanged()

void MSLaneChanger::registerUnchanged ( MSVehicle * vehicle)
protectedinherited

Update changer for vehicles that did not change

Definition at line 419 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 )
protectedinherited

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 1837 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 )
protectedinherited

Definition at line 472 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:

◆ startChangeSublane()

bool MSLaneChangerSublane::startChangeSublane ( MSVehicle * vehicle,
ChangerIt & from,
double latDist,
double maneuverDist )
protected

change by the specified amount and return whether a new lane was entered

Definition at line 340 of file MSLaneChangerSublane.cpp.

References abortLCManeuver(), checkChangeToNewLane(), MSVehicle::computeAngle(), DEBUG_COND, DELTA_T, DIST2SPEED, MSVehicle::getActionStepLength(), MSVehicle::getActionStepLengthSecs(), MSVehicle::getAngle(), MSAbstractLaneChangeModel::getCommittedSpeed(), MSLane::getEdge(), Named::getID(), Named::getIDSecure(), MSLane::getIndex(), MSVehicle::getInfluencer(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSVehicle::getLateralPositionOnLane(), MSVehicle::getLatOffset(), MSAbstractLaneChangeModel::getManeuverDist(), MSVehicleType::getMaxSpeedLat(), MSLane::getOpposite(), MSAbstractLaneChangeModel::getOwnState(), MSAbstractLaneChangeModel::getPreviousManeuverDist(), MSAbstractLaneChangeModel::getPrevState(), MSLane::getRightSideOnEdge(), MSAbstractLaneChangeModel::getShadowLane(), MSBaseVehicle::getVehicleType(), MSBaseVehicle::getWidth(), MSLane::getWidth(), Position::INVALID, MSAbstractLaneChangeModel::isOpposite(), MSVehicle::isRemoteControlled(), LCA_CHANGE_REASONS, LCA_SUBLANE, LCA_TRACI, M_PI, MSLaneChanger::mayChange(), MSVehicle::myCachedPosition, MSLaneChanger::myChanger, MSVehicle::myFurtherLanesPosLat, MSVehicle::State::myPosLat, MSVehicle::myState, outputLCEnded(), outputLCStarted(), RAD2DEG, MSVehicle::setAngle(), MSAbstractLaneChangeModel::setManeuverDist(), MSAbstractLaneChangeModel::setSpeedLat(), MSVehicle::Influencer::setSublaneChange(), SIMTIME, toString(), MSAbstractLaneChangeModel::updateSafeLatDist(), MSAbstractLaneChangeModel::updateShadowLane(), and MSAbstractLaneChangeModel::updateTargetLane().

Referenced by change(), checkChangeOpposite(), and continueChangeSublane().

Here is the caller graph for this function:

◆ updateChanger()

◆ updateLanes()

void MSLaneChanger::updateLanes ( SUMOTime t)
protectedinherited

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 220 of file MSLaneChanger.cpp.

References myChanger.

Referenced by laneChange().

Here is the caller graph for this function:

◆ veh()

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

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

Definition at line 152 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
inlineprotectedinherited

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

Definition at line 139 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 )
protectedinherited

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

Definition at line 1786 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 )
protectedinherited

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

Definition at line 1814 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
protectedinherited

Definition at line 331 of file MSLaneChanger.h.

Referenced by change(), mayChange(), and MSLaneChanger().

◆ myCandi

◆ myChanger

◆ myChangeToOpposite

const bool MSLaneChanger::myChangeToOpposite
protectedinherited

whether this edge allows changing to the opposite direction edge

Definition at line 334 of file MSLaneChanger.h.

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

◆ myCheckedChangeOpposite

bool MSLaneChangerSublane::myCheckedChangeOpposite
protected

whether checkChangeOpposite was called for the current vehicle

Definition at line 118 of file MSLaneChangerSublane.h.

Referenced by change(), and checkChangeOpposite().


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