48 #ifdef CHECK_MEMORY_LEAKS
50 #endif // CHECK_MEMORY_LEAKS
63 #define DEBUG_COND false
88 for (std::vector<MSLane*>::const_iterator lane = lanes->begin(); lane != lanes->end(); ++lane) {
107 const bool haveChanged =
change();
114 ce->lane->releaseVehicles();
128 ce->firstBlocked = 0;
131 ce->lane->getVehiclesSecure();
169 ce->lane->swapAfterLaneChange(t);
170 ce->lane->releaseVehicles();
190 assert(
veh(ce) != 0);
191 assert(
veh(max) != 0);
192 if (
veh(max)->getPositionOnLane() <
veh(ce)->getPositionOnLane()) {
198 assert(
veh(max) != 0);
205 if (direction == 0) {
211 if (direction == -1) {
213 }
else if (direction == 1) {
233 #ifdef DEBUG_VEHICLE_GUI_SELECTION
260 for (
int i = 0; i < (int)
myChanger.size(); ++i) {
263 const std::vector<MSVehicle::LaneQ>& preb = vehicle->
getBestLanes();
268 bool changingAllowed1 = (state1 &
LCA_BLOCKED) == 0;
270 if ((state1 &
LCA_RIGHT) != 0 && changingAllowed1) {
275 if ((state1 & LCA_RIGHT) != 0 && (state1 &
LCA_URGENT) != 0) {
276 (
myCandi - 1)->lastBlocked = vehicle;
277 if ((
myCandi - 1)->firstBlocked == 0) {
278 (
myCandi - 1)->firstBlocked = vehicle;
289 bool changingAllowed2 = (state2 &
LCA_BLOCKED) == 0;
291 if ((state2 &
LCA_LEFT) != 0 && changingAllowed2) {
296 if ((state2 & LCA_LEFT) != 0 && (state2 &
LCA_URGENT) != 0) {
297 (
myCandi + 1)->lastBlocked = vehicle;
298 if ((
myCandi + 1)->firstBlocked == 0) {
299 (
myCandi + 1)->firstBlocked = vehicle;
338 to->lane->myTmpVehicles.insert(to->lane->myTmpVehicles.begin(), vehicle);
340 to->hoppedVeh = vehicle;
355 MSLane* target = to->lane;
358 to->lane->myTmpVehicles.insert(to->lane->myTmpVehicles.begin(), vehicle);
360 to->hoppedVeh = vehicle;
362 from->lane->myTmpVehicles.insert(from->lane->myTmpVehicles.begin(), vehicle);
364 from->hoppedVeh = vehicle;
374 shadow->hoppedVeh = vehicle;
378 #ifdef DEBUG_CONTINUE_CHANGE
381 <<
" continueChange veh=" << vehicle->
getID()
383 <<
" dir=" << direction
384 <<
" pastMidpoint=" << pastMidpoint
396 std::pair<MSVehicle* const, SUMOReal>
400 #ifdef DEBUG_SURROUNDING_VEHICLES
403 std::cout <<
SIMTIME <<
" veh '" << vehicle->
getID() <<
"' looks for leader on lc-target lane '" << target->lane->getID() <<
"'." << std::endl;
409 #ifdef DEBUG_SURROUNDING_VEHICLES
411 if (neighLead != 0) {
412 std::cout <<
"Considering '" << neighLead->
getID() <<
"' at position " << neighLead->
getPositionOnLane() << std::endl;
423 if (target->hoppedVeh != 0) {
424 SUMOReal hoppedPos = target->hoppedVeh->getPositionOnLane();
425 #ifdef DEBUG_SURROUNDING_VEHICLES
427 std::cout <<
"Considering hopped vehicle '" << target->hoppedVeh->getID() <<
"' at position " << hoppedPos << std::endl;
431 neighLead = target->hoppedVeh;
435 if (neighLead == 0) {
436 #ifdef DEBUG_SURROUNDING_VEHICLES
438 std::cout <<
"Looking for leader on consecutive lanes." << std::endl;
442 MSLane* targetLane = target->lane;
445 std::vector<MSVehicle*>::const_iterator i = targetLane->
myPartialVehicles.begin();
460 return std::pair<MSVehicle* const, SUMOReal>(
static_cast<MSVehicle*
>(0), -1);
463 return target->lane->getLeaderOnConsecutive(dist, seen, speed, *
veh(
myCandi), bestLaneConts);
471 std::pair<MSVehicle* const, SUMOReal>
475 #ifdef DEBUG_SURROUNDING_VEHICLES
478 std::cout <<
SIMTIME <<
" veh '" << vehicle->
getID() <<
"' looks for follower on lc-target lane '" << target->lane->getID() <<
"'." << std::endl;
485 #ifdef DEBUG_SURROUNDING_VEHICLES
487 if (neighFollow != 0) {
488 std::cout <<
"veh(target) returns '" << neighFollow->
getID() <<
"' at position " << neighFollow->
getPositionOnLane() << std::endl;
490 std::cout <<
"veh(target) returns none." << std::endl;
496 #ifdef DEBUG_SURROUNDING_VEHICLES
498 if (
getCloserFollower(candiPos, neighFollow, target->hoppedVeh) != neighFollow) {
499 std::cout <<
"Hopped vehicle '" << target->hoppedVeh->getID() <<
"' at position " << target->hoppedVeh->getPositionOnLane() <<
" is closer." << std::endl;
508 #ifdef DEBUG_SURROUNDING_VEHICLES
511 if (partialBehind != 0 && partialBehind != neighFollow) {
512 std::cout <<
"'Partial behind'-vehicle '" << target->lane->getPartialBehind(candi)->
getID() <<
"' at position " << target->hoppedVeh->getPositionOnLane() <<
" is closer." << std::endl;
517 neighFollow =
getCloserFollower(candiPos, neighFollow, target->lane->getPartialBehind(candi));
519 if (neighFollow == 0) {
520 std::pair<MSVehicle* const, SUMOReal> consecutiveFollower = target->lane->getFollowerOnConsecutive(
523 #ifdef DEBUG_SURROUNDING_VEHICLES
525 if (consecutiveFollower.first == 0) {
526 std::cout <<
"no follower found." << std::endl;
528 std::cout <<
"found follower '" << consecutiveFollower.first->
getID() <<
"' on consecutive lanes." << std::endl;
532 return consecutiveFollower;
534 #ifdef DEBUG_SURROUNDING_VEHICLES
536 std::cout <<
"found follower '" << neighFollow->
getID() <<
"'." << std::endl;
540 return std::pair<MSVehicle* const, SUMOReal>(neighFollow,
564 const std::pair<MSVehicle* const, SUMOReal>& leader,
565 const std::vector<MSVehicle::LaneQ>& preb)
const {
569 if (neighLead.first != 0 && neighLead.first == neighFollow.first) {
572 neighFollow.first = 0;
575 return checkChange(laneOffset, target->lane, leader, neighLead, neighFollow, preb);
582 const std::pair<MSVehicle* const, SUMOReal>& leader,
583 const std::pair<MSVehicle* const, SUMOReal>& neighLead,
584 const std::pair<MSVehicle* const, SUMOReal>& neighFollow,
585 const std::vector<MSVehicle::LaneQ>& preb)
const {
590 #ifdef DEBUG_CHECK_CHANGE
593 <<
"\n" <<
SIMTIME <<
" checkChange() for vehicle '" << vehicle->
getID() <<
"'"
603 if (neighFollow.first != 0 && neighFollow.second < 0) {
607 #ifdef DEBUG_CHECK_CHANGE
610 <<
" overlapping with follower..."
616 if (neighLead.first != 0 && neighLead.second < 0) {
620 #ifdef DEBUG_CHECK_CHANGE
623 <<
" overlapping with leader..."
631 if ((blocked & blockedByFollower) == 0 && neighFollow.first != 0) {
634 blocked |= blockedByFollower;
637 #ifdef DEBUG_CHECK_CHANGE
640 <<
" back gap unsafe: "
641 <<
"gap = " << neighFollow.second
643 << neighFollow.first->getCarFollowModel().getSecureGap(neighFollow.first->getSpeed(),
653 if ((blocked & blockedByLeader) == 0 && neighLead.first != 0) {
656 blocked |= blockedByLeader;
659 #ifdef DEBUG_CHECK_CHANGE
662 <<
" front gap unsafe: "
663 <<
"gap = " << neighLead.second
666 neighLead.first->getSpeed(), neighLead.first->getCarFollowModel().getMaxDecel())
677 laneOffset, msg, blocked, leader, neighLead, neighFollow, *targetLane, preb, &(
myCandi->lastBlocked), &(
myCandi->firstBlocked));
686 std::pair<MSVehicle* const, SUMOReal> neighLead2 = targetLane->
getCriticalLeader(dist, seen, speed, *vehicle);
687 if (neighLead2.first != 0 && neighLead2.first != neighLead.first
689 vehicle->
getSpeed(), neighLead2.first->getSpeed(), neighLead2.first->getCarFollowModel().getMaxDecel()))) {
690 state |= blockedByLeader;
694 if (blocked == 0 && (state & LCA_WANTS_LANECHANGE)) {
697 state |= blockedByLeader;
714 MSLinkCont::const_iterator link =
MSLane::succLinkSec(*vehicle, view, *nextLane, bestLaneConts);
715 while (!nextLane->
isLinkEnd(link) && seen <= space2change) {
719 || (nextLane->
getEdge().
isInternal() && (*link)->getViaLaneOrLane()->getEdge().isInternal())
724 #ifdef HAVE_INTERNAL_LANES
725 if ((*link)->getViaLane() == 0) {
731 nextLane = (*link)->getViaLaneOrLane();
736 if (nextLane->
isLinkEnd(link) && seen < space2change) {
737 #ifdef DEBUG_CHECK_CHANGE
739 std::cout <<
SIMTIME <<
" checkChange insufficientSpace: seen=" << seen <<
" space2change=" << space2change <<
"\n";
745 if ((state & LCA_BLOCKED) == 0) {
753 MSLinkCont::const_iterator link =
MSLane::succLinkSec(*vehicle, view, *nextLane, bestLaneConts);
754 while (!nextLane->
isLinkEnd(link) && seen <= space2change && seen <= dist) {
755 nextLane = (*link)->getViaLaneOrLane();
757 if (targetLane == 0) {
761 std::pair<MSVehicle* const, SUMOReal> neighLead2 = targetLane->
getLeader(vehicle, -seen, std::vector<MSLane*>());
762 if (neighLead2.first != 0 && neighLead2.first != neighLead.first
764 vehicle->
getSpeed(), neighLead2.first->getSpeed(), neighLead2.first->getCarFollowModel().getMaxDecel()))) {
765 state |= blockedByLeader;
769 #ifdef HAVE_INTERNAL_LANES
770 if ((*link)->getViaLane() == 0) {
783 #ifdef DEBUG_CHECK_CHANGE
784 const int oldstate = state;
789 #ifdef DEBUG_CHECK_CHANGE
792 <<
" veh=" << vehicle->
getID()
818 if (!isOpposite && leader.first == 0) {
834 std::pair<MSVehicle*, SUMOReal> neighLead((
MSVehicle*)0, -1);
838 assert(leader.first != 0);
843 std::pair<MSVehicle*, SUMOReal> columnLeader = leader;
845 bool foundSpaceAhead =
false;
846 SUMOReal seen = leader.second + leader.first->getVehicleType().getLengthWithGap();
848 while (!foundSpaceAhead) {
849 const SUMOReal requiredSpaceAfterLeader = (columnLeader.first->getCarFollowModel().getSecureGap(
854 std::pair<MSVehicle* const, SUMOReal> leadLead = columnLeader.first->getLane()->getLeader(
855 columnLeader.first, columnLeader.first->getPositionOnLane(), conts, requiredSpaceAfterLeader + mergeBrakeGap,
true);
857 #ifdef DEBUG_CHANGE_OPPOSITE
859 std::cout <<
" leadLead=" <<
Named::getIDSecure(leadLead.first) <<
" gap=" << leadLead.second <<
"\n";
862 if (leadLead.first == 0) {
863 foundSpaceAhead =
true;
865 const SUMOReal requiredSpace = (requiredSpaceAfterLeader
866 + vehicle->
getCarFollowModel().
getSecureGap(overtakingSpeed, leadLead.first->getSpeed(), leadLead.first->getCarFollowModel().getMaxDecel()));
867 if (leadLead.second > requiredSpace) {
868 foundSpaceAhead =
true;
870 #ifdef DEBUG_CHANGE_OPPOSITE
872 std::cout <<
" not enough space after columnLeader=" << leadLead.first->getID() <<
" gap=" << leadLead.second <<
" required=" << requiredSpace <<
"\n";
875 seen += leadLead.second + leadLead.first->getVehicleType().getLengthWithGap();
876 if (seen > maxLookAhead) {
877 #ifdef DEBUG_CHANGE_OPPOSITE
879 std::cout <<
" cannot changeOpposite due to insufficient free space after columnLeader (seen=" << seen <<
" columnLeader=" << leadLead.first->getID() <<
")\n";
885 egoGap += columnLeader.first->getVehicleType().getLengthWithGap() + leadLead.second;
886 columnLeader = leadLead;
887 #ifdef DEBUG_CHANGE_OPPOSITE
889 std::cout <<
" new columnLeader=" << columnLeader.first->getID() <<
"\n";
895 #ifdef DEBUG_CHANGE_OPPOSITE
897 std::cout <<
" compute time/space to overtake for columnLeader=" << columnLeader.first->getID() <<
" gap=" << columnLeader.second <<
"\n";
905 #ifdef DEBUG_CHANGE_OPPOSITE
907 std::cout <<
" cannot changeOpposite due to upcoming stop (dist=" << vehicle->
nextStopDist() <<
" spaceToOvertake=" << spaceToOvertake <<
")\n";
914 #ifdef DEBUG_CHANGE_OPPOSITE
917 <<
" veh=" << vehicle->
getID()
918 <<
" changeOpposite opposite=" << opposite->
getID()
921 <<
" timeToOvertake=" << timeToOvertake
922 <<
" spaceToOvertake=" << spaceToOvertake
929 const MSVehicle* oncoming = neighLead.first;
932 #ifdef DEBUG_CHANGE_OPPOSITE
935 <<
" timeToOvertake=" << timeToOvertake
936 <<
" spaceToOvertake=" << spaceToOvertake
937 <<
" oncomingGap=" << neighLead.second
938 <<
" leaderGap=" << leader.second
942 if (neighLead.second - spaceToOvertake - timeToOvertake * oncoming->
getSpeed() < 0) {
944 #ifdef DEBUG_CHANGE_OPPOSITE
946 std::cout <<
" cannot changeOpposite due to dangerous oncoming\n";
956 assert(bestLaneConts.size() >= 1);
957 std::vector<MSLane*>::const_iterator it = bestLaneConts.begin() + 1;
958 while (seen < spaceToOvertake && it != bestLaneConts.end()) {
959 if ((*it)->getOpposite() == 0) {
963 if (*(it - 1) != 0) {
969 seen += (*it)->getLength();
971 if (seen < spaceToOvertake) {
972 #ifdef DEBUG_CHANGE_OPPOSITE
974 std::cout <<
" cannot changeOpposite due to insufficient space (seen=" << seen <<
" spaceToOvertake=" << spaceToOvertake <<
")\n";
979 #ifdef DEBUG_CHANGE_OPPOSITE
981 std::cout <<
" seen=" << seen <<
" spaceToOvertake=" << spaceToOvertake <<
" timeToOvertake=" << timeToOvertake <<
"\n";
992 std::vector<MSVehicle::LaneQ> preb = vehicle->
getBestLanes();
993 if (isOpposite && leader.first != 0) {
999 std::pair<MSVehicle* const, SUMOReal> neighFollow = opposite->
getOppositeFollower(vehicle);
1000 int state =
checkChange(direction, opposite, leader, neighLead, neighFollow, preb);
1002 bool changingAllowed = (state &
LCA_BLOCKED) == 0;
1011 #ifdef DEBUG_CHANGE_OPPOSITE
1013 std::cout <<
SIMTIME <<
" changing to opposite veh=" << vehicle->
getID() <<
" dir=" << direction <<
" opposite=" <<
Named::getIDSecure(opposite) <<
" state=" << state <<
"\n";
1018 #ifdef DEBUG_CHANGE_OPPOSITE
1020 std::cout <<
SIMTIME <<
" not changing to opposite veh=" << vehicle->
getID() <<
" dir=" << direction <<
" opposite=" <<
Named::getIDSecure(opposite) <<
" state=" << state <<
"\n";
1042 SUMOReal t = (u - v - sqrt(4 * (u - v) * (u - v) + 8 * a * g) * sign * 0.5) / a;
1046 const SUMOReal timeToMaxSpeed = (vMax - v) / a;
1048 if (t <= timeToMaxSpeed) {
1050 spaceToOvertake = v * t + t * t * a * 0.5;
1054 const SUMOReal s = v * timeToMaxSpeed + timeToMaxSpeed * timeToMaxSpeed * a * 0.5;
1058 t = (g - s + m * vMax) / (vMax - u);
1060 spaceToOvertake = s + (t - m) * vMax;
void laneChange(SUMOTime t)
Start lane-change-process for all vehicles on the edge'e lanes.
bool isRemoteControlled() const
Returns the information whether the vehicle is fully controlled via TraCI.
MSEdge & getEdge() const
Returns the lane's edge.
Representation of a vehicle in the micro simulation.
bool isLinkEnd(MSLinkCont::const_iterator &i) const
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts)
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
State myState
This Vehicles driving state (pos and speed)
bool isChangingLanes() const
return true if the vehicle currently performs a lane change maneuver
std::pair< MSVehicle *const, SUMOReal > getRealLeader(const ChangerIt &target) const
std::pair< MSVehicle *const, SUMOReal > getOppositeFollower(const MSVehicle *ego) const
SUMOReal getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
The vehicle is blocked by left follower.
MSLane * getOpposite() const
return the opposite direction lane for lane changing or 0
bool alreadyChanged() const
reset the flag whether a vehicle already moved to false
bool unsafeLinkAhead(const MSLane *lane) const
whether the vehicle may safely move to the given lane with regard to upcoming links ...
bool continueChange(MSVehicle *vehicle, ChangerIt &from)
continue a lane change maneuver and return whether the midpoint was passed in this step (used if gLan...
void initChanger()
Initialize the changer before looping over all vehicles.
SUMOReal getLength() const
Returns the lane's length.
int checkChangeWithinEdge(int laneOffset, const std::pair< MSVehicle *const, SUMOReal > &leader, const std::vector< MSVehicle::LaneQ > &preb) const
bool mayChange(int direction) const
whether changing to the lane in the given direction should be considered
int getShadowDirection() const
return the direction in which the current shadow lane lies
SUMOReal getLength() const
Get vehicle's length [m].
const bool myChangeToOpposite
whether this edge allows changing to the opposite direction edge
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)
Called to examine whether the vehicle wants to change using the given laneOffset. This method gets th...
SUMOReal getWidth() const
Returns the lane's width.
MSVehicle * veh(ConstChangerIt ce) const
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
SUMOReal getSecureGap(const SUMOReal speed, const SUMOReal leaderSpeed, const SUMOReal leaderMaxDecel) const
Returns the minimum gap to reserve if the leader is braking at maximum (>=0)
void startChange(MSVehicle *vehicle, ChangerIt &from, int direction)
start the lane change maneuver (and finish it instantly if gLaneChangeDuration == 0) ...
SUMOReal getPositionOnLane() const
Get the vehicle's position along the lane.
std::pair< MSVehicle *const, SUMOReal > getCriticalLeader(SUMOReal dist, SUMOReal seen, SUMOReal speed, const MSVehicle &veh) const
Returns the most dangerous leader and the distance to him.
ChangeElem(MSLane *_lane)
VehCont myPartialVehicles
The lane's partial vehicles. This container holds all vehicles that are partially on this lane but wh...
SUMOReal length
The overall length which may be driven when using this lane without a lane change.
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.
ChangerIt findCandidate()
Find current candidate. If there is none, myChanger.end() is returned.
This is an uncontrolled, zipper-merge link.
The link is a (hard) left direction.
static MSVehicle * getCloserFollower(const SUMOReal maxPos, MSVehicle *follow1, MSVehicle *follow2)
return the closer follower of ego
MSAbstractLaneChangeModel & getLaneChangeModel()
std::string gDebugSelectedVehicle
SUMOReal getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
A class responsible for exchanging messages between cars involved in lane-change interaction.
const std::string & getID() const
Returns the id.
The vehicle changes lanes (micro only) XXX: What if a vehicle changes lanes and passes a junction sim...
std::pair< MSVehicle *const, SUMOReal > getRealFollower(const ChangerIt &target) const
SUMOReal brakeGap(const SUMOReal speed) const
Returns the distance the vehicle needs to halt including driver's reaction time, assuming that during...
SUMOReal computeAngle() const
compute the current vehicle angle
virtual void updateChanger(bool vehHasChanged)
The action is urgent (to be defined by lc-model)
SUMOReal getMinGap() const
Get the free space in front of vehicles of this class.
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the subpart of best lanes that describes the vehicle's current lane and their successors...
SUMOReal getLateralSpeed() const
return the lateral speed of the current lane change maneuver
SUMOReal myAngle
the angle in radians (
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
Position myCachedPosition
MSLane * getParallelLane(int offset) const
Returns the lane with the given offset parallel to this one or 0 if it does not exist.
virtual bool changeOpposite(std::pair< MSVehicle *, SUMOReal > leader)
bool isStopped() const
Returns whether the vehicle is at a stop.
The link is a (hard) right direction.
virtual void setOwnState(int state)
SUMOReal getSpeedLimit() const
Returns the lane's maximum allowed speed.
A structure representing the best lanes for continuing the route.
SUMOReal getMaxDecel() const
Get the vehicle type's maximum deceleration [m/s^2].
MSLane * getShadowLane() const
Returns the lane the vehicles shadow is on during continuous/sublane lane change. ...
MSLaneChanger()
Default constructor.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
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
bool isInternal() const
return whether this edge is an internal edge
void updateLanes(SUMOTime t)
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
std::vector< MSVehicle * > VehCont
Container for vehicles.
bool canChangeToOpposite()
whether this edge allows changing to the opposite direction edge
bool startLaneChangeManeuver(MSLane *source, MSLane *target, int direction)
start the lane change maneuver and return whether it continues
void forceVehicleInsertion(MSVehicle *veh, SUMOReal pos, MSMoveReminder::Notification notification, SUMOReal posLat=0)
Inserts the given vehicle at the given position.
SUMOReal getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
void primaryLaneChanged(MSLane *source, MSLane *target, int direction)
called once when the vehicles primary lane changes
LaneChangeAction
The state of a vehicle's lane-change behavior.
bool havePriority() const
Returns whether this link is a major link.
std::pair< MSVehicle *const, SUMOReal > getOppositeLeader(const MSVehicle *ego, SUMOReal dist) const
static MSLink * getConnectingLink(const MSLane &from, const MSLane &to)
Returns the link connecting both lanes Both lanes have to be non-internal; 0 may be returned if no co...
virtual ~MSLaneChanger()
Destructor.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
Changer::iterator ChangerIt
the iterator moving over the ChangeElems
SUMOReal getSpeed() const
Returns the vehicle's current speed.
SUMOReal myPos
the stored position
SUMOReal getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
SUMOReal nextStopDist() const
return the distance to the next stop or SUMORealMax if there is none.
Changer myChanger
Container for ChangeElemements, one for every lane in the edge.
SUMOReal getOppositePos(SUMOReal pos) const
return the corresponding position on the opposite lane
LinkState getState() const
Returns the current state of the link.
void registerUnchanged(MSVehicle *vehicle)
SUMOReal myPosLat
the stored lateral position
void adaptBestLanesOccupation(int laneIndex, SUMOReal density)
update occupation from MSLaneChanger
SUMOReal myBackPos
the stored back position
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
The vehicle is blocked by right leader.
MSLane * getLane() const
Returns the lane the vehicle is on.
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
bool vehInChanger() const
Check if there is a single change-candidate in the changer. Returns true if there is one...
static SUMOTime gLaneChangeDuration
Representation of a lane in the micro simulation.
The vehicle is blocked by right follower.
Interface for lane-change models.
std::pair< MSVehicle *const, SUMOReal > getLeader(const MSVehicle *veh, const SUMOReal vehPos, const std::vector< MSLane * > &bestLaneConts, SUMOReal dist=-1, bool checkTmpVehicles=false) const
Returns the immediate leader of veh and the distance to veh starting on this lane.
static const Position INVALID
The vehicle is blocked by left leader.
int getLaneChangeDirection() const
return the direction of the current lane change maneuver
const std::string & getID() const
Returns the name of the vehicle.
void endLaneChangeManeuver(const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_LANE_CHANGE)