SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSAbstractLaneChangeModel Class Referenceabstract

Interface for lane-change models. More...

#include <MSAbstractLaneChangeModel.h>

Inheritance diagram for MSAbstractLaneChangeModel:
MSLCM_DK2008 MSLCM_JE2013 MSLCM_LC2013

Data Structures

class  MSLCMessager
 A class responsible for exchanging messages between cars involved in lane-change interaction. More...
 

Public Member Functions

bool alreadyMoved () const
 reset the flag whether a vehicle already moved to false More...
 
virtual void changed ()=0
 
void continueLaneChangeManeuver (bool moved)
 
void endLaneChangeManeuver ()
 
SUMOReal getLaneChangeCompletion () const
 return whether the vehicle passed the midpoint of a continuous lane change maneuver More...
 
int getLaneChangeDirection () const
 return the direction of the current lane change maneuver More...
 
SUMOTime getLastLaneChangeOffset () const
 
int getOwnState () const
 
MSLanegetShadowLane () const
 Returns the lane the vehicles shadow is on during continuouss lane change. More...
 
virtual void * inform (void *info, MSVehicle *sender)=0
 
bool isChangingLanes () const
 return true if the vehicle currently performs a lane change maneuver More...
 
bool isLaneChangeMidpointPassed () const
 return whether the vehicle passed the midpoint of a continuous lane change maneuver More...
 
 MSAbstractLaneChangeModel (MSVehicle &v)
 Constructor. More...
 
virtual SUMOReal patchSpeed (const SUMOReal min, const SUMOReal wanted, const SUMOReal max, const MSCFModel &cfModel)=0
 Called to adapt the speed in order to allow a lane change. More...
 
virtual void prepareStep ()
 
void removeLaneChangeShadow ()
 remove the shadow copy of a lane change maneuver More...
 
void resetMoved ()
 reset the flag whether a vehicle already moved to false More...
 
virtual void saveBlockerLength (SUMOReal length)
 reserve space at the end of the lane to avoid dead locks More...
 
void setOwnState (int state)
 
bool startLaneChangeManeuver (MSLane *source, MSLane *target, int direction)
 start the lane change maneuver and return whether it continues More...
 
void unchanged ()
 
virtual int wantsChange (int laneOffset, MSAbstractLaneChangeModel::MSLCMessager &msgPass, int blocked, const std::pair< MSVehicle *, SUMOReal > &leader, const std::pair< MSVehicle *, SUMOReal > &neighLead, const std::pair< MSVehicle *, SUMOReal > &neighFollow, const MSLane &neighLane, const std::vector< MSVehicle::LaneQ > &preb, MSVehicle **lastBlocked, MSVehicle **firstBlocked)=0
 Called to examine whether the vehicle wants to change using the given laneOffset. This method gets the information about the surrounding vehicles and whether another lane may be more preferable. More...
 
virtual ~MSAbstractLaneChangeModel ()
 Destructor. More...
 

Static Public Member Functions

static MSAbstractLaneChangeModelbuild (LaneChangeModel lcm, MSVehicle &vehicle)
 Factory method for instantiating new lane changing models. More...
 

Protected Member Functions

virtual bool congested (const MSVehicle *const neighLeader)
 
virtual bool predInteraction (const MSVehicle *const leader)
 

Protected Attributes

bool myAlreadyMoved
 whether the vehicle has already moved this step More...
 
const MSCFModelmyCarFollowModel
 The vehicle's car following model. More...
 
bool myHaveShadow
 Wether a vehicle shadow exists. More...
 
SUMOReal myLaneChangeCompletion
 progress of the lane change maneuver 0:started, 1:complete More...
 
int myLaneChangeDirection
 direction of the lane change maneuver -1 means right, 1 means left More...
 
bool myLaneChangeMidpointPassed
 whether myLane has already been set to the target of the lane-change maneuver More...
 
SUMOTime myLastLaneChangeOffset
 information how long ago the vehicle has performed a lane-change More...
 
int myOwnState
 The current state of the vehicle. More...
 
MSLanemyShadowLane
 The lane the vehicle shadow is on during a continuous lane change. More...
 
MSVehiclemyVehicle
 The vehicle this lane-changer belongs to. More...
 

Private Member Functions

MSAbstractLaneChangeModeloperator= (const MSAbstractLaneChangeModel &s)
 Invalidated assignment operator. More...
 

Detailed Description

Interface for lane-change models.

Definition at line 113 of file MSAbstractLaneChangeModel.h.

Constructor & Destructor Documentation

MSAbstractLaneChangeModel::MSAbstractLaneChangeModel ( MSVehicle v)

Constructor.

Parameters
[in]vThe vehicle this lane-changer belongs to

Definition at line 62 of file MSAbstractLaneChangeModel.cpp.

MSAbstractLaneChangeModel::~MSAbstractLaneChangeModel ( )
virtual

Member Function Documentation

bool MSAbstractLaneChangeModel::alreadyMoved ( ) const
inline

reset the flag whether a vehicle already moved to false

Definition at line 273 of file MSAbstractLaneChangeModel.h.

References myAlreadyMoved.

Referenced by MSLane::executeMovements().

MSAbstractLaneChangeModel * MSAbstractLaneChangeModel::build ( LaneChangeModel  lcm,
MSVehicle vehicle 
)
static

Factory method for instantiating new lane changing models.

Parameters
[in]lcmThe type of model to build
[in]vehicleThe vehicle for which this model shall be built

Definition at line 48 of file MSAbstractLaneChangeModel.cpp.

References LCM_DK2008, LCM_JE2013, LCM_LC2013, and toString().

Referenced by MSVehicle::MSVehicle().

virtual void MSAbstractLaneChangeModel::changed ( )
pure virtual
bool MSAbstractLaneChangeModel::congested ( const MSVehicle *const  neighLeader)
protectedvirtual
void MSAbstractLaneChangeModel::endLaneChangeManeuver ( )
inline
SUMOReal MSAbstractLaneChangeModel::getLaneChangeCompletion ( ) const
inline

return whether the vehicle passed the midpoint of a continuous lane change maneuver

Definition at line 258 of file MSAbstractLaneChangeModel.h.

References myLaneChangeCompletion.

Referenced by MSVehicle::getAngle().

int MSAbstractLaneChangeModel::getLaneChangeDirection ( ) const
inline

return the direction of the current lane change maneuver

Definition at line 268 of file MSAbstractLaneChangeModel.h.

References myLaneChangeDirection.

Referenced by MSVehicle::getAngle().

SUMOTime MSAbstractLaneChangeModel::getLastLaneChangeOffset ( ) const
inline

Definition at line 247 of file MSAbstractLaneChangeModel.h.

References myLastLaneChangeOffset.

int MSAbstractLaneChangeModel::getOwnState ( ) const
inline
MSLane* MSAbstractLaneChangeModel::getShadowLane ( ) const
inline

Returns the lane the vehicles shadow is on during continuouss lane change.

Returns
The vehicle's shadow lane

Definition at line 242 of file MSAbstractLaneChangeModel.h.

References myShadowLane.

Referenced by MSLane::executeMovements(), and MSVehicle::getPosition().

bool MSAbstractLaneChangeModel::isChangingLanes ( ) const
inline

return true if the vehicle currently performs a lane change maneuver

Definition at line 263 of file MSAbstractLaneChangeModel.h.

References myLaneChangeCompletion, and NUMERICAL_EPS.

Referenced by MSLaneChanger::change(), continueLaneChangeManeuver(), MSLane::executeMovements(), MSVehicle::getAngle(), and MSVehicle::getPosition().

bool MSAbstractLaneChangeModel::isLaneChangeMidpointPassed ( ) const
inline

return whether the vehicle passed the midpoint of a continuous lane change maneuver

Definition at line 253 of file MSAbstractLaneChangeModel.h.

References myLaneChangeMidpointPassed.

Referenced by MSVehicle::getAngle(), MSVehicle::getPosition(), and MSVehicle::planMoveInternal().

MSAbstractLaneChangeModel& MSAbstractLaneChangeModel::operator= ( const MSAbstractLaneChangeModel s)
private

Invalidated assignment operator.

virtual SUMOReal MSAbstractLaneChangeModel::patchSpeed ( const SUMOReal  min,
const SUMOReal  wanted,
const SUMOReal  max,
const MSCFModel cfModel 
)
pure virtual

Called to adapt the speed in order to allow a lane change.

It is guaranteed that min<=wanted<=max, but the implementation needs to make sure that the return value is between min and max.

Parameters
minThe minimum resulting speed
wantedThe aspired speed of the car following model
maxThe maximum resulting speed
cfModelThe model used
Returns
the new speed of the vehicle as proposed by the lane changer

Implemented in MSLCM_LC2013, MSLCM_DK2008, and MSLCM_JE2013.

Referenced by MSCFModel_Daniel1::moveHelper(), MSCFModel_SmartSK::moveHelper(), MSCFModel_KraussOrig1::moveHelper(), and MSCFModel::moveHelper().

virtual void MSAbstractLaneChangeModel::prepareStep ( )
inlinevirtual

Reimplemented in MSLCM_LC2013, MSLCM_JE2013, and MSLCM_DK2008.

Definition at line 200 of file MSAbstractLaneChangeModel.h.

Referenced by MSVehicle::executeMove().

void MSAbstractLaneChangeModel::removeLaneChangeShadow ( )

remove the shadow copy of a lane change maneuver

Definition at line 189 of file MSAbstractLaneChangeModel.cpp.

References myHaveShadow, myShadowLane, myVehicle, MSMoveReminder::NOTIFICATION_LANE_CHANGE, and MSLane::removeVehicle().

Referenced by continueLaneChangeManeuver(), and endLaneChangeManeuver().

void MSAbstractLaneChangeModel::resetMoved ( )
inline

reset the flag whether a vehicle already moved to false

Definition at line 278 of file MSAbstractLaneChangeModel.h.

References myAlreadyMoved.

Referenced by MSVehicle::planMove().

virtual void MSAbstractLaneChangeModel::saveBlockerLength ( SUMOReal  length)
inlinevirtual

reserve space at the end of the lane to avoid dead locks

Reimplemented in MSLCM_LC2013, and MSLCM_JE2013.

Definition at line 304 of file MSAbstractLaneChangeModel.h.

References UNUSED_PARAMETER.

Referenced by MSLCM_JE2013::saveBlockerLength(), and MSLCM_LC2013::saveBlockerLength().

void MSAbstractLaneChangeModel::setOwnState ( int  state)
inline

Definition at line 196 of file MSAbstractLaneChangeModel.h.

References myOwnState.

Referenced by MSLaneChanger::change().

void MSAbstractLaneChangeModel::unchanged ( )
inline

Definition at line 235 of file MSAbstractLaneChangeModel.h.

References DELTA_T, and myLastLaneChangeOffset.

Referenced by MSLaneChanger::registerUnchanged().

virtual int MSAbstractLaneChangeModel::wantsChange ( int  laneOffset,
MSAbstractLaneChangeModel::MSLCMessager msgPass,
int  blocked,
const std::pair< MSVehicle *, SUMOReal > &  leader,
const std::pair< MSVehicle *, SUMOReal > &  neighLead,
const std::pair< MSVehicle *, SUMOReal > &  neighFollow,
const MSLane neighLane,
const std::vector< MSVehicle::LaneQ > &  preb,
MSVehicle **  lastBlocked,
MSVehicle **  firstBlocked 
)
pure virtual

Called to examine whether the vehicle wants to change using the given laneOffset. This method gets the information about the surrounding vehicles and whether another lane may be more preferable.

Implemented in MSLCM_LC2013, MSLCM_DK2008, and MSLCM_JE2013.

Referenced by MSLaneChanger::checkChange().

Field Documentation

bool MSAbstractLaneChangeModel::myAlreadyMoved
protected

whether the vehicle has already moved this step

Definition at line 334 of file MSAbstractLaneChangeModel.h.

Referenced by alreadyMoved(), continueLaneChangeManeuver(), and resetMoved().

bool MSAbstractLaneChangeModel::myHaveShadow
protected
SUMOReal MSAbstractLaneChangeModel::myLaneChangeCompletion
protected

progress of the lane change maneuver 0:started, 1:complete

Definition at line 325 of file MSAbstractLaneChangeModel.h.

Referenced by continueLaneChangeManeuver(), endLaneChangeManeuver(), getLaneChangeCompletion(), isChangingLanes(), and startLaneChangeManeuver().

int MSAbstractLaneChangeModel::myLaneChangeDirection
protected

direction of the lane change maneuver -1 means right, 1 means left

Definition at line 328 of file MSAbstractLaneChangeModel.h.

Referenced by continueLaneChangeManeuver(), getLaneChangeDirection(), and startLaneChangeManeuver().

bool MSAbstractLaneChangeModel::myLaneChangeMidpointPassed
protected

whether myLane has already been set to the target of the lane-change maneuver

Definition at line 331 of file MSAbstractLaneChangeModel.h.

Referenced by continueLaneChangeManeuver(), isLaneChangeMidpointPassed(), and startLaneChangeManeuver().

SUMOTime MSAbstractLaneChangeModel::myLastLaneChangeOffset
protected

information how long ago the vehicle has performed a lane-change

Definition at line 322 of file MSAbstractLaneChangeModel.h.

Referenced by MSLCM_DK2008::changed(), MSLCM_JE2013::changed(), MSLCM_LC2013::changed(), continueLaneChangeManeuver(), getLastLaneChangeOffset(), startLaneChangeManeuver(), and unchanged().

MSLane* MSAbstractLaneChangeModel::myShadowLane
protected

The lane the vehicle shadow is on during a continuous lane change.

Definition at line 337 of file MSAbstractLaneChangeModel.h.

Referenced by continueLaneChangeManeuver(), endLaneChangeManeuver(), getShadowLane(), removeLaneChangeShadow(), startLaneChangeManeuver(), and ~MSAbstractLaneChangeModel().


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