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. | |
typedef Changer::iterator | ChangerIt |
the iterator moving over the ChangeElems | |
typedef Changer::const_iterator | ConstChangerIt |
the iterator moving over the ChangeElems |
Public Member Functions | |
void | laneChange (SUMOTime t) |
Start lane-change-process for all vehicles on the edge'e lanes. | |
MSLaneChanger (std::vector< MSLane * > *lanes, bool allowSwap) | |
Constructor. | |
~MSLaneChanger () | |
Destructor. |
Protected Member Functions | |
bool | change () |
int | change2left (const std::pair< MSVehicle *const, SUMOReal > &leader, const std::pair< MSVehicle *const, SUMOReal > &rLead, const std::pair< MSVehicle *const, SUMOReal > &rFollow, const std::vector< MSVehicle::LaneQ > &preb) const |
int | change2right (const std::pair< MSVehicle *const, SUMOReal > &leader, const std::pair< MSVehicle *const, SUMOReal > &rLead, const std::pair< MSVehicle *const, SUMOReal > &rFollow, const std::vector< MSVehicle::LaneQ > &preb) const |
ChangerIt | findCandidate () |
Find current candidate. If there is none, myChanger.end() is returned. | |
std::pair< MSVehicle *const, SUMOReal > | getRealFollower (const ChangerIt &target) const |
std::pair< MSVehicle *const, SUMOReal > | getRealLeader (const ChangerIt &target) const |
std::pair< MSVehicle *const, SUMOReal > | getRealThisLeader (const ChangerIt &target) const |
void | initChanger () |
Initialize the changer before looping over all vehicles. | |
bool | overlapWithHopped (ChangerIt target) const |
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. |
Protected Attributes | |
bool | myAllowsSwap |
Whether blocking vehicles may be swapped. | |
ChangerIt | myCandi |
Changer | myChanger |
Container for ChangeElemements, one for every lane in the edge. |
Private Member Functions | |
MSLaneChanger () | |
Default constructor. | |
MSLaneChanger (const MSLaneChanger &) | |
Copy constructor. | |
MSLaneChanger & | operator= (const MSLaneChanger &) |
Assignment operator. |
Performs lane changing of vehicles.
Definition at line 54 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 91 of file MSLaneChanger.h.
typedef Changer::iterator MSLaneChanger::ChangerIt |
the iterator moving over the ChangeElems
Definition at line 94 of file MSLaneChanger.h.
typedef Changer::const_iterator MSLaneChanger::ConstChangerIt |
the iterator moving over the ChangeElems
Definition at line 97 of file MSLaneChanger.h.
Constructor.
Definition at line 61 of file MSLaneChanger.cpp.
References 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 80 of file MSLaneChanger.cpp.
|
private |
Default constructor.
|
private |
Copy constructor.
|
protected |
Find a new candidate and try to change it.
Definition at line 125 of file MSLaneChanger.cpp.
References bla, change2left(), change2right(), MSAbstractLaneChangeModel::changed(), DELTA_T, MSVehicle::enterLaneAtLaneChange(), findCandidate(), MSAbstractLaneChangeModel::fulfillChangeRequest(), MSVehicle::getBestLanes(), MSVehicle::getInfluencer(), MSVehicle::getLaneChangeModel(), MSVehicleType::getLengthWithGap(), MSAbstractLaneChangeModel::getOwnState(), MSVehicle::getPositionOnLane(), getRealFollower(), getRealLeader(), getRealThisLeader(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), GLO_VEHICLE, gSelected, MSVehicle::hasInfluencer(), GUISelectedStorage::isSelected(), MSVehicle::Influencer::isVTDControlled(), LCA_BLOCKED, LCA_LEFT, LCA_RIGHT, LCA_SPEEDGAIN, LCA_URGENT, MSVehicle::leaveLane(), myAllowsSwap, myCandi, myChanger, MSVehicle::myLastLaneChangeOffset, MSVehicle::State::myPos, MSVehicle::State::mySpeed, MSVehicle::myState, MSMoveReminder::NOTIFICATION_LANE_CHANGE, MSAbstractLaneChangeModel::prepareStep(), MSVehicle::REQUEST_LEFT, MSVehicle::REQUEST_RIGHT, MSAbstractLaneChangeModel::setOwnState(), SUMOReal, and veh().
Referenced by laneChange().
|
protected |
Definition at line 511 of file MSLaneChanger.cpp.
References MSVehicle::getCarFollowModel(), MSVehicle::getLaneChangeModel(), MSCFModel::getMaxDecel(), MSVehicle::getPositionOnLane(), MSCFModel::getSecureGap(), MSVehicle::getSpeed(), LCA_BLOCKED_BY_LEFT_FOLLOWER, LCA_BLOCKED_BY_LEFT_LEADER, myCandi, overlapWithHopped(), veh(), and MSAbstractLaneChangeModel::wantsChangeToLeft().
Referenced by change().
|
protected |
Definition at line 471 of file MSLaneChanger.cpp.
References MSVehicle::getCarFollowModel(), MSVehicle::getLaneChangeModel(), MSCFModel::getMaxDecel(), MSVehicle::getPositionOnLane(), MSCFModel::getSecureGap(), MSVehicle::getSpeed(), LCA_BLOCKED_BY_RIGHT_FOLLOWER, LCA_BLOCKED_BY_RIGHT_LEADER, myCandi, overlapWithHopped(), veh(), and MSAbstractLaneChangeModel::wantsChangeToRight().
Referenced by change().
|
protected |
|
protected |
!! recheck
Definition at line 373 of file MSLaneChanger.cpp.
References MSVehicleType::getLength(), MSVehicle::getPositionOnLane(), MSVehicle::getSpeed(), MSBaseVehicle::getVehicleType(), MIN2(), myCandi, SPEED2DIST, SUMOReal, and veh().
Referenced by change().
|
protected |
Definition at line 341 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().
|
protected |
Definition at line 305 of file MSLaneChanger.cpp.
References MSVehicle::getBestLanesContinuation(), MSLane::getLastVehicle(), MSVehicleType::getLength(), MSVehicleType::getMinGap(), MSLane::getPartialOccupator(), MSLane::getPartialOccupatorEnd(), MSVehicle::getPositionOnLane(), MSBaseVehicle::getVehicleType(), MSLane::isLinkEnd(), MAX2(), myCandi, MSLane::succLinkSec(), SUMOReal, and veh().
Referenced by change().
|
protected |
Initialize the changer before looping over all vehicles.
Definition at line 100 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 84 of file MSLaneChanger.cpp.
References change(), initChanger(), updateChanger(), updateLanes(), and vehInChanger().
Referenced by MSEdge::changeLanes().
|
private |
Assignment operator.
Returns true if candidate overlaps with a vehicle, that already changed the lane.
Definition at line 159 of file MSLaneChanger.h.
References myCandi, MSVehicle::overlap(), and veh().
Referenced by change2left(), and change2right().
|
protected |
After the possible change, update the changer.
Definition at line 402 of file MSLaneChanger.cpp.
References myCandi, and veh().
Referenced by laneChange().
|
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 428 of file MSLaneChanger.cpp.
References myChanger.
Referenced by laneChange().
|
inlineprotected |
Returns a pointer to the changer-element-iterator vehicle, or 0 if there is none.
Definition at line 118 of file MSLaneChanger.h.
Referenced by change(), change2left(), change2right(), findCandidate(), getRealFollower(), getRealLeader(), getRealThisLeader(), overlapWithHopped(), updateChanger(), and vehInChanger().
|
inlineprotected |
Check if there is a single change-candidate in the changer. Returns true if there is one.
Definition at line 105 of file MSLaneChanger.h.
References myChanger, and veh().
Referenced by laneChange().
|
protected |
Whether blocking vehicles may be swapped.
Definition at line 184 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 181 of file MSLaneChanger.h.
Referenced by change(), change2left(), change2right(), getRealFollower(), getRealLeader(), getRealThisLeader(), overlapWithHopped(), and updateChanger().
|
protected |
Container for ChangeElemements, one for every lane in the edge.
Definition at line 176 of file MSLaneChanger.h.
Referenced by change(), findCandidate(), initChanger(), MSLaneChanger(), updateLanes(), and vehInChanger().