![]() |
SUMO - Simulation of Urban MObility
|
Performs lane changing of vehicles. More...
#include <MSLaneChanger.h>
Data Structures | |
struct | ChangeElem |
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... | |
MSLaneChanger (const std::vector< MSLane * > *lanes, bool allowSwap) | |
Constructor. More... | |
~MSLaneChanger () | |
Destructor. More... | |
Protected Member Functions | |
bool | change () |
int | checkChange (int laneOffset, const std::pair< MSVehicle *const, SUMOReal > &leader, const std::vector< MSVehicle::LaneQ > &preb) const |
ChangerIt | findCandidate () |
Find current candidate. If there is none, myChanger.end() is returned. 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... | |
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... | |
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... | |
Protected Attributes | |
bool | myAllowsSwap |
Whether blocking vehicles may be swapped. More... | |
ChangerIt | myCandi |
Changer | myChanger |
Container for ChangeElemements, one for every lane in the edge. More... | |
Private Member Functions | |
MSLaneChanger () | |
Default constructor. More... | |
MSLaneChanger (const MSLaneChanger &) | |
Copy constructor. More... | |
MSLaneChanger & | operator= (const MSLaneChanger &) |
Assignment operator. More... | |
Performs lane changing of vehicles.
Definition at line 55 of file MSLaneChanger.h.
typedef std::vector< ChangeElem > MSLaneChanger::Changer |
The list of changers; For each lane, a ChangeElem is being build.
Definition at line 94 of file MSLaneChanger.h.
typedef Changer::iterator MSLaneChanger::ChangerIt |
the iterator moving over the ChangeElems
Definition at line 97 of file MSLaneChanger.h.
typedef Changer::const_iterator MSLaneChanger::ConstChangerIt |
the iterator moving over the ChangeElems
Definition at line 100 of file MSLaneChanger.h.
MSLaneChanger::MSLaneChanger | ( | const std::vector< MSLane * > * | lanes, |
bool | allowSwap | ||
) |
Constructor.
Definition at line 56 of file MSLaneChanger.cpp.
References MSLaneChanger::ChangeElem::firstBlocked, MSLaneChanger::ChangeElem::follow, MSLaneChanger::ChangeElem::hoppedVeh, MSLaneChanger::ChangeElem::lane, MSLaneChanger::ChangeElem::lastBlocked, MSLaneChanger::ChangeElem::lead, myChanger, and MSLaneChanger::ChangeElem::veh.
MSLaneChanger::~MSLaneChanger | ( | ) |
Destructor.
Definition at line 76 of file MSLaneChanger.cpp.
|
private |
Default constructor.
|
private |
Copy constructor.
|
protected |
Find a new candidate and try to change it.
Definition at line 121 of file MSLaneChanger.cpp.
References MSVehicle::adaptBestLanesOccupation(), bla, MSAbstractLaneChangeModel::changed(), checkChange(), MSVehicle::enterLaneAtLaneChange(), findCandidate(), gDebugSelectedVehicle, MSVehicle::getBestLanes(), MSBaseVehicle::getID(), MSVehicle::getInfluencer(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSVehicleType::getLengthWithGap(), MSAbstractLaneChangeModel::getOwnState(), MSVehicle::getPositionOnLane(), getRealLeader(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), MSVehicle::hasInfluencer(), MSAbstractLaneChangeModel::isChangingLanes(), MSVehicle::Influencer::isVTDControlled(), LCA_BLOCKED, LCA_LEFT, LCA_RIGHT, LCA_URGENT, MSVehicle::leaveLane(), myAllowsSwap, myCandi, myChanger, MSVehicle::State::myPos, MSVehicle::State::mySpeed, MSVehicle::myState, MSMoveReminder::NOTIFICATION_LANE_CHANGE, registerUnchanged(), MSAbstractLaneChangeModel::setOwnState(), startChange(), SUMOReal, MSVehicle::updateBestLanes(), and veh().
Referenced by laneChange(), and veh().
|
protected |
Definition at line 422 of file MSLaneChanger.cpp.
References MSCFModel::brakeGap(), DELTA_T, MSVehicle::getBestLanesContinuation(), MSVehicle::getCarFollowModel(), MSLane::getCriticalLeader(), MSLane::getEdge(), MSVehicle::getLane(), MSVehicle::getLaneChangeModel(), MSLane::getLeader(), MSLane::getLength(), MSCFModel::getMaxDecel(), MSVehicleType::getMinGap(), MSLane::getParallelLane(), MSVehicle::getPositionOnLane(), getRealFollower(), getRealLeader(), 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(), myCandi, STEPS2TIME, MSLane::succLinkSec(), SUMOReal, MSVehicle::unsafeLinkAhead(), veh(), and MSAbstractLaneChangeModel::wantsChange().
|
protected |
|
protected |
Definition at line 329 of file MSLaneChanger.cpp.
References MSVehicle::getCarFollowModel(), MSVehicleType::getLength(), MSCFModel::getMaxDecel(), MSVehicle::getPositionOnLane(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), myCandi, SUMOReal, and veh().
Referenced by checkChange(), and veh().
|
protected |
Definition at line 297 of file MSLaneChanger.cpp.
References MSCFModel::brakeGap(), MSVehicle::getBestLanesContinuation(), MSVehicle::getCarFollowModel(), MSVehicleType::getMinGap(), MSLane::getPartialOccupator(), MSLane::getPartialOccupatorEnd(), MSVehicle::getPositionOnLane(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), myCandi, SUMOReal, and veh().
Referenced by change(), checkChange(), and veh().
|
protected |
Initialize the changer before looping over all vehicles.
Definition at line 95 of file MSLaneChanger.cpp.
References myChanger.
Referenced by laneChange().
void MSLaneChanger::laneChange | ( | SUMOTime | t | ) |
Start lane-change-process for all vehicles on the edge'e lanes.
Definition at line 80 of file MSLaneChanger.cpp.
References change(), initChanger(), updateChanger(), updateLanes(), and vehInChanger().
Referenced by MSEdge::changeLanes().
|
private |
Assignment operator.
|
protected |
Update changer for vehicles that did not change
Definition at line 272 of file MSLaneChanger.cpp.
References MSVehicle::getLaneChangeModel(), MSVehicleType::getLengthWithGap(), MSBaseVehicle::getVehicleType(), myCandi, MSAbstractLaneChangeModel::unchanged(), and veh().
start the lane change maneuver (and finish it instantly if gLaneChangeDuration == 0)
Definition at line 280 of file MSLaneChanger.cpp.
References MSVehicle::computeAngle(), MSVehicle::getLaneChangeModel(), MSVehicleType::getLengthWithGap(), MSBaseVehicle::getVehicleType(), MSVehicle::myAngle, and MSAbstractLaneChangeModel::startLaneChangeManeuver().
|
protected |
After the possible change, update the changer.
Definition at line 354 of file MSLaneChanger.cpp.
References DELTA_T, MSGlobals::gLaneChangeDuration, myCandi, and veh().
Referenced by laneChange(), and veh().
|
protected |
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 380 of file MSLaneChanger.cpp.
References myChanger.
Referenced by laneChange(), and veh().
|
inlineprotected |
Returns a pointer to the changer-element-iterator vehicle, or 0 if there is none.
Definition at line 121 of file MSLaneChanger.h.
References change(), checkChange(), findCandidate(), getRealFollower(), getRealLeader(), registerUnchanged(), startChange(), updateChanger(), and updateLanes().
Referenced by change(), checkChange(), findCandidate(), getRealFollower(), getRealLeader(), registerUnchanged(), and updateChanger().
|
inlineprotected |
Check if there is a single change-candidate in the changer. Returns true if there is one.
Definition at line 108 of file MSLaneChanger.h.
References myChanger, and MSLaneChanger::ChangeElem::veh.
Referenced by laneChange().
|
protected |
Whether blocking vehicles may be swapped.
Definition at line 172 of file MSLaneChanger.h.
Referenced by change().
|
protected |
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 169 of file MSLaneChanger.h.
Referenced by change(), checkChange(), getRealFollower(), getRealLeader(), registerUnchanged(), and updateChanger().
|
protected |
Container for ChangeElemements, one for every lane in the edge.
Definition at line 164 of file MSLaneChanger.h.
Referenced by change(), findCandidate(), initChanger(), MSLaneChanger(), updateLanes(), and vehInChanger().