81 #ifdef CHECK_MEMORY_LEAKS 83 #endif // CHECK_MEMORY_LEAKS 93 #define DEBUG_COND (getID() == "disabled") 95 #define STOPPING_PLACE_OFFSET 0.5 97 #define CRLL_LOOK_AHEAD 5 100 #define DIST_TO_STOPLINE_EXPECT_PRIORITY 1.0 178 if (memorySpan == -1) {
183 if (i->second >= memorySpan) {
184 if (i->first >= memorySpan) {
187 totalWaitingTime += memorySpan - i->first;
190 totalWaitingTime += i->second - i->first;
193 return totalWaitingTime;
200 bool startNewInterval = i == end || (i->first != 0);
211 waitingIntervalList::iterator::difference_type d = std::distance(i, end);
219 }
else if (!startNewInterval) {
236 mySpeedAdaptationStarted(true),
237 myConsiderSafeVelocity(true),
238 myConsiderMaxAcceleration(true),
239 myConsiderMaxDeceleration(true),
240 myRespectJunctionPriority(true),
241 myEmergencyBrakeRedLight(true),
299 speed =
MIN2(speed, vSafe);
302 speed =
MIN2(speed, vMax);
305 speed =
MAX2(speed, vMin);
321 if (destinationLaneIndex < (
int)currentEdge.
getLanes().size()) {
322 if (currentLaneIndex > destinationLaneIndex) {
324 }
else if (currentLaneIndex < destinationLaneIndex) {
352 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
360 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
381 switch (changeRequest) {
470 const bool wasOnRoad = v->
isOnRoad();
560 if ((*myCurrEdge)->getDepartLane(*
this) == 0) {
561 throw ProcessError(
"Invalid departlane definition for vehicle '" + pars->
id +
"'.");
565 throw ProcessError(
"Vehicle '" + pars->
id +
"' is not allowed to depart on any lane of its first edge.");
570 "' is too high for the vehicle type '" + type->
getID() +
"'.");
581 (*i)->resetPartialOccupation(
this);
632 (newCurrEdge + 1) == edges.end() || (*(newCurrEdge + 1)) != &(
myLane->
getOutgoingLanes()[0]->getEdge()))) {
652 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end();) {
653 if (find(
myCurrEdge, edges.end(), &iter->lane->getEdge()) == edges.end()) {
656 iter->edge = find(
myCurrEdge, edges.end(), &iter->lane->getEdge());
661 for (std::vector<SUMOVehicleParameter::Stop>::const_iterator i = newRoute->
getStops().begin(); i != newRoute->
getStops().end(); ++i) {
724 if (!rem->first->notifyMove(*
this, oldPos + rem->second, newPos + rem->second,
MAX2((
SUMOReal)0., newSpeed))) {
726 if (myTraceMoveReminders) {
727 traceMoveReminder(
"notifyMove", rem->first, rem->second,
false);
733 if (myTraceMoveReminders) {
734 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
750 rem->second += oldLaneLength;
752 if (myTraceMoveReminders) {
753 traceMoveReminder(
"adaptedPos", rem->first, rem->second,
true);
790 if (offset == 0. && !changingLanes) {
808 #ifdef HAVE_INTERNAL_LANES 843 std::cout <<
SIMTIME <<
" computeAngle veh=" <<
getID() <<
" p1=" << p1 <<
" p2=" << p2 <<
" angle=" << result <<
"\n";
879 errorMsg =
"Vehicle '" +
myParameter->
id +
"' is not allowed to stop on lane '" + stopPar.
lane +
"'.";
892 if (stop.
until != -1) {
893 stop.
until += untilOffset;
905 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' has an invalid position.";
918 std::list<Stop>::iterator iter =
myStops.begin();
921 prevStopEdge =
myStops.back().edge;
922 prevStopPos =
myStops.back().endPos;
925 if (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos) {
931 while (iter !=
myStops.end() && (iter->edge < stop.
edge ||
932 (iter->endPos < stop.
endPos && iter->edge == stop.
edge))) {
933 prevStopEdge = iter->edge;
934 prevStopPos = iter->endPos;
938 int index = stopPar.
index;
940 prevStopEdge = iter->edge;
941 prevStopPos = iter->endPos;
949 (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos)) {
955 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is not downstream the current route.";
961 errorMsg =
"Stop for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is too close to break.";
969 pos += (*myCurrEdge)->getLength();
981 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is before departPos.";
986 std::list<Stop>::iterator iter2 = iter;
988 if (stop.
until >= 0 && iter2->until > stop.
until) {
994 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' ends earlier than previous stop.";
1030 return currentVelocity;
1035 std::cout <<
"\nPROCESS_NEXT_STOP\n" <<
SIMTIME <<
" vehicle '" <<
getID() <<
"'" << std::endl;
1044 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' reached stop." << std::endl;
1058 for (std::vector<MSTransportable*>::const_iterator i = persons.begin(); i != persons.end(); ++i) {
1069 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' unregisters as waiting for person." << std::endl;
1077 for (std::vector<MSTransportable*>::const_iterator i = containers.begin(); i != containers.end(); ++i) {
1088 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' unregisters as waiting for container." << std::endl;
1096 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' resumes from stopping." << std::endl;
1103 WRITE_WARNING(
"Vehicle '" +
getID() +
"' ignores triggered stop on lane '" + stop.
lane->
getID() +
"' due to capacity constraints.");
1111 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' registers as waiting for person." << std::endl;
1117 WRITE_WARNING(
"Vehicle '" +
getID() +
"' ignores container triggered stop on lane '" + stop.
lane->
getID() +
"' due to capacity constraints.");
1125 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' registers as waiting for container." << std::endl;
1150 std::cout <<
SIMTIME <<
" vehicle '" <<
getID() <<
"' hasn't reached next stop." << std::endl;
1158 bool useStoppingPlace =
false;
1159 bool fitsOnStoppingPlace =
true;
1161 useStoppingPlace =
true;
1166 fitsOnStoppingPlace =
false;
1171 useStoppingPlace =
true;
1175 fitsOnStoppingPlace =
false;
1185 if (stop.
until >= 0) {
1211 return currentVelocity;
1218 for (std::list<Stop>::const_iterator iter =
myStops.begin(); iter !=
myStops.end(); ++iter) {
1219 result.push_back(*iter->edge);
1228 #ifdef DEBUG_PLAN_MOVE 1233 <<
" veh=" <<
getID()
1242 #ifdef DEBUG_PLAN_MOVE 1244 DriveItemVector::iterator i;
1247 <<
" vPass=" << (*i).myVLinkPass
1248 <<
" vWait=" << (*i).myVLinkWait
1249 <<
" linkLane=" << ((*i).myLink == 0 ?
"NULL" : (*i).myLink->getViaLaneOrLane()->getID())
1250 <<
" request=" << (*i).mySetRequest
1256 #ifdef DEBUG_PLAN_MOVE 1258 std::cout <<
" after checkRewindLinkLanes\n";
1259 DriveItemVector::iterator i;
1262 <<
" vPass=" << (*i).myVLinkPass
1263 <<
" vWait=" << (*i).myVLinkWait
1264 <<
" linkLane=" << ((*i).myLink == 0 ?
"NULL" : (*i).myLink->getViaLaneOrLane()->getID())
1265 <<
" request=" << (*i).mySetRequest
1266 <<
" atime=" << (*i).myArrivalTime
1267 <<
" atimeB=" << (*i).myArrivalTimeBraking
1278 #ifdef DEBUG_VEHICLE_GUI_SELECTION 1307 #ifdef DEBUG_PLAN_MOVE 1309 std::cout <<
" bestLaneConts=" <<
toString(bestLaneConts) <<
"\n";
1312 assert(bestLaneConts.size() > 0);
1313 #ifdef HAVE_INTERNAL_LANES 1314 bool hadNonInternal =
false;
1316 bool hadNonInternal =
true;
1323 bool slowedDownForMinor =
false;
1330 adaptToLeaders(ahead, 0, seen, lastLink, leaderLane, v, vLinkPass);
1331 #ifdef DEBUG_PLAN_MOVE 1333 std::cout <<
"\nv = " << v <<
"\n";
1341 if (shadowLane != 0) {
1345 seen, lastLink, shadowLane, v, vLinkPass);
1354 myStopDist = seen + endPos - lane->
getLength();
1356 if (lastLink != 0) {
1359 v =
MIN2(v, stopSpeed);
1362 #ifdef DEBUG_PLAN_MOVE 1364 std::cout <<
"\n" <<
SIMTIME <<
" next stop: distance = " << myStopDist <<
" requires stopSpeed = " << stopSpeed <<
"\n";
1374 MSLinkCont::const_iterator link =
MSLane::succLinkSec(*
this, view + 1, *lane, bestLaneConts);
1383 if (lastLink != 0) {
1393 if (lastLink != 0) {
1425 assert(timeRemaining != 0);
1428 #ifdef DEBUG_PLAN_MOVE 1429 if (
DEBUG_COND) std::cout <<
SIMTIME <<
" veh=" <<
getID() <<
" slowing down to finish continuous change before" 1430 <<
" link=" << (*link)->getViaLaneOrLane()->getID()
1431 <<
" timeRemaining=" << timeRemaining
1443 const bool abortRequestAfterMinor = slowedDownForMinor && (*link)->getInternalLaneBefore() == 0;
1445 bool setRequest = (v > 0 && !abortRequestAfterMinor) || (leavingCurrentIntersection);
1449 if (yellowOrRed && seen >= brakeDist) {
1456 #ifdef HAVE_INTERNAL_LANES 1460 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
1462 const MSVehicle* leader = (*it).vehAndGap.first;
1466 adaptToLeader(std::make_pair(
this, -1), seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1467 }
else if ((*link)->isLeader(
this, leader)) {
1468 adaptToLeader(it->vehAndGap, seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1469 if (lastLink != 0) {
1481 vLinkWait =
MIN2(vLinkWait, v);
1485 if (lastLink != 0) {
1494 SUMOReal visibilityDistance = (*link)->getFoeVisibilityDistance();
1495 SUMOReal determinedFoePresence = seen < visibilityDistance;
1500 if (!(*link)->havePriority() && !determinedFoePresence && brakeDist < seen) {
1505 arrivalSpeed =
MIN2(vLinkPass, maxArrivalSpeed);
1506 slowedDownForMinor =
true;
1528 arrivalSpeedBraking =
MIN2(arrivalSpeedBraking, arrivalSpeed);
1532 arrivalTimeBraking =
MAX2(arrivalTime, t +
TIME2STEPS(seen / ((v + arrivalSpeedBraking) * 0.5)));
1535 arrivalTime, arrivalSpeed,
1536 arrivalTimeBraking, arrivalSpeedBraking,
1539 #ifdef HAVE_INTERNAL_LANES 1540 if ((*link)->getViaLane() == 0) {
1541 hadNonInternal =
true;
1548 if ((!setRequest || v <= 0 || seen > dist) && hadNonInternal && seenNonInternal > vehicleLength *
CRLL_LOOK_AHEAD) {
1552 lane = (*link)->getViaLaneOrLane();
1566 lastLink = &lfLinks.back();
1584 ahead.
getSubLanes(
this, latOffset, rightmost, leftmost);
1585 #ifdef DEBUG_PLAN_MOVE 1587 <<
"\nADAPT_TO_LEADERS\nveh=" <<
getID()
1588 <<
" lane=" << lane->
getID()
1589 <<
" rm=" << rightmost
1590 <<
" lm=" << leftmost
1594 for (
int sublane = rightmost; sublane <= leftmost; ++sublane) {
1599 const SUMOReal gap = (lastLink == 0
1602 #ifdef DEBUG_PLAN_MOVE 1604 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";
1607 adaptToLeader(std::make_pair(pred, gap), seen, lastLink, lane, v, vLinkPass);
1618 if (leaderInfo.first != 0) {
1620 if (lastLink != 0) {
1623 v =
MIN2(v, vsafeLeader);
1624 vLinkPass =
MIN2(vLinkPass, vsafeLeader);
1626 #ifdef DEBUG_PLAN_MOVE 1630 <<
" veh=" <<
getID()
1631 <<
" lead=" << leaderInfo.first->getID()
1632 <<
" leadSpeed=" << leaderInfo.first->getSpeed()
1633 <<
" gap=" << leaderInfo.second
1634 <<
" leadLane=" << leaderInfo.first->getLane()->getID()
1635 <<
" predPos=" << leaderInfo.first->getPositionOnLane()
1637 <<
" lane=" << lane->
getID()
1639 <<
" dTC=" << distToCrossing
1641 <<
" vSafeLeader=" << vsafeLeader
1642 <<
" vLinkPass=" << vLinkPass
1652 assert(leaderInfo.first != 0);
1655 if (leaderInfo.second >= 0) {
1656 vsafeLeader = cfModel.
followSpeed(
this,
getSpeed(), leaderInfo.second, leaderInfo.first->getSpeed(), leaderInfo.first->getCarFollowModel().getMaxDecel());
1662 if (distToCrossing >= 0) {
1693 #ifdef DEBUG_VEHICLE_GUI_SELECTION 1699 #ifdef DEBUG_EXEC_MOVE 1700 if (
DEBUG_COND) std::cout <<
"\nEXECUTE_MOVE\n" 1702 <<
" veh=" <<
getID()
1717 DriveItemVector::iterator i;
1719 MSLink* link = (*i).myLink;
1721 #ifdef DEBUG_EXEC_MOVE 1724 <<
" veh=" <<
getID()
1726 <<
" req=" << (*i).mySetRequest
1727 <<
" vP=" << (*i).myVLinkPass
1728 <<
" vW=" << (*i).myVLinkWait
1729 <<
" d=" << (*i).myDistance
1734 if (link != 0 && (*i).mySetRequest) {
1741 vSafe = (*i).myVLinkWait;
1743 link->removeApproaching(
this);
1748 const bool influencerPrio =
false;
1752 std::vector<const SUMOVehicle*> collectFoes;
1753 bool opened = yellow || influencerPrio ||
1754 link->opened((*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1761 if (parallelLink != 0) {
1764 opened &= parallelLink->
opened((*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1768 #ifdef DEBUG_EXEC_MOVE 1771 <<
" veh=" <<
getID()
1775 <<
" opened=" << opened
1781 if (opened && !influencerPrio && !link->havePriority() && !link->lastWasContMajor() && !link->isCont()) {
1782 SUMOReal visibilityDistance = link->getFoeVisibilityDistance();
1783 SUMOReal determinedFoePresence = i->myDistance <= visibilityDistance;
1784 if (!determinedFoePresence) {
1785 vSafe = (*i).myVLinkWait;
1788 link->removeApproaching(
this);
1808 vSafe = (*i).myVLinkPass;
1814 vSafeZipper =
MIN2(vSafeZipper,
1815 link->getZipperSpeed(
this, (*i).myDistance, (*i).myVLinkPass, (*i).myArrivalTime, &collectFoes));
1817 vSafe = (*i).myVLinkWait;
1820 link->removeApproaching(
this);
1822 #ifdef DEBUG_EXEC_MOVE 1824 std::cout <<
SIMTIME <<
" braking for closed link=" << link->getViaLaneOrLane()->getID() <<
"\n";
1831 vSafe = (*i).myVLinkWait;
1862 #ifdef DEBUG_EXEC_MOVE 1864 std::cout <<
"vSafeMin Problem?" << std::endl;
1875 vSafe =
MIN2(vSafe, vSafeZipper);
1896 if (vSafeMin == 0) {
1908 #ifdef DEBUG_EXEC_MOVE 1910 std::cout <<
SIMTIME <<
" moveHelper vSafe=" << vSafe <<
" vSafeMin=" << vSafeMin <<
" vNext=" << vNext <<
"\n";
1948 brakelightsOn =
true;
1954 if (brakelightsOn) {
1962 std::vector<MSLane*> passedLanes;
1964 passedLanes.push_back(*i);
1966 if (passedLanes.size() == 0 || passedLanes.back() !=
myLane) {
1967 passedLanes.push_back(
myLane);
1970 std::string emergencyReason =
" for unknown reasons";
1979 MSLink* link = (*i).myLink;
1990 emergencyReason =
" because of a red traffic light";
1997 emergencyReason =
" because there is no connection to the next edge";
2001 if (approachedLane !=
myLane && approachedLane != 0) {
2006 #ifdef HAVE_INTERNAL_LANES 2009 if (link->getViaLane() == 0) {
2020 WRITE_WARNING(
"Vehicle '" +
getID() +
"' could not finish continuous lane change (turn lane) time=" +
2031 passedLanes.push_back(approachedLane);
2039 +
"'" + emergencyReason
2049 passedLanes.clear();
2067 #ifdef DEBUG_EXEC_MOVE 2148 const std::vector<MSLane*>& passedLanes) {
2151 #ifdef DEBUG_FURTHER 2153 <<
" updateFurtherLanes oldFurther=" <<
toString(furtherLanes)
2154 <<
" oldFurtherPosLat=" <<
toString(furtherLanesPosLat)
2155 <<
" passed=" <<
toString(passedLanes)
2158 for (std::vector<MSLane*>::iterator i = furtherLanes.begin(); i != furtherLanes.end(); ++i) {
2159 (*i)->resetPartialOccupation(
this);
2161 const MSLane* firstOldFurther = furtherLanes.size() > 0 ? furtherLanes.front() : 0;
2164 furtherLanes.clear();
2165 if (passedLanes.size() > 0) {
2167 std::vector<MSLane*>::const_reverse_iterator i = passedLanes.rbegin() + 1;
2168 while (leftLength > 0 && i != passedLanes.rend()) {
2169 furtherLanes.push_back(*i);
2170 if (*i != firstOldFurther) {
2171 furtherLanesPosLat.insert(furtherLanesPosLat.begin(),
myState.
myPosLat);
2173 #ifdef DEBUG_FURTHER 2175 std::cout <<
SIMTIME <<
" updateFurtherLanes \n";
2178 leftLength -= (*i)->setPartialOccupation(
this);
2181 result = -leftLength;
2183 assert(furtherLanesPosLat.size() >= furtherLanes.size());
2184 furtherLanesPosLat.erase(furtherLanesPosLat.begin() + furtherLanes.size(), furtherLanesPosLat.end());
2185 assert(furtherLanesPosLat.size() == furtherLanes.size());
2186 #ifdef DEBUG_FURTHER 2188 <<
" newFurther=" <<
toString(furtherLanes)
2189 <<
" newFurtherPosLat=" <<
toString(furtherLanesPosLat)
2190 <<
" newBackPos=" << result
2199 #ifdef DEBUG_FURTHER 2227 leftLength -= (*i)->getLength();
2238 leftLength -= (*i)->getLength();
2267 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
2270 && (*i)->isFrontOnLane(l)) {
2271 foundStopped =
true;
2272 const SUMOReal ret = (*i)->getPositionOnLane() - (*i)->getVehicleType().getLengthWithGap() - lengths;
2276 lengths += (*i)->getVehicleType().getLengthWithGap();
2285 #ifdef DEBUG_VEHICLE_GUI_SELECTION 2290 #ifdef HAVE_INTERNAL_LANES 2292 bool hadVehicle =
false;
2293 SUMOReal seenSpace = -lengthsInFront;
2295 bool foundStopped =
false;
2298 for (
int i = 0; i < (int)lfLinks.size(); ++i) {
2301 if (item.
myLink == 0 || foundStopped) {
2307 const MSLane* approachedLane = item.
myLink->getViaLane();
2308 if (approachedLane != 0) {
2318 #ifdef DEBUG_PLAN_MOVE 2321 <<
" veh=" <<
getID()
2322 <<
" approached=" << approachedLane->
getID()
2325 <<
" seenSpace=" << seenSpace
2327 <<
" lengthsInFront=" << lengthsInFront
2335 seenSpace += approachedLane->
getLength();
2346 foundStopped =
true;
2348 #ifdef DEBUG_PLAN_MOVE 2351 <<
" veh=" <<
getID()
2352 <<
" approached=" << approachedLane->
getID()
2353 <<
" lastPoc=" << last->
getID()
2355 <<
" seenSpace=" << seenSpace
2356 <<
" foundStopped=" << foundStopped
2373 foundStopped =
true;
2376 #ifdef DEBUG_PLAN_MOVE 2379 <<
" veh=" <<
getID()
2380 <<
" approached=" << approachedLane->
getID()
2381 <<
" last=" << last->
getID()
2383 <<
" seenSpace=" << seenSpace
2384 <<
" foundStopped=" << foundStopped
2392 #ifdef DEBUG_VEHICLE_GUI_SELECTION 2398 for (
int i = ((
int)lfLinks.size() - 1); i > 0; --i) {
2400 const bool canLeaveJunction = item.
myLink->getViaLane() == 0 || lfLinks[i].mySetRequest;
2408 bool allowsContinuation = item.
myLink == 0 || item.
myLink->
isCont() || !lfLinks[i].hadVehicle || opened;
2409 if (!opened && item.
myLink != 0) {
2413 allowsContinuation =
true;
2417 if (allowsContinuation) {
2423 int removalBegin = -1;
2424 for (
int i = 0; hadVehicle && i < (int)lfLinks.size() && removalBegin < 0; ++i) {
2438 if (leftSpace < 0/* && item.myLink->willHaveBlockedFoe()*/) {
2445 if (leftSpace < -impatienceCorrection / 10. && item.myLink->hasFoes() && item.
myLink->
keepClear()) {
2453 while (removalBegin < (
int)(lfLinks.size())) {
2455 lfLinks[removalBegin].myVLinkPass = lfLinks[removalBegin].myVLinkWait;
2457 lfLinks[removalBegin].mySetRequest =
false;
2466 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
2467 if ((*i).myLink != 0) {
2471 (*i).myLink->setApproaching(
this, (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
2472 (*i).mySetRequest, (*i).myArrivalTimeBraking, (*i).myArrivalSpeedBraking,
getWaitingTime(), (*i).myDistance);
2477 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
2478 if ((*i).myLink != 0) {
2480 if (parallelLink != 0) {
2481 parallelLink->
setApproaching(
this, (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
2482 (*i).mySetRequest, (*i).myArrivalTimeBraking, (*i).myArrivalSpeedBraking,
getWaitingTime(), (*i).myDistance);
2495 if (rem->first->getLane() != 0 && rem->second > 0.) {
2497 if (myTraceMoveReminders) {
2498 traceMoveReminder(
"notifyEnter_skipped", rem->first, rem->second,
true);
2503 if (rem->first->notifyEnter(*
this, reason)) {
2505 if (myTraceMoveReminders) {
2506 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
true);
2512 if (myTraceMoveReminders) {
2513 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
false);
2544 if (!onTeleporting) {
2580 #ifdef DEBUG_FURTHER 2582 std::cout <<
SIMTIME <<
" enterLaneAtLaneChange \n";
2588 #ifdef DEBUG_FURTHER 2590 std::cout <<
SIMTIME <<
" enterLaneAtLaneChange \n";
2593 leftLength -= (lane)->setPartialOccupation(
this);
2601 #ifdef DEBUG_FURTHER 2631 MSLane* clane = enteredLane;
2632 while (leftLength > 0) {
2634 if (clane == 0 || clane ==
myLane) {
2639 leftLength -= (clane)->setPartialOccupation(
this);
2655 if (rem->first->notifyLeave(*
this,
myState.
myPos + rem->second, reason)) {
2657 if (myTraceMoveReminders) {
2658 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
2664 if (myTraceMoveReminders) {
2665 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
false);
2675 #ifdef DEBUG_FURTHER 2677 std::cout <<
SIMTIME <<
" leaveLane \n";
2680 (*i)->resetPartialOccupation(
this);
2713 const std::vector<MSVehicle::LaneQ>&
2721 #ifdef DEBUG_BESTLANES 2726 #ifdef DEBUG_VEHICLE_GUI_SELECTION 2732 if (startLane == 0) {
2735 assert(startLane != 0);
2756 std::vector<LaneQ>& lanes = *it;
2757 assert(lanes.size() > 0);
2758 if (&(lanes[0].lane->getEdge()) == nextEdge) {
2760 std::vector<LaneQ> oldLanes = lanes;
2762 const std::vector<MSLane*>& sourceLanes = startLane->
getEdge().
getLanes();
2763 for (std::vector<MSLane*>::const_iterator it_source = sourceLanes.begin(); it_source != sourceLanes.end(); ++it_source) {
2764 for (std::vector<LaneQ>::iterator it_lane = oldLanes.begin(); it_lane != oldLanes.end(); ++it_lane) {
2765 if ((*it_source)->getLinkCont()[0]->getLane() == (*it_lane).lane) {
2766 lanes.push_back(*it_lane);
2773 for (
int i = 0; i < (int)lanes.size(); ++i) {
2774 if (i + lanes[i].bestLaneOffset < 0) {
2775 lanes[i].bestLaneOffset = -i;
2777 if (i + lanes[i].bestLaneOffset >= (
int)lanes.size()) {
2778 lanes[i].bestLaneOffset = (int)lanes.size() - i - 1;
2780 assert(i + lanes[i].bestLaneOffset >= 0);
2781 assert(i + lanes[i].bestLaneOffset < (
int)lanes.size());
2782 if (lanes[i].bestContinuations[0] != 0) {
2784 lanes[i].bestContinuations.insert(lanes[i].bestContinuations.begin(), (
MSLane*)0);
2786 if (startLane->
getLinkCont()[0]->getLane() == lanes[i].lane) {
2789 assert(&(lanes[i].lane->getEdge()) == nextEdge);
2802 myLastBestLanesEdge = &startLane->
getEdge();
2806 const MSEdge* nextStopEdge = 0;
2807 const MSLane* nextStopLane = 0;
2811 nextStopLane = nextStop.
lane;
2812 nextStopEdge = &nextStopLane->
getEdge();
2820 if (nextStopEdge != 0) {
2829 bool progress =
true;
2831 std::vector<LaneQ> currentLanes;
2832 const std::vector<MSLane*>* allowed = 0;
2833 const MSEdge* nextEdge = 0;
2835 nextEdge = *(ce + 1);
2838 const std::vector<MSLane*>& lanes = (*ce)->getLanes();
2839 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
2847 q.
allowsContinuation = allowed == 0 || find(allowed->begin(), allowed->end(), cl) != allowed->end();
2850 currentLanes.push_back(q);
2853 if (nextStopEdge == *ce) {
2855 for (std::vector<LaneQ>::iterator q = currentLanes.begin(); q != currentLanes.end(); ++q) {
2856 if (nextStopLane != 0 && nextStopLane != (*q).lane) {
2857 (*q).allowsContinuation =
false;
2858 (*q).length = nextStopPos;
2859 (*q).currentLength = (*q).length;
2866 seenLength += currentLanes[0].lane->getLength();
2868 progress &= (seen <= 4 || seenLength < 3000);
2869 progress &= seen <= 8;
2881 int bestThisIndex = 0;
2884 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
2885 if ((*j).length > bestLength) {
2886 bestLength = (*j).length;
2887 bestThisIndex = index;
2891 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
2892 if ((*j).length < bestLength) {
2893 (*j).bestLaneOffset = bestThisIndex - index;
2897 #ifdef DEBUG_BESTLANES 2899 std::cout <<
" last edge:\n";
2901 for (std::vector<LaneQ>::iterator j = laneQs.begin(); j != laneQs.end(); ++j) {
2902 std::cout <<
" lane=" << (*j).lane->getID() <<
" length=" << (*j).length <<
" bestOffset=" << (*j).bestLaneOffset <<
"\n";
2908 for (std::vector<std::vector<LaneQ> >::reverse_iterator i =
myBestLanes.rbegin() + 1; i !=
myBestLanes.rend(); ++i) {
2909 std::vector<LaneQ>& nextLanes = (*(i - 1));
2910 std::vector<LaneQ>& clanes = (*i);
2911 MSEdge& cE = clanes[0].lane->getEdge();
2915 for (std::vector<LaneQ>::iterator j = nextLanes.begin(); j != nextLanes.end(); ++j, ++index) {
2916 if ((*j).lane->isApproachedFrom(&cE) && bestConnectedLength < (*j).length) {
2917 bestConnectedLength = (*j).length;
2919 if (bestLength < (*j).length) {
2920 bestLength = (*j).length;
2924 int bestThisIndex = 0;
2925 if (bestConnectedLength > 0) {
2927 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2928 LaneQ bestConnectedNext;
2929 bestConnectedNext.
length = -1;
2930 if ((*j).allowsContinuation) {
2931 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m) {
2932 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
2933 if (bestConnectedNext.
length < (*m).length || (bestConnectedNext.
length == (*m).length &&
abs(bestConnectedNext.
bestLaneOffset) >
abs((*m).bestLaneOffset))) {
2934 bestConnectedNext = *m;
2939 (*j).
length += bestLength;
2941 (*j).length += bestConnectedNext.
length;
2946 if (clanes[bestThisIndex].length < (*j).length
2947 || (clanes[bestThisIndex].length == (*j).length &&
abs(clanes[bestThisIndex].bestLaneOffset) >
abs((*j).bestLaneOffset))
2948 || (clanes[bestThisIndex].length == (*j).length &&
abs(clanes[bestThisIndex].bestLaneOffset) ==
abs((*j).bestLaneOffset) &&
2951 bestThisIndex = index;
2954 #ifdef DEBUG_BESTLANES 2956 std::cout <<
" edge=" << cE.
getID() <<
"\n";
2957 std::vector<LaneQ>& laneQs = clanes;
2958 for (std::vector<LaneQ>::iterator j = laneQs.begin(); j != laneQs.end(); ++j) {
2959 std::cout <<
" lane=" << (*j).lane->getID() <<
" length=" << (*j).length <<
" bestOffset=" << (*j).bestLaneOffset <<
"\n";
2966 int bestNextIndex = 0;
2967 int bestDistToNeeded = (int) clanes.size();
2969 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2970 if ((*j).allowsContinuation) {
2972 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m, ++nextIndex) {
2973 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
2974 if (bestDistToNeeded >
abs((*m).bestLaneOffset)) {
2975 bestDistToNeeded =
abs((*m).bestLaneOffset);
2976 bestThisIndex = index;
2977 bestNextIndex = nextIndex;
2983 clanes[bestThisIndex].length += nextLanes[bestNextIndex].length;
2984 copy(nextLanes[bestNextIndex].bestContinuations.begin(), nextLanes[bestNextIndex].bestContinuations.end(), back_inserter(clanes[bestThisIndex].bestContinuations));
2989 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2990 if ((*j).length < clanes[bestThisIndex].length
2991 || ((*j).length == clanes[bestThisIndex].length &&
abs((*j).bestLaneOffset) >
abs(clanes[bestThisIndex].bestLaneOffset))
2994 (*j).bestLaneOffset = bestThisIndex - index;
2997 (*j).length = (*j).currentLength;
3000 (*j).bestLaneOffset = 0;
3005 #ifdef DEBUG_BESTLANES 3016 if (conts.size() < 2) {
3032 std::vector<LaneQ>& currLanes = *
myBestLanes.begin();
3033 std::vector<LaneQ>::iterator i;
3034 for (i = currLanes.begin(); i != currLanes.end(); ++i) {
3036 for (std::vector<MSLane*>::const_iterator j = (*i).bestContinuations.begin() + 1; j != (*i).bestContinuations.end(); ++j) {
3037 nextOccupation += (*j)->getBruttoVehLenSum();
3039 (*i).nextOccupation = nextOccupation;
3040 if ((*i).lane == startLane) {
3047 const std::vector<MSLane*>&
3052 return (*myCurrentLaneInBestLanes).bestContinuations;
3056 const std::vector<MSLane*>&
3068 if ((*i).lane == lane) {
3069 return (*i).bestContinuations;
3081 return (*myCurrentLaneInBestLanes).bestLaneOffset;
3088 std::vector<MSVehicle::LaneQ>& preb =
myBestLanes.front();
3089 assert(laneIndex < (
int)preb.size());
3090 preb[laneIndex].occupation = density + preb[laneIndex].nextOccupation;
3105 if (
isOnRoad() && destEdge != NULL) {
3119 std::pair<const MSVehicle* const, SUMOReal>
3122 return std::make_pair(static_cast<const MSVehicle*>(0), -1);
3129 assert(vehs.size() > 0);
3130 MSLane::VehCont::const_iterator it = std::find(vehs.begin(), vehs.end(),
this);
3131 if (it != vehs.end() && it + 1 != vehs.end()) {
3135 std::pair<const MSVehicle* const, SUMOReal> result(
3150 std::pair<const MSVehicle* const, SUMOReal> leaderInfo =
getLeader();
3151 if (leaderInfo.first == 0 ||
getSpeed() == 0) {
3214 int numExpected = (int)
myStops.front().awaitedPersons.size();
3215 if (numExpected != 0) {
3220 numExpected = (int)
myStops.front().awaitedPersons.size();
3222 if (numExpected == 0) {
3236 int numExpected = (int)
myStops.front().awaitedContainers.size();
3237 if (numExpected != 0) {
3238 myStops.front().awaitedContainers.erase(container->
getID());
3239 numExpected = (int)
myStops.front().awaitedContainers.size();
3241 if (numExpected == 0) {
3248 const std::vector<MSTransportable*>&
3258 const std::vector<MSTransportable*>&
3287 }
else if ((state &
LCA_RIGHT) != 0 && (state & LCA_SUBLANE) == 0) {
3299 switch ((*link)->getDirection()) {
3319 if (currentTime % 1000 == 0) {
3374 #ifdef DEBUG_FURTHER 3384 for (
int i = 0; i < (int)shadowFurther.size(); ++i) {
3386 if (shadowFurther[i] == lane) {
3406 #ifdef DEBUG_FURTHER 3414 #ifdef DEBUG_FURTHER 3420 for (
int i = 0; i < (int)shadowFurther.size(); ++i) {
3421 if (shadowFurther[i] == lane) {
3422 #ifdef DEBUG_FURTHER 3425 <<
" lane=" << lane->
getID()
3450 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
3451 if ((*i).myLink != 0) {
3452 (*i).myLink->removeApproaching(
this);
3472 while (!lane->
isLinkEnd(link) && seen <= dist) {
3475 || !(*link)->havePriority())) {
3479 if ((*di).myLink != 0) {
3480 const MSLane* diPredLane = (*di).myLink->getApproachingLane();
3481 if (diPredLane != 0) {
3492 const SUMOTime leaveTime = (*link)->getLeaveTime((*di).myArrivalTime, (*di).myArrivalSpeed,
3494 if ((*link)->hasApproachingFoe((*di).myArrivalTime, leaveTime, (*di).myArrivalSpeed,
getCarFollowModel().getMaxDecel())) {
3501 lane = (*link)->getViaLaneOrLane();
3544 result.push_back(line1[0]);
3545 result.push_back(line2[0]);
3546 result.push_back(line2[1]);
3547 result.push_back(line1[1]);
3550 result.push_back(line1[1]);
3551 result.push_back(line2[1]);
3552 result.push_back(line2[0]);
3553 result.push_back(line1[0]);
3565 const bool parking,
const bool triggered,
const bool containerTriggered, std::string& errorMsg) {
3567 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
3568 if (iter->lane == lane && fabs(iter->endPos - endPos) <
POSITION_EPS) {
3569 if (duration == 0 && !iter->reached) {
3572 iter->duration = duration;
3583 newStop.
until = until;
3588 const bool result =
addStop(newStop, errorMsg);
3598 const bool triggered,
const bool containerTriggered,
const bool isContainerStop, std::string& errorMsg) {
3600 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
3601 const Named*
const stop = isContainerStop ? (
Named*)iter->containerstop : iter->busstop;
3602 if (stop != 0 && stop->
getID() == stopId) {
3603 if (duration == 0 && !iter->reached) {
3606 iter->duration = duration;
3614 if (isContainerStop) {
3618 errorMsg =
"The container stop '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
3625 errorMsg =
"The bus stop '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
3630 newStop.
until = until;
3638 const bool result =
addStop(newStop, errorMsg);
3658 if (
myStops.front().busstop != 0) {
3660 myStops.front().busstop->leaveFrom(
this);
3663 if (
myStops.front().containerstop != 0) {
3665 myStops.front().containerstop->leaveFrom(
this);
3744 std::vector<SUMOTime> internals;
3758 throw ProcessError(
"Error: Invalid vehicles in state (may be a meso state)!");
3765 myDeparture -= offset;
void adaptToLeader(const std::pair< const MSVehicle *, SUMOReal > leaderInfo, const SUMOReal seen, DriveProcessItem *const lastLink, const MSLane *const lane, SUMOReal &v, SUMOReal &vLinkPass, SUMOReal distToCrossing=-1) const
int getRoutePosition() const
SUMOReal getOppositePos(SUMOReal pos) const
return the corresponding position on the opposite lane
SUMOReal getWidth() const
Returns the lane's width.
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected.
SUMOReal 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) ...
SUMOReal getSpeedAfterMaxDecel(SUMOReal v) const
Returns the velocity after maximum deceleration.
void setAngle(SUMOReal angle)
Set a custom vehicle angle in rad.
const std::vector< MSTransportable * > & getTransportables() const
Returns the list of transportables using this vehicle.
const MSLane * myLastBestLanesInternalLane
The link is a partial left direction.
bool isChangingLanes() const
return true if the vehicle currently performs a lane change maneuver
SUMOReal updateFurtherLanes(std::vector< MSLane *> &furtherLanes, std::vector< SUMOReal > &furtherLanesPosLat, const std::vector< MSLane *> &passedLanes)
update a vector of further lanes and return the new backPos
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
const MSVehicleType * myType
This Vehicle's type.
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
SUMOReal getLength() const
Returns the lane's length.
SUMOVehicleShape getGuiShape() const
Get this vehicle type's shape.
void addWaiting(const MSEdge *const edge, SUMOVehicle *vehicle)
Adds a vehicle to the list of waiting vehiclse to a given edge.
SUMOReal getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
bool enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
std::pair< MSVehicle *const, SUMOReal > getLeaderOnConsecutive(SUMOReal dist, SUMOReal seen, SUMOReal speed, const MSVehicle &veh, const std::vector< MSLane *> &bestLaneConts) const
Returns the immediate leader and the distance to him.
MSEdge & getEdge() const
Returns the lane's edge.
Representation of a vehicle in the micro simulation.
void planMove(const SUMOTime t, const MSLeaderInfo &ahead, const SUMOReal lengthsInFront)
Compute safe velocities for the upcoming lanes based on positions and speeds from the last time step...
int size() const
Return the number of passengers / containers.
bool isRemoteControlled() const
Returns the information whether the vehicle is fully controlled via TraCI.
SUMOTime timeToBoardNextPerson
The time at which the vehicle is able to board another person.
bool hasPersons() const
Returns whether persons are simulated.
bool keepClear() const
whether the junction after this link must be kept clear
void remove(MSVehicle *veh)
Remove a vehicle from this transfer object.
const SUMOReal SUMO_const_laneWidth
MSEdgeWeightsStorage * myEdgeWeights
MoveReminderCont myMoveReminders
Currently relevant move reminders.
SUMOReal myArrivalPos
The position on the destination lane where the vehicle stops.
The action is due to the default of keeping right "Rechtsfahrgebot".
PositionVector getBoundingPoly() const
get bounding polygon
const ConstMSEdgeVector & getEdges() const
The action is done to help someone else.
static int nextLinkPriority(const std::vector< MSLane *> &conts)
get a numerical value for the priority of the upcoming link
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
const MSEdge * myLastBestLanesEdge
std::string containerstop
(Optional) container stop if one is assigned to the stop
LaneChangeMode
modes for resolving conflicts between external control (traci) and vehicle control over lane changing...
MSAbstractLaneChangeModel * myLaneChangeModel
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived) ...
SUMOReal angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position ...
LaneChangeMode myRightDriveLC
changing to the rightmost lane
LinkDirection getDirection() const
Returns the direction the vehicle passing this link take.
std::vector< std::vector< LaneQ > > myBestLanes
const std::vector< SUMOReal > & getShadowFurtherLanesPosLat() const
bool parking
whether the vehicle is removed from the net while stopping
MSLane * getLane() const
Returns the connected lane.
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
State myState
This Vehicles driving state (pos and speed)
bool hasDeparted() const
Returns whether this vehicle has already departed.
void setTentativeLaneAndPosition(MSLane *lane, SUMOReal pos, SUMOReal posLat=0)
set tentative lane and position during insertion to ensure that all cfmodels work (some of them requi...
SUMOReal getSafeFollowSpeed(const std::pair< const MSVehicle *, SUMOReal > leaderInfo, const SUMOReal seen, const MSLane *const lane, SUMOReal distToCrossing) const
compute safe speed for following the given leader
void release() const
deletes the route if there are no further references to it
void setApproaching(const SUMOVehicle *approaching, const SUMOTime arrivalTime, const SUMOReal arrivalSpeed, const SUMOReal leaveSpeed, const bool setRequest, const SUMOTime arrivalTimeBraking, const SUMOReal arrivalSpeedBraking, const SUMOTime waitingTime, SUMOReal dist)
Sets the information about an approaching vehicle.
A lane area vehicles can halt at.
DriveItemVector myLFLinkLanes
SUMOReal backPos() const
back Position of this state
void enterLaneAtInsertion(MSLane *enteredLane, SUMOReal pos, SUMOReal speed, SUMOReal posLat, MSMoveReminder::Notification notification)
Update when the vehicle enters a new lane in the emit step.
bool resumeFromStopping()
bool myAmRegisteredAsWaitingForPerson
Whether this vehicle is registered as waiting for a person (for deadlock-recognition) ...
MSLane * getLane() const
Returns the lane the vehicle is on.
SUMOTime duration
The stopping duration.
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
SUMOReal slopeDegreeAtOffset(SUMOReal pos) const
Returns the slope at the given length.
static const SUMOReal ZIPPER_ADAPT_DIST
Position getPosition(const SUMOReal offset=0) const
Return current position (x/y, cartesian)
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive...
SUMOReal getStoppingPosition(const SUMOVehicle *veh) const
For vehicles at the stop this gives the the actual stopping position of the vehicle. For all others the last free stopping position.
void setBlinkerInformation()
void addContainer(MSTransportable *container)
Adds a container.
void checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector &lfLinks) const
SUMOReal getCenterOnEdge() const
SUMOTime getMemorySize() const
SUMOReal myAcceleration
The current acceleration after dawdling in m/s.
The vehicle arrived at a junction.
void setRespectJunctionPriority(bool value)
Sets whether junction priority rules shall be respected.
int getShadowDirection() const
return the direction in which the current shadow lane lies
int getPersonNumber() const
Returns the number of persons.
bool isVTDAffected(SUMOTime t) const
virtual SUMOReal followSpeed(const MSVehicle *const veh, SUMOReal speed, SUMOReal gap2pred, SUMOReal predSpeed, SUMOReal predMaxDecel) const =0
Computes the vehicle's follow speed (no dawdling)
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
SUMOReal departSpeed
(optional) The initial speed of the vehicle
void getSubLanes(const MSVehicle *veh, SUMOReal latOffset, int &rightmost, int &leftmost) const
The car-following model abstraction.
bool myConsiderMaxAcceleration
Whether the maximum acceleration shall be regarded.
SUMOReal getLatOffset(const MSLane *lane) const
Get the offset that that must be added to interpret myState.myPosLat for the given lane...
virtual SUMOReal moveHelper(MSVehicle *const veh, SUMOReal vPos) const
Applies interaction with stops and lane changing model influences.
SUMOReal arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
void updateState(SUMOReal vNext)
updates the vehicles state, given a next value for its speed. This value can be negative in case of t...
SUMOReal getMaxDecel() const
Get the vehicle type's maximum deceleration [m/s^2].
int getBestLaneOffset() const
returns the current offset from the best lane
The link is a 180 degree turn.
Notification
Definition of a vehicle state.
static SUMOReal rand()
Returns a random real number in [0, 1)
std::string time2string(SUMOTime t)
std::vector< const MSLane * > getOutgoingLanes() const
get the list of outgoing lanes
SUMOReal getLength() const
Get vehicle's length [m].
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
SUMOReal currentLength
The length which may be driven on this lane.
MSDevice_Transportable * myPersonDevice
The passengers this vehicle may have.
bool replaceRoute(const MSRoute *route, bool onInit=false, int offset=0)
Replaces the current route by the given one.
#define STOPPING_PLACE_OFFSET
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
SUMOReal getNOxEmissions() const
Returns NOx emission of the current state.
Changes the wished vehicle speed / lanes.
SUMOReal implicitDeltaPosVTD(const MSVehicle *veh)
return the change in longitudinal position that is implicit in the new VTD position ...
static MSDevice_Transportable * buildVehicleDevices(SUMOVehicle &v, std::vector< MSDevice *> &into, const bool isContainer)
Build devices for the given vehicle, if needed.
bool isStoppedInRange(SUMOReal pos) const
return whether the given position is within range of the current stop
SUMOReal getEndLanePosition() const
Returns the end position of this stop.
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING) const
Get the allowed lanes to reach the destination-edge.
SUMOReal getLeaveSpeed() const
bool myRespectJunctionPriority
Whether the junction priority rules are respected.
bool reached
Information whether the stop has been reached.
virtual VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting...
void registerEmergencyStop()
register emergency stop
bool isRoundabout() const
void scaleRelative(SUMOReal factor)
enlarges/shrinks the polygon by a factor based at the centroid
State & operator=(const State &state)
Assignment operator.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOReal getBackPositionOnLane() const
Get the vehicle's position relative to its current lane.
vehicle doesn't want to change
TraciLaneChangePriority
modes for prioritizing traci lane change requests
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
const PositionVector & getShape() const
Returns this lane's shape.
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
PositionVector getBoundingBox() const
get bounding rectangle
bool isLinkEnd(MSLinkCont::const_iterator &i) const
const MSRoute & getRoute() const
Returns the current route.
SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const
The vehicle got vaporized.
void postProcessVTD(MSVehicle *v)
PositionVector reverse() const
reverse position vector
SUMOTime until
The time at which the vehicle may continue its journey.
WaitingTimeCollector myWaitingTimeCollector
SUMOReal mySpeed
the stored speed (should be >=0 at any time)
Definition of vehicle stop (position and duration)
This is an uncontrolled, right-before-left link.
bool hasFoes() const
Returns whether this link belongs to a junction where more than one edge is incoming.
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.
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.
SUMOTime myMemorySize
the maximal memory to store
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.
const std::string & getID() const
Returns the id.
const std::vector< MSMoveReminder *> & getMoveReminders() const
Return the list of this lane's move reminders.
The base class for microscopic and mesoscopic vehicles.
bool myHaveToWaitOnNextLink
SUMOReal processNextStop(SUMOReal currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
A storage for edge travel times and efforts.
int getSpeedMode() const
return the current speed mode
void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector &lfLinks, SUMOReal &myStopDist) const
SUMOReal getCO2Emissions() const
Returns CO2 emission of the current state.
This is an uncontrolled, all-way stop link.
The action is due to the wish to be faster (tactical lc)
SUMOReal length
The overall length which may be driven when using this lane without a lane change.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list...
#define UNUSED_PARAMETER(x)
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
SUMOReal rotationAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
This is an uncontrolled, zipper-merge link.
The link is a (hard) left direction.
SUMOReal myStopDist
distance to the next stop or -1 if there is none
#define WRITE_WARNING(msg)
The simulated network and simulation perfomer.
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()
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
MSCFModel::VehicleVariables * myCFVariables
The per vehicle variables of the car following model.
MSLink * getParallelLink(int direction) const
return the link that is parallel to this lane or 0
std::string gDebugSelectedVehicle
SUMOReal getOriginalSpeed() const
Returns the originally longitudinal speed to use.
const MSEdge * getInternalFollower() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
bool isFrontOnLane(const MSLane *lane) const
Returns the information whether the front of the vehicle is on the given lane.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
LinkState getState() const
Returns the current state of the link.
Right blinker lights are switched on.
SUMOReal getRightSideOnLane() const
Get the vehicle's lateral position on the lane:
SUMOReal nextOccupation
As occupation, but without the first lane.
virtual MSTransportableControl & getContainerControl()
Returns the container control.
SUMOReal getLastFreePos(const SUMOVehicle &forVehicle) const
Returns the last free position on this stop.
const ConstMSEdgeVector getStopEdges() const
Returns the list of still pending stop edges.
SUMOReal getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
SUMOReal changeRequestRemainingSeconds(const SUMOTime currentTime) const
Return the remaining number of seconds of the current laneTimeLine assuming one exists.
The vehicles starts to stop.
void unregisterOneWaitingForContainer()
decreases the count of vehicles waiting for a container to allow recogniztion of container related de...
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
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.
SUMOReal getSpaceTillLastStanding(const MSLane *l, bool &foundStopped) const
bool signalSet(int which) const
Returns whether the given signal is on.
bool getEmergencyBrakeRedLight() const
Returns whether red lights shall be a reason to brake.
WaitingTimeCollector & operator=(const WaitingTimeCollector &wt)
Assignment operator.
static SUMOReal computeNoise(SUMOEmissionClass c, double v, double a)
Returns the noise produced by the a vehicle of the given type at the given speed. ...
std::string busstop
(Optional) bus stop if one is assigned to the stop
SUMOReal influenceSpeed(SUMOTime currentTime, SUMOReal speed, SUMOReal vSafe, SUMOReal vMin, SUMOReal vMax)
Applies stored velocity information on the speed to use.
bool operator!=(const State &state)
Operator !=.
static std::vector< MSTransportable * > myEmptyTransportableVector
A road/street connecting two junctions.
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
SUMOReal getMinimalArrivalSpeedEuler(SUMOReal dist, SUMOReal currentSpeed) const
Computes the minimal possible arrival speed after covering a given distance for Euler update...
SUMOReal getDistanceBetween(SUMOReal fromPos, SUMOReal 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...
The vehicle changes lanes (micro only) XXX: What if a vehicle changes lanes and passes a junction sim...
LaneChangeModel getLaneChangeModel() const
SUMOReal getWidth() const
Get the width which vehicles of this class shall have when being drawn.
MSLane * lane
The described lane.
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
SUMOReal getBeginLanePosition() const
Returns the begin position of this stop.
SUMOReal getCOEmissions() const
Returns CO emission of the current state.
SUMOReal getFuelConsumption() const
Returns fuel consumption of the current state.
Left blinker lights are switched on.
void setEmergencyBrakeRedLight(bool value)
Sets whether red lights shall be a reason to brake.
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
SUMOTime getMinimalArrivalTime(SUMOReal dist, SUMOReal currentSpeed, SUMOReal arrivalSpeed) const
Computes the minimal time needed to cover a distance given the desired speed at arrival.
SUMOReal implicitSpeedVTD(const MSVehicle *veh, SUMOReal oldSpeed)
return the speed that is implicit in the new VTD position
SUMOReal startPos
The stopping position start.
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
The edge is a district edge.
The vehicle got a new route.
SUMOReal posLat() const
Lateral Position of this state (m relative to the centerline of the lane).
void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Processes active move reminder.
vehicle want's to change to right lane
#define DIST_TO_STOPLINE_EXPECT_PRIORITY
The action is urgent (to be defined by lc-model)
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...
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
Encapsulated SAX-Attributes.
virtual SUMOReal getHeadwayTime() const
Get the driver's reaction time [s].
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
ChangeRequest
Requests set via TraCI.
A point in 2D or 3D with translation and scaling methods.
TraciLaneChangePriority myTraciLaneChangePriority
flags for determining the priority of traci lane change requests
SUMOReal endPos
The stopping position end.
bool isVTDControlled() const
virtual SUMOReal freeSpeed(const MSVehicle *const veh, SUMOReal speed, SUMOReal seen, SUMOReal maxSpeed, const bool onInsertion=false) const
Computes the vehicle's safe speed without a leader.
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
static void clear()
Clears the dictionary.
SUMOTime timeToLoadNextContainer
The time at which the vehicle is able to load another container.
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the subpart of best lanes that describes the vehicle's current lane and their successors...
virtual SUMOReal getFloat(int id) const =0
Returns the SUMOReal-value of the named (by its enum-value) attribute.
Position myCachedPosition
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
const MSLane * lane
The lane to stop at.
int getVehicleNumber() const
Returns the number of vehicles on this lane (for which this lane is responsible)
SUMOReal myOriginalSpeed
The velocity before influence.
std::vector< SUMOReal > myFurtherLanesPosLat
SUMOReal getPMxEmissions() const
Returns PMx emission of the current state.
bool triggered
whether an arriving person lets the vehicle continue
bool addStop(const SUMOVehicleParameter::Stop &stopPar, std::string &errorMsg, SUMOTime untilOffset=0)
Adds a stop.
std::list< Stop > myStops
The vehicle's list of stops.
ConstMSEdgeVector::const_iterator MSRouteIterator
bool hasContainers() const
Returns whether containers are simulated.
bool havePriority() const
Returns whether this link is a major link.
bool myConsiderMaxDeceleration
Whether the maximum deceleration shall be regarded.
bool amVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
void adaptLeaveSpeed(const SUMOReal v)
MSLane * myLane
The lane the vehicle is on.
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)
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
SUMOReal getMaxSpeed() const
Returns the maximum speed.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
SUMOTime duration
The stopping duration.
SUMOReal getPositionOnLane() const
Get the vehicle's position along the lane.
MSVehicle()
invalidated default constructor
SUMOReal computeAngle() const
compute the current vehicle angle
SUMOReal myLastCoveredDist
The link is a (hard) right direction.
The action is needed to follow the route (navigational lc)
const std::string & getID() const
returns the id of the transportable
SUMOReal getTimeGap() const
Returns the time gap in seconds to the leader of the vehicle looking for a fixed distance.
std::vector< LinkLeader > LinkLeaders
void addTransportable(MSTransportable *transportable)
Add a passenger.
A blue emergency light is on.
A structure representing the best lanes for continuing the route.
bool opened(SUMOTime arrivalTime, SUMOReal arrivalSpeed, SUMOReal leaveSpeed, SUMOReal vehicleLength, SUMOReal impatience, SUMOReal decel, SUMOTime waitingTime, SUMOReal posLat=0, std::vector< const SUMOVehicle *> *collectFoes=0) const
Returns the information whether the link may be passed.
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.
SUMOReal getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
bool hasInfluencer() const
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.
SUMOReal maximumSafeStopSpeed(SUMOReal gap, SUMOReal currentSpeed, bool onInsertion=false, SUMOReal headway=-1) const
Returns the maximum next velocity for stopping within gap.
void removeTransportable(MSTransportable *p)
Removes a transportable from this stop.
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
MSLane * getOpposite() const
return the opposite direction lane for lane changing or 0
void fixPosition()
repair errors in vehicle position after changing between internal edges
SUMOReal getSlope() const
Returns the slope of the road at vehicle's position.
render as a passenger vehicle
SUMOReal speed() const
Speed of this state.
void setShadowApproachingInformation(MSLink *link) const
set approach information for the shadow vehicle
SUMOTime myWaitingTime
The time the vehicle waits (is not faster than 0.1m/s) in seconds.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
LaneChangeMode mySpeedGainLC
lane changing to travel with higher speed
bool isInternal() const
return whether this edge is an internal edge
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
SUMOReal pos() const
Position of this state.
The link is a partial right direction.
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons) ...
LaneChangeMode myCooperativeLC
lane changing with the intent to help other vehicles
void setVTDControlled(Position xyPos, MSLane *l, SUMOReal pos, SUMOReal posLat, SUMOReal angle, int edgeOffset, const ConstMSEdgeVector &route, SUMOTime t)
std::vector< MSVehicle * > VehCont
Container for vehicles.
bool containerTriggered
whether an arriving container lets the vehicle continue
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane *> &conts)
State(SUMOReal pos, SUMOReal speed, SUMOReal posLat, SUMOReal backPos)
Constructor.
bool allowsContinuation
Whether this lane allows to continue the drive.
const waitingIntervalList & getWaitingIntervals() const
SUMOReal getLateralOverlap() const
return the amount by which the vehicle extends laterally outside it's primary lane ...
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.
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.
SUMOReal getBruttoVehLenSum() const
Returns the sum of lengths of vehicles, including their minGaps, which were on the lane during the la...
std::string lane
The lane to stop at.
bool myEmergencyBrakeRedLight
Whether red lights are a reason to brake.
SUMOReal brakeGap(const SUMOReal speed) const
Returns the distance the vehicle needs to halt including driver's reaction time, assuming that during...
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
ConstMSEdgeVector myVTDRoute
void enter(SUMOVehicle *what, SUMOReal beg, SUMOReal end)
Called if a vehicle enters this stop.
void leaveLane(const MSMoveReminder::Notification reason)
Update of members if vehicle leaves a new lane in the lane change step or at arrival.
virtual void drawOutsideNetwork(bool)
register vehicle for drawing while outside the network
void forceVehicleInsertion(MSVehicle *veh, SUMOReal pos, MSMoveReminder::Notification notification, SUMOReal posLat=0)
Inserts the given vehicle at the given position.
void removeShadowApproachingInformation() const
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
void setEmergencyBlueLight(SUMOTime currentTime)
sets the blue flashing light for emergency vehicles
virtual std::string toString() const
print a debugging representation
SUMOReal estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
MSStoppingPlace * getContainerStop(const std::string &id) const
Returns the named container stop.
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
SUMOReal getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
The vehicle starts or ends parking.
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, SUMOReal > > &speedTimeLine)
Sets a new velocity timeline.
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Structure representing possible vehicle parameter.
LaneChangeMode mySublaneLC
changing to the prefered lateral alignment
static SUMOReal compute(const SUMOEmissionClass c, const EmissionType e, const double v, const double a, const double slope)
Returns the amount of the emitted pollutant given the vehicle type and state (in mg/s or ml/s for fue...
void adaptToLeaders(const MSLeaderInfo &ahead, SUMOReal latOffset, const SUMOReal seen, DriveProcessItem *const lastLink, const MSLane *const lane, SUMOReal &v, SUMOReal &vLinkPass) const
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
void removeApproachingInformation(DriveItemVector &lfLinks) const
unregister approach from all upcoming links
std::vector< std::pair< SUMOTime, SUMOReal > > mySpeedTimeLine
The velocity time line to apply.
void setNoShadowPartialOccupator(MSLane *lane)
bool containerTriggered
whether an arriving container lets the vehicle continue
The link has yellow light, may pass.
void setConsiderMaxDeceleration(bool value)
Sets whether the maximum deceleration shall be regarded.
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
void passTime(SUMOTime dt, bool waiting)
SUMOReal occupation
The overall vehicle sum on consecutive lanes which can be passed without a lane change.
const MSLeaderInfo & getLastVehicleInformation(const MSVehicle *ego, SUMOReal latOffset, SUMOReal minPos=0, bool allowCached=true) const
Returns the last vehicles on the lane.
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
Consecutive lane that can be followed without a lane change (contribute to length and occupation) ...
Definition of vehicle stop (position and duration)
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
SUMOReal myPreviousSpeed
the speed at the begin of the previous time step
void onDepart()
Called when the vehicle is inserted into the network.
SUMOReal getLength() const
return the length of the edge
The link has red light (must brake)
SUMOReal getMinimalArrivalSpeed(SUMOReal dist, SUMOReal currentSpeed) const
Computes the minimal possible arrival speed after covering a given distance.
SUMOReal getMaxSpeed() const
Get vehicle's maximum speed [m/s].
SUMOTime until
The time at which the vehicle may continue its journey.
static SUMOReal gLateralResolution
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
const std::string & getID() const
Returns the name of the vehicle type.
void setConsiderSafeVelocity(bool value)
Sets whether the safe velocity shall be regarded.
bool replaceRouteEdges(ConstMSEdgeVector &edges, bool onInit=false, bool check=false)
Replaces the current route by the given edges.
int index
at which position in the stops list
MSVehicle * getLastAnyVehicle() const
returns the last vehicle that is fully or partially on this lane
MSRouteIterator edge
The edge in the route to stop at.
virtual SUMOReal stopSpeed(const MSVehicle *const veh, const SUMOReal speed, SUMOReal gap) const =0
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) ...
bool addTraciBusOrContainerStop(const std::string &stopId, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, const bool isContainerStop, std::string &errorMsg)
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
const SUMOReal SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
The arrival lane is given.
int containerNumber
The static number of containers in the vehicle when it departs.
The vehicle ends to stop.
void addReference() const
increments the reference counter for the route
int myNumberReroutes
The number of reroutings.
int getContainerNumber() const
Returns the number of containers.
SUMOReal 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) ...
SUMOReal departPos
(optional) The position the vehicle shall depart from
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to)
Informs all added listeners about a vehicle's state change.
SUMOTime cumulatedWaitingTime(SUMOTime memory=-1) const
void setLaneChangeMode(int value)
Sets lane changing behavior.
SUMOReal myPos
the stored position
const MSLane * getBackLane() const
virtual void prepareStep()
bool allowsVehicleClass(SUMOVehicleClass vclass) const
SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge *destEdge) const
waitingIntervalList myWaitingIntervals
std::vector< DriveProcessItem > DriveItemVector
Container for used Links/visited Lanes during lookForward.
SUMOReal estimateLeaveSpeed(const MSLink *const link, const SUMOReal vLinkPass) const
estimate leaving speed when accelerating across a link
SUMOReal getHCEmissions() const
Returns HC emission of the current state.
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
SUMOReal getMinGap() const
Get the free space in front of vehicles of this class.
SUMOReal endPos
The stopping position end.
The action is due to a TraCI request.
void move2side(SUMOReal amount)
move position vector to side using certain ammount
const std::vector< MSLane * > & getShadowFurtherLanes() const
vehicle want's to keep the current lane
Static storage of an output device and its base (abstract) implementation.
SUMOReal myPosLat
the stored lateral position
void changedToOpposite()
called when a vehicle changes between lanes in opposite directions
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.
void addPerson(MSTransportable *person)
Adds a passenger.
static std::vector< MSLane * > myEmptyLaneVector
void adaptBestLanesOccupation(int laneIndex, SUMOReal density)
update occupation from MSLaneChanger
MSRouteIterator myCurrEdge
Iterator to current route-edge.
bool unsafeLinkAhead(const MSLane *lane) const
whether the vehicle may safely move to the given lane with regard to upcoming links ...
MSEdgeWeightsStorage & _getWeightsStorage() const
SUMOReal myBackPos
the stored back position
MSLane * getShadowLane() const
Returns the lane the vehicles shadow is on during continuous/sublane lane change. ...
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, int > > &laneTimeLine)
Sets a new lane timeline.
virtual ~MSVehicle()
Destructor.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
const std::vector< MSTransportable * > & getPersons() const
retrieve riding persons
bool isStopped() const
Returns whether the vehicle is at a stop.
No information given; use default.
const std::vector< MSTransportable * > & getContainers() const
retrieve riding containers
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
const Position getBackPosition() const
The link has yellow light, has to brake anyway.
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
const MSLane & getLane() const
Returns the lane this stop is located at.
bool isParking() const
Returns whether the vehicle is parking.
SUMOReal getElectricityConsumption() const
Returns electricity consumption of the current state.
virtual SUMOReal maxNextSpeed(SUMOReal speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
std::pair< const MSVehicle *const, SUMOReal > getLeader(SUMOReal dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
bool mySpeedAdaptationStarted
Whether influencing the speed has already started.
SUMOReal getImpatience() const
Returns this vehicles impatience.
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
void activateReminders(const MSMoveReminder::Notification reason)
"Activates" all current move reminder
The edge is an internal edge.
public emergency vehicles
render as a wagon passenger vehicle ("Combi")
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
static SUMOTime gLaneChangeDuration
SUMOReal getRightSideOnEdge() const
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.
const std::string & getID() const
Returns the name of the vehicle.
bool addTraciStop(MSLane *const lane, const SUMOReal startPos, const SUMOReal endPos, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, std::string &errorMsg)
SUMOReal startPos
The stopping position start.
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.
std::vector< MSDevice * > myDevices
The devices this vehicle has.
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
SUMOReal getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
MSStoppingPlace * getBusStop(const std::string &id) const
Returns the named bus stop.
void adaptLaneEntering2MoveReminder(const MSLane &enteredLane)
Adapts the vehicle's entering of a new lane.
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the stops.
LaneChangeMode myStrategicLC
lane changing which is necessary to follow the current route
The link has red light (must brake) but indicates upcoming green.
void passedJunction(const MSVehicle *vehicle)
erase vehicle from myLinkLeaders of this links junction
SUMOReal getSpeed() const
Returns the vehicle's current speed.
MSRouteIterator end() const
Returns the end of the list of edges to pass.
Interface for lane-change models.
bool contains(const MSEdge *const edge) const
const Position geometryPositionAtOffset(SUMOReal offset, SUMOReal lateralOffset=0) const
bool myConsiderSafeVelocity
Whether the safe velocity shall be regarded.
void append(const PositionVector &v, SUMOReal sameThreshold=2.0)
void setConsiderMaxAcceleration(bool value)
Sets whether the maximum acceleration shall be regarded.
SUMOTime myDeparture
The real departure time.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
static const SUMOTime NOT_YET_DEPARTED
MSDevice_Transportable * myContainerDevice
The containers this vehicle may have.
SUMOReal getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
std::string id
The vehicle's id.
bool parking
whether the vehicle is removed from the net while stopping
static const Position INVALID
The vehicle is being teleported.
MSLane * getParallelLane(int offset) const
Returns the lane with the given offset parallel to this one or 0 if it does not exist.
void endLaneChangeManeuver(const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_LANE_CHANGE)
SUMOReal getDeltaPos(SUMOReal accel)
calculates the distance covered in the next integration step given an acceleration and assuming the c...