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 () |
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 |
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... | |
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 MSCFModel & | myCarFollowModel |
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... | |
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 102 of file MSAbstractLaneChangeModel.h.
MSAbstractLaneChangeModel::MSAbstractLaneChangeModel | ( | MSVehicle & | v) |
Constructor.
[in] | v | The vehicle this lane-changer belongs to |
Definition at line 44 of file MSAbstractLaneChangeModel.cpp.
|
virtual |
Destructor.
Definition at line 61 of file MSAbstractLaneChangeModel.cpp.
References removeLaneChangeShadow().
|
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().
|
pure virtual |
Implemented in MSLCM_DK2004.
Referenced by MSLaneChanger::change(), continueLaneChangeManeuver(), and startLaneChangeManeuver().
Definition at line 67 of file MSAbstractLaneChangeModel.cpp.
References MSVehicle::congested(), MSVehicle::getLane(), MSLane::getSpeedLimit(), and myVehicle.
Referenced by MSLCM_DK2004::wantsChangeToLeft(), and MSLCM_DK2004::wantsChangeToRight().
void MSAbstractLaneChangeModel::continueLaneChangeManeuver | ( | bool | moved) |
Definition at line 122 of file MSAbstractLaneChangeModel.cpp.
References changed(), DELTA_T, MSEdge::EDGEFUNCTION_INTERNAL, endLaneChangeManeuver(), MSVehicle::enterLaneAtLaneChange(), MSVehicle::fixContinuations(), MSVehicle::fixPosition(), MSVehicle::getBestLanes(), MSLane::getEdge(), Named::getID(), MSBaseVehicle::getID(), MSNet::getInstance(), MSVehicle::getLane(), MSLane::getLength(), MSLane::getLogicalPredecessorLane(), MSLane::getParallelLane(), MSVehicle::getPositionOnLane(), MSEdge::getPurpose(), 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 286 of file MSAbstractLaneChangeModel.h.
References myLaneChangeCompletion, myShadowLane, and removeLaneChangeShadow().
Referenced by MSVehicleTransfer::addVeh(), continueLaneChangeManeuver(), MSLane::detectCollisions(), and MSVehicle::executeMove().
|
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.
request | indicates the request that was fulfilled |
Definition at line 312 of file MSAbstractLaneChangeModel.h.
References myChangeRequest, and MSVehicle::REQUEST_NONE.
Referenced by MSLaneChanger::change().
|
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().
|
inline |
return the direction of the current lane change maneuver
Definition at line 260 of file MSAbstractLaneChangeModel.h.
References myLaneChangeDirection.
Referenced by MSVehicle::getAngle().
|
inline |
Definition at line 239 of file MSAbstractLaneChangeModel.h.
References myLastLaneChangeOffset.
|
inline |
Definition at line 175 of file MSAbstractLaneChangeModel.h.
References myOwnState.
Referenced by MSLaneChanger::change(), and MSVehicle::setBlinkerInformation().
|
inline |
Returns the lane the vehicles shadow is on during continuouss lane change.
Definition at line 234 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 255 of file MSAbstractLaneChangeModel.h.
References myLaneChangeCompletion, and NUMERICAL_EPS.
Referenced by MSLaneChanger::change(), continueLaneChangeManeuver(), MSLane::executeMovements(), and MSVehicle::getAngle().
|
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().
|
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_DK2004.
Referenced by MSCFModel_Daniel1::moveHelper(), MSCFModel_SmartSK::moveHelper(), MSCFModel_KraussOrig1::moveHelper(), and MSCFModel::moveHelper().
Definition at line 86 of file MSAbstractLaneChangeModel.cpp.
References MSVehicleType::getLength(), MSVehicleType::getMinGap(), MSVehicle::getPositionOnLane(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), MSCFModel::interactionGap(), myCarFollowModel, myVehicle, and SUMOReal.
Referenced by MSLCM_DK2004::wantsChangeToLeft(), and MSLCM_DK2004::wantsChangeToRight().
|
inlinevirtual |
Reimplemented in MSLCM_DK2004.
Definition at line 183 of file MSAbstractLaneChangeModel.h.
Referenced by MSLaneChanger::change().
void MSAbstractLaneChangeModel::removeLaneChangeShadow | ( | ) |
remove the shadow copy of a lane change maneuver
Definition at line 181 of file MSAbstractLaneChangeModel.cpp.
References myHaveShadow, myShadowLane, myVehicle, MSMoveReminder::NOTIFICATION_LANE_CHANGE, and MSLane::removeVehicle().
Referenced by continueLaneChangeManeuver(), endLaneChangeManeuver(), and ~MSAbstractLaneChangeModel().
|
inlinevirtual |
The vehicle is requested to change the lane as soon as possible without violating any directives defined by this lane change model
request | indicates the requested change |
Definition at line 302 of file MSAbstractLaneChangeModel.h.
References myChangeRequest.
Referenced by MSVehicle::enterLaneAtLaneChange(), MSVehicle::enterLaneAtMove(), and TraCIServerAPI_Vehicle::processSet().
|
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().
|
inline |
Definition at line 179 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 100 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 227 of file MSAbstractLaneChangeModel.h.
References DELTA_T, and myLastLaneChangeOffset.
Referenced by MSLaneChanger::registerUnchanged().
|
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().
|
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().
|
protected |
whether the vehicle has already moved this step
Definition at line 345 of file MSAbstractLaneChangeModel.h.
Referenced by alreadyMoved(), continueLaneChangeManeuver(), and resetMoved().
|
protected |
The vehicle's car following model.
Definition at line 358 of file MSAbstractLaneChangeModel.h.
Referenced by MSLCM_DK2004::informBlocker(), predInteraction(), MSLCM_DK2004::wantsChangeToLeft(), and MSLCM_DK2004::wantsChangeToRight().
|
protected |
Definition at line 354 of file MSAbstractLaneChangeModel.h.
Referenced by fulfillChangeRequest(), requestLaneChange(), MSLCM_DK2004::wantsChangeToLeft(), and MSLCM_DK2004::wantsChangeToRight().
|
protected |
Wether a vehicle shadow exists.
Definition at line 351 of file MSAbstractLaneChangeModel.h.
Referenced by continueLaneChangeManeuver(), removeLaneChangeShadow(), and startLaneChangeManeuver().
|
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().
|
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().
|
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().
|
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().
|
protected |
The current state of the vehicle.
Definition at line 330 of file MSAbstractLaneChangeModel.h.
Referenced by MSLCM_DK2004::amBlockingFollower(), MSLCM_DK2004::amBlockingFollowerNB(), MSLCM_DK2004::amBlockingFollowerPlusNB(), MSLCM_DK2004::amBlockingLeader(), MSLCM_DK2004::changed(), getOwnState(), MSLCM_DK2004::inform(), MSLCM_DK2004::patchSpeed(), setOwnState(), MSLCM_DK2004::wantsChangeToLeft(), and MSLCM_DK2004::wantsChangeToRight().
|
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().
|
protected |
The vehicle this lane-changer belongs to.
Definition at line 327 of file MSAbstractLaneChangeModel.h.
Referenced by congested(), continueLaneChangeManeuver(), MSLCM_DK2004::informBlocker(), MSLCM_DK2004::patchSpeed(), predInteraction(), removeLaneChangeShadow(), startLaneChangeManeuver(), MSLCM_DK2004::wantsChangeToLeft(), and MSLCM_DK2004::wantsChangeToRight().