99 #define STOPPING_PLACE_OFFSET 0.5 101 #define CRLL_LOOK_AHEAD 5 104 #define DIST_TO_STOPLINE_EXPECT_PRIORITY 1.0 182 if (memorySpan == -1) {
187 if (i->second >= memorySpan) {
188 if (i->first >= memorySpan) {
191 totalWaitingTime += memorySpan - i->first;
194 totalWaitingTime += i->second - i->first;
197 return totalWaitingTime;
204 bool startNewInterval = i == end || (i->first != 0);
215 waitingIntervalList::iterator::difference_type d = std::distance(i, end);
223 }
else if (!startNewInterval) {
241 mySpeedAdaptationStarted(true),
242 myConsiderSafeVelocity(true),
243 myConsiderMaxAcceleration(true),
244 myConsiderMaxDeceleration(true),
245 myRespectJunctionPriority(true),
246 myEmergencyBrakeRedLight(true),
321 speed =
MIN2(speed, vSafe);
324 speed =
MIN2(speed, vMax);
327 speed =
MAX2(speed, vMin);
349 if (destinationLaneIndex < (
int)currentEdge.
getLanes().size()) {
350 if (currentLaneIndex > destinationLaneIndex) {
352 }
else if (currentLaneIndex < destinationLaneIndex) {
380 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
388 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
409 switch (changeRequest) {
478 const bool wasOnRoad = v->
isOnRoad();
584 if (!(*myCurrEdge)->isTazConnector()) {
586 if ((*myCurrEdge)->getDepartLane(*
this) == 0) {
587 throw ProcessError(
"Invalid departlane definition for vehicle '" + pars->
id +
"'.");
591 throw ProcessError(
"Vehicle '" + pars->
id +
"' is not allowed to depart on any lane of its first edge.");
596 "' is too high for the vehicle type '" + type->
getID() +
"'.");
607 (*i)->resetPartialOccupation(
this);
658 (newCurrEdge + 1) == edges.end() || (*(newCurrEdge + 1)) != &(
myLane->
getOutgoingLanes()[0]->getEdge()))) {
674 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end();) {
675 if (find(
myCurrEdge, edges.end(), &iter->lane->getEdge()) == edges.end()) {
678 iter->edge = find(
myCurrEdge, edges.end(), &iter->lane->getEdge());
684 for (std::vector<SUMOVehicleParameter::Stop>::const_iterator i = newRoute->
getStops().begin(); i != newRoute->
getStops().end(); ++i) {
752 if (!rem->first->notifyMove(*
this, oldPos + rem->second, newPos + rem->second,
MAX2(0., newSpeed))) {
754 if (myTraceMoveReminders) {
755 traceMoveReminder(
"notifyMove", rem->first, rem->second,
false);
761 if (myTraceMoveReminders) {
762 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
778 rem->second += oldLaneLength;
782 if (myTraceMoveReminders) {
783 traceMoveReminder(
"adaptedPos", rem->first, rem->second,
true);
816 if (
myStops.begin()->parkingarea != 0) {
817 return myStops.begin()->parkingarea->getVehiclePosition(*
this);
826 if (offset == 0. && !changingLanes) {
841 auto nextBestLane = bestLanes.begin();
864 while (nextBestLane != bestLanes.end() && *nextBestLane == 0) {
869 assert(lane == *nextBestLane);
873 assert(nextBestLane == bestLanes.end() || *nextBestLane != 0);
874 if (nextBestLane == bestLanes.end()) {
901 int furtherIndex = 0;
939 if (
myStops.begin()->parkingarea != 0) {
940 return myStops.begin()->parkingarea->getVehicleAngle(*
this);
961 double result = (p1 != p2 ? p2.
angleTo2D(p1) :
968 std::cout <<
SIMTIME <<
" computeAngle veh=" <<
getID() <<
" p1=" << p1 <<
" p2=" << p2 <<
" angle=" << result <<
"\n";
1005 errorMsg =
"Vehicle '" +
myParameter->
id +
"' is not allowed to stop on lane '" + stopPar.
lane +
"'.";
1020 if (stop.
until != -1) {
1021 stop.
until += untilOffset;
1034 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' has an invalid position.";
1048 if (searchStart == 0) {
1055 std::list<Stop>::iterator iter =
myStops.begin();
1058 prevStopEdge =
myStops.back().edge;
1059 prevStopPos =
myStops.back().endPos;
1062 if (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos) {
1068 while (iter !=
myStops.end() && (iter->edge < stop.
edge ||
1069 (iter->endPos < stop.
endPos && iter->edge == stop.
edge))) {
1070 prevStopEdge = iter->edge;
1071 prevStopPos = iter->endPos;
1075 int index = stopPar.
index;
1077 prevStopEdge = iter->edge;
1078 prevStopPos = iter->endPos;
1086 (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos && !collision)
1091 return addStop(stopPar, errorMsg, untilOffset, collision, &next);
1098 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is not downstream the current route.";
1109 errorMsg =
"Stop for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is too close to break.";
1117 pos += (*myCurrEdge)->getLength();
1123 if (pos > stop.
endPos + endPosOffset) {
1127 return addStop(stopPar, errorMsg, untilOffset, collision, &next);
1134 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is before departPos.";
1138 if (iter !=
myStops.begin()) {
1139 std::list<Stop>::iterator iter2 = iter;
1141 if (stop.
until >= 0 && iter2->until > stop.
until) {
1147 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' ends earlier than previous stop.";
1158 assert(parkingArea != 0);
1160 errorMsg =
"Vehicle '" +
myParameter->
id +
"' has no stops.";
1166 errorMsg =
"current stop already reached";
1170 errorMsg =
"current stop is not a parkingArea";
1174 errorMsg =
"current stop is the same as the new parking area";
1180 int removeStops = 0;
1183 for (std::list<Stop>::const_iterator iter =
myStops.begin(); iter !=
myStops.end(); ++iter) {
1184 if (duration == 0) {
1185 duration = iter->duration;
1188 if (iter->parkingarea != 0 && iter->parkingarea == parkingArea) {
1189 duration += iter->duration;
1213 while (removeStops > 0) {
1217 const bool result =
addStop(stopPar, errorMsg);
1235 return nextParkingArea;
1287 return currentVelocity;
1292 std::cout <<
"\nPROCESS_NEXT_STOP\n" <<
SIMTIME <<
" vehicle '" <<
getID() <<
"'" << std::endl;
1301 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' reached stop." << std::endl;
1315 for (std::vector<MSTransportable*>::const_iterator i = persons.begin(); i != persons.end(); ++i) {
1326 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' unregisters as waiting for person." << std::endl;
1334 for (std::vector<MSTransportable*>::const_iterator i = containers.begin(); i != containers.end(); ++i) {
1345 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' unregisters as waiting for container." << std::endl;
1353 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' resumes from stopping." << std::endl;
1360 WRITE_WARNING(
"Vehicle '" +
getID() +
"' ignores triggered stop on lane '" + stop.
lane->
getID() +
"' due to capacity constraints.");
1368 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' registers as waiting for person." << std::endl;
1374 WRITE_WARNING(
"Vehicle '" +
getID() +
"' ignores container triggered stop on lane '" + stop.
lane->
getID() +
"' due to capacity constraints.");
1382 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' registers as waiting for container." << std::endl;
1401 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' hasn't reached next stop." << std::endl;
1408 double endPos = stop.
endPos;
1409 bool useStoppingPlace =
false;
1410 bool fitsOnStoppingPlace =
true;
1412 useStoppingPlace =
true;
1417 fitsOnStoppingPlace =
false;
1422 useStoppingPlace =
true;
1426 fitsOnStoppingPlace =
false;
1433 fitsOnStoppingPlace =
false;
1440 if (
myStops.empty() ||
myStops.front().parkingarea != oldParkingArea) {
1442 return currentVelocity;
1461 if (stop.
until >= 0) {
1491 return currentVelocity;
1498 for (std::list<Stop>::const_iterator iter =
myStops.begin(); iter !=
myStops.end(); ++iter) {
1499 result.push_back(*iter->edge);
1508 #ifdef DEBUG_PLAN_MOVE 1513 <<
" veh=" <<
getID()
1522 #ifdef DEBUG_PLAN_MOVE 1524 DriveItemVector::iterator i;
1527 <<
" vPass=" << (*i).myVLinkPass
1528 <<
" vWait=" << (*i).myVLinkWait
1529 <<
" linkLane=" << ((*i).myLink == 0 ?
"NULL" : (*i).myLink->getViaLaneOrLane()->getID())
1530 <<
" request=" << (*i).mySetRequest
1536 #ifdef DEBUG_PLAN_MOVE 1538 std::cout <<
" after checkRewindLinkLanes\n";
1539 DriveItemVector::iterator i;
1542 <<
" vPass=" << (*i).myVLinkPass
1543 <<
" vWait=" << (*i).myVLinkWait
1544 <<
" linkLane=" << ((*i).myLink == 0 ?
"NULL" : (*i).myLink->getViaLaneOrLane()->getID())
1545 <<
" request=" << (*i).mySetRequest
1546 <<
" atime=" << (*i).myArrivalTime
1547 <<
" atimeB=" << (*i).myArrivalTimeBraking
1558 #ifdef DEBUG_VEHICLE_GUI_SELECTION 1575 double v =
MIN2(maxV, laneMaxV);
1588 #ifdef DEBUG_PLAN_MOVE 1590 std::cout <<
" bestLaneConts=" <<
toString(bestLaneConts) <<
"\n";
1593 assert(bestLaneConts.size() > 0);
1594 bool hadNonInternal =
false;
1596 double seenNonInternal = 0;
1600 bool slowedDownForMinor =
false;
1606 #pragma warning(push) 1607 #pragma warning(disable: 4127) // do not warn about constant conditional expression 1611 #pragma warning(pop) 1622 if (leader.first != 0 && leader.first->getLane() == leaderLane && leader.first->getLaneChangeModel().isOpposite()) {
1626 adaptToLeaders(ahead, 0, seen, lastLink, leaderLane, v, vLinkPass);
1627 #ifdef DEBUG_PLAN_MOVE 1629 std::cout <<
"\nv = " << v <<
"\n";
1637 if (shadowLane != 0) {
1641 seen, lastLink, shadowLane, v, vLinkPass);
1646 const double relativePos = lane->
getLength() - seen;
1647 #ifdef DEBUG_PLAN_MOVE 1649 std::cout <<
SIMTIME <<
" adapt to pedestrians on lane=" << lane->
getID() <<
" relPos=" << relativePos <<
"\n";
1654 if (leader.first != 0) {
1656 v =
MIN2(v, stopSpeed);
1657 #ifdef DEBUG_PLAN_MOVE 1659 std::cout <<
SIMTIME <<
" pedLeader=" << leader.first->getID() <<
" dist=" << leader.second <<
" v=" << v <<
"\n";
1672 myStopDist = seen + endPos - lane->
getLength();
1674 if (lastLink != 0) {
1677 v =
MIN2(v, stopSpeed);
1680 #ifdef DEBUG_PLAN_MOVE 1682 std::cout <<
"\n" <<
SIMTIME <<
" next stop: distance = " << myStopDist <<
" requires stopSpeed = " << stopSpeed <<
"\n";
1692 MSLinkCont::const_iterator link =
MSLane::succLinkSec(*
this, view + 1, *lane, bestLaneConts);
1701 if (lastLink != 0) {
1709 ((*link)->getViaLane() == 0
1723 if (lastLink != 0) {
1731 #ifdef DEBUG_PLAN_MOVE 1742 const bool yellowOrRed = (*link)->haveRed() || (*link)->haveYellow();
1754 const double stopDist =
MAX2(0., seen - laneStopOffset);
1764 assert(timeRemaining != 0);
1767 #ifdef DEBUG_PLAN_MOVE 1768 if (
DEBUG_COND) std::cout <<
SIMTIME <<
" veh=" <<
getID() <<
" slowing down to finish continuous change before" 1769 <<
" link=" << (*link)->getViaLaneOrLane()->getID()
1770 <<
" timeRemaining=" << timeRemaining
1782 const bool abortRequestAfterMinor = slowedDownForMinor && (*link)->getInternalLaneBefore() == 0;
1784 bool setRequest = (v > 0 && !abortRequestAfterMinor) || (leavingCurrentIntersection);
1788 const bool canBrake = seen >= brakeDist;
1789 #ifdef DEBUG_PLAN_MOVE 1792 <<
" stopDist=" << stopDist
1793 <<
" vLinkWait=" << vLinkWait
1794 <<
" brakeDist=" << brakeDist
1797 if (yellowOrRed && canBrake && !
ignoreRed(*link, canBrake)) {
1809 #ifdef DEBUG_EXEC_MOVE 1811 <<
" ignoreRed spent=" <<
STEPS2TIME(t - (*link)->getLastStateChange())
1812 <<
" redSpeed=" << redSpeed
1821 checkLinkLeader(*link, lane, seen, lastLink, v, vLinkPass, vLinkWait, setRequest);
1824 if (parallelLink != 0) {
1825 checkLinkLeader(parallelLink, lane, seen, lastLink, v, vLinkPass, vLinkWait, setRequest,
true);
1830 if (lastLink != 0) {
1833 double arrivalSpeed = vLinkPass;
1839 double visibilityDistance = (*link)->getFoeVisibilityDistance();
1840 double determinedFoePresence = seen < visibilityDistance;
1845 #ifdef DEBUG_PLAN_MOVE 1847 std::cout <<
" approaching link=" << (*link)->getViaLaneOrLane()->getID() <<
" prio=" << (*link)->havePriority() <<
" seen=" << seen <<
" visibilityDistance=" << visibilityDistance <<
" brakeDist=" << brakeDist <<
"\n";
1851 if (!(*link)->havePriority() && !determinedFoePresence && brakeDist < seen && !(*link)->lastWasContMajor()) {
1856 arrivalSpeed =
MIN2(vLinkPass, maxArrivalSpeed);
1857 slowedDownForMinor =
true;
1858 #ifdef DEBUG_PLAN_MOVE 1860 std::cout <<
" slowedDownForMinor maxArrivalSpeed=" << maxArrivalSpeed <<
" arrivalSpeed=" << arrivalSpeed <<
"\n";
1877 double arrivalSpeedBraking = 0;
1884 arrivalSpeedBraking =
MIN2(arrivalSpeedBraking, arrivalSpeed);
1888 arrivalTimeBraking =
MAX2(arrivalTime, t +
TIME2STEPS(seen / ((v + arrivalSpeedBraking) * 0.5)));
1891 arrivalTime, arrivalSpeed,
1892 arrivalTimeBraking, arrivalSpeedBraking,
1895 if ((*link)->getViaLane() == 0) {
1896 hadNonInternal =
true;
1900 if ((!setRequest || v <= 0 || seen > dist) && hadNonInternal && seenNonInternal > vehicleLength *
CRLL_LOOK_AHEAD) {
1904 lane = (*link)->getViaLaneOrLane();
1913 leaderLane = opposite ? lane->
getOpposite() : lane;
1914 if (leaderLane == 0) {
1920 lastLink = &lfLinks.back();
1935 const MSLane*
const lane,
double& v,
double& vLinkPass)
const {
1938 ahead.
getSubLanes(
this, latOffset, rightmost, leftmost);
1939 #ifdef DEBUG_PLAN_MOVE 1941 <<
"\nADAPT_TO_LEADERS\nveh=" <<
getID()
1942 <<
" lane=" << lane->
getID()
1943 <<
" rm=" << rightmost
1944 <<
" lm=" << leftmost
1958 for (
int sublane = rightmost; sublane <= leftmost; ++sublane) {
1963 const double gap = (lastLink == 0
1966 #ifdef DEBUG_PLAN_MOVE 1968 std::cout <<
" pred=" << pred->
getID() <<
" predLane=" << pred->
getLane()->
getID() <<
" predPos=" << pred->
getPositionOnLane() <<
" gap=" << gap <<
" predBack=" << predBack <<
" seen=" << seen <<
" lane=" << lane->
getID() <<
" myLane=" <<
myLane->
getID() <<
"\n";
1971 adaptToLeader(std::make_pair(pred, gap), seen, lastLink, lane, v, vLinkPass);
1980 const MSLane*
const lane,
double& v,
double& vLinkPass,
1981 double distToCrossing)
const {
1982 if (leaderInfo.first != 0) {
1983 const double vsafeLeader =
getSafeFollowSpeed(leaderInfo, seen, lane, distToCrossing);
1984 if (lastLink != 0) {
1987 v =
MIN2(v, vsafeLeader);
1988 vLinkPass =
MIN2(vLinkPass, vsafeLeader);
1990 #ifdef DEBUG_PLAN_MOVE 1994 <<
" veh=" <<
getID()
1995 <<
" lead=" << leaderInfo.first->getID()
1996 <<
" leadSpeed=" << leaderInfo.first->getSpeed()
1997 <<
" gap=" << leaderInfo.second
1998 <<
" leadLane=" << leaderInfo.first->getLane()->getID()
1999 <<
" predPos=" << leaderInfo.first->getPositionOnLane()
2001 <<
" lane=" << lane->
getID()
2003 <<
" dTC=" << distToCrossing
2005 <<
" vSafeLeader=" << vsafeLeader
2006 <<
" vLinkPass=" << vLinkPass
2015 DriveProcessItem*
const lastLink,
double& v,
double& vLinkPass,
double& vLinkWait,
bool& setRequest,
2016 bool isShadowLink)
const {
2018 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
2020 const MSVehicle* leader = (*it).vehAndGap.first;
2024 adaptToLeader(std::make_pair(
this, -1), seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
2025 }
else if (link->
isLeader(
this, leader)) {
2026 adaptToLeader(it->vehAndGap, seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
2027 if (lastLink != 0) {
2039 vLinkWait =
MIN2(vLinkWait, v);
2045 const double seen,
const MSLane*
const lane,
double distToCrossing)
const {
2046 assert(leaderInfo.first != 0);
2048 double vsafeLeader = 0;
2049 if (leaderInfo.second >= 0) {
2050 vsafeLeader = cfModel.
followSpeed(
this,
getSpeed(), leaderInfo.second, leaderInfo.first->getSpeed(), leaderInfo.first->getCarFollowModel().getApparentDecel());
2056 if (distToCrossing >= 0) {
2087 #ifdef DEBUG_VEHICLE_GUI_SELECTION 2093 #ifdef DEBUG_EXEC_MOVE 2094 if (
DEBUG_COND) std::cout <<
"\nEXECUTE_MOVE\n" 2096 <<
" veh=" <<
getID()
2104 double vSafeMin = 0;
2107 double vSafeMinDist = 0;
2111 DriveItemVector::iterator i;
2113 MSLink* link = (*i).myLink;
2115 #ifdef DEBUG_EXEC_MOVE 2119 <<
" veh=" <<
getID()
2121 <<
" req=" << (*i).mySetRequest
2122 <<
" vP=" << (*i).myVLinkPass
2123 <<
" vW=" << (*i).myVLinkWait
2124 <<
" d=" << (*i).myDistance
2131 if (link != 0 && (*i).mySetRequest) {
2138 const bool ignoreRedLink =
ignoreRed(link, canBrake);
2139 if (yellow && canBrake && !ignoreRedLink) {
2140 vSafe = (*i).myVLinkWait;
2147 const bool influencerPrio =
false;
2151 std::vector<const SUMOVehicle*> collectFoes;
2152 bool opened = (yellow || influencerPrio
2153 || link->
opened((*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
2161 if (parallelLink != 0) {
2164 opened = yellow || influencerPrio || (opened & parallelLink->
opened((*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
2168 ignoreRedLink,
this));
2169 #ifdef DEBUG_EXEC_MOVE 2172 <<
" veh=" <<
getID()
2176 <<
" opened=" << opened
2185 double determinedFoePresence = i->myDistance <= visibilityDistance;
2186 if (!determinedFoePresence) {
2187 vSafe = (*i).myVLinkWait;
2210 vSafe = (*i).myVLinkPass;
2216 vSafeZipper =
MIN2(vSafeZipper,
2217 link->
getZipperSpeed(
this, (*i).myDistance, (*i).myVLinkPass, (*i).myArrivalTime, &collectFoes));
2219 vSafe = (*i).myVLinkWait;
2224 #ifdef DEBUG_EXEC_MOVE 2233 vSafe = (*i).myVLinkWait;
2264 #ifdef DEBUG_EXEC_MOVE 2266 std::cout <<
"vSafeMin Problem?" << std::endl;
2277 vSafe =
MIN2(vSafe, vSafeZipper);
2291 if (vSafeMin == 0) {
2303 #ifdef DEBUG_EXEC_MOVE 2305 std::cout <<
SIMTIME <<
" moveHelper vSafe=" << vSafe <<
" vSafeMin=" << vSafeMin <<
" vNext=" << vNext <<
"\n";
2322 vNext =
MAX2(vNext, 0.);
2350 brakelightsOn =
true;
2356 if (brakelightsOn) {
2364 std::vector<MSLane*> passedLanes;
2366 passedLanes.push_back(*i);
2368 if (passedLanes.size() == 0 || passedLanes.back() !=
myLane) {
2369 passedLanes.push_back(
myLane);
2372 std::string emergencyReason =
" for unknown reasons";
2380 MSLink* link = (*i).myLink;
2391 emergencyReason =
" because of a red traffic light";
2401 emergencyReason =
" because there is no connection to the next edge";
2405 if (approachedLane !=
myLane && approachedLane != 0) {
2422 WRITE_WARNING(
"Vehicle '" +
getID() +
"' could not finish continuous lane change (turn lane) time=" +
2433 passedLanes.push_back(approachedLane);
2449 +
"'" + emergencyReason
2459 passedLanes.clear();
2480 #ifdef DEBUG_EXEC_MOVE 2562 const std::vector<MSLane*>& passedLanes) {
2565 #ifdef DEBUG_FURTHER 2567 <<
" updateFurtherLanes oldFurther=" <<
toString(furtherLanes)
2568 <<
" oldFurtherPosLat=" <<
toString(furtherLanesPosLat)
2569 <<
" passed=" <<
toString(passedLanes)
2572 for (std::vector<MSLane*>::iterator i = furtherLanes.begin(); i != furtherLanes.end(); ++i) {
2573 (*i)->resetPartialOccupation(
this);
2575 const MSLane* firstOldFurther = furtherLanes.size() > 0 ? furtherLanes.front() : 0;
2576 bool newFurther =
true;
2579 furtherLanes.clear();
2580 if (passedLanes.size() > 0) {
2582 std::vector<MSLane*>::const_reverse_iterator i = passedLanes.rbegin() + 1;
2583 while (leftLength > 0 && i != passedLanes.rend()) {
2584 furtherLanes.push_back(*i);
2586 if (*i == firstOldFurther) {
2590 furtherLanesPosLat.insert(furtherLanesPosLat.begin(),
myState.
myPosLat);
2592 #ifdef DEBUG_FURTHER 2594 std::cout <<
SIMTIME <<
" updateFurtherLanes \n";
2597 leftLength -= (*i)->setPartialOccupation(
this);
2600 result = -leftLength;
2602 assert(furtherLanesPosLat.size() >= furtherLanes.size());
2603 furtherLanesPosLat.erase(furtherLanesPosLat.begin() + furtherLanes.size(), furtherLanesPosLat.end());
2604 assert(furtherLanesPosLat.size() == furtherLanes.size());
2605 #ifdef DEBUG_FURTHER 2607 <<
" newFurther=" <<
toString(furtherLanes)
2608 <<
" newFurtherPosLat=" <<
toString(furtherLanesPosLat)
2609 <<
" newBackPos=" << result
2618 #ifdef DEBUG_FURTHER 2646 leftLength -= (*i)->getLength();
2657 leftLength -= (*i)->getLength();
2688 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
2692 && (*i)->isFrontOnLane(l)) {
2693 foundStopped =
true;
2694 const double ret = (*i)->getPositionOnLane() - (*i)->getVehicleType().getLengthWithGap() - lengths;
2698 lengths += (*i)->getVehicleType().getLengthWithGap();
2707 #ifdef DEBUG_VEHICLE_GUI_SELECTION 2713 bool hadVehicle =
false;
2714 double seenSpace = -lengthsInFront;
2716 bool foundStopped =
false;
2719 for (
int i = 0; i < (int)lfLinks.size(); ++i) {
2722 if (item.
myLink == 0 || foundStopped) {
2723 if (!foundStopped) {
2733 if (approachedLane != 0) {
2737 if (approachedLane ==
myLane) {
2746 #ifdef DEBUG_PLAN_MOVE 2749 <<
" veh=" <<
getID()
2750 <<
" approached=" << approachedLane->
getID()
2753 <<
" seenSpace=" << seenSpace
2755 <<
" lengthsInFront=" << lengthsInFront
2762 if (last == 0 || last ==
this) {
2763 seenSpace += approachedLane->
getLength();
2774 foundStopped =
true;
2776 #ifdef DEBUG_PLAN_MOVE 2779 <<
" veh=" <<
getID()
2780 <<
" approached=" << approachedLane->
getID()
2781 <<
" lastPoc=" << last->
getID()
2783 <<
" seenSpace=" << seenSpace
2784 <<
" foundStopped=" << foundStopped
2801 foundStopped =
true;
2804 #ifdef DEBUG_PLAN_MOVE 2807 <<
" veh=" <<
getID()
2808 <<
" approached=" << approachedLane->
getID()
2809 <<
" last=" << last->
getID()
2811 <<
" seenSpace=" << seenSpace
2812 <<
" foundStopped=" << foundStopped
2820 #ifdef DEBUG_VEHICLE_GUI_SELECTION 2826 for (
int i = ((
int)lfLinks.size() - 1); i > 0; --i) {
2828 const bool canLeaveJunction = item.
myLink->
getViaLane() == 0 || lfLinks[i].mySetRequest;
2836 bool allowsContinuation = item.
myLink == 0 || item.
myLink->
isCont() || !lfLinks[i].hadVehicle || opened;
2837 if (!opened && item.
myLink != 0) {
2841 allowsContinuation =
true;
2845 if (allowsContinuation) {
2851 int removalBegin = -1;
2852 for (
int i = 0; hadVehicle && i < (int)lfLinks.size() && removalBegin < 0; ++i) {
2866 if (leftSpace < 0/* && item.myLink->willHaveBlockedFoe()*/) {
2867 double impatienceCorrection = 0;
2874 if (leftSpace < -impatienceCorrection / 10. &&
keepClear(item.
myLink)) {
2882 while (removalBegin < (
int)(lfLinks.size())) {
2884 lfLinks[removalBegin].myVLinkPass = lfLinks[removalBegin].myVLinkWait;
2886 lfLinks[removalBegin].mySetRequest =
false;
2892 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
2893 if ((*i).myLink != 0) {
2897 (*i).myLink->setApproaching(
this, (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
2898 (*i).mySetRequest, (*i).myArrivalTimeBraking, (*i).myArrivalSpeedBraking,
getWaitingTime(), (*i).myDistance);
2903 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
2904 if ((*i).myLink != 0) {
2906 if (parallelLink != 0) {
2907 parallelLink->
setApproaching(
this, (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
2908 (*i).mySetRequest, (*i).myArrivalTimeBraking, (*i).myArrivalSpeedBraking,
getWaitingTime(), (*i).myDistance);
2921 if (rem->first->getLane() != 0 && rem->second > 0.) {
2923 if (myTraceMoveReminders) {
2924 traceMoveReminder(
"notifyEnter_skipped", rem->first, rem->second,
true);
2929 if (rem->first->notifyEnter(*
this, reason, enteredLane)) {
2931 if (myTraceMoveReminders) {
2932 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
true);
2938 if (myTraceMoveReminders) {
2939 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
false);
2971 if (!onTeleporting) {
3008 #ifdef DEBUG_FURTHER 3010 std::cout <<
SIMTIME <<
" enterLaneAtLaneChange \n";
3016 #ifdef DEBUG_FURTHER 3018 std::cout <<
SIMTIME <<
" enterLaneAtLaneChange \n";
3021 leftLength -= (lane)->setPartialOccupation(
this);
3029 #ifdef DEBUG_FURTHER 3059 MSLane* clane = enteredLane;
3060 while (leftLength > 0) {
3062 if (clane == 0 || clane ==
myLane) {
3067 leftLength -= (clane)->setPartialOccupation(
this);
3073 #ifdef DEBUG_FURTHER 3075 std::cout <<
SIMTIME <<
" enterLaneAtInsertion \n";
3078 (*i)->resetPartialOccupation(
this);
3096 if (rem->first->notifyLeave(*
this,
myState.
myPos + rem->second, reason, approachedLane)) {
3098 if (myTraceMoveReminders) {
3099 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
3105 if (myTraceMoveReminders) {
3106 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
false);
3116 #ifdef DEBUG_FURTHER 3118 std::cout <<
SIMTIME <<
" leaveLane \n";
3121 (*i)->resetPartialOccupation(
this);
3155 const std::vector<MSVehicle::LaneQ>&
3163 #ifdef DEBUG_BESTLANES 3168 #ifdef DEBUG_VEHICLE_GUI_SELECTION 3174 if (startLane == 0) {
3177 assert(startLane != 0);
3182 bool startLaneIsOpposite = (startLane->
isInternal()
3185 if (startLaneIsOpposite) {
3187 assert(startLane != 0);
3207 std::vector<LaneQ>& lanes = *it;
3208 assert(lanes.size() > 0);
3209 if (&(lanes[0].lane->getEdge()) == nextEdge) {
3211 std::vector<LaneQ> oldLanes = lanes;
3213 const std::vector<MSLane*>& sourceLanes = startLane->
getEdge().
getLanes();
3214 for (std::vector<MSLane*>::const_iterator it_source = sourceLanes.begin(); it_source != sourceLanes.end(); ++it_source) {
3215 for (std::vector<LaneQ>::iterator it_lane = oldLanes.begin(); it_lane != oldLanes.end(); ++it_lane) {
3216 if ((*it_source)->getLinkCont()[0]->getLane() == (*it_lane).lane) {
3217 lanes.push_back(*it_lane);
3224 for (
int i = 0; i < (int)lanes.size(); ++i) {
3225 if (i + lanes[i].bestLaneOffset < 0) {
3226 lanes[i].bestLaneOffset = -i;
3228 if (i + lanes[i].bestLaneOffset >= (
int)lanes.size()) {
3229 lanes[i].bestLaneOffset = (int)lanes.size() - i - 1;
3231 assert(i + lanes[i].bestLaneOffset >= 0);
3232 assert(i + lanes[i].bestLaneOffset < (
int)lanes.size());
3233 if (lanes[i].bestContinuations[0] != 0) {
3235 lanes[i].bestContinuations.insert(lanes[i].bestContinuations.begin(), (
MSLane*)0);
3237 if (startLane->
getLinkCont()[0]->getLane() == lanes[i].lane) {
3240 assert(&(lanes[i].lane->getEdge()) == nextEdge);
3253 myLastBestLanesEdge = &startLane->
getEdge();
3258 const MSLane* nextStopLane = 0;
3259 double nextStopPos = 0;
3262 nextStopLane = nextStop.
lane;
3263 nextStopEdge = nextStop.
edge;
3276 nextStopPos += (*nextStopEdge)->getLength();
3282 double seenLength = 0;
3283 bool progress =
true;
3285 std::vector<LaneQ> currentLanes;
3286 const std::vector<MSLane*>* allowed = 0;
3287 const MSEdge* nextEdge = 0;
3289 nextEdge = *(ce + 1);
3292 const std::vector<MSLane*>& lanes = (*ce)->getLanes();
3293 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
3301 q.
allowsContinuation = allowed == 0 || find(allowed->begin(), allowed->end(), cl) != allowed->end();
3304 currentLanes.push_back(q);
3307 if (nextStopEdge == ce && !nextStopLane->
isInternal()) {
3309 for (std::vector<LaneQ>::iterator q = currentLanes.begin(); q != currentLanes.end(); ++q) {
3310 if (nextStopLane != 0 && nextStopLane != (*q).lane) {
3311 (*q).allowsContinuation =
false;
3312 (*q).length = nextStopPos;
3313 (*q).currentLength = (*q).length;
3320 seenLength += currentLanes[0].lane->getLength();
3322 progress &= (seen <= 4 || seenLength < 3000);
3323 progress &= seen <= 8;
3334 double bestLength = -1;
3335 int bestThisIndex = 0;
3338 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
3339 if ((*j).length > bestLength) {
3340 bestLength = (*j).length;
3341 bestThisIndex = index;
3345 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
3346 if ((*j).length < bestLength) {
3347 (*j).bestLaneOffset = bestThisIndex - index;
3351 #ifdef DEBUG_BESTLANES 3353 std::cout <<
" last edge:\n";
3355 for (std::vector<LaneQ>::iterator j = laneQs.begin(); j != laneQs.end(); ++j) {
3356 std::cout <<
" lane=" << (*j).lane->getID() <<
" length=" << (*j).length <<
" bestOffset=" << (*j).bestLaneOffset <<
"\n";
3362 for (std::vector<std::vector<LaneQ> >::reverse_iterator i =
myBestLanes.rbegin() + 1; i !=
myBestLanes.rend(); ++i) {
3363 std::vector<LaneQ>& nextLanes = (*(i - 1));
3364 std::vector<LaneQ>& clanes = (*i);
3365 MSEdge& cE = clanes[0].lane->getEdge();
3367 double bestConnectedLength = -1;
3368 double bestLength = -1;
3369 for (std::vector<LaneQ>::iterator j = nextLanes.begin(); j != nextLanes.end(); ++j, ++index) {
3370 if ((*j).lane->isApproachedFrom(&cE) && bestConnectedLength < (*j).length) {
3371 bestConnectedLength = (*j).length;
3373 if (bestLength < (*j).length) {
3374 bestLength = (*j).length;
3378 int bestThisIndex = 0;
3379 if (bestConnectedLength > 0) {
3381 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
3382 LaneQ bestConnectedNext;
3383 bestConnectedNext.
length = -1;
3384 if ((*j).allowsContinuation) {
3385 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m) {
3386 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
3387 if (bestConnectedNext.
length < (*m).length || (bestConnectedNext.
length == (*m).length &&
abs(bestConnectedNext.
bestLaneOffset) >
abs((*m).bestLaneOffset))) {
3388 bestConnectedNext = *m;
3393 (*j).
length += bestLength;
3395 (*j).length += bestConnectedNext.
length;
3400 if (clanes[bestThisIndex].length < (*j).length
3401 || (clanes[bestThisIndex].length == (*j).length &&
abs(clanes[bestThisIndex].bestLaneOffset) >
abs((*j).bestLaneOffset))
3402 || (clanes[bestThisIndex].length == (*j).length &&
abs(clanes[bestThisIndex].bestLaneOffset) ==
abs((*j).bestLaneOffset) &&
3405 bestThisIndex = index;
3408 #ifdef DEBUG_BESTLANES 3410 std::cout <<
" edge=" << cE.
getID() <<
"\n";
3411 std::vector<LaneQ>& laneQs = clanes;
3412 for (std::vector<LaneQ>::iterator j = laneQs.begin(); j != laneQs.end(); ++j) {
3413 std::cout <<
" lane=" << (*j).lane->getID() <<
" length=" << (*j).length <<
" bestOffset=" << (*j).bestLaneOffset <<
"\n";
3420 int bestNextIndex = 0;
3421 int bestDistToNeeded = (int) clanes.size();
3423 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
3424 if ((*j).allowsContinuation) {
3426 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m, ++nextIndex) {
3427 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
3428 if (bestDistToNeeded >
abs((*m).bestLaneOffset)) {
3429 bestDistToNeeded =
abs((*m).bestLaneOffset);
3430 bestThisIndex = index;
3431 bestNextIndex = nextIndex;
3437 clanes[bestThisIndex].length += nextLanes[bestNextIndex].length;
3438 copy(nextLanes[bestNextIndex].bestContinuations.begin(), nextLanes[bestNextIndex].bestContinuations.end(), back_inserter(clanes[bestThisIndex].bestContinuations));
3443 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
3444 if ((*j).length < clanes[bestThisIndex].length
3445 || ((*j).length == clanes[bestThisIndex].length &&
abs((*j).bestLaneOffset) >
abs(clanes[bestThisIndex].bestLaneOffset))
3448 (*j).bestLaneOffset = bestThisIndex - index;
3451 (*j).length = (*j).currentLength;
3454 (*j).bestLaneOffset = 0;
3459 #ifdef DEBUG_BESTLANES 3470 if (conts.size() < 2) {
3486 std::vector<LaneQ>& currLanes = *
myBestLanes.begin();
3487 std::vector<LaneQ>::iterator i;
3488 for (i = currLanes.begin(); i != currLanes.end(); ++i) {
3489 double nextOccupation = 0;
3490 for (std::vector<MSLane*>::const_iterator j = (*i).bestContinuations.begin() + 1; j != (*i).bestContinuations.end(); ++j) {
3491 nextOccupation += (*j)->getBruttoVehLenSum();
3493 (*i).nextOccupation = nextOccupation;
3494 if ((*i).lane == startLane) {
3501 const std::vector<MSLane*>&
3506 return (*myCurrentLaneInBestLanes).bestContinuations;
3510 const std::vector<MSLane*>&
3522 if ((*i).lane == lane) {
3523 return (*i).bestContinuations;
3535 return (*myCurrentLaneInBestLanes).bestLaneOffset;
3542 std::vector<MSVehicle::LaneQ>& preb =
myBestLanes.front();
3543 assert(laneIndex < (
int)preb.size());
3544 preb[laneIndex].occupation = density + preb[laneIndex].nextOccupation;
3559 if (
isOnRoad() && destEdge != NULL) {
3573 std::pair<const MSVehicle* const, double>
3576 return std::make_pair(static_cast<const MSVehicle*>(0), -1);
3584 MSLane::VehCont::const_iterator it = std::find(vehs.begin(), vehs.end(),
this);
3585 if (it != vehs.end() && it + 1 != vehs.end()) {
3589 std::pair<const MSVehicle* const, double> result(
3605 std::pair<const MSVehicle* const, double> leaderInfo =
getLeader(-1);
3606 if (leaderInfo.first == 0 ||
getSpeed() == 0) {
3669 int numExpected = (int)
myStops.front().awaitedPersons.size();
3670 if (numExpected != 0) {
3675 numExpected = (int)
myStops.front().awaitedPersons.size();
3677 if (numExpected == 0) {
3691 int numExpected = (int)
myStops.front().awaitedContainers.size();
3692 if (numExpected != 0) {
3693 myStops.front().awaitedContainers.erase(container->
getID());
3694 numExpected = (int)
myStops.front().awaitedContainers.size();
3696 if (numExpected == 0) {
3705 const bool isPerson =
dynamic_cast<MSPerson*
>(t) != 0;
3713 const std::vector<MSTransportable*>&
3723 const std::vector<MSTransportable*>&
3751 const bool blinkerManoeuvre = (((state &
LCA_SUBLANE) == 0) && (
3753 if ((state &
LCA_LEFT) != 0 && blinkerManoeuvre) {
3755 }
else if ((state &
LCA_RIGHT) != 0 && blinkerManoeuvre) {
3767 switch ((*link)->getDirection()) {
3790 if (currentTime % 1000 == 0) {
3837 #ifdef DEBUG_FURTHER 3847 for (
int i = 0; i < (int)shadowFurther.size(); ++i) {
3849 if (shadowFurther[i] == lane) {
3869 #ifdef DEBUG_FURTHER 3877 #ifdef DEBUG_FURTHER 3883 for (
int i = 0; i < (int)shadowFurther.size(); ++i) {
3884 if (shadowFurther[i] == lane) {
3885 #ifdef DEBUG_FURTHER 3888 <<
" lane=" << lane->
getID()
3918 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
3919 if ((*i).myLink != 0) {
3920 (*i).myLink->removeApproaching(
this);
3940 while (!lane->
isLinkEnd(link) && seen <= dist) {
3943 || !(*link)->havePriority())) {
3947 if ((*di).myLink != 0) {
3948 const MSLane* diPredLane = (*di).myLink->getLaneBefore();
3949 if (diPredLane != 0) {
3960 const SUMOTime leaveTime = (*link)->getLeaveTime((*di).myArrivalTime, (*di).myArrivalSpeed,
3962 if ((*link)->hasApproachingFoe((*di).myArrivalTime, leaveTime, (*di).myArrivalSpeed,
getCarFollowModel().getMaxDecel())) {
3969 lane = (*link)->getViaLaneOrLane();
4012 result.push_back(line1[0]);
4013 result.push_back(line2[0]);
4014 result.push_back(line2[1]);
4015 result.push_back(line1[1]);
4018 result.push_back(line1[1]);
4019 result.push_back(line2[1]);
4020 result.push_back(line2[0]);
4021 result.push_back(line1[0]);
4033 if (&(*i)->getEdge() == edge) {
4044 const bool parking,
const bool triggered,
const bool containerTriggered, std::string& errorMsg) {
4046 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
4047 if (iter->lane == lane && fabs(iter->endPos - endPos) <
POSITION_EPS) {
4048 if (duration == 0 && !iter->reached) {
4052 iter->duration = duration;
4063 newStop.
until = until;
4068 const bool result =
addStop(newStop, errorMsg);
4081 const bool triggered,
const bool containerTriggered,
const SumoXMLTag stoppingPlaceType, std::string& errorMsg) {
4083 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
4085 switch (stoppingPlaceType) {
4087 stop = iter->busstop;
4090 stop = iter->containerstop;
4093 stop = iter->chargingStation;
4096 stop = iter->parkingarea;
4101 if (stop != 0 && stop->
getID() == stopId) {
4102 if (duration == 0 && !iter->reached) {
4105 iter->duration = duration;
4113 switch (stoppingPlaceType) {
4118 errorMsg =
"The bus stop '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
4126 errorMsg =
"The container stop '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
4134 errorMsg =
"The charging station '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
4142 errorMsg =
"The parking area '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
4150 newStop.
until = until;
4158 const bool result =
addStop(newStop, errorMsg);
4181 if (
myStops.front().busstop != 0) {
4183 myStops.front().busstop->leaveFrom(
this);
4186 if (
myStops.front().containerstop != 0) {
4188 myStops.front().containerstop->leaveFrom(
this);
4190 if (
myStops.front().parkingarea != 0) {
4192 myStops.front().parkingarea->leaveFrom(
this);
4285 if (containerstop != 0) {
4288 if (busstop == 0 && containerstop == 0) {
4293 if (duration >= 0) {
4302 if (containerTriggered) {
4308 if (awaitedPersons.size() > 0) {
4311 if (awaitedContainers.size() > 0) {
4321 return busstop->getLastFreePos(veh);
4322 }
else if (containerstop != 0) {
4323 return containerstop->getLastFreePos(veh);
4324 }
else if (parkingarea != 0) {
4325 return parkingarea->getLastFreePos(veh);
4326 }
else if (chargingStation != 0) {
4327 return chargingStation->getLastFreePos(veh);
4351 #ifdef DEBUG_IGNORE_RED 4356 if (ignoreRedTime < 0) {
4364 #ifdef DEBUG_IGNORE_RED 4368 <<
" ignoreRedTime=" << ignoreRedTime
4369 <<
" spentRed=" << redDuration
4370 <<
" canBrake=" << canBrake <<
"\n";
4374 return !canBrake || ignoreRedTime > redDuration;
4385 std::vector<std::string> internals;
4395 for (std::list<Stop>::const_iterator it =
myStops.begin(); it !=
myStops.end(); ++it) {
4399 for (std::vector<MSDevice*>::const_iterator dev =
myDevices.begin(); dev !=
myDevices.end(); ++dev) {
4400 (*dev)->saveState(out);
4409 throw ProcessError(
"Error: Invalid vehicles in state (may be a meso state)!");
4419 myDeparture -= offset;
double myPos
the stored position
bool gDebugFlag1
global utility flags for debugging
double myLatDist
The requested lateral change.
A lane area vehicles can halt at.
void setAngle(double angle)
Set a custom vehicle angle in rad.
bool signalSet(int which) const
Returns whether the given signal is on.
const MSLane * myLastBestLanesInternalLane
int getCapacity() const
Returns the area capacity.
The link is a partial left direction.
int getOccupancy() const
Returns the area occupancy.
bool isRemoteControlled() const
Returns the information whether the vehicle is fully controlled via TraCI.
double getMinGap() const
Get the free space in front of vehicles of this class.
static double gLateralResolution
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
SumoXMLTag
Numbers representing SUMO-XML - element names.
void addWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
Adds a vehicle to the list of waiting vehiclse to a given edge.
bool enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
MSEdge & getEdge() const
Returns the lane's edge.
static int nextLinkPriority(const std::vector< MSLane * > &conts)
get a numerical value for the priority of the upcoming link
std::pair< MSVehicle *const, double > getLeaderOnConsecutive(double dist, double seen, double speed, const MSVehicle &veh, const std::vector< MSLane * > &bestLaneConts) const
Returns the immediate leader and the distance to him.
double posLat() const
Lateral Position of this state (m relative to the centerline of the lane).
double myAngle
the angle in radians (
double getWidth() const
Returns the lane's width.
Representation of a vehicle in the micro simulation.
bool hasFoes() const
Returns whether this link belongs to a junction where more than one edge is incoming.
bool isLinkEnd(MSLinkCont::const_iterator &i) const
MSVehicle * getLastAnyVehicle() const
returns the last vehicle that is fully or partially on this lane
SUMOTime timeToBoardNextPerson
The time at which the vehicle is able to board another person.
bool isLeader(const MSVehicle *ego, const MSVehicle *foe) const
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts)
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
virtual int addLeader(const MSVehicle *veh, bool beyond, double latOffset=0)
int getVehicleNumber() const
Returns the number of vehicles on this lane (for which this lane is responsible)
virtual std::string toString() const
print a debugging representation
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
void remove(MSVehicle *veh)
Remove a vehicle from this transfer object.
double getCenterOnEdge() const
MSEdgeWeightsStorage * myEdgeWeights
MoveReminderCont myMoveReminders
Currently relevant move reminders.
The action is due to the default of keeping right "Rechtsfahrgebot".
The action is done to help someone else.
const MSEdge * myLastBestLanesEdge
double getMaxSpeed() const
Returns the maximum speed.
std::string containerstop
(Optional) container stop if one is assigned to the stop
const MSEdge * getNextNormal() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
LaneChangeMode
modes for resolving conflicts between external control (traci) and vehicle control over lane changing...
void enterLaneAtInsertion(MSLane *enteredLane, double pos, double speed, double posLat, MSMoveReminder::Notification notification)
Update when the vehicle enters a new lane in the emit step.
MSAbstractLaneChangeModel * myLaneChangeModel
void append(const PositionVector &v, double sameThreshold=2.0)
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived) ...
LinkLeaders getLeaderInfo(const MSVehicle *ego, double dist, std::vector< const MSPerson * > *collectBlockers=0, bool isShadowLink=false) const
Returns all potential link leaders (vehicles on foeLanes) Valid during the planMove() phase...
LaneChangeMode myRightDriveLC
changing to the rightmost lane
virtual bool hasPedestrians(const MSLane *lane)
whether the given lane has pedestrians on it
std::vector< std::vector< LaneQ > > myBestLanes
bool parking
whether the vehicle is removed from the net while stopping
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
MSLink * getLinkTo(const MSLane *) const
returns the link to the given lane or 0, if it is not connected
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
MSLink * getParallelLink(int direction) const
return the link that is parallel to this lane or 0
State myState
This Vehicles driving state (pos and speed)
MSParkingArea * getParkingArea(const std::string &id) const
Returns the named parking area.
void adaptToLeaders(const MSLeaderInfo &ahead, double latOffset, const double seen, DriveProcessItem *const lastLink, const MSLane *const lane, double &v, double &vLinkPass) const
bool isChangingLanes() const
return true if the vehicle currently performs a lane change maneuver
double myOriginalSpeed
The velocity before influence.
virtual double followSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel) const =0
Computes the vehicle's follow speed (no dawdling)
std::pair< MSVehicle *const, double > getOppositeLeader(const MSVehicle *ego, double dist, bool oppositeDir) const
virtual double moveHelper(MSVehicle *const veh, double vPos) const
Applies interaction with stops and lane changing model influences.
A lane area vehicles can halt at.
bool replaceParkingArea(MSParkingArea *parkingArea, std::string &errorMsg)
replace the current parking area stop with a new stop with merge duration
void enter(SUMOVehicle *what, double beg, double end)
Called if a vehicle enters this stop.
DriveItemVector myLFLinkLanes
bool resumeFromStopping()
bool myAmRegisteredAsWaitingForPerson
Whether this vehicle is registered as waiting for a person (for deadlock-recognition) ...
bool hasInfluencer() const
SUMOTime duration
The stopping duration.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
bool keepClear() const
whether the junction after this link must be kept clear
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive...
double getTimeGapOnLane() const
Returns the time gap in seconds to the leader of the vehicle on the same lane.
void setBlinkerInformation()
double getLatOffset(const MSLane *lane) const
Get the offset that that must be added to interpret myState.myPosLat for the given lane...
int getLanechangeMode() const
return the current lane change mode
const MSLeaderInfo & getLastVehicleInformation(const MSVehicle *ego, double latOffset, double minPos=0, bool allowCached=true) const
Returns the last vehicles on the lane.
MSLane * getOpposite() const
return the opposite direction lane for lane changing or 0
bool isStoppedOnLane() const
void addContainer(MSTransportable *container)
Adds a container.
bool unsafeLinkAhead(const MSLane *lane) const
whether the vehicle may safely move to the given lane with regard to upcoming links ...
bool hasPersons() const
Returns whether persons are simulated.
The vehicle arrived at a junction.
bool isVTDControlled() const
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
double implicitDeltaPosVTD(const MSVehicle *veh)
return the change in longitudinal position that is implicit in the new VTD position ...
int myRoutingMode
routing mode (see TraCIConstants.h)
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
void enter(SUMOVehicle *what, double beg, double end)
Called if a vehicle enters this stop.
const double SUMO_const_laneWidth
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
MSLane * getViaLane() const
Returns the following inner lane.
void planMove(const SUMOTime t, const MSLeaderInfo &ahead, const double lengthsInFront)
Compute safe velocities for the upcoming lanes based on positions and speeds from the last time step...
The car-following model abstraction.
double maximumSafeStopSpeed(double gap, double currentSpeed, bool onInsertion=false, double headway=-1) const
Returns the maximum next velocity for stopping within gap.
bool myConsiderMaxAcceleration
Whether the maximum acceleration shall be regarded.
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
double myPosLat
the stored lateral position
int getShadowDirection() const
return the direction in which the current shadow lane lies
double myArrivalPos
The position on the destination lane where the vehicle stops.
The link is a 180 degree turn.
virtual void clear()
discard all information
Notification
Definition of a vehicle state.
std::string time2string(SUMOTime t)
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
MSDevice_Transportable * myPersonDevice
The passengers this vehicle may have.
double interpolateLanePosToGeometryPos(double lanePos) const
#define STOPPING_PLACE_OFFSET
Changes the wished vehicle speed / lanes.
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
double getCO2Emissions() const
Returns CO2 emission of the current state.
bool addTraciStopAtStoppingPlace(const std::string &stopId, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, const SumoXMLTag stoppingPlaceType, std::string &errorMsg)
bool myRespectJunctionPriority
Whether the junction priority rules are respected.
bool reached
Information whether the stop has been reached.
const MSLane * getBackLane() const
virtual double getHeadwayTime() const
Get the driver's desired headway [s].
void registerEmergencyStop()
register emergency stop
static const double ZIPPER_ADAPT_DIST
MSChargingStation * getChargingStation(const std::string &id) const
Returns the named charging station.
State & operator=(const State &state)
Assignment operator.
double getLength() const
Returns the lane's length.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
bool replaceRoute(const MSRoute *route, bool onInit=false, int offset=0, bool addStops=true)
Replaces the current route by the given one.
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
const MSRoute & getRoute() const
Returns the current route.
vehicle doesn't want to change
TraciLaneChangePriority
modes for prioritizing traci lane change requests
double getSpaceTillLastStanding(const MSLane *l, bool &foundStopped) const
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
void write(OutputDevice &dev) const
double slopeDegreeAtOffset(double pos) const
Returns the slope at the given length.
const MSRoute * myRoute
This vehicle's route.
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
double getEndLanePosition() const
Returns the end position of this stop.
const std::string & getID() const
returns the id of the transportable
double getHCEmissions() const
Returns HC emission of the current state.
bool hasDeparted() const
Returns whether this vehicle has already departed.
The vehicle got vaporized.
void postProcessVTD(MSVehicle *v)
double getPositionOnLane() const
Get the vehicle's position along the lane.
SUMOTime until
The time at which the vehicle may continue its journey.
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0, bool collision=false, MSRouteIterator *searchStart=0)
Adds a stop.
void adaptBestLanesOccupation(int laneIndex, double density)
update occupation from MSLaneChanger
WaitingTimeCollector myWaitingTimeCollector
void checkRewindLinkLanes(const double lengthsInFront, DriveItemVector &lfLinks) const
Definition of vehicle stop (position and duration)
This is an uncontrolled, right-before-left link.
render as a sedan passenger vehicle ("Stufenheck")
void removeWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
Removes a vehicle from the list of waiting vehicles to a given edge.
LinkDirection getDirection() const
Returns the direction the vehicle passing this link take.
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
std::vector< const MSEdge * > ConstMSEdgeVector
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
static double computeNoise(SUMOEmissionClass c, double v, double a)
Returns the noise produced by the a vehicle of the given type at the given speed. ...
SUMOTime myMemorySize
the maximal memory to store
void setVTDControlled(Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector &route, SUMOTime t)
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
int myArrivalLane
The destination lane where the vehicle stops.
const SUMOVehicleParameter * myParameter
This vehicle's parameter.
double getMinimalArrivalSpeed(double dist, double currentSpeed) const
Computes the minimal possible arrival speed after covering a given distance.
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the stops.
The base class for microscopic and mesoscopic vehicles.
double computeAngle() const
compute the current vehicle angle
bool myHaveToWaitOnNextLink
A storage for edge travel times and efforts.
virtual double getFloat(int id) const =0
Returns the double-value of the named (by its enum-value) attribute.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
double nextOccupation
As occupation, but without the first lane.
double getLength() const
Returns the vehicle's length.
double length
The overall length which may be driven when using this lane without a lane change.
double getLastFreePos(const SUMOVehicle &forVehicle) const
Returns the last free position on this stop.
bool lastWasContMajor() const
whether this is a link past an internal junction which currently has priority
This is an uncontrolled, all-way stop link.
The action is due to the wish to be faster (tactical lc)
used by the sublane model
void setApproaching(const SUMOVehicle *approaching, const SUMOTime arrivalTime, const double arrivalSpeed, const double leaveSpeed, const bool setRequest, const SUMOTime arrivalTimeBraking, const double arrivalSpeedBraking, const SUMOTime waitingTime, double dist)
Sets the information about an approaching vehicle.
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
bool collision
Whether this stop was triggered by a collision.
This is an uncontrolled, zipper-merge link.
The link is a (hard) left direction.
std::string parkingarea
(Optional) parking area if one is assigned to the stop
#define WRITE_WARNING(msg)
The simulated network and simulation perfomer.
bool replaceRouteEdges(ConstMSEdgeVector &edges, bool onInit=false, bool check=false, bool addStops=true)
Replaces the current route by the given edges.
The car-following model and parameter.
bool triggered
whether an arriving person lets the vehicle continue
virtual void saveState(OutputDevice &out)
Saves the (common) state of a vehicle.
WaitingTimeCollector(SUMOTime memory=MSGlobals::gWaitingTimeMemory)
Constructor.
MSAbstractLaneChangeModel & getLaneChangeModel()
SUMOTime getMinimalArrivalTime(double dist, double currentSpeed, double arrivalSpeed) const
Computes the minimal time needed to cover a distance given the desired speed at arrival.
MSCFModel::VehicleVariables * myCFVariables
The per vehicle variables of the car following model.
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
std::string gDebugSelectedVehicle
double backPos() const
back Position of this state
double getFoeVisibilityDistance() const
Returns the distance on the approaching lane from which an approaching vehicle is able to see all rel...
Right blinker lights are switched on.
double getOppositePos(double pos) const
return the corresponding position on the opposite lane
std::vector< Stop > stops
List of the stops the vehicle will make, TraCI may add entries here.
MSChargingStation * chargingStation
(Optional) charging station if one is assigned to the stop
double getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
PositionVector reverse() const
reverse position vector
double getSlope() const
Returns the slope of the road at vehicle's position.
virtual MSTransportableControl & getContainerControl()
Returns the container control.
static CollisionAction getCollisionAction()
The vehicles starts to stop.
void unregisterOneWaitingForContainer()
decreases the count of vehicles waiting for a container to allow recogniztion of container related de...
SUMOTime getMemorySize() const
Needs to stay on the current lane.
void calculateArrivalParams()
(Re-)Calculates the arrival position and lane from the vehicle parameters
std::vector< std::pair< SUMOTime, int > > myLaneTimeLine
The lane usage time line to apply.
double influenceSpeed(SUMOTime currentTime, double speed, double vSafe, double vMin, double vMax)
Applies stored velocity information on the speed to use.
double getImpatience() const
Returns this vehicles impatience.
int getContainerNumber() const
Returns the number of containers.
std::vector< double > myFurtherLanesPosLat
double getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
WaitingTimeCollector & operator=(const WaitingTimeCollector &wt)
Assignment operator.
std::string busstop
(Optional) bus stop if one is assigned to the stop
bool operator!=(const State &state)
Operator !=.
static std::vector< MSTransportable * > myEmptyTransportableVector
void adaptToLeader(const std::pair< const MSVehicle *, double > leaderInfo, const double seen, DriveProcessItem *const lastLink, const MSLane *const lane, double &v, double &vLinkPass, double distToCrossing=-1) const
double departSpeed
(optional) The initial speed of the vehicle
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
void leaveLane(const MSMoveReminder::Notification reason, const MSLane *approachedLane=0)
Update of members if vehicle leaves a new lane in the lane change step or at arrival.
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, double > > &speedTimeLine)
Sets a new velocity timeline.
The vehicle changes lanes (micro only)
double getZipperSpeed(const MSVehicle *ego, const double dist, double vSafe, SUMOTime arrivalTime, std::vector< const SUMOVehicle * > *collectFoes) const
return the speed at which ego vehicle must approach the zipper link
double getBruttoVehLenSum() const
Returns the sum of lengths of vehicles, including their minGaps, which were on the lane during the la...
double getElectricityConsumption() const
Returns electricity consumption of the current state.
double getLeaveSpeed() const
MSLane * lane
The described lane.
void setSpeedMode(int speedMode)
Sets speed-constraining behaviors.
Left blinker lights are switched on.
double myDepartPos
The real depart position.
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
const MSLane & getLane() const
Returns the lane this stop is located at.
double getBackPositionOnLane() const
Get the vehicle's position relative to its current lane.
void setSublaneChange(double latDist)
Sets a new sublane-change request.
bool allowsVehicleClass(SUMOVehicleClass vclass) const
double getLastFreePos(const SUMOVehicle &forVehicle) const
Returns the last free position on this stop.
blocked in all directions
The vehicle got a new route.
double getDistanceToPosition(double destPos, const MSEdge *destEdge) const
MSStoppingPlace * getBusStop(const std::string &id) const
Returns the named bus stop.
vehicle want's to change to right lane
const SUMOVTypeParameter & getParameter() const
void updateState(double vNext)
updates the vehicles state, given a next value for its speed. This value can be negative in case of t...
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
#define DIST_TO_STOPLINE_EXPECT_PRIORITY
void removeApproachingInformation(DriveItemVector &lfLinks) const
unregister approach from all upcoming links
Position getPositionAlongBestLanes(double offset) const
Return the (x,y)-position, which the vehicle would reach if it continued along its best continuation ...
The action is urgent (to be defined by lc-model)
Representation of a vehicle.
MSStoppingPlace * containerstop
(Optional) container stop if one is assigned to the stop
render as a hatchback passenger vehicle ("Fliessheck")
Stores the waiting intervals over the previous seconds (memory is to be specified in ms...
bool opened(SUMOTime arrivalTime, double arrivalSpeed, double leaveSpeed, double vehicleLength, double impatience, double decel, SUMOTime waitingTime, double posLat=0, std::vector< const SUMOVehicle * > *collectFoes=0, bool ignoreRed=false, const SUMOVehicle *ego=0) const
Returns the information whether the link may be passed.
PositionVector getBoundingBox() const
get bounding rectangle
double startPos
The stopping position start.
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
Encapsulated SAX-Attributes.
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
static MSPModel * getModel()
SUMOTime myCollisionImmunity
amount of time for which the vehicle is immune from collisions
virtual MSTransportableControl & getPersonControl()
Returns the person control.
bool keepStopping(bool afterProcessing=false) const
Returns whether the vehicle is stopped and must continue to do so.
void adaptLeaveSpeed(const double v)
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
ChangeRequest
Requests set via TraCI.
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
std::string chargingStation
(Optional) charging station if one is assigned to the stop
A point in 2D or 3D with translation and scaling methods.
TraciLaneChangePriority myTraciLaneChangePriority
flags for determining the priority of traci lane change requests
MSLane * getLane() const
Returns the connected lane.
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
double getCommittedSpeed() const
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
static void clear()
Clears the dictionary.
SUMOTime timeToLoadNextContainer
The time at which the vehicle is able to load another container.
Position myCachedPosition
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
MSLane * getParallelLane(int offset) const
Returns the lane with the given offset parallel to this one or 0 if it does not exist.
const MSLane * lane
The lane to stop at.
double currentLength
The length which may be driven on this lane.
const std::vector< MSLane * > & getShadowFurtherLanes() const
bool triggered
whether an arriving person lets the vehicle continue
std::list< Stop > myStops
The vehicle's list of stops.
ConstMSEdgeVector::const_iterator MSRouteIterator
SUMOTime myTimeLoss
the time loss due to writing with less than maximum speed
void getSubLanes(const MSVehicle *veh, double latOffset, int &rightmost, int &leftmost) const
void removeVType(const MSVehicleType *vehType)
PositionVector getBoundingPoly() const
get bounding polygon
bool contains(const MSEdge *const edge) const
const std::vector< MSTransportable * > & getTransportables() const
Returns the list of transportables using this vehicle.
bool isStopped() const
Returns whether the vehicle is at a stop.
SUMOTime collisionStopTime() const
Returns the remaining time a vehicle needs to stop due to a collision. A negative value indicates tha...
bool myConsiderMaxDeceleration
Whether the maximum deceleration shall be regarded.
MSLane * myLane
The lane the vehicle is on.
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected.
bool myAmRegisteredAsWaitingForContainer
Whether this vehicle is registered as waiting for a container (for deadlock-recognition) ...
bool loadAnyWaiting(MSEdge *edge, MSVehicle *vehicle, MSVehicle::Stop *stop)
load any applicable containers Loads any container that is waiting on that edge for the given vehicle...
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
Influencer * myInfluencer
An instance of a velocity/lane influencing instance; built in "getInfluencer".
void resetRoutePosition(int index)
const std::vector< MSTransportable * > & getContainers() const
retrieve riding containers
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
const ConstMSEdgeVector & getEdges() const
double getDeltaPos(double accel)
calculates the distance covered in the next integration step given an acceleration and assuming the c...
double getSafeFollowSpeed(const std::pair< const MSVehicle *, double > leaderInfo, const double seen, const MSLane *const lane, double distToCrossing) const
compute safe speed for following the given leader
void forceVehicleInsertion(MSVehicle *veh, double pos, MSMoveReminder::Notification notification, double posLat=0)
Inserts the given vehicle at the given position.
void removeShadowApproachingInformation() const
SUMOTime duration
The stopping duration.
double getPMxEmissions() const
Returns PMx emission of the current state.
bool isRoundabout() const
MSVehicle()
invalidated default constructor
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
double updateFurtherLanes(std::vector< MSLane * > &furtherLanes, std::vector< double > &furtherLanesPosLat, const std::vector< MSLane * > &passedLanes)
update a vector of further lanes and return the new backPos
The link is a (hard) right direction.
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT() const
The action is needed to follow the route (navigational lc)
std::vector< LinkLeader > LinkLeaders
void addTransportable(MSTransportable *transportable)
Add a passenger.
A blue emergency light is on.
double speed() const
Speed of this state.
A structure representing the best lanes for continuing the current route starting at 'lane'...
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
void stopStarted(const SUMOVehicle *veh, int numPersons, int numContainers)
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
virtual PersonDist nextBlocking(const MSLane *lane, double minPos, double minRight, double maxLeft, double stopTime=0)
returns the next pedestrian beyond minPos that is laterally between minRight and maxLeft or 0 ...
virtual double freeSpeed(const MSVehicle *const veh, double speed, double seen, double maxSpeed, const bool onInsertion=false) const
Computes the vehicle's safe speed without a leader.
double getCenterOnEdge(const MSLane *lane=0) const
Get the vehicle's lateral position on the edge of the given lane (or its current edge if lane == 0) ...
double myStopDist
distance to the next stop or -1 if there is none
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
bool keepClear(const MSLink *link) const
decide whether the given link must be kept clear
double endPos
The stopping position end.
const std::vector< double > & getShadowFurtherLanesPosLat() const
void removeTransportable(MSTransportable *p)
Removes a transportable from this stop.
bool hasContainers() const
Returns whether containers are simulated.
MSLane * getShadowLane() const
Returns the lane the vehicles shadow is on during continuous/sublane lane change. ...
double myAcceleration
The current acceleration after dawdling in m/s.
void fixPosition()
repair errors in vehicle position after changing between internal edges
double getRightSideOnLane() const
Get the vehicle's lateral position on the lane:
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
double myPreviousSpeed
the speed at the begin of the previous time step
render as a passenger vehicle
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
MSParkingArea * parkingarea
(Optional) parkingArea if one is assigned to the stop
SUMOTime myWaitingTime
The time the vehicle waits (is not faster than 0.1m/s) in seconds.
LaneChangeMode mySpeedGainLC
lane changing to travel with higher speed
bool isInternal() const
return whether this edge is an internal edge
bool isVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
The link is a partial right direction.
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons) ...
void addReference() const
increments the reference counter for the route
bool isParking() const
Returns whether the vehicle is parking.
LaneChangeMode myCooperativeLC
lane changing with the intent to help other vehicles
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
int getRoutePosition() const
std::vector< MSVehicle * > VehCont
Container for vehicles.
bool containerTriggered
whether an arriving container lets the vehicle continue
void move2side(double amount)
move position vector to side using certain ammount
int getPersonNumber() const
Returns the number of persons.
bool allowsContinuation
Whether this lane allows to continue the drive.
void stopEnded(const SUMOVehicle *veh, const MSVehicle::Stop &stop)
const std::vector< MSTransportable * > & getPersons() const
retrieve riding persons
Container that holds the vehicles driving state (position+speed).
void unregisterOneWaitingForPerson()
decreases the count of vehicles waiting for a person to allow recogniztion of person related deadlock...
Base class for objects which have an id.
double getJMParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
double getNOxEmissions() const
Returns NOx emission of the current state.
void registerOneWaitingForPerson()
increases the count of vehicles waiting for a person to allow recogniztion of person related deadlock...
void saveState(OutputDevice &out)
Saves the states of a vehicle.
SUMOVehicleShape getGuiShape() const
Get this vehicle type's shape.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector &lfLinks, double &myStopDist) const
double getWidth() const
Returns the edges's width (sum over all lanes)
std::string lane
The lane to stop at.
bool myEmergencyBrakeRedLight
Whether red lights are a reason to brake.
SUMOTime getLastStateChange() const
MSEdgeWeightsStorage & _getWeightsStorage() const
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const MSEdgeVector &prohibited=MSEdgeVector()) const
std::vector< std::string > via
List of the via-edges the vehicle must visit.
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
ConstMSEdgeVector myVTDRoute
virtual void drawOutsideNetwork(bool)
register vehicle for drawing while outside the network
void setShadowApproachingInformation(MSLink *link) const
set approach information for the shadow vehicle
bool wasRemoteControlled(SUMOTime lookBack=DELTA_T) const
Returns the information whether the vehicle is fully controlled via TraCI within the lookBack time...
bool boardAnyWaiting(MSEdge *edge, MSVehicle *vehicle, MSVehicle::Stop *stop)
board any applicable persons Boards any people who wait on that edge for the given vehicle and remove...
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
std::pair< const MSPerson *, double > PersonDist
void setEmergencyBlueLight(SUMOTime currentTime)
sets the blue flashing light for emergency vehicles
const MSEdge * getNormalBefore() const
if this edge is an internal edge, return its first normal predecessor, otherwise the edge itself ...
double getOriginalSpeed() const
Returns the originally longitudinal speed to use.
std::vector< const MSLane * > getOutgoingLanes() const
get the list of outgoing lanes
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
bool addTraciStop(MSLane *const lane, const double startPos, const double endPos, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, std::string &errorMsg)
double getLength() const
Get vehicle's length [m].
double departPos
(optional) The position the vehicle shall depart from
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
void registerOneWaitingForContainer()
increases the count of vehicles waiting for a container to allow recogniztion of container related de...
vehicle want's to change to left lane
std::pair< const MSVehicle *, double > CLeaderDist
The vehicle starts or ends parking.
static double compute(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope, const std::map< int, double > *param=0)
Returns the amount of the emitted pollutant given the vehicle type and state (in mg/s or ml/s for fue...
void addStops(const bool ignoreStopErrors)
Adds stops to the built vehicle.
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
LaneChangeModel getLaneChangeModel() const
Influencer & getInfluencer()
Returns the velocity/lane influencer.
static MSDevice_Transportable * buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice * > &into, const bool isContainer)
Build devices for the given vehicle, if needed.
Structure representing possible vehicle parameter.
bool havePriority() const
Returns whether this link is a major link.
MSRouteIterator end() const
Returns the end of the list of edges to pass.
bool getEmergencyBrakeRedLight() const
Returns whether red lights shall be a reason to brake.
double occupation
The overall vehicle sum on consecutive lanes which can be passed without a lane change.
LaneChangeMode mySublaneLC
changing to the prefered lateral alignment
double processNextStop(double currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
virtual VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting...
void setNoShadowPartialOccupator(MSLane *lane)
void setTentativeLaneAndPosition(MSLane *lane, double pos, double posLat=0)
set tentative lane and position during insertion to ensure that all cfmodels work (some of them requi...
bool containerTriggered
whether an arriving container lets the vehicle continue
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
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...
void setVTDState(Position xyPos)
sets position outside the road network
std::vector< std::pair< SUMOTime, double > > mySpeedTimeLine
The velocity time line to apply.
SUMOTime getLastAccessTimeStep() const
virtual double maxNextSpeed(double speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
MSVehicleType * myType
This vehicle's type.
void passTime(SUMOTime dt, bool waiting)
virtual double minNextSpeed(double speed, const MSVehicle *const veh=0) const
Returns the minimum speed given the current speed (depends on the numerical update scheme and its ste...
void workOnMoveReminders(double oldPos, double newPos, double newSpeed)
Processes active move reminder.
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
The vehicle is blocked being overlapping.
int mySignals
State of things of the vehicle that can be on or off.
void resetChanged()
reset the flag whether a vehicle already moved to false
std::vector< MSLane * > bestContinuations
std::pair< const MSVehicle *const, double > getLeader(double dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
Definition of vehicle stop (position and duration)
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING) const
Get the allowed lanes to reach the destination-edge.
void scaleRelative(double factor)
enlarges/shrinks the polygon by a factor based at the centroid
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
const MSTrafficLightLogic * getTLLogic() const
Returns the TLS index.
void onDepart()
Called when the vehicle is inserted into the network.
bool isStoppedInRange(double pos) const
return whether the given position is within range of the current stop
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
SUMOTime until
The time at which the vehicle may continue its journey.
double estimateSpeedAfterDistance(const double dist, const double v, const double accel) const
MSStoppingPlace * getContainerStop(const std::string &id) const
Returns the named container stop.
const ConstMSEdgeVector getStopEdges() const
Returns the list of still pending stop edges.
bool haveRed() const
Returns whether this link is blocked by a red (or redyellow) traffic light.
int index
at which position in the stops list
MSRouteIterator edge
The edge in the route to stop at.
const waitingIntervalList & getWaitingIntervals() const
The arrival lane is given.
int containerNumber
The static number of containers in the vehicle when it departs.
const std::string & getID() const
Returns the name of the vehicle type.
The vehicle ends to stop.
void activateReminders(const MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
"Activates" all current move reminder
double implicitSpeedVTD(const MSVehicle *veh, double oldSpeed)
return the speed that is implicit in the new VTD position
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
int myNumberReroutes
The number of reroutings.
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
double getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
virtual double stopSpeed(const MSVehicle *const veh, const double speed, double gap) const =0
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) ...
bool isFrontOnLane(const MSLane *lane) const
Returns the information whether the front of the vehicle is on the given lane.
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to)
Informs all added listeners about a vehicle's state change.
void setLaneChangeMode(int value)
Sets lane changing behavior.
virtual void prepareStep()
double getBeginLanePosition() const
Returns the begin position of this stop.
double getAccumulatedWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s) within the last millisecs...
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
static MSStopOut * getInstance()
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
void checkLinkLeader(const MSLink *link, const MSLane *lane, double seen, DriveProcessItem *const lastLink, double &v, double &vLinkPass, double &vLinkWait, bool &setRequest, bool isShadowLink=false) const
checks for link leaders on the given link
waitingIntervalList myWaitingIntervals
double getDistanceBetween(double fromPos, double toPos, const MSEdge *fromEdge, const MSEdge *toEdge, bool includeInternal=true) const
Compute the distance between 2 given edges on this route, including the length of internal lanes...
std::vector< DriveProcessItem > DriveItemVector
Container for used Links/visited Lanes during lookForward.
void setSignals(int signals)
double getEndPos(const SUMOVehicle &veh) const
return halting position for upcoming stop;
double pos() const
Position of this state.
const PositionVector & getShape() const
Returns this lane's shape.
The action is due to a TraCI request.
double getRightSideOnEdge() const
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
vehicle want's to keep the current lane
LinkState getState() const
Returns the current state of the link.
Static storage of an output device and its base (abstract) implementation.
void changedToOpposite()
called when a vehicle changes between lanes in opposite directions
The vehicle needs another parking area.
const std::set< MSTransportable * > & getPersons() const
Returns this edge's persons set.
bool closeTag()
Closes the most recently opened tag.
void switchOffSignal(int signal)
Switches the given signal off.
static bool gSemiImplicitEulerUpdate
void switchOnSignal(int signal)
Switches the given signal on.
double getFuelConsumption() const
Returns fuel consumption of the current state.
void addPerson(MSTransportable *person)
Adds a passenger.
double getCOEmissions() const
Returns CO emission of the current state.
double getRightSideOnEdge(const MSLane *lane=0) const
Get the vehicle's lateral position on the edge of the given lane (or its current edge if lane == 0) ...
static std::vector< MSLane * > myEmptyLaneVector
double estimateLeaveSpeed(const MSLink *const link, const double vLinkPass) const
estimate leaving speed when accelerating across a link
void removeApproaching(const SUMOVehicle *veh)
removes the vehicle from myApproachingVehicles
MSRouteIterator myCurrEdge
Iterator to current route-edge.
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
int getSpeedMode() const
return the current speed mode
SUMOTime cumulatedWaitingTime(SUMOTime memory=-1) const
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, int > > &laneTimeLine)
Sets a new lane timeline.
double getLateralOverlap() const
return the amount by which the vehicle extends laterally outside it's primary lane ...
virtual ~MSVehicle()
Destructor.
double changeRequestRemainingSeconds(const SUMOTime currentTime) const
Return the remaining number of seconds of the current laneTimeLine assuming one exists.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
No information given; use default.
SUMOTime getDeparture() const
Returns this vehicle's real departure time.
MSParkingArea * getNextParkingArea()
get the current parking area stop
double getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
void release() const
deletes the route if there are no further references to it
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
double endPos
The stopping position end.
State(double pos, double speed, double posLat, double backPos)
Constructor.
bool mySpeedAdaptationStarted
Whether influencing the speed has already started.
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
static SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const MSEdgeVector &prohibited=MSEdgeVector())
return the router instance
Position validatePosition(Position result, double offset=0) const
ensure that a vehicle-relative position is not invalid
MSLane * getLane() const
Returns the lane the vehicle is on.
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
public emergency vehicles
render as a wagon passenger vehicle ("Combi")
void removeTransportable(MSTransportable *transportable)
Remove a passenger (TraCI)
static SUMOTime gLaneChangeDuration
const std::vector< MSMoveReminder * > & getMoveReminders() const
Return the list of this lane's move reminders.
int influenceChangeDecision(const SUMOTime currentTime, const MSEdge ¤tEdge, const int currentLaneIndex, int state)
Applies stored LaneChangeMode information and laneTimeLine.
static MSAbstractLaneChangeModel * build(LaneChangeModel lcm, MSVehicle &vehicle)
Factory method for instantiating new lane changing models.
void writeParams(OutputDevice &out) const
MSStoppingPlace * busstop
(Optional) bus stop if one is assigned to the stop
void addReminder(MSMoveReminder *rem)
Adds a MoveReminder dynamically.
Representation of a lane in the micro simulation.
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
std::vector< MSDevice * > myDevices
The devices this vehicle has.
double myBackPos
the stored back position
bool onFurtherEdge(const MSEdge *edge) const
whether this vehicle has its back (and no its front) on the given edge
void adaptLaneEntering2MoveReminder(const MSLane &enteredLane)
Adapts the vehicle's entering of a new lane.
LaneChangeMode myStrategicLC
lane changing which is necessary to follow the current route
void passedJunction(const MSVehicle *vehicle)
erase vehicle from myLinkLeaders of this links junction
bool isVTDAffected(SUMOTime t) const
double brakeGap(const double speed) const
Returns the distance the vehicle needs to halt including driver's reaction time tau (i...
bool isFringe() const
return whether this edge is at the fringe of the network
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
Interface for lane-change models.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
double mySpeed
the stored speed (should be >=0 at any time)
int getBestLaneOffset() const
bool myConsiderSafeVelocity
Whether the safe velocity shall be regarded.
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position ...
SUMOTime myDeparture
The real departure time.
void removeTransportable(MSTransportable *t)
removes a person or container
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
MSDevice_Transportable * myContainerDevice
The containers this vehicle may have.
static const SUMOTime NOT_YET_DEPARTED
double getMinimalArrivalSpeedEuler(double dist, double currentSpeed) const
Computes the minimal possible arrival speed after covering a given distance for Euler update...
double startPos
The stopping position start.
std::string id
The vehicle's id.
bool parking
whether the vehicle is removed from the net while stopping
static const Position INVALID
used to indicate that a position is valid
The vehicle is being teleported.
double getWidth() const
Returns the vehicle's width.
const std::string & getID() const
Returns the name of the vehicle.
int size() const
Return the number of passengers / containers.
double getSpeed() const
Returns the vehicle's current speed.
void endLaneChangeManeuver(const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_LANE_CHANGE)
const Position getBackPosition() const
bool ignoreRed(const MSLink *link, bool canBrake) const
decide whether a red (or yellow light) may be ignore