SUMO - Simulation of Urban MObility
MSLaneChangerSublane Class Reference

Performs lane changing of vehicles. More...

#include <MSLaneChangerSublane.h>

Inheritance diagram for MSLaneChangerSublane:
Inheritance graph
Collaboration diagram for MSLaneChangerSublane:
Collaboration graph

Public Types

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

Public Member Functions

void laneChange (SUMOTime t)
 Start lane-change-process for all vehicles on the edge'e lanes. More...
 
 MSLaneChangerSublane (const std::vector< MSLane *> *lanes, bool allowChanging)
 Constructor. More...
 
 ~MSLaneChangerSublane ()
 Destructor. More...
 

Protected Types

typedef MSAbstractLaneChangeModel::StateAndDist StateAndDist
 

Protected Member Functions

virtual bool change ()
 
virtual bool changeOpposite (std::pair< MSVehicle *, SUMOReal > leader)
 
int checkChange (int laneOffset, const MSLane *targetLane, const std::pair< MSVehicle *const, SUMOReal > &leader, const std::pair< MSVehicle *const, SUMOReal > &neighLead, const std::pair< MSVehicle *const, SUMOReal > &neighFollow, const std::vector< MSVehicle::LaneQ > &preb) const
 
StateAndDist checkChangeHelper (MSVehicle *vehicle, int laneOffset)
 helper function that calls checkChangeSublane and sets blocker information More...
 
int checkChangeSublane (int laneOffset, const std::vector< MSVehicle::LaneQ > &preb, SUMOReal &latDist) const
 check whether sub-lane changing in the given direction is desirable and possible More...
 
int checkChangeWithinEdge (int laneOffset, const std::pair< MSVehicle *const, SUMOReal > &leader, const std::vector< MSVehicle::LaneQ > &preb) const
 
bool continueChange (MSVehicle *vehicle, ChangerIt &from)
 continue a lane change maneuver and return whether the midpoint was passed in this step (used if gLaneChangeDuration > 0) More...
 
ChangerIt findCandidate ()
 Find current candidate. If there is none, myChanger.end() is returned. More...
 
MSLeaderDistanceInfo getLeaders (const ChangerIt &target, const MSVehicle *ego) const
 get leaders for ego on the given lane More...
 
std::pair< MSVehicle *const, SUMORealgetRealFollower (const ChangerIt &target) const
 
std::pair< MSVehicle *const, SUMORealgetRealLeader (const ChangerIt &target) const
 
void initChanger ()
 Initialize the changer before looping over all vehicles. More...
 
bool mayChange (int direction) const
 whether changing to the lane in the given direction should be considered More...
 
void registerUnchanged (MSVehicle *vehicle)
 
void startChange (MSVehicle *vehicle, ChangerIt &from, int direction)
 start the lane change maneuver (and finish it instantly if gLaneChangeDuration == 0) More...
 
bool startChangeSublane (MSVehicle *vehicle, ChangerIt &from, SUMOReal latDist)
 change by the specified amount and return whether a new lane was entered More...
 
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. More...
 

Static Protected Member Functions

static void computeOvertakingTime (const MSVehicle *vehicle, const MSVehicle *leader, SUMOReal gap, SUMOReal &timeToOvertake, SUMOReal &spaceToOvertake)
 Compute the time and space required for overtaking the given leader. More...
 
static MSVehiclegetCloserFollower (const SUMOReal maxPos, MSVehicle *follow1, MSVehicle *follow2)
 return the closer follower of ego More...
 

Protected Attributes

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

Private Member Functions

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

Detailed Description

Performs lane changing of vehicles.

Definition at line 49 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 102 of file MSLaneChanger.h.

§ ChangerIt

typedef Changer::iterator MSLaneChanger::ChangerIt
inherited

the iterator moving over the ChangeElems

Definition at line 105 of file MSLaneChanger.h.

§ ConstChangerIt

typedef Changer::const_iterator MSLaneChanger::ConstChangerIt
inherited

the iterator moving over the ChangeElems

Definition at line 108 of file MSLaneChanger.h.

§ StateAndDist

Constructor & Destructor Documentation

§ MSLaneChangerSublane() [1/3]

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

Constructor.

Definition at line 51 of file MSLaneChangerSublane.cpp.

§ ~MSLaneChangerSublane()

MSLaneChangerSublane::~MSLaneChangerSublane ( )

Destructor.

Definition at line 56 of file MSLaneChangerSublane.cpp.

§ MSLaneChangerSublane() [2/3]

MSLaneChangerSublane::MSLaneChangerSublane ( )
private

Default constructor.

§ MSLaneChangerSublane() [3/3]

MSLaneChangerSublane::MSLaneChangerSublane ( const MSLaneChangerSublane )
private

Copy constructor.

Member Function Documentation

§ change()

§ changeOpposite()

bool MSLaneChanger::changeOpposite ( std::pair< MSVehicle *, SUMOReal leader)
protectedvirtualinherited

try changing to the opposite direction edge.

XXX what about overtaking multiple vehicles?

XXX compute sensible distance

XXX compute sensible usable dist

XXX use a dedicated transformation function

XXX compute a bette lateral position

Definition at line 805 of file MSLaneChanger.cpp.

References MSCFModel::brakeGap(), MSEdge::canChangeToOpposite(), MSLaneChanger::checkChange(), MSLaneChanger::computeOvertakingTime(), DEBUG_COND, MSLaneChanger::findCandidate(), MSLane::forceVehicleInsertion(), MSVehicle::getBestLanes(), MSVehicle::getBestLanesContinuation(), MSVehicle::getCarFollowModel(), MSLinkContHelper::getConnectingLink(), MSLane::getEdge(), Named::getID(), MSBaseVehicle::getID(), Named::getIDSecure(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSLane::getLength(), MSVehicleType::getLengthWithGap(), MSCFModel::getMaxDecel(), MSLane::getOpposite(), MSLane::getOppositeFollower(), MSLane::getOppositeLeader(), MSLane::getOppositePos(), MSVehicle::getPositionOnLane(), MSCFModel::getSecureGap(), MSVehicle::getSpeed(), MSLane::getSpeedLimit(), MSLink::getState(), MSLane::getVehicleMaxSpeed(), MSBaseVehicle::getVehicleType(), MSLink::havePriority(), MSAbstractLaneChangeModel::isOpposite(), MSVehicle::isStopped(), LCA_BLOCKED, LCA_WANTS_LANECHANGE, MSVehicle::LaneQ::length, LINKSTATE_ZIPPER, MIN2(), MSVehicle::State::myBackPos, MSLaneChanger::myCandi, MSLaneChanger::myChangeToOpposite, MSVehicle::State::myPos, MSVehicle::myState, MSVehicle::nextStopDist(), MSMoveReminder::NOTIFICATION_LANE_CHANGE, SIMTIME, MSAbstractLaneChangeModel::startLaneChangeManeuver(), SUMOReal, and MSLaneChanger::veh().

Referenced by MSLaneChanger::change(), and MSLaneChanger::veh().

§ checkChange()

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

§ checkChangeHelper()

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

§ checkChangeSublane()

int MSLaneChangerSublane::checkChangeSublane ( int  laneOffset,
const std::vector< MSVehicle::LaneQ > &  preb,
SUMOReal latDist 
) 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

Definition at line 262 of file MSLaneChangerSublane.cpp.

References gDebugFlag1, MSBaseVehicle::getID(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), getLeaders(), MSLane::getRightSideOnEdge(), MSVehicle::influenceChangeDecision(), MSLaneChanger::myCandi, SIMTIME, MSLeaderDistanceInfo::toString(), MSLaneChanger::veh(), and MSAbstractLaneChangeModel::wantsChangeSublane().

Referenced by checkChangeHelper().

§ checkChangeWithinEdge()

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

§ computeOvertakingTime()

void MSLaneChanger::computeOvertakingTime ( const MSVehicle vehicle,
const MSVehicle leader,
SUMOReal  gap,
SUMOReal timeToOvertake,
SUMOReal 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 1028 of file MSLaneChanger.cpp.

References MSVehicle::getCarFollowModel(), MSVehicle::getLane(), MSVehicleType::getLengthWithGap(), MSCFModel::getMaxAccel(), MSVehicleType::getMinGap(), MSVehicle::getSpeed(), MSLane::getVehicleMaxSpeed(), MSBaseVehicle::getVehicleType(), sign, and SUMOReal.

Referenced by MSLaneChanger::changeOpposite(), and MSLaneChanger::veh().

§ continueChange()

§ findCandidate()

MSLaneChanger::ChangerIt MSLaneChanger::findCandidate ( )
protectedinherited

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

Definition at line 176 of file MSLaneChanger.cpp.

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

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

§ getCloserFollower()

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

return the closer follower of ego

Definition at line 547 of file MSLaneChanger.cpp.

References MSVehicle::getPositionOnLane().

Referenced by MSLaneChanger::getRealFollower(), and MSLaneChanger::veh().

§ getLeaders()

§ getRealFollower()

§ getRealLeader()

§ initChanger()

void MSLaneChanger::initChanger ( )
protectedinherited

Initialize the changer before looping over all vehicles.

Definition at line 122 of file MSLaneChanger.cpp.

References MSLaneChanger::myChanger.

Referenced by MSLaneChanger::laneChange().

§ laneChange()

void MSLaneChanger::laneChange ( SUMOTime  t)
inherited

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

Definition at line 99 of file MSLaneChanger.cpp.

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

Referenced by MSEdge::changeLanes().

§ mayChange()

bool MSLaneChanger::mayChange ( int  direction) const
protectedinherited

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

Definition at line 204 of file MSLaneChanger.cpp.

References MSLaneChanger::myAllowsChanging, MSLaneChanger::myCandi, MSLaneChanger::myChanger, and MSLaneChanger::veh().

Referenced by MSLaneChanger::change(), checkChangeHelper(), startChangeSublane(), and MSLaneChanger::veh().

§ operator=()

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

Assignment operator.

§ registerUnchanged()

void MSLaneChanger::registerUnchanged ( MSVehicle vehicle)
protectedinherited

§ startChange()

void MSLaneChanger::startChange ( MSVehicle vehicle,
ChangerIt from,
int  direction 
)
protectedinherited

§ startChangeSublane()

§ updateChanger()

void MSLaneChangerSublane::updateChanger ( bool  vehHasChanged)
protectedvirtual

§ updateLanes()

void MSLaneChanger::updateLanes ( SUMOTime  t)
protectedinherited

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

Definition at line 158 of file MSLaneChanger.cpp.

References MSLaneChanger::myChanger.

Referenced by MSLaneChanger::laneChange(), and MSLaneChanger::veh().

§ veh()

§ 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 116 of file MSLaneChanger.h.

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

Referenced by MSLaneChanger::laneChange().

Field Documentation

§ myAllowsChanging

bool MSLaneChanger::myAllowsChanging
protectedinherited

Definition at line 214 of file MSLaneChanger.h.

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

§ myCandi

§ myChanger

§ myChangeToOpposite

const bool MSLaneChanger::myChangeToOpposite
protectedinherited

whether this edge allows changing to the opposite direction edge

Definition at line 217 of file MSLaneChanger.h.

Referenced by MSLaneChanger::changeOpposite().


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