![]() |
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 (int dir)=0 |
void | continueLaneChangeManeuver (bool moved) |
void | endLaneChangeManeuver (const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_LANE_CHANGE) |
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... | |
MSLane * | getShadowLane (const MSLane *lane) const |
return the shadow lane for the given lane More... | |
bool | hasShadowVehicle () const |
return true if the vehicle currently has a shadow vehicle 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 (const MSMoveReminder::Notification reason, bool notify=true) |
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 | setNoShadowPartialOccupator (MSLane *lane) |
void | setOwnState (int state) |
void | setShadowPartialOccupator (MSLane *lane) |
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... | |
static void | initGlobalOptions (const OptionsCont &oc) |
init global model parameters More... | |
Protected Member Functions | |
bool | cancelRequest (int state) |
whether the influencer cancels the given request More... | |
virtual bool | congested (const MSVehicle *const neighLeader) |
void | initLastLaneChangeOffset (int dir) |
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... | |
std::vector< MSLane * > | myNoPartiallyOccupatedByShadow |
int | myOwnState |
The current state of the vehicle. More... | |
std::vector< MSLane * > | myPartiallyOccupatedByShadow |
list of lanes where the shadow vehicle is partial occupator 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... | |
Static Protected Attributes | |
static bool | myAllowOvertakingRight |
whether overtaking on the right is permitted More... | |
Private Member Functions | |
MSAbstractLaneChangeModel & | operator= (const MSAbstractLaneChangeModel &s) |
Invalidated assignment operator. More... | |
Private Attributes | |
SUMOTime | myLastLaneChangeOffset |
Interface for lane-change models.
Definition at line 118 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 293 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().
|
protected |
whether the influencer cancels the given request
Definition at line 257 of file MSAbstractLaneChangeModel.cpp.
References MSVehicle::influenceChangeDecision(), and myVehicle.
Referenced by MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), and setNoShadowPartialOccupator().
|
pure virtual |
Implemented in MSLCM_LC2013, MSLCM_JE2013, and MSLCM_DK2008.
Referenced by MSLaneChanger::change(), continueLaneChangeManeuver(), prepareStep(), and startLaneChangeManeuver().
|
protectedvirtual |
Definition at line 96 of file MSAbstractLaneChangeModel.cpp.
References MSVehicle::congested(), MSVehicle::getLane(), MSLane::getSpeedLimit(), and myVehicle.
Referenced by setNoShadowPartialOccupator(), MSLCM_DK2008::wantsChangeToLeft(), and MSLCM_DK2008::wantsChangeToRight().
void MSAbstractLaneChangeModel::continueLaneChangeManeuver | ( | bool | moved | ) |
Definition at line 177 of file MSAbstractLaneChangeModel.cpp.
References changed(), DELTA_T, endLaneChangeManeuver(), MSVehicle::enterLaneAtLaneChange(), MSVehicle::fixPosition(), Named::getID(), MSBaseVehicle::getID(), MSNet::getInstance(), MSVehicle::getLane(), MSLane::getLength(), MSVehicle::getPositionOnLane(), getShadowLane(), MSBaseVehicle::getVehicleType(), MSVehicleType::getWidth(), MSLane::getWidth(), MSGlobals::gLaneChangeDuration, isChangingLanes(), MSVehicle::leaveLane(), myAlreadyMoved, myHaveShadow, myLaneChangeCompletion, myLaneChangeDirection, myLaneChangeMidpointPassed, myPartiallyOccupatedByShadow, myShadowLane, myVehicle, MSMoveReminder::NOTIFICATION_JUNCTION, MSMoveReminder::NOTIFICATION_LANE_CHANGE, removeLaneChangeShadow(), MSLane::resetPartialOccupation(), SUMOReal, time2string(), toString(), and WRITE_WARNING.
Referenced by MSVehicle::executeMove(), resetMoved(), and startLaneChangeManeuver().
void MSAbstractLaneChangeModel::endLaneChangeManeuver | ( | const MSMoveReminder::Notification | reason = MSMoveReminder::NOTIFICATION_LANE_CHANGE | ) |
Definition at line 244 of file MSAbstractLaneChangeModel.cpp.
References myLaneChangeCompletion, myNoPartiallyOccupatedByShadow, myPartiallyOccupatedByShadow, myShadowLane, myVehicle, removeLaneChangeShadow(), and MSLane::resetPartialOccupation().
Referenced by MSVehicleTransfer::add(), continueLaneChangeManeuver(), MSVehicle::executeMove(), and resetMoved().
|
inline |
return whether the vehicle passed the midpoint of a continuous lane change maneuver
Definition at line 273 of file MSAbstractLaneChangeModel.h.
References myLaneChangeCompletion.
Referenced by MSVehicle::computeAngle(), and MSVehicle::getPosition().
|
inline |
return the direction of the current lane change maneuver
Definition at line 288 of file MSAbstractLaneChangeModel.h.
References myLaneChangeDirection.
Referenced by MSVehicle::computeAngle().
|
inline |
Definition at line 262 of file MSAbstractLaneChangeModel.h.
References myLastLaneChangeOffset.
|
inline |
Definition at line 200 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 254 of file MSAbstractLaneChangeModel.h.
References myShadowLane.
Referenced by MSVehicle::computeAngle(), continueLaneChangeManeuver(), MSLane::executeMovements(), MSVehicle::getPosition(), MSVehicle::planMoveInternal(), MSLane::resetPartialOccupation(), and MSLane::setPartialOccupation().
return the shadow lane for the given lane
Definition at line 166 of file MSAbstractLaneChangeModel.cpp.
References MSLane::getParallelLane(), myLaneChangeDirection, myLaneChangeMidpointPassed, and myNoPartiallyOccupatedByShadow.
|
inline |
return true if the vehicle currently has a shadow vehicle
Definition at line 283 of file MSAbstractLaneChangeModel.h.
References myHaveShadow.
Referenced by MSLane::executeMovements(), and MSLane::setPartialOccupation().
|
pure virtual |
|
static |
init global model parameters
Definition at line 54 of file MSAbstractLaneChangeModel.cpp.
References OptionsCont::getBool(), and myAllowOvertakingRight.
Referenced by MSFrame::setMSGlobals().
|
protected |
Definition at line 264 of file MSAbstractLaneChangeModel.cpp.
References myLastLaneChangeOffset.
Referenced by MSLCM_DK2008::changed(), MSLCM_JE2013::changed(), and MSLCM_LC2013::changed().
|
inline |
return true if the vehicle currently performs a lane change maneuver
Definition at line 278 of file MSAbstractLaneChangeModel.h.
References myLaneChangeCompletion, and NUMERICAL_EPS.
Referenced by MSLaneChanger::change(), MSVehicle::computeAngle(), continueLaneChangeManeuver(), MSVehicle::enterLaneAtLaneChange(), MSVehicle::getPosition(), MSLane::handleCollision(), MSLane::resetPartialOccupation(), and MSLane::setPartialOccupation().
|
inline |
return whether the vehicle passed the midpoint of a continuous lane change maneuver
Definition at line 268 of file MSAbstractLaneChangeModel.h.
References myLaneChangeMidpointPassed.
Referenced by MSVehicle::computeAngle(), 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(), MSCFModel::moveHelper(), and prepareStep().
|
protectedvirtual |
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 setNoShadowPartialOccupator(), MSLCM_DK2008::wantsChangeToLeft(), and MSLCM_DK2008::wantsChangeToRight().
|
inlinevirtual |
Reimplemented in MSLCM_LC2013, MSLCM_JE2013, and MSLCM_DK2008.
Definition at line 208 of file MSAbstractLaneChangeModel.h.
References changed(), inform(), max, min, patchSpeed(), SUMOReal, and wantsChange().
Referenced by MSVehicle::executeMove().
void MSAbstractLaneChangeModel::removeLaneChangeShadow | ( | const MSMoveReminder::Notification | reason, |
bool | notify = true |
||
) |
remove the shadow copy of a lane change maneuver
Definition at line 235 of file MSAbstractLaneChangeModel.cpp.
References myHaveShadow, myShadowLane, myVehicle, and MSLane::removeVehicle().
Referenced by continueLaneChangeManeuver(), endLaneChangeManeuver(), and resetMoved().
|
inline |
reset the flag whether a vehicle already moved to false
Definition at line 298 of file MSAbstractLaneChangeModel.h.
References continueLaneChangeManeuver(), endLaneChangeManeuver(), myAlreadyMoved, MSMoveReminder::NOTIFICATION_LANE_CHANGE, removeLaneChangeShadow(), and startLaneChangeManeuver().
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 319 of file MSAbstractLaneChangeModel.h.
References UNUSED_PARAMETER.
Referenced by MSLCM_JE2013::saveBlockerLength(), and MSLCM_LC2013::saveBlockerLength().
|
inline |
Definition at line 327 of file MSAbstractLaneChangeModel.h.
References cancelRequest(), congested(), myNoPartiallyOccupatedByShadow, and predInteraction().
Referenced by MSVehicle::enterLaneAtLaneChange().
|
inline |
Definition at line 204 of file MSAbstractLaneChangeModel.h.
References myOwnState.
Referenced by MSLaneChanger::change().
|
inline |
Definition at line 323 of file MSAbstractLaneChangeModel.h.
References myPartiallyOccupatedByShadow.
Referenced by MSLane::setPartialOccupation(), and startLaneChangeManeuver().
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(), MSVehicle::getFurtherLanes(), MSVehicleType::getLength(), MSLane::getLogicalPredecessorLane(), MSVehicle::getPositionOnLane(), MSBaseVehicle::getVehicleType(), MSGlobals::gLaneChangeDuration, MSVehicle::leaveLane(), MSLane::leftByLaneChange(), myHaveShadow, myLaneChangeCompletion, myLaneChangeDirection, myLaneChangeMidpointPassed, myShadowLane, myVehicle, MSMoveReminder::NOTIFICATION_LANE_CHANGE, MSLane::setPartialOccupation(), setShadowPartialOccupator(), SUMOReal, MSVehicle::switchOffSignal(), MSVehicle::switchOnSignal(), MSVehicle::VEH_SIGNAL_BLINKER_LEFT, and MSVehicle::VEH_SIGNAL_BLINKER_RIGHT.
Referenced by resetMoved(), and MSLaneChanger::startChange().
|
inline |
Definition at line 243 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(), and prepareStep().
|
staticprotected |
whether overtaking on the right is permitted
Definition at line 380 of file MSAbstractLaneChangeModel.h.
Referenced by MSLCM_JE2013::_wantsChange(), MSLCM_LC2013::_wantsChange(), MSLCM_JE2013::informFollower(), MSLCM_JE2013::informLeader(), MSLCM_LC2013::informLeader(), and initGlobalOptions().
|
protected |
whether the vehicle has already moved this step
Definition at line 357 of file MSAbstractLaneChangeModel.h.
Referenced by alreadyMoved(), continueLaneChangeManeuver(), and resetMoved().
|
protected |
The vehicle's car following model.
Definition at line 366 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 363 of file MSAbstractLaneChangeModel.h.
Referenced by continueLaneChangeManeuver(), hasShadowVehicle(), removeLaneChangeShadow(), startLaneChangeManeuver(), and ~MSAbstractLaneChangeModel().
|
protected |
progress of the lane change maneuver 0:started, 1:complete
Definition at line 348 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 351 of file MSAbstractLaneChangeModel.h.
Referenced by continueLaneChangeManeuver(), getLaneChangeDirection(), getShadowLane(), and startLaneChangeManeuver().
|
protected |
whether myLane has already been set to the target of the lane-change maneuver
Definition at line 354 of file MSAbstractLaneChangeModel.h.
Referenced by continueLaneChangeManeuver(), getShadowLane(), isLaneChangeMidpointPassed(), and startLaneChangeManeuver().
|
private |
Definition at line 386 of file MSAbstractLaneChangeModel.h.
Referenced by getLastLaneChangeOffset(), initLastLaneChangeOffset(), and unchanged().
|
protected |
Definition at line 373 of file MSAbstractLaneChangeModel.h.
Referenced by endLaneChangeManeuver(), getShadowLane(), and setNoShadowPartialOccupator().
|
protected |
The current state of the vehicle.
Definition at line 345 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 |
list of lanes where the shadow vehicle is partial occupator
Definition at line 369 of file MSAbstractLaneChangeModel.h.
Referenced by continueLaneChangeManeuver(), endLaneChangeManeuver(), and setShadowPartialOccupator().
|
protected |
The lane the vehicle shadow is on during a continuous lane change.
Definition at line 360 of file MSAbstractLaneChangeModel.h.
Referenced by continueLaneChangeManeuver(), endLaneChangeManeuver(), getShadowLane(), removeLaneChangeShadow(), startLaneChangeManeuver(), and ~MSAbstractLaneChangeModel().
|
protected |
The vehicle this lane-changer belongs to.
Definition at line 342 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(), endLaneChangeManeuver(), 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().