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_DK2004

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 ()
 
virtual void fulfillChangeRequest (MSVehicle::ChangeRequest request)
 
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...
 
virtual void requestLaneChange (MSVehicle::ChangeRequest request)
 
void resetMoved ()
 reset the flag whether a vehicle already moved to false 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 wantsChangeToLeft (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)=0
 Called to examine whether the vehicle wants to change to left This method gets the information about the surrounding vehicles and whether another lane may be more preferable. More...
 
virtual int wantsChangeToRight (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)=0
 Called to examine whether the vehicle wants to change to right This method gets the information about the surrounding vehicles and whether another lane may be more preferable. More...
 
virtual ~MSAbstractLaneChangeModel ()
 Destructor. 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...
 
MSVehicle::ChangeRequest myChangeRequest
 
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 102 of file MSAbstractLaneChangeModel.h.

Constructor & Destructor Documentation

MSAbstractLaneChangeModel::MSAbstractLaneChangeModel ( MSVehicle v)

Constructor.

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

Definition at line 44 of file MSAbstractLaneChangeModel.cpp.

MSAbstractLaneChangeModel::~MSAbstractLaneChangeModel ( )
virtual

Destructor.

Definition at line 61 of file MSAbstractLaneChangeModel.cpp.

References removeLaneChangeShadow().

Member Function Documentation

bool MSAbstractLaneChangeModel::alreadyMoved ( ) const
inline

reset the flag whether a vehicle already moved to false

Definition at line 265 of file MSAbstractLaneChangeModel.h.

References myAlreadyMoved.

Referenced by MSLane::executeMovements().

virtual void MSAbstractLaneChangeModel::changed ( )
pure virtual
bool MSAbstractLaneChangeModel::congested ( const MSVehicle *const  neighLeader)
protectedvirtual
void MSAbstractLaneChangeModel::endLaneChangeManeuver ( )
inline
virtual void MSAbstractLaneChangeModel::fulfillChangeRequest ( MSVehicle::ChangeRequest  request)
inlinevirtual

Inform the model that a certain lane change request has been fulfilled by the lane changer, so the request won't be taken into account the next time.

Parameters
requestindicates the request that was fulfilled

Definition at line 312 of file MSAbstractLaneChangeModel.h.

References myChangeRequest, and MSVehicle::REQUEST_NONE.

Referenced by MSLaneChanger::change().

SUMOReal MSAbstractLaneChangeModel::getLaneChangeCompletion ( ) const
inline

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

Definition at line 250 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 260 of file MSAbstractLaneChangeModel.h.

References myLaneChangeDirection.

Referenced by MSVehicle::getAngle().

SUMOTime MSAbstractLaneChangeModel::getLastLaneChangeOffset ( ) const
inline

Definition at line 239 of file MSAbstractLaneChangeModel.h.

References myLastLaneChangeOffset.

int MSAbstractLaneChangeModel::getOwnState ( ) const
inline

Definition at line 175 of file MSAbstractLaneChangeModel.h.

References myOwnState.

Referenced by MSLaneChanger::change(), and MSVehicle::setBlinkerInformation().

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 234 of file MSAbstractLaneChangeModel.h.

References myShadowLane.

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

virtual void* MSAbstractLaneChangeModel::inform ( void *  info,
MSVehicle sender 
)
pure virtual
bool MSAbstractLaneChangeModel::isChangingLanes ( ) const
inline

return true if the vehicle currently performs a lane change maneuver

Definition at line 255 of file MSAbstractLaneChangeModel.h.

References myLaneChangeCompletion, and NUMERICAL_EPS.

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

bool MSAbstractLaneChangeModel::isLaneChangeMidpointPassed ( ) const
inline

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

Definition at line 245 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_DK2004.

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

virtual void MSAbstractLaneChangeModel::prepareStep ( )
inlinevirtual

Reimplemented in MSLCM_DK2004.

Definition at line 183 of file MSAbstractLaneChangeModel.h.

Referenced by MSLaneChanger::change().

void MSAbstractLaneChangeModel::removeLaneChangeShadow ( )
virtual void MSAbstractLaneChangeModel::requestLaneChange ( MSVehicle::ChangeRequest  request)
inlinevirtual

The vehicle is requested to change the lane as soon as possible without violating any directives defined by this lane change model

Parameters
requestindicates the requested change

Definition at line 302 of file MSAbstractLaneChangeModel.h.

References myChangeRequest.

Referenced by MSVehicle::enterLaneAtLaneChange(), MSVehicle::enterLaneAtMove(), and TraCIServerAPI_Vehicle::processSet().

void MSAbstractLaneChangeModel::resetMoved ( )
inline

reset the flag whether a vehicle already moved to false

Definition at line 270 of file MSAbstractLaneChangeModel.h.

References myAlreadyMoved.

Referenced by MSVehicle::planMove().

void MSAbstractLaneChangeModel::setOwnState ( int  state)
inline

Definition at line 179 of file MSAbstractLaneChangeModel.h.

References myOwnState.

Referenced by MSLaneChanger::change().

void MSAbstractLaneChangeModel::unchanged ( )
inline

Definition at line 227 of file MSAbstractLaneChangeModel.h.

References DELTA_T, and myLastLaneChangeOffset.

Referenced by MSLaneChanger::registerUnchanged().

virtual int MSAbstractLaneChangeModel::wantsChangeToLeft ( 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 
)
pure virtual

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

Implemented in MSLCM_DK2004.

Referenced by MSLaneChanger::change2left().

virtual int MSAbstractLaneChangeModel::wantsChangeToRight ( 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 
)
pure virtual

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

Implemented in MSLCM_DK2004.

Referenced by MSLaneChanger::change2right().

Field Documentation

bool MSAbstractLaneChangeModel::myAlreadyMoved
protected

whether the vehicle has already moved this step

Definition at line 345 of file MSAbstractLaneChangeModel.h.

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

const MSCFModel& MSAbstractLaneChangeModel::myCarFollowModel
protected
MSVehicle::ChangeRequest MSAbstractLaneChangeModel::myChangeRequest
protected
bool MSAbstractLaneChangeModel::myHaveShadow
protected

Wether a vehicle shadow exists.

Definition at line 351 of file MSAbstractLaneChangeModel.h.

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

SUMOReal MSAbstractLaneChangeModel::myLaneChangeCompletion
protected

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

Definition at line 336 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 339 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 342 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 333 of file MSAbstractLaneChangeModel.h.

Referenced by MSLCM_DK2004::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 348 of file MSAbstractLaneChangeModel.h.

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


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