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 | |
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 | |
int | getLaneChangeDirection () const |
return the direction of the current lane change maneuver | |
SUMOTime | getLastLaneChangeOffset () const |
int | getOwnState () const |
MSLane * | getShadowLane () const |
Returns the lane the vehicles shadow is on during continuouss lane change. | |
virtual void * | inform (void *info, MSVehicle *sender)=0 |
bool | isChangingLanes () const |
return true if the vehicle currently performs a lane change maneuver | |
bool | isLaneChangeMidpointPassed () const |
return whether the vehicle passed the midpoint of a continuous lane change maneuver | |
MSAbstractLaneChangeModel (MSVehicle &v) | |
Constructor. | |
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. | |
virtual void | prepareStep () |
void | removeLaneChangeShadow () |
remove the shadow copy of a lane change maneuver | |
void | resetMoved () |
reset the flag whether a vehicle already moved to false | |
virtual void | saveBlockerLength (SUMOReal length) |
reserve space at the end of the lane to avoid dead locks | |
void | setOwnState (int state) |
bool | startLaneChangeManeuver (MSLane *source, MSLane *target, int direction) |
start the lane change maneuver and return whether it continues | |
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. | |
virtual | ~MSAbstractLaneChangeModel () |
Destructor. |
Static Public Member Functions | |
static MSAbstractLaneChangeModel * | build (LaneChangeModel lcm, MSVehicle &vehicle) |
Factory method for instantiating new lane changing models. | |
static void | initGlobalOptions (const OptionsCont &oc) |
init global model parameters |
Protected Member Functions | |
bool | cancelRequest (int state) |
whether the influencer cancels the given request | |
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 | |
const MSCFModel & | myCarFollowModel |
The vehicle's car following model. | |
bool | myHaveShadow |
Wether a vehicle shadow exists. | |
SUMOReal | myLaneChangeCompletion |
progress of the lane change maneuver 0:started, 1:complete | |
int | myLaneChangeDirection |
direction of the lane change maneuver -1 means right, 1 means left | |
bool | myLaneChangeMidpointPassed |
whether myLane has already been set to the target of the lane-change maneuver | |
SUMOTime | myLastLaneChangeOffset |
information how long ago the vehicle has performed a lane-change | |
int | myOwnState |
The current state of the vehicle. | |
MSLane * | myShadowLane |
The lane the vehicle shadow is on during a continuous lane change. | |
MSVehicle & | myVehicle |
The vehicle this lane-changer belongs to. |
Static Protected Attributes | |
static bool | myAllowOvertakingRight |
whether overtaking on the right is permitted |
Private Member Functions | |
MSAbstractLaneChangeModel & | operator= (const MSAbstractLaneChangeModel &s) |
Invalidated assignment operator. |
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 74 of file MSAbstractLaneChangeModel.cpp.
|
virtual |
Destructor.
Definition at line 88 of file MSAbstractLaneChangeModel.cpp.
References myHaveShadow, myShadowLane, myVehicle, MSMoveReminder::NOTIFICATION_VAPORIZED, and MSLane::removeVehicle().
|
inline |
reset the flag whether a vehicle already moved to false
Definition at line 276 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 60 of file MSAbstractLaneChangeModel.cpp.
References LCM_DK2008, LCM_JE2013, LCM_LC2013, and toString().
Referenced by MSVehicle::MSVehicle().
whether the influencer cancels the given request
Definition at line 210 of file MSAbstractLaneChangeModel.cpp.
References MSVehicle::influenceChangeDecision(), and myVehicle.
Referenced by MSLCM_JE2013::_wantsChange(), and MSLCM_LC2013::_wantsChange().
|
pure virtual |
Implemented in MSLCM_LC2013, MSLCM_JE2013, and MSLCM_DK2008.
Referenced by MSLaneChanger::change(), continueLaneChangeManeuver(), and startLaneChangeManeuver().
Definition at line 96 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 151 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 297 of file MSAbstractLaneChangeModel.h.
References myLaneChangeCompletion, myShadowLane, and removeLaneChangeShadow().
Referenced by MSVehicleTransfer::add(), continueLaneChangeManeuver(), MSLane::detectCollisions(), and MSVehicle::executeMove().
|
inline |
return whether the vehicle passed the midpoint of a continuous lane change maneuver
Definition at line 261 of file MSAbstractLaneChangeModel.h.
References myLaneChangeCompletion.
Referenced by MSVehicle::getAngle().
|
inline |
return the direction of the current lane change maneuver
Definition at line 271 of file MSAbstractLaneChangeModel.h.
References myLaneChangeDirection.
Referenced by MSVehicle::getAngle().
|
inline |
Definition at line 250 of file MSAbstractLaneChangeModel.h.
References myLastLaneChangeOffset.
|
inline |
Definition at line 195 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 245 of file MSAbstractLaneChangeModel.h.
References myShadowLane.
Referenced by MSLane::executeMovements(), and MSVehicle::getPosition().
|
pure virtual |
|
static |
init global model parameters
Definition at line 54 of file MSAbstractLaneChangeModel.cpp.
References OptionsCont::getBool(), and myAllowOvertakingRight.
Referenced by MSFrame::setMSGlobals().
|
inline |
return true if the vehicle currently performs a lane change maneuver
Definition at line 266 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 256 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_JE2013, and MSLCM_DK2008.
Referenced by MSCFModel_Daniel1::moveHelper(), MSCFModel_SmartSK::moveHelper(), MSCFModel_KraussOrig1::moveHelper(), and MSCFModel::moveHelper().
Definition at line 115 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 203 of file MSAbstractLaneChangeModel.h.
Referenced by MSVehicle::executeMove().
void MSAbstractLaneChangeModel::removeLaneChangeShadow | ( | ) |
remove the shadow copy of a lane change maneuver
Definition at line 201 of file MSAbstractLaneChangeModel.cpp.
References myHaveShadow, myShadowLane, myVehicle, MSMoveReminder::NOTIFICATION_LANE_CHANGE, and MSLane::removeVehicle().
Referenced by continueLaneChangeManeuver(), and endLaneChangeManeuver().
|
inline |
reset the flag whether a vehicle already moved to false
Definition at line 281 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 307 of file MSAbstractLaneChangeModel.h.
References UNUSED_PARAMETER.
Referenced by MSLCM_JE2013::saveBlockerLength(), and MSLCM_LC2013::saveBlockerLength().
|
inline |
Definition at line 199 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 129 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 238 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_JE2013, and MSLCM_DK2008.
Referenced by MSLaneChanger::checkChange().
|
staticprotected |
whether overtaking on the right is permitted
Definition at line 352 of file MSAbstractLaneChangeModel.h.
Referenced by MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), and initGlobalOptions().
|
protected |
whether the vehicle has already moved this step
Definition at line 340 of file MSAbstractLaneChangeModel.h.
Referenced by alreadyMoved(), continueLaneChangeManeuver(), and resetMoved().
|
protected |
The vehicle's car following model.
Definition at line 349 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 346 of file MSAbstractLaneChangeModel.h.
Referenced by continueLaneChangeManeuver(), removeLaneChangeShadow(), startLaneChangeManeuver(), and ~MSAbstractLaneChangeModel().
|
protected |
progress of the lane change maneuver 0:started, 1:complete
Definition at line 331 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 334 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 337 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 328 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 325 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 343 of file MSAbstractLaneChangeModel.h.
Referenced by continueLaneChangeManeuver(), endLaneChangeManeuver(), getShadowLane(), removeLaneChangeShadow(), startLaneChangeManeuver(), and ~MSAbstractLaneChangeModel().
|
protected |
The vehicle this lane-changer belongs to.
Definition at line 322 of file MSAbstractLaneChangeModel.h.
Referenced by MSLCM_JE2013::_patchSpeed(), MSLCM_LC2013::_patchSpeed(), MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), cancelRequest(), 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_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(), MSLCM_DK2008::wantsChangeToRight(), and ~MSAbstractLaneChangeModel().