Eclipse SUMO - Simulation of Urban MObility
MSLeaderDistanceInfo Class Reference

saves leader/follower vehicles and their distances relative to an ego vehicle More...

#include <MSLeaderInfo.h>

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

Public Member Functions

virtual int addLeader (const MSVehicle *veh, bool beyond, double latOffset=0)
 
virtual int addLeader (const MSVehicle *veh, double gap, double latOffset=0, int sublane=-1)
 
virtual void addLeaders (MSLeaderDistanceInfo &other)
 updatd empty sublanes with vehicles and gaps from other More...
 
virtual void clear ()
 discard all information More...
 
void fixOppositeGaps (bool isFollower)
 subtract vehicle length from all gaps if the leader vehicle is driving in the opposite direction More...
 
CLeaderDist getClosest () const
 return vehicle with the smalles gap More...
 
const std::vector< double > & getDistances () const
 
void getSublaneBorders (int sublane, double latOffset, double &rightSide, double &leftSide) const
 
int getSublaneOffset () const
 
void getSubLanes (const MSVehicle *veh, double latOffset, int &rightmost, int &leftmost) const
 
const std::vector< const MSVehicle * > & getVehicles () const
 
bool hasStoppedVehicle () const
 whether a stopped vehicle is leader More...
 
bool hasVehicles () const
 
void moveSamePosTo (const MSVehicle *ego, MSLeaderDistanceInfo &other)
 
 MSLeaderDistanceInfo (const CLeaderDist &cLeaderDist, const double laneWidth)
 Construct for the non-sublane-case. More...
 
 MSLeaderDistanceInfo (const double laneWidth, const MSVehicle *ego, const double latOffset)
 Constructor. More...
 
int numFreeSublanes () const
 
int numSublanes () const
 
CLeaderDist operator[] (int sublane) const
 return the vehicle and its distance for the given sublane More...
 
void patchGaps (double amount)
 add given value to all gaps More...
 
void removeOpposite (const MSLane *lane)
 remove vehicles that are driving in the opposite direction (fully or partially) on the given lane More...
 
void setSublaneOffset (int offset)
 set number of sublanes by which to shift positions More...
 
virtual std::string toString () const
 print a debugging representation More...
 
virtual ~MSLeaderDistanceInfo ()
 Destructor. More...
 

Protected Attributes

int egoLeftMost
 
int egoRightMost
 borders of the ego vehicle for filtering of free sublanes More...
 
std::vector< double > myDistances
 
int myFreeSublanes
 the number of free sublanes More...
 
bool myHasVehicles
 
int myOffset
 an extra offset for shifting the interpretation of sublane borders (default [0,myWidth]) More...
 
std::vector< const MSVehicle * > myVehicles
 
double myWidth
 the width of the lane to which this instance applies More...
 

Detailed Description

saves leader/follower vehicles and their distances relative to an ego vehicle

Definition at line 144 of file MSLeaderInfo.h.

Constructor & Destructor Documentation

◆ MSLeaderDistanceInfo() [1/2]

MSLeaderDistanceInfo::MSLeaderDistanceInfo ( const double  laneWidth,
const MSVehicle ego,
const double  latOffset 
)

Constructor.

Definition at line 222 of file MSLeaderInfo.cpp.

◆ MSLeaderDistanceInfo() [2/2]

MSLeaderDistanceInfo::MSLeaderDistanceInfo ( const CLeaderDist cLeaderDist,
const double  laneWidth 
)

Construct for the non-sublane-case.

Definition at line 228 of file MSLeaderInfo.cpp.

References MSLeaderInfo::myHasVehicles, and MSLeaderInfo::myVehicles.

◆ ~MSLeaderDistanceInfo()

MSLeaderDistanceInfo::~MSLeaderDistanceInfo ( )
virtual

Destructor.

Definition at line 236 of file MSLeaderInfo.cpp.

Member Function Documentation

◆ addLeader() [1/2]

virtual int MSLeaderDistanceInfo::addLeader ( const MSVehicle veh,
bool  beyond,
double  latOffset = 0 
)
inlinevirtual

Reimplemented from MSLeaderInfo.

Reimplemented in MSCriticalFollowerDistanceInfo.

Definition at line 165 of file MSLeaderInfo.h.

References TL, and UNUSED_PARAMETER.

◆ addLeader() [2/2]

int MSLeaderDistanceInfo::addLeader ( const MSVehicle veh,
double  gap,
double  latOffset = 0,
int  sublane = -1 
)
virtual

◆ addLeaders()

void MSLeaderDistanceInfo::addLeaders ( MSLeaderDistanceInfo other)
virtual

updatd empty sublanes with vehicles and gaps from other

Definition at line 285 of file MSLeaderInfo.cpp.

References addLeader(), MIN2(), and MSLeaderInfo::numSublanes().

Referenced by MSLaneChangerSublane::checkChangeSublane().

Here is the caller graph for this function:

◆ clear()

void MSLeaderDistanceInfo::clear ( )
virtual

discard all information

Reimplemented from MSLeaderInfo.

Reimplemented in MSCriticalFollowerDistanceInfo.

Definition at line 298 of file MSLeaderInfo.cpp.

References MSLeaderInfo::clear(), myDistances, and MSLeaderInfo::myVehicles.

Referenced by MSCriticalFollowerDistanceInfo::clear().

Here is the caller graph for this function:

◆ fixOppositeGaps()

void MSLeaderDistanceInfo::fixOppositeGaps ( bool  isFollower)

subtract vehicle length from all gaps if the leader vehicle is driving in the opposite direction

Definition at line 333 of file MSLeaderInfo.cpp.

References myDistances, and MSLeaderInfo::myVehicles.

Referenced by MSLaneChangerSublane::checkChangeOpposite(), LIBSUMO_NAMESPACE::Vehicle::getNeighbors(), and MSVehicle::planMoveInternal().

Here is the caller graph for this function:

◆ getClosest()

CLeaderDist MSLeaderDistanceInfo::getClosest ( ) const

return vehicle with the smalles gap

Definition at line 358 of file MSLeaderInfo.cpp.

References MSLeaderInfo::hasVehicles(), myDistances, and MSLeaderInfo::myVehicles.

Referenced by MSLane::getFollower().

Here is the caller graph for this function:

◆ getDistances()

const std::vector<double>& MSLeaderDistanceInfo::getDistances ( ) const
inline

Definition at line 184 of file MSLeaderInfo.h.

References myDistances.

◆ getSublaneBorders()

void MSLeaderInfo::getSublaneBorders ( int  sublane,
double  latOffset,
double &  rightSide,
double &  leftSide 
) const
inherited

Definition at line 153 of file MSLeaderInfo.cpp.

References MSGlobals::gLateralResolution, MIN2(), MSLeaderInfo::myOffset, MSLeaderInfo::myVehicles, and MSLeaderInfo::myWidth.

Referenced by MSLCM_SL2015::checkBlockingVehicles(), MSLCM_SL2015::commitFollowSpeed(), MSLCM_SL2015::updateCFRelated(), MSLCM_SL2015::updateExpectedSublaneSpeeds(), and MSLCM_SL2015::updateGaps().

Here is the caller graph for this function:

◆ getSublaneOffset()

int MSLeaderInfo::getSublaneOffset ( ) const
inlineinherited

Definition at line 102 of file MSLeaderInfo.h.

References MSLeaderInfo::myOffset.

Referenced by MSVehicle::adaptToLeaders(), and MSLane::getFollowersOnConsecutive().

Here is the caller graph for this function:

◆ getSubLanes()

◆ getVehicles()

const std::vector<const MSVehicle*>& MSLeaderInfo::getVehicles ( ) const
inlineinherited

Definition at line 98 of file MSLeaderInfo.h.

References MSLeaderInfo::myVehicles.

◆ hasStoppedVehicle()

bool MSLeaderInfo::hasStoppedVehicle ( ) const
inherited

whether a stopped vehicle is leader

Definition at line 194 of file MSLeaderInfo.cpp.

References MSLeaderInfo::myHasVehicles, and MSLeaderInfo::myVehicles.

Referenced by MSLCM_SL2015::_wantsChangeSublane(), MSLCM_SL2015::checkStrategicChange(), and MSLCM_SL2015::mustOvertakeStopped().

Here is the caller graph for this function:

◆ hasVehicles()

bool MSLeaderInfo::hasVehicles ( ) const
inlineinherited

◆ moveSamePosTo()

void MSLeaderDistanceInfo::moveSamePosTo ( const MSVehicle ego,
MSLeaderDistanceInfo other 
)

Definition at line 375 of file MSLeaderInfo.cpp.

References MSLane::getEdge(), MSVehicle::getLane(), MSVehicle::getPositionOnLane(), myDistances, and MSLeaderInfo::myVehicles.

Referenced by MSLaneChangerSublane::checkChangeSublane().

Here is the caller graph for this function:

◆ numFreeSublanes()

int MSLeaderInfo::numFreeSublanes ( ) const
inlineinherited

Definition at line 90 of file MSLeaderInfo.h.

References MSLeaderInfo::myFreeSublanes.

Referenced by MSLane::addLeaders(), MSLane::getFollowersOnConsecutive(), MSLane::getLeadersOnConsecutive(), and MSLane::isInsertionSuccess().

Here is the caller graph for this function:

◆ numSublanes()

◆ operator[]()

CLeaderDist MSLeaderDistanceInfo::operator[] ( int  sublane) const

return the vehicle and its distance for the given sublane

Definition at line 305 of file MSLeaderInfo.cpp.

References myDistances, and MSLeaderInfo::myVehicles.

◆ patchGaps()

void MSLeaderDistanceInfo::patchGaps ( double  amount)

add given value to all gaps

Definition at line 349 of file MSLeaderInfo.cpp.

References myDistances, and MSLeaderInfo::myVehicles.

Referenced by MSLaneChangerSublane::checkChangeOpposite().

Here is the caller graph for this function:

◆ removeOpposite()

void MSLeaderInfo::removeOpposite ( const MSLane lane)
inherited

remove vehicles that are driving in the opposite direction (fully or partially) on the given lane

Definition at line 207 of file MSLeaderInfo.cpp.

References MSLane::getEdge(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSAbstractLaneChangeModel::isOpposite(), and MSLeaderInfo::myVehicles.

Referenced by MSVehicle::planMoveInternal().

Here is the caller graph for this function:

◆ setSublaneOffset()

void MSLeaderInfo::setSublaneOffset ( int  offset)
inherited

set number of sublanes by which to shift positions

Definition at line 187 of file MSLeaderInfo.cpp.

References MSGlobals::gLateralResolution, and MSLeaderInfo::myOffset.

Referenced by MSLaneChangerSublane::addOutsideLeaders(), MSLane::getFollowersOnConsecutive(), MSLaneChangerSublane::getLeaders(), and MSVehicle::planMoveInternal().

Here is the caller graph for this function:

◆ toString()

std::string MSLeaderDistanceInfo::toString ( ) const
virtual

Field Documentation

◆ egoLeftMost

int MSLeaderInfo::egoLeftMost
protectedinherited

◆ egoRightMost

int MSLeaderInfo::egoRightMost
protectedinherited

borders of the ego vehicle for filtering of free sublanes

Definition at line 135 of file MSLeaderInfo.h.

Referenced by MSCriticalFollowerDistanceInfo::addFollower(), MSLeaderInfo::addLeader(), addLeader(), MSLeaderInfo::clear(), and MSLeaderInfo::MSLeaderInfo().

◆ myDistances

◆ myFreeSublanes

◆ myHasVehicles

◆ myOffset

int MSLeaderInfo::myOffset
protectedinherited

an extra offset for shifting the interpretation of sublane borders (default [0,myWidth])

Definition at line 125 of file MSLeaderInfo.h.

Referenced by MSLeaderInfo::getSublaneBorders(), MSLeaderInfo::getSublaneOffset(), MSLeaderInfo::getSubLanes(), and MSLeaderInfo::setSublaneOffset().

◆ myVehicles

◆ myWidth

double MSLeaderInfo::myWidth
protectedinherited

the width of the lane to which this instance applies

Definition at line 122 of file MSLeaderInfo.h.

Referenced by MSLeaderInfo::getSublaneBorders(), and MSLeaderInfo::getSubLanes().


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