![]() |
SUMO - Simulation of Urban MObility
|
Performs lane changing of vehicles. More...
#include <MSLaneChangerSublane.h>
Public Types | |
typedef std::vector< ChangeElem > | Changer |
The list of changers; For each lane, a ChangeElem is being build. More... | |
typedef Changer::iterator | ChangerIt |
the iterator moving over the ChangeElems More... | |
typedef Changer::const_iterator | ConstChangerIt |
the iterator moving over the ChangeElems More... | |
Public Member Functions | |
void | laneChange (SUMOTime t) |
Start lane-change-process for all vehicles on the edge'e lanes. More... | |
MSLaneChangerSublane (const std::vector< MSLane * > *lanes, bool allowChanging, bool allowSwap) | |
Constructor. More... | |
~MSLaneChangerSublane () | |
Destructor. More... | |
Protected Types | |
typedef MSAbstractLaneChangeModel::StateAndDist | StateAndDist |
Protected Member Functions | |
virtual bool | change () |
virtual bool | changeOpposite (std::pair< MSVehicle *, SUMOReal > leader) |
int | checkChange (int laneOffset, const MSLane *targetLane, const std::pair< MSVehicle *const, SUMOReal > &leader, const std::pair< MSVehicle *const, SUMOReal > &neighLead, const std::pair< MSVehicle *const, SUMOReal > &neighFollow, const std::vector< MSVehicle::LaneQ > &preb) const |
StateAndDist | checkChangeHelper (MSVehicle *vehicle, int laneOffset) |
helper function that calls checkChangeSublane and sets blocker information More... | |
int | checkChangeSublane (int laneOffset, const std::vector< MSVehicle::LaneQ > &preb, SUMOReal &latDist) const |
check whether sub-lane changing in the given direction is desirable and possible More... | |
int | checkChangeWithinEdge (int laneOffset, const std::pair< MSVehicle *const, SUMOReal > &leader, const std::vector< MSVehicle::LaneQ > &preb) const |
bool | continueChange (MSVehicle *vehicle, ChangerIt &from) |
continue a lane change maneuver and return whether the midpoint was passed in this step (used if gLaneChangeDuration > 0) More... | |
ChangerIt | findCandidate () |
Find current candidate. If there is none, myChanger.end() is returned. More... | |
MSLeaderDistanceInfo | getLeaders (const ChangerIt &target, const MSVehicle *ego) const |
get leaders for ego on the given lane More... | |
std::pair< MSVehicle *const, SUMOReal > | getRealFollower (const ChangerIt &target) const |
std::pair< MSVehicle *const, SUMOReal > | getRealLeader (const ChangerIt &target) const |
void | initChanger () |
Initialize the changer before looping over all vehicles. More... | |
bool | mayChange (int direction) const |
whether changing to the lane in the given direction should be considered More... | |
void | registerUnchanged (MSVehicle *vehicle) |
void | startChange (MSVehicle *vehicle, ChangerIt &from, int direction) |
start the lane change maneuver (and finish it instantly if gLaneChangeDuration == 0) More... | |
bool | startChangeSublane (MSVehicle *vehicle, ChangerIt &from, SUMOReal latDist) |
change by the specified amount and return whether a new lane was entered More... | |
virtual void | updateChanger (bool vehHasChanged) |
void | updateLanes (SUMOTime t) |
MSVehicle * | veh (ConstChangerIt ce) const |
bool | vehInChanger () const |
Check if there is a single change-candidate in the changer. Returns true if there is one. More... | |
Static Protected Member Functions | |
static void | computeOvertakingTime (const MSVehicle *vehicle, const MSVehicle *leader, SUMOReal gap, SUMOReal &timeToOvertake, SUMOReal &spaceToOvertake) |
Compute the time and space required for overtaking the given leader. More... | |
static MSVehicle * | getCloserFollower (const SUMOReal maxPos, MSVehicle *follow1, MSVehicle *follow2) |
return the closer follower of ego More... | |
Protected Attributes | |
bool | myAllowsChanging |
bool | myAllowsSwap |
Whether blocking vehicles may be swapped. More... | |
ChangerIt | myCandi |
Changer | myChanger |
Container for ChangeElemements, one for every lane in the edge. More... | |
const bool | myChangeToOpposite |
whether this edge allows changing to the opposite direction edge More... | |
Private Member Functions | |
MSLaneChangerSublane () | |
Default constructor. More... | |
MSLaneChangerSublane (const MSLaneChangerSublane &) | |
Copy constructor. More... | |
MSLaneChangerSublane & | operator= (const MSLaneChangerSublane &) |
Assignment operator. More... | |
Performs lane changing of vehicles.
Definition at line 49 of file MSLaneChangerSublane.h.
|
inherited |
The list of changers; For each lane, a ChangeElem is being build.
Definition at line 102 of file MSLaneChanger.h.
|
inherited |
the iterator moving over the ChangeElems
Definition at line 105 of file MSLaneChanger.h.
|
inherited |
the iterator moving over the ChangeElems
Definition at line 108 of file MSLaneChanger.h.
|
protected |
Definition at line 83 of file MSLaneChangerSublane.h.
MSLaneChangerSublane::MSLaneChangerSublane | ( | const std::vector< MSLane * > * | lanes, |
bool | allowChanging, | ||
bool | allowSwap | ||
) |
Constructor.
Definition at line 51 of file MSLaneChangerSublane.cpp.
MSLaneChangerSublane::~MSLaneChangerSublane | ( | ) |
Destructor.
Definition at line 56 of file MSLaneChangerSublane.cpp.
|
private |
Default constructor.
|
private |
Copy constructor.
|
protectedvirtual |
Find a new candidate and try to change it.
Reimplemented from MSLaneChanger.
Definition at line 81 of file MSLaneChangerSublane.cpp.
References MSVehicle::adaptBestLanesOccupation(), bla, checkChangeHelper(), MSAbstractLaneChangeModel::debugVehicle(), MSAbstractLaneChangeModel::decideDirection(), MSLaneChanger::findCandidate(), gDebugSelectedVehicle, MSBaseVehicle::getID(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSAbstractLaneChangeModel::isChangingLanes(), MSVehicle::isRemoteControlled(), MSAbstractLaneChangeModel::StateAndDist::latDist, LCA_BLOCKED, LCA_URGENT, LCA_WANTS_LANECHANGE, MSLaneChanger::myCandi, MSLaneChanger::myChanger, MSLaneChanger::registerUnchanged(), MSAbstractLaneChangeModel::setOwnState(), SIMTIME, startChangeSublane(), MSAbstractLaneChangeModel::StateAndDist::state, toString(), MSVehicle::updateBestLanes(), MSAbstractLaneChangeModel::updateExpectedSublaneSpeeds(), and MSLaneChanger::veh().
|
protectedvirtualinherited |
try changing to the opposite direction edge.
XXX what about overtaking multiple vehicles?
XXX compute sensible distance
XXX compute sensible usable dist
XXX use a dedicated transformation function
XXX compute a bette lateral position
Definition at line 706 of file MSLaneChanger.cpp.
References MSCFModel::brakeGap(), MSEdge::canChangeToOpposite(), MSLaneChanger::checkChange(), MSLaneChanger::computeOvertakingTime(), DEBUG_COND, MSLaneChanger::findCandidate(), MSLane::forceVehicleInsertion(), MSVehicle::getBestLanes(), MSVehicle::getBestLanesContinuation(), MSVehicle::getCarFollowModel(), MSLinkContHelper::getConnectingLink(), MSLane::getEdge(), Named::getID(), MSBaseVehicle::getID(), Named::getIDSecure(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSLane::getLength(), MSVehicleType::getLengthWithGap(), MSCFModel::getMaxDecel(), MSLane::getOpposite(), MSLane::getOppositeFollower(), MSLane::getOppositeLeader(), MSLane::getOppositePos(), MSVehicle::getPositionOnLane(), MSCFModel::getSecureGap(), MSVehicle::getSpeed(), MSLane::getSpeedLimit(), MSLink::getState(), MSLane::getVehicleMaxSpeed(), MSBaseVehicle::getVehicleType(), MSLink::havePriority(), MSAbstractLaneChangeModel::isOpposite(), MSVehicle::isStopped(), LCA_BLOCKED, LCA_WANTS_LANECHANGE, MSVehicle::LaneQ::length, LINKSTATE_ZIPPER, MIN2(), MSVehicle::State::myBackPos, MSLaneChanger::myCandi, MSLaneChanger::myChangeToOpposite, MSVehicle::State::myPos, MSVehicle::myState, MSVehicle::nextStopDist(), MSMoveReminder::NOTIFICATION_LANE_CHANGE, SIMTIME, MSAbstractLaneChangeModel::startLaneChangeManeuver(), SUMOReal, and MSLaneChanger::veh().
Referenced by MSLaneChanger::change(), and MSLaneChanger::veh().
|
protectedinherited |
Definition at line 541 of file MSLaneChanger.cpp.
References ACCEL2SPEED, MSCFModel::brakeGap(), DEBUG_COND, DELTA_T, MSVehicle::getBestLanesContinuation(), MSVehicle::getCarFollowModel(), MSLane::getCriticalLeader(), MSLane::getEdge(), MSBaseVehicle::getID(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSLane::getLeader(), MSLane::getLength(), MSCFModel::getMaxDecel(), MSVehicleType::getMinGap(), MSLane::getParallelLane(), MSVehicle::getPositionOnLane(), MSCFModel::getSecureGap(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), MSGlobals::gLaneChangeDuration, MSVehicle::influenceChangeDecision(), MSEdge::isInternal(), MSLane::isLinkEnd(), LCA_BLOCKED, LCA_BLOCKED_BY_LEFT_FOLLOWER, LCA_BLOCKED_BY_LEFT_LEADER, LCA_BLOCKED_BY_RIGHT_FOLLOWER, LCA_BLOCKED_BY_RIGHT_LEADER, LCA_INSUFFICIENT_SPACE, LCA_OVERLAPPING, LCA_WANTS_LANECHANGE, LINKDIR_LEFT, LINKDIR_RIGHT, MAX2(), MSLaneChanger::myCandi, SIMTIME, STEPS2TIME, MSLane::succLinkSec(), SUMOReal, toString(), MSVehicle::unsafeLinkAhead(), MSLaneChanger::veh(), and MSAbstractLaneChangeModel::wantsChange().
Referenced by MSLaneChanger::changeOpposite(), MSLaneChanger::checkChangeWithinEdge(), and MSLaneChanger::veh().
|
protected |
helper function that calls checkChangeSublane and sets blocker information
Definition at line 137 of file MSLaneChangerSublane.cpp.
References checkChangeSublane(), MSAbstractLaneChangeModel::StateAndDist::dir, MSVehicle::getBestLanes(), MSAbstractLaneChangeModel::StateAndDist::latDist, LCA_BLOCKED, LCA_URGENT, LCA_WANTS_LANECHANGE, MSLaneChanger::mayChange(), MSLaneChanger::myCandi, and MSAbstractLaneChangeModel::StateAndDist::state.
Referenced by change().
|
protected |
check whether sub-lane changing in the given direction is desirable and possible
[in] | laneOffset | The direction in which changing should be checked |
[in] | leaders | The candidate vehicle's leaders |
[in] | preb | The bestLanse of the candidaet vehicle |
[out] | latDist | The distance by which the vehicle changes laterally |
Definition at line 253 of file MSLaneChangerSublane.cpp.
References gDebugFlag1, MSBaseVehicle::getID(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), getLeaders(), MSLane::getRightSideOnEdge(), MSVehicle::influenceChangeDecision(), MSLaneChanger::myCandi, SIMTIME, MSLeaderDistanceInfo::toString(), MSLaneChanger::veh(), and MSAbstractLaneChangeModel::wantsChangeSublane().
Referenced by checkChangeHelper().
|
protectedinherited |
Definition at line 524 of file MSLaneChanger.cpp.
References MSLaneChanger::checkChange(), MSLaneChanger::getRealFollower(), MSLaneChanger::getRealLeader(), and MSLaneChanger::myCandi.
Referenced by MSLaneChanger::change(), and MSLaneChanger::veh().
|
staticprotectedinherited |
Compute the time and space required for overtaking the given leader.
[in] | vehicle | The vehicle that wants to overtake |
[in] | leader | The vehicle to be overtaken |
[in] | gap | The gap between vehicle and leader |
[out] | timeToOvertake | The time for overtaking |
[out] | spaceToOvertake | The space for overtaking |
XXX ignore speed limit when overtaking through the opposite lane?
Definition at line 929 of file MSLaneChanger.cpp.
References MSVehicle::getCarFollowModel(), MSVehicle::getLane(), MSVehicleType::getLengthWithGap(), MSCFModel::getMaxAccel(), MSVehicleType::getMinGap(), MSVehicle::getSpeed(), MSLane::getVehicleMaxSpeed(), MSBaseVehicle::getVehicleType(), sign, and SUMOReal.
Referenced by MSLaneChanger::changeOpposite(), and MSLaneChanger::veh().
continue a lane change maneuver and return whether the midpoint was passed in this step (used if gLaneChangeDuration > 0)
Definition at line 396 of file MSLaneChanger.cpp.
References MSVehicle::computeAngle(), DEBUG_COND, MSAbstractLaneChangeModel::endLaneChangeManeuver(), MSBaseVehicle::getID(), Named::getIDSecure(), MSAbstractLaneChangeModel::getLaneChangeDirection(), MSVehicle::getLaneChangeModel(), MSVehicle::getLateralPositionOnLane(), MSAbstractLaneChangeModel::getLateralSpeed(), MSVehicleType::getLengthWithGap(), MSAbstractLaneChangeModel::getShadowDirection(), MSAbstractLaneChangeModel::getShadowLane(), MSBaseVehicle::getVehicleType(), MSLane::getWidth(), Position::INVALID, MSAbstractLaneChangeModel::isChangingLanes(), MSVehicle::myAngle, MSVehicle::myCachedPosition, MSLaneChanger::myCandi, MSVehicle::State::myPosLat, MSVehicle::myState, MSAbstractLaneChangeModel::primaryLaneChanged(), SIMTIME, MSAbstractLaneChangeModel::updateCompletion(), and MSAbstractLaneChangeModel::updateShadowLane().
Referenced by MSLaneChanger::change(), MSLaneChanger::startChange(), and MSLaneChanger::veh().
|
protectedinherited |
Find current candidate. If there is none, myChanger.end() is returned.
Definition at line 176 of file MSLaneChanger.cpp.
References max, MSLaneChanger::myChanger, and MSLaneChanger::veh().
Referenced by change(), MSLaneChanger::change(), MSLaneChanger::changeOpposite(), and MSLaneChanger::veh().
|
staticprotectedinherited |
return the closer follower of ego
Definition at line 509 of file MSLaneChanger.cpp.
References MSVehicle::getPositionOnLane().
Referenced by MSLaneChanger::getRealFollower(), and MSLaneChanger::veh().
|
protected |
get leaders for ego on the given lane
Definition at line 202 of file MSLaneChangerSublane.cpp.
References MSLeaderDistanceInfo::addLeader(), MSCFModel::brakeGap(), gDebugFlag1, MSVehicle::getBackPositionOnLane(), MSVehicle::getBestLanesContinuation(), MSVehicle::getCarFollowModel(), MSBaseVehicle::getID(), MSVehicle::getLane(), MSLane::getLength(), MSVehicleType::getMinGap(), MSVehicle::getPositionOnLane(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), MSLaneChanger::myCandi, MSLeaderInfo::numFreeSublanes(), MSLeaderInfo::numSublanes(), SIMTIME, SUMOReal, and MSLaneChanger::veh().
Referenced by checkChangeSublane().
|
protectedinherited |
Definition at line 489 of file MSLaneChanger.cpp.
References MSVehicle::getCarFollowModel(), MSLaneChanger::getCloserFollower(), MSVehicleType::getLength(), MSCFModel::getMaxDecel(), MSVehicle::getPositionOnLane(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), MSLaneChanger::myCandi, SUMOReal, and MSLaneChanger::veh().
Referenced by MSLaneChanger::checkChangeWithinEdge(), and MSLaneChanger::veh().
|
protectedinherited |
Definition at line 449 of file MSLaneChanger.cpp.
References MSCFModel::brakeGap(), MSVehicle::getBackPositionOnLane(), MSVehicle::getBestLanesContinuation(), MSVehicle::getCarFollowModel(), MSVehicleType::getMinGap(), MSVehicle::getPositionOnLane(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), MSLaneChanger::myCandi, MSLane::myPartialVehicles, SUMOReal, and MSLaneChanger::veh().
Referenced by MSLaneChanger::change(), MSLaneChanger::checkChangeWithinEdge(), and MSLaneChanger::veh().
|
protectedinherited |
Initialize the changer before looping over all vehicles.
Definition at line 122 of file MSLaneChanger.cpp.
References MSLaneChanger::myChanger.
Referenced by MSLaneChanger::laneChange().
|
inherited |
Start lane-change-process for all vehicles on the edge'e lanes.
Definition at line 99 of file MSLaneChanger.cpp.
References MSLaneChanger::change(), MSLaneChanger::initChanger(), MSLaneChanger::myChanger, MSLaneChanger::updateChanger(), MSLaneChanger::updateLanes(), and MSLaneChanger::vehInChanger().
Referenced by MSEdge::changeLanes().
|
protectedinherited |
whether changing to the lane in the given direction should be considered
Definition at line 204 of file MSLaneChanger.cpp.
References MSLaneChanger::myAllowsChanging, MSLaneChanger::myCandi, MSLaneChanger::myChanger, and MSLaneChanger::veh().
Referenced by MSLaneChanger::change(), checkChangeHelper(), startChangeSublane(), and MSLaneChanger::veh().
|
private |
Assignment operator.
|
protectedinherited |
Update changer for vehicles that did not change
Definition at line 371 of file MSLaneChanger.cpp.
References MSVehicle::getLaneChangeModel(), MSVehicleType::getLengthWithGap(), MSBaseVehicle::getVehicleType(), MSLaneChanger::myCandi, MSAbstractLaneChangeModel::unchanged(), and MSLaneChanger::veh().
Referenced by change(), MSLaneChanger::change(), startChangeSublane(), and MSLaneChanger::veh().
|
protectedinherited |
start the lane change maneuver (and finish it instantly if gLaneChangeDuration == 0)
Definition at line 379 of file MSLaneChanger.cpp.
References MSLaneChanger::continueChange(), MSVehicle::getLaneChangeModel(), MSVehicleType::getLengthWithGap(), MSBaseVehicle::getVehicleType(), MSLaneChanger::myCandi, and MSAbstractLaneChangeModel::startLaneChangeManeuver().
Referenced by MSLaneChanger::change(), and MSLaneChanger::veh().
|
protected |
change by the specified amount and return whether a new lane was entered
XXX assert(false);
Definition at line 155 of file MSLaneChangerSublane.cpp.
References gDebugFlag4, Named::getIDSecure(), MSLane::getIndex(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSVehicle::getLateralPositionOnLane(), MSVehicleType::getLengthWithGap(), MSLane::getRightSideOnEdge(), MSAbstractLaneChangeModel::getShadowLane(), MSBaseVehicle::getVehicleType(), MSLane::getWidth(), Position::INVALID, MSLaneChanger::mayChange(), MSVehicle::myCachedPosition, MSLaneChanger::myChanger, MSVehicle::State::myPosLat, MSVehicle::myState, MSLaneChanger::registerUnchanged(), SIMTIME, MSAbstractLaneChangeModel::startLaneChangeManeuver(), SUMOReal, and MSAbstractLaneChangeModel::updateShadowLane().
Referenced by change().
|
protectedvirtual |
After the possible change, update the changer.
Reimplemented from MSLaneChanger.
Definition at line 60 of file MSLaneChangerSublane.cpp.
References MSLane::getIndex(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSLane::getRightSideOnEdge(), MSAbstractLaneChangeModel::getShadowLane(), MSLaneChanger::myCandi, MSLaneChanger::myChanger, SUMOReal, and MSLaneChanger::updateChanger().
|
protectedinherited |
During lane-change a temporary vehicle container is filled within the lanes (bad pratice to modify foreign members, I know). Swap this container with the real one.
Definition at line 158 of file MSLaneChanger.cpp.
References MSLaneChanger::myChanger.
Referenced by MSLaneChanger::laneChange(), and MSLaneChanger::veh().
|
inlineprotectedinherited |
Returns the furthes unhandled vehicle on this change-elements lane or 0 if there is none.
Definition at line 129 of file MSLaneChanger.h.
References MSLaneChanger::change(), MSLaneChanger::changeOpposite(), MSLaneChanger::checkChange(), MSLaneChanger::checkChangeWithinEdge(), MSLaneChanger::computeOvertakingTime(), MSLaneChanger::continueChange(), MSLaneChanger::findCandidate(), MSLaneChanger::getCloserFollower(), MSLaneChanger::getRealFollower(), MSLaneChanger::getRealLeader(), MSLaneChanger::mayChange(), MSLaneChanger::registerUnchanged(), MSLaneChanger::startChange(), SUMOReal, MSLaneChanger::updateChanger(), and MSLaneChanger::updateLanes().
Referenced by change(), MSLaneChanger::change(), MSLaneChanger::changeOpposite(), MSLaneChanger::checkChange(), checkChangeSublane(), MSLaneChanger::findCandidate(), getLeaders(), MSLaneChanger::getRealFollower(), MSLaneChanger::getRealLeader(), MSLaneChanger::mayChange(), MSLaneChanger::registerUnchanged(), MSLaneChanger::updateChanger(), and MSLaneChanger::vehInChanger().
|
inlineprotectedinherited |
Check if there is a single change-candidate in the changer. Returns true if there is one.
Definition at line 116 of file MSLaneChanger.h.
References MSLaneChanger::myChanger, and MSLaneChanger::veh().
Referenced by MSLaneChanger::laneChange().
|
protectedinherited |
Definition at line 217 of file MSLaneChanger.h.
Referenced by MSLaneChanger::change(), and MSLaneChanger::mayChange().
|
protectedinherited |
Whether blocking vehicles may be swapped.
Definition at line 213 of file MSLaneChanger.h.
Referenced by MSLaneChanger::change().
|
protectedinherited |
Change-candidate. Last of the vehicles in changer. Only this one will try to change. Every vehicle on the edge will be a candidate once in the change-process.
Definition at line 210 of file MSLaneChanger.h.
Referenced by change(), MSLaneChanger::change(), MSLaneChanger::changeOpposite(), MSLaneChanger::checkChange(), checkChangeHelper(), checkChangeSublane(), MSLaneChanger::checkChangeWithinEdge(), MSLaneChanger::continueChange(), getLeaders(), MSLaneChanger::getRealFollower(), MSLaneChanger::getRealLeader(), MSLaneChanger::mayChange(), MSLaneChanger::registerUnchanged(), MSLaneChanger::startChange(), updateChanger(), and MSLaneChanger::updateChanger().
|
protectedinherited |
Container for ChangeElemements, one for every lane in the edge.
Definition at line 205 of file MSLaneChanger.h.
Referenced by change(), MSLaneChanger::change(), MSLaneChanger::findCandidate(), MSLaneChanger::initChanger(), MSLaneChanger::laneChange(), MSLaneChanger::mayChange(), MSLaneChanger::MSLaneChanger(), startChangeSublane(), updateChanger(), MSLaneChanger::updateLanes(), and MSLaneChanger::vehInChanger().
|
protectedinherited |
whether this edge allows changing to the opposite direction edge
Definition at line 220 of file MSLaneChanger.h.
Referenced by MSLaneChanger::changeOpposite().