SUMO - Simulation of Urban MObility
|
Interface for lane-change models. More...
#include <MSAbstractLaneChangeModel.h>
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 |
MSLane * | getShadowLane () 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 MSAbstractLaneChangeModel * | build (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 MSCFModel & | myCarFollowModel |
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... | |
MSLane * | myShadowLane |
The lane the vehicle shadow is on during a continuous lane change. More... | |
MSVehicle & | myVehicle |
The vehicle this lane-changer belongs to. More... | |
Private Member Functions | |
MSAbstractLaneChangeModel & | operator= (const MSAbstractLaneChangeModel &s) |
Invalidated assignment operator. More... | |
Interface for lane-change models.
Definition at line 113 of file MSAbstractLaneChangeModel.h.
MSAbstractLaneChangeModel::MSAbstractLaneChangeModel | ( | MSVehicle & | v | ) |
Constructor.
[in] | v | The vehicle this lane-changer belongs to |
Definition at line 62 of file MSAbstractLaneChangeModel.cpp.
|
virtual |
Destructor.
Definition at line 76 of file MSAbstractLaneChangeModel.cpp.
References removeLaneChangeShadow().
|
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().
|
static |
Factory method for instantiating new lane changing models.
[in] | lcm | The type of model to build |
[in] | vehicle | The 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().
|
pure virtual |
Implemented in MSLCM_LC2013, MSLCM_JE2013, and MSLCM_DK2008.
Referenced by MSLaneChanger::change(), continueLaneChangeManeuver(), and startLaneChangeManeuver().
Definition at line 82 of file MSAbstractLaneChangeModel.cpp.
References MSVehicle::congested(), MSVehicle::getLane(), MSLane::getSpeedLimit(), and myVehicle.
Referenced by MSLCM_DK2008::wantsChangeToLeft(), and MSLCM_DK2008::wantsChangeToRight().
void MSAbstractLaneChangeModel::continueLaneChangeManeuver | ( | bool | moved | ) |
Definition at line 137 of file MSAbstractLaneChangeModel.cpp.
References changed(), DELTA_T, endLaneChangeManeuver(), MSVehicle::enterLaneAtLaneChange(), MSVehicle::fixPosition(), Named::getID(), MSBaseVehicle::getID(), MSNet::getInstance(), MSVehicle::getLane(), MSLane::getLength(), MSLane::getParallelLane(), MSVehicle::getPositionOnLane(), MSBaseVehicle::getVehicleType(), MSVehicleType::getWidth(), MSLane::getWidth(), MSGlobals::gLaneChangeDuration, isChangingLanes(), MSVehicle::leaveLane(), myAlreadyMoved, myHaveShadow, myLaneChangeCompletion, myLaneChangeDirection, myLaneChangeMidpointPassed, myLastLaneChangeOffset, myShadowLane, myVehicle, MSMoveReminder::NOTIFICATION_LANE_CHANGE, removeLaneChangeShadow(), SUMOReal, time2string(), toString(), and WRITE_WARNING.
Referenced by MSVehicle::executeMove(), and startLaneChangeManeuver().
|
inline |
Definition at line 294 of file MSAbstractLaneChangeModel.h.
References myLaneChangeCompletion, myShadowLane, and removeLaneChangeShadow().
Referenced by MSVehicleTransfer::addVeh(), continueLaneChangeManeuver(), MSLane::detectCollisions(), and MSVehicle::executeMove().
|
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().
|
inline |
return the direction of the current lane change maneuver
Definition at line 268 of file MSAbstractLaneChangeModel.h.
References myLaneChangeDirection.
Referenced by MSVehicle::getAngle().
|
inline |
Definition at line 247 of file MSAbstractLaneChangeModel.h.
References myLastLaneChangeOffset.
|
inline |
Definition at line 192 of file MSAbstractLaneChangeModel.h.
References myOwnState.
Referenced by MSLaneChanger::change(), MSLCM_JE2013::saveBlockerLength(), MSLCM_LC2013::saveBlockerLength(), and MSVehicle::setBlinkerInformation().
|
inline |
Returns the lane the vehicles shadow is on during continuouss lane change.
Definition at line 242 of file MSAbstractLaneChangeModel.h.
References myShadowLane.
Referenced by MSLane::executeMovements(), and MSVehicle::getPosition().
|
pure virtual |
|
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().
|
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().
|
private |
Invalidated assignment operator.
|
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.
min | The minimum resulting speed |
wanted | The aspired speed of the car following model |
max | The maximum resulting speed |
cfModel | The model used |
Implemented in MSLCM_LC2013, MSLCM_DK2008, and MSLCM_JE2013.
Referenced by MSCFModel_Daniel1::moveHelper(), MSCFModel_SmartSK::moveHelper(), MSCFModel_KraussOrig1::moveHelper(), and MSCFModel::moveHelper().
Definition at line 101 of file MSAbstractLaneChangeModel.cpp.
References MSVehicleType::getLength(), MSVehicleType::getMinGap(), MSVehicle::getPositionOnLane(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), MSCFModel::interactionGap(), myCarFollowModel, myVehicle, and SUMOReal.
Referenced by MSLCM_DK2008::wantsChangeToLeft(), and MSLCM_DK2008::wantsChangeToRight().
|
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 187 of file MSAbstractLaneChangeModel.cpp.
References myHaveShadow, myShadowLane, myVehicle, MSMoveReminder::NOTIFICATION_LANE_CHANGE, and MSLane::removeVehicle().
Referenced by continueLaneChangeManeuver(), endLaneChangeManeuver(), and ~MSAbstractLaneChangeModel().
|
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().
|
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().
|
inline |
Definition at line 196 of file MSAbstractLaneChangeModel.h.
References myOwnState.
Referenced by MSLaneChanger::change().
bool MSAbstractLaneChangeModel::startLaneChangeManeuver | ( | MSLane * | source, |
MSLane * | target, | ||
int | direction | ||
) |
start the lane change maneuver and return whether it continues
Definition at line 115 of file MSAbstractLaneChangeModel.cpp.
References changed(), continueLaneChangeManeuver(), DELTA_T, MSLane::enteredByLaneChange(), MSVehicle::enterLaneAtLaneChange(), MSGlobals::gLaneChangeDuration, MSVehicle::leaveLane(), MSLane::leftByLaneChange(), myHaveShadow, myLaneChangeCompletion, myLaneChangeDirection, myLaneChangeMidpointPassed, myLastLaneChangeOffset, myShadowLane, myVehicle, and MSMoveReminder::NOTIFICATION_LANE_CHANGE.
Referenced by MSLaneChanger::startChange().
|
inline |
Definition at line 235 of file MSAbstractLaneChangeModel.h.
References DELTA_T, and myLastLaneChangeOffset.
Referenced by MSLaneChanger::registerUnchanged().
|
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().
|
protected |
whether the vehicle has already moved this step
Definition at line 334 of file MSAbstractLaneChangeModel.h.
Referenced by alreadyMoved(), continueLaneChangeManeuver(), and resetMoved().
|
protected |
The vehicle's car following model.
Definition at line 343 of file MSAbstractLaneChangeModel.h.
Referenced by MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), MSLCM_DK2008::informBlocker(), MSLCM_JE2013::informLeader(), MSLCM_LC2013::informLeader(), predInteraction(), MSLCM_JE2013::slowDownForBlocked(), MSLCM_LC2013::slowDownForBlocked(), MSLCM_DK2008::wantsChangeToLeft(), and MSLCM_DK2008::wantsChangeToRight().
|
protected |
Wether a vehicle shadow exists.
Definition at line 340 of file MSAbstractLaneChangeModel.h.
Referenced by continueLaneChangeManeuver(), removeLaneChangeShadow(), and startLaneChangeManeuver().
|
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().
|
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().
|
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().
|
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().
|
protected |
The current state of the vehicle.
Definition at line 319 of file MSAbstractLaneChangeModel.h.
Referenced by MSLCM_JE2013::_patchSpeed(), MSLCM_LC2013::_patchSpeed(), MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), MSLCM_DK2008::amBlockingFollower(), MSLCM_JE2013::amBlockingFollower(), MSLCM_LC2013::amBlockingFollower(), MSLCM_DK2008::amBlockingFollowerNB(), MSLCM_JE2013::amBlockingFollowerNB(), MSLCM_LC2013::amBlockingFollowerNB(), MSLCM_DK2008::amBlockingFollowerPlusNB(), MSLCM_JE2013::amBlockingFollowerPlusNB(), MSLCM_LC2013::amBlockingFollowerPlusNB(), MSLCM_DK2008::amBlockingLeader(), MSLCM_JE2013::amBlockingLeader(), MSLCM_LC2013::amBlockingLeader(), MSLCM_DK2008::changed(), MSLCM_JE2013::changed(), MSLCM_LC2013::changed(), getOwnState(), MSLCM_DK2008::inform(), MSLCM_JE2013::inform(), MSLCM_LC2013::inform(), MSLCM_DK2008::patchSpeed(), MSLCM_DK2008::prepareStep(), MSLCM_JE2013::prepareStep(), MSLCM_LC2013::prepareStep(), setOwnState(), MSLCM_DK2008::wantsChangeToLeft(), and MSLCM_DK2008::wantsChangeToRight().
|
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(), and startLaneChangeManeuver().
|
protected |
The vehicle this lane-changer belongs to.
Definition at line 316 of file MSAbstractLaneChangeModel.h.
Referenced by MSLCM_JE2013::_patchSpeed(), MSLCM_LC2013::_patchSpeed(), MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), MSLCM_JE2013::changed(), MSLCM_LC2013::changed(), congested(), continueLaneChangeManeuver(), MSLCM_JE2013::inform(), MSLCM_DK2008::informBlocker(), MSLCM_JE2013::informFollower(), MSLCM_LC2013::informFollower(), MSLCM_JE2013::informLeader(), MSLCM_LC2013::informLeader(), MSLCM_JE2013::keepRight(), MSLCM_LC2013::keepRight(), MSLCM_DK2008::patchSpeed(), MSLCM_JE2013::patchSpeed(), predInteraction(), removeLaneChangeShadow(), MSLCM_JE2013::saveBlockerLength(), MSLCM_LC2013::saveBlockerLength(), MSLCM_JE2013::slowDownForBlocked(), MSLCM_LC2013::slowDownForBlocked(), startLaneChangeManeuver(), MSLCM_JE2013::wantsChange(), MSLCM_DK2008::wantsChangeToLeft(), and MSLCM_DK2008::wantsChangeToRight().