78 #ifdef CHECK_MEMORY_LEAKS 80 #endif // CHECK_MEMORY_LEAKS 89 #define DEBUG_COND (getID() == "disabled") 91 #define STOPPING_PLACE_OFFSET 0.5 93 #define CRLL_LOOK_AHEAD 5 96 #define DIST_TO_STOPLINE_EXPECT_PRIORITY 1.0 168 if (memorySpan == -1) {
173 if (i->second >= memorySpan) {
174 if (i->first >= memorySpan) {
177 totalWaitingTime += memorySpan - i->first;
180 totalWaitingTime += i->second - i->first;
183 return totalWaitingTime;
190 bool startNewInterval = i == end || (i->first != 0);
201 waitingIntervalList::iterator::difference_type d = std::distance(i, end);
209 }
else if (!startNewInterval) {
226 mySpeedAdaptationStarted(true),
227 myConsiderSafeVelocity(true),
228 myConsiderMaxAcceleration(true),
229 myConsiderMaxDeceleration(true),
230 myRespectJunctionPriority(true),
231 myEmergencyBrakeRedLight(true),
289 speed =
MIN2(speed, vSafe);
292 speed =
MIN2(speed, vMax);
295 speed =
MAX2(speed, vMin);
311 if (destinationLaneIndex < (
int)currentEdge.
getLanes().size()) {
312 if (currentLaneIndex > destinationLaneIndex) {
314 }
else if (currentLaneIndex < destinationLaneIndex) {
342 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
350 state &= ~LCA_WANTS_LANECHANGE_OR_STAY;
371 switch (changeRequest) {
460 const bool wasOnRoad = v->
isOnRoad();
550 if ((*myCurrEdge)->getDepartLane(*
this) == 0) {
551 throw ProcessError(
"Invalid departlane definition for vehicle '" + pars->
id +
"'.");
555 throw ProcessError(
"Vehicle '" + pars->
id +
"' is not allowed to depart on any lane of its first edge.");
560 "' is too high for the vehicle type '" + type->
getID() +
"'.");
571 (*i)->resetPartialOccupation(
this);
623 (newCurrEdge + 1) == edges.end() || (*(newCurrEdge + 1)) != &(
myLane->
getOutgoingLanes()[0]->getEdge()))) {
642 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end();) {
643 if (find(
myCurrEdge, edges.end(), &iter->lane->getEdge()) == edges.end()) {
646 iter->edge = find(
myCurrEdge, edges.end(), &iter->lane->getEdge());
651 for (std::vector<SUMOVehicleParameter::Stop>::const_iterator i = newRoute->
getStops().begin(); i != newRoute->
getStops().end(); ++i) {
710 if (!rem->first->notifyMove(*
this, oldPos + rem->second, newPos + rem->second, newSpeed)) {
712 if (myTraceMoveReminders) {
713 traceMoveReminder(
"notifyMove", rem->first, rem->second,
false);
719 if (myTraceMoveReminders) {
720 traceMoveReminder(
"notifyMove", rem->first, rem->second,
true);
735 rem->second += oldLaneLength;
737 if (myTraceMoveReminders) {
738 traceMoveReminder(
"adaptedPos", rem->first, rem->second,
true);
775 if (offset == 0. && !changingLanes) {
793 #ifdef HAVE_INTERNAL_LANES 828 std::cout <<
SIMTIME <<
" computeAngle veh=" <<
getID() <<
" p1=" << p1 <<
" p2=" << p2 <<
" angle=" << result <<
"\n";
864 errorMsg =
"Vehicle '" +
myParameter->
id +
"' is not allowed to stop on lane '" + stopPar.
lane +
"'.";
877 if (stop.
until != -1) {
878 stop.
until += untilOffset;
890 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' has an invalid position.";
903 std::list<Stop>::iterator iter =
myStops.begin();
906 prevStopEdge =
myStops.back().edge;
907 prevStopPos =
myStops.back().endPos;
910 if (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos) {
916 while (iter !=
myStops.end() && (iter->edge < stop.
edge ||
917 (iter->endPos < stop.
endPos && iter->edge == stop.
edge))) {
918 prevStopEdge = iter->edge;
919 prevStopPos = iter->endPos;
923 int index = stopPar.
index;
925 prevStopEdge = iter->edge;
926 prevStopPos = iter->endPos;
934 (prevStopEdge == stop.
edge && prevStopPos > stop.
endPos)) {
940 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is not downstream the current route.";
946 errorMsg =
"Stop for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is too close to break.";
954 pos += (*myCurrEdge)->getLength();
966 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' is before departPos.";
971 std::list<Stop>::iterator iter2 = iter;
973 if (stop.
until >= 0 && iter2->until > stop.
until) {
979 errorMsg +=
" for vehicle '" +
myParameter->
id +
"' on lane '" + stopPar.
lane +
"' ends earlier than previous stop.";
1015 return currentVelocity;
1030 for (std::vector<MSTransportable*>::const_iterator i = persons.begin(); i != persons.end(); ++i) {
1044 for (std::vector<MSTransportable*>::const_iterator i = containers.begin(); i != containers.end(); ++i) {
1060 WRITE_WARNING(
"Vehicle '" +
getID() +
"' ignores triggered stop on lane '" + stop.
lane->
getID() +
"' due to capacity constraints.");
1069 WRITE_WARNING(
"Vehicle '" +
getID() +
"' ignores container triggered stop on lane '" + stop.
lane->
getID() +
"' due to capacity constraints.");
1085 bool useStoppingPlace =
false;
1086 bool fitsOnStoppingPlace =
true;
1088 useStoppingPlace =
true;
1093 fitsOnStoppingPlace =
false;
1098 useStoppingPlace =
true;
1102 fitsOnStoppingPlace =
false;
1112 if (stop.
until >= 0) {
1132 return currentVelocity;
1139 for (std::list<Stop>::const_iterator iter =
myStops.begin(); iter !=
myStops.end(); ++iter) {
1140 result.push_back(*iter->edge);
1149 #ifdef DEBUG_PLAN_MOVE 1154 <<
" veh=" <<
getID()
1163 #ifdef DEBUG_PLAN_MOVE 1165 DriveItemVector::iterator i;
1168 <<
" vPass=" << (*i).myVLinkPass
1169 <<
" vWait=" << (*i).myVLinkWait
1170 <<
" linkLane=" << ((*i).myLink == 0 ?
"NULL" : (*i).myLink->getViaLaneOrLane()->getID())
1171 <<
" request=" << (*i).mySetRequest
1177 #ifdef DEBUG_PLAN_MOVE 1179 std::cout <<
" after checkRewindLinkLanes\n";
1180 DriveItemVector::iterator i;
1183 <<
" vPass=" << (*i).myVLinkPass
1184 <<
" vWait=" << (*i).myVLinkWait
1185 <<
" linkLane=" << ((*i).myLink == 0 ?
"NULL" : (*i).myLink->getViaLaneOrLane()->getID())
1186 <<
" request=" << (*i).mySetRequest
1187 <<
" atime=" << (*i).myArrivalTime
1188 <<
" atimeB=" << (*i).myArrivalTimeBraking
1199 #ifdef DEBUG_VEHICLE_GUI_SELECTION 1225 #ifdef DEBUG_PLAN_MOVE 1227 std::cout <<
" bestLaneConts=" <<
toString(bestLaneConts) <<
"\n";
1230 assert(bestLaneConts.size() > 0);
1231 #ifdef HAVE_INTERNAL_LANES 1232 bool hadNonInternal =
false;
1234 bool hadNonInternal =
true;
1241 bool slowedDownForMinor =
false;
1248 adaptToLeaders(ahead, 0, seen, lastLink, leaderLane, v, vLinkPass);
1253 if (shadowLane != 0) {
1257 seen, lastLink, shadowLane, v, vLinkPass);
1266 myStopDist = seen + endPos - lane->
getLength();
1268 if (lastLink != 0) {
1271 v =
MIN2(v, stopSpeed);
1278 MSLinkCont::const_iterator link =
MSLane::succLinkSec(*
this, view + 1, *lane, bestLaneConts);
1287 if (lastLink != 0) {
1297 if (lastLink != 0) {
1330 #ifdef DEBUG_PLAN_MOVE 1331 if (
DEBUG_COND) std::cout <<
SIMTIME <<
" veh=" <<
getID() <<
" slowing down to finish continuous change before" 1332 <<
" link=" << (*link)->getViaLaneOrLane()->getID()
1333 <<
" timeRemaining=" << timeRemaining
1345 const bool abortRequestAfterMinor = slowedDownForMinor && (*link)->getInternalLaneBefore() == 0;
1347 bool setRequest = (v > 0 && !abortRequestAfterMinor) || (leavingCurrentIntersection);
1351 if (yellowOrRed && seen >= brakeDist) {
1358 #ifdef HAVE_INTERNAL_LANES 1362 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
1364 const MSVehicle* leader = (*it).vehAndGap.first;
1368 adaptToLeader(std::make_pair(
this, -1), seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1369 }
else if ((*link)->isLeader(
this, leader)) {
1370 adaptToLeader(it->vehAndGap, seen, lastLink, lane, v, vLinkPass, it->distToCrossing);
1371 if (lastLink != 0) {
1383 vLinkWait =
MIN2(vLinkWait, v);
1387 if (lastLink != 0) {
1394 if (!(*link)->havePriority() && stopDist > cfModel.
getMaxDecel() && brakeDist < seen) {
1397 slowedDownForMinor =
true;
1402 const SUMOReal accelTime = (arrivalSpeed - v) / accel;
1403 const SUMOReal accelWay = accelTime * (arrivalSpeed + v) * 0.5;
1420 arrivalSpeedBraking = arrivalSpeed;
1427 arrivalSpeedBraking =
MIN2(arrivalSpeedBraking, arrivalSpeed);
1428 arrivalTimeBraking =
MAX2(arrivalTime, t +
TIME2STEPS(seen / ((v + arrivalSpeedBraking) * 0.5)));
1431 arrivalTime, arrivalSpeed,
1432 arrivalTimeBraking, arrivalSpeedBraking,
1435 #ifdef HAVE_INTERNAL_LANES 1436 if ((*link)->getViaLane() == 0) {
1437 hadNonInternal =
true;
1444 if ((!setRequest || v <= 0 || seen > dist) && hadNonInternal && seenNonInternal > vehicleLength *
CRLL_LOOK_AHEAD) {
1448 lane = (*link)->getViaLaneOrLane();
1462 lastLink = &lfLinks.back();
1474 ahead.
getSubLanes(
this, latOffset, rightmost, leftmost);
1475 #ifdef DEBUG_PLAN_MOVE 1477 <<
" adaptToLeaders veh=" <<
getID()
1478 <<
" lane=" << lane->
getID()
1479 <<
" rm=" << rightmost
1480 <<
" lm=" << leftmost
1484 for (
int sublane = rightmost; sublane <= leftmost; ++sublane) {
1489 const SUMOReal gap = (lastLink == 0
1492 #ifdef DEBUG_PLAN_MOVE 1494 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";
1497 adaptToLeader(std::make_pair(pred, gap), seen, lastLink, lane, v, vLinkPass);
1508 if (leaderInfo.first != 0) {
1510 if (lastLink != 0) {
1513 v =
MIN2(v, vsafeLeader);
1514 vLinkPass =
MIN2(vLinkPass, vsafeLeader);
1516 #ifdef DEBUG_PLAN_MOVE 1520 <<
" veh=" <<
getID()
1521 <<
" lead=" << leaderInfo.first->getID()
1522 <<
" gap=" << leaderInfo.second
1523 <<
" leadLane=" << leaderInfo.first->getLane()->getID()
1524 <<
" predPos=" << leaderInfo.first->getPositionOnLane()
1526 <<
" lane=" << lane->
getID()
1528 <<
" dTC=" << distToCrossing
1530 <<
" vLinkPass=" << vLinkPass
1540 assert(leaderInfo.first != 0);
1543 if (leaderInfo.second >= 0) {
1544 vsafeLeader = cfModel.
followSpeed(
this,
getSpeed(), leaderInfo.second, leaderInfo.first->getSpeed(), leaderInfo.first->getCarFollowModel().getMaxDecel());
1550 if (distToCrossing >= 0) {
1560 #ifdef DEBUG_VEHICLE_GUI_SELECTION 1575 DriveItemVector::iterator i;
1577 MSLink* link = (*i).myLink;
1579 #ifdef DEBUG_EXEC_MOVE 1582 <<
" veh=" <<
getID()
1584 <<
" req=" << (*i).mySetRequest
1585 <<
" vP=" << (*i).myVLinkPass
1586 <<
" vW=" << (*i).myVLinkWait
1587 <<
" d=" << (*i).myDistance
1592 if (link != 0 && (*i).mySetRequest) {
1600 vSafe = (*i).myVLinkWait;
1602 link->removeApproaching(
this);
1607 const bool influencerPrio =
false;
1611 std::vector<const SUMOVehicle*> collectFoes;
1612 bool opened = yellow || influencerPrio ||
1613 link->opened((*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1620 if (parallelLink != 0) {
1623 opened &= parallelLink->
opened((*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
1627 #ifdef DEBUG_EXEC_MOVE 1630 <<
" veh=" <<
getID()
1634 <<
" opened=" << opened
1640 if (opened && !influencerPrio && !link->havePriority() && !link->lastWasContMajor() && !link->isCont()) {
1642 vSafe = (*i).myVLinkWait;
1645 link->removeApproaching(
this);
1661 vSafe = (*i).myVLinkPass;
1667 vSafeZipper =
MIN2(vSafeZipper,
1668 link->getZipperSpeed(
this, (*i).myDistance, (*i).myVLinkPass, (*i).myArrivalTime, &collectFoes));
1670 vSafe = (*i).myVLinkWait;
1673 link->removeApproaching(
this);
1675 #ifdef DEBUG_EXEC_MOVE 1677 std::cout <<
SIMTIME <<
" braking for closed link=" << link->getViaLaneOrLane()->getID() <<
"\n";
1683 vSafe = (*i).myVLinkWait;
1700 vSafe =
MIN2(vSafe, vSafeZipper);
1710 #ifdef DEBUG_EXEC_MOVE 1712 std::cout <<
SIMTIME <<
" moveHelper vSafe=" << vSafe <<
" vSafeMin=" << vSafeMin <<
" vNext=" << vNext <<
"\n";
1742 brakelightsOn =
true;
1748 if (brakelightsOn) {
1772 std::vector<MSLane*> passedLanes;
1774 passedLanes.push_back(*i);
1776 if (passedLanes.size() == 0 || passedLanes.back() !=
myLane) {
1777 passedLanes.push_back(
myLane);
1780 std::string emergencyReason =
" for unknown reasons";
1793 MSLink* link = (*i).myLink;
1804 emergencyReason =
" because of a red traffic light";
1811 emergencyReason =
" because there is no connection to the next edge";
1815 if (approachedLane !=
myLane && approachedLane != 0) {
1820 #ifdef HAVE_INTERNAL_LANES 1823 if (link->getViaLane() == 0) {
1834 WRITE_WARNING(
"Vehicle '" +
getID() +
"' could not finish continuous lane change (turn lane) time=" +
1845 passedLanes.push_back(approachedLane);
1853 +
"'" + emergencyReason
1862 passedLanes.clear();
1879 #ifdef DEBUG_EXEC_MOVE 1912 const std::vector<MSLane*>& passedLanes) {
1915 #ifdef DEBUG_FURTHER 1917 <<
" updateFurtherLanes oldFurther=" <<
toString(furtherLanes)
1918 <<
" oldFurtherPosLat=" <<
toString(furtherLanesPosLat)
1919 <<
" passed=" <<
toString(passedLanes)
1922 for (std::vector<MSLane*>::iterator i = furtherLanes.begin(); i != furtherLanes.end(); ++i) {
1923 (*i)->resetPartialOccupation(
this);
1925 const MSLane* firstOldFurther = furtherLanes.size() > 0 ? furtherLanes.front() : 0;
1928 furtherLanes.clear();
1929 if (passedLanes.size() > 0) {
1931 std::vector<MSLane*>::const_reverse_iterator i = passedLanes.rbegin() + 1;
1932 while (leftLength > 0 && i != passedLanes.rend()) {
1933 furtherLanes.push_back(*i);
1934 if (*i != firstOldFurther) {
1935 furtherLanesPosLat.insert(furtherLanesPosLat.begin(),
myState.
myPosLat);
1937 #ifdef DEBUG_FURTHER 1939 std::cout <<
SIMTIME <<
" updateFurtherLanes \n";
1942 leftLength -= (*i)->setPartialOccupation(
this);
1945 result = -leftLength;
1947 assert(furtherLanesPosLat.size() >= furtherLanes.size());
1948 furtherLanesPosLat.erase(furtherLanesPosLat.begin() + furtherLanes.size(), furtherLanesPosLat.end());
1949 assert(furtherLanesPosLat.size() == furtherLanes.size());
1950 #ifdef DEBUG_FURTHER 1952 <<
" newFurther=" <<
toString(furtherLanes)
1953 <<
" newFurtherPosLat=" <<
toString(furtherLanesPosLat)
1954 <<
" newBackPos=" << result
1963 #ifdef DEBUG_FURTHER 1991 leftLength -= (*i)->getLength();
2002 leftLength -= (*i)->getLength();
2031 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
2034 && (*i)->isFrontOnLane(l)) {
2035 foundStopped =
true;
2036 const SUMOReal ret = (*i)->getPositionOnLane() - (*i)->getVehicleType().getLengthWithGap() - lengths;
2040 lengths += (*i)->getVehicleType().getLengthWithGap();
2049 #ifdef DEBUG_VEHICLE_GUI_SELECTION 2054 #ifdef HAVE_INTERNAL_LANES 2056 bool hadVehicle =
false;
2057 SUMOReal seenSpace = -lengthsInFront;
2059 bool foundStopped =
false;
2062 for (
int i = 0; i < (int)lfLinks.size(); ++i) {
2065 if (item.
myLink == 0 || foundStopped) {
2071 const MSLane* approachedLane = item.
myLink->getViaLane();
2072 if (approachedLane != 0) {
2082 #ifdef DEBUG_PLAN_MOVE 2085 <<
" veh=" <<
getID()
2086 <<
" approached=" << approachedLane->
getID()
2089 <<
" seenSpace=" << seenSpace
2091 <<
" lengthsInFront=" << lengthsInFront
2099 seenSpace += approachedLane->
getLength();
2110 foundStopped =
true;
2112 #ifdef DEBUG_PLAN_MOVE 2115 <<
" veh=" <<
getID()
2116 <<
" approached=" << approachedLane->
getID()
2117 <<
" lastPoc=" << last->
getID()
2119 <<
" seenSpace=" << seenSpace
2120 <<
" foundStopped=" << foundStopped
2137 foundStopped =
true;
2140 #ifdef DEBUG_PLAN_MOVE 2143 <<
" veh=" <<
getID()
2144 <<
" approached=" << approachedLane->
getID()
2145 <<
" last=" << last->
getID()
2147 <<
" seenSpace=" << seenSpace
2148 <<
" foundStopped=" << foundStopped
2156 #ifdef DEBUG_VEHICLE_GUI_SELECTION 2162 for (
int i = ((
int)lfLinks.size() - 1); i > 0; --i) {
2164 const bool canLeaveJunction = item.
myLink->getViaLane() == 0 || lfLinks[i].mySetRequest;
2172 bool allowsContinuation = item.
myLink == 0 || item.
myLink->
isCont() || !lfLinks[i].hadVehicle || opened;
2173 if (!opened && item.
myLink != 0) {
2177 allowsContinuation =
true;
2181 if (allowsContinuation) {
2187 int removalBegin = -1;
2188 for (
int i = 0; hadVehicle && i < (int)lfLinks.size() && removalBegin < 0; ++i) {
2202 if (leftSpace < 0/* && item.myLink->willHaveBlockedFoe()*/) {
2209 if (leftSpace < -impatienceCorrection / 10. && item.myLink->hasFoes() && item.
myLink->
keepClear()) {
2217 while (removalBegin < (
int)(lfLinks.size())) {
2219 lfLinks[removalBegin].myVLinkPass = lfLinks[removalBegin].myVLinkWait;
2221 lfLinks[removalBegin].mySetRequest =
false;
2230 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
2231 if ((*i).myLink != 0) {
2235 (*i).myLink->setApproaching(
this, (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
2236 (*i).mySetRequest, (*i).myArrivalTimeBraking, (*i).myArrivalSpeedBraking,
getWaitingTime(), (*i).myDistance);
2241 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
2242 if ((*i).myLink != 0) {
2244 if (parallelLink != 0) {
2245 parallelLink->
setApproaching(
this, (*i).myArrivalTime, (*i).myArrivalSpeed, (*i).getLeaveSpeed(),
2246 (*i).mySetRequest, (*i).myArrivalTimeBraking, (*i).myArrivalSpeedBraking,
getWaitingTime(), (*i).myDistance);
2259 if (rem->first->getLane() != 0 && rem->second > 0.) {
2261 if (myTraceMoveReminders) {
2262 traceMoveReminder(
"notifyEnter_skipped", rem->first, rem->second,
true);
2267 if (rem->first->notifyEnter(*
this, reason)) {
2269 if (myTraceMoveReminders) {
2270 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
true);
2276 if (myTraceMoveReminders) {
2277 traceMoveReminder(
"notifyEnter", rem->first, rem->second,
false);
2308 if (!onTeleporting) {
2340 #ifdef DEBUG_FURTHER 2342 std::cout <<
SIMTIME <<
" enterLaneAtLaneChange \n";
2348 #ifdef DEBUG_FURTHER 2350 std::cout <<
SIMTIME <<
" enterLaneAtLaneChange \n";
2353 leftLength -= (lane)->setPartialOccupation(
this);
2361 #ifdef DEBUG_FURTHER 2391 MSLane* clane = enteredLane;
2392 while (leftLength > 0) {
2394 if (clane == 0 || clane ==
myLane) {
2399 leftLength -= (clane)->setPartialOccupation(
this);
2415 if (rem->first->notifyLeave(*
this,
myState.
myPos + rem->second, reason)) {
2417 if (myTraceMoveReminders) {
2418 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
true);
2424 if (myTraceMoveReminders) {
2425 traceMoveReminder(
"notifyLeave", rem->first, rem->second,
false);
2435 #ifdef DEBUG_FURTHER 2437 std::cout <<
SIMTIME <<
" leaveLane \n";
2440 (*i)->resetPartialOccupation(
this);
2473 const std::vector<MSVehicle::LaneQ>&
2481 #ifdef DEBUG_BESTLANES 2486 #ifdef DEBUG_VEHICLE_GUI_SELECTION 2492 if (startLane == 0) {
2495 assert(startLane != 0);
2516 std::vector<LaneQ>& lanes = *it;
2517 assert(lanes.size() > 0);
2518 if (&(lanes[0].lane->getEdge()) == nextEdge) {
2520 std::vector<LaneQ> oldLanes = lanes;
2522 const std::vector<MSLane*>& sourceLanes = startLane->
getEdge().
getLanes();
2523 for (std::vector<MSLane*>::const_iterator it_source = sourceLanes.begin(); it_source != sourceLanes.end(); ++it_source) {
2524 for (std::vector<LaneQ>::iterator it_lane = oldLanes.begin(); it_lane != oldLanes.end(); ++it_lane) {
2525 if ((*it_source)->getLinkCont()[0]->getLane() == (*it_lane).lane) {
2526 lanes.push_back(*it_lane);
2533 for (
int i = 0; i < (int)lanes.size(); ++i) {
2534 if (i + lanes[i].bestLaneOffset < 0) {
2535 lanes[i].bestLaneOffset = -i;
2537 if (i + lanes[i].bestLaneOffset >= (
int)lanes.size()) {
2538 lanes[i].bestLaneOffset = (int)lanes.size() - i - 1;
2540 assert(i + lanes[i].bestLaneOffset >= 0);
2541 assert(i + lanes[i].bestLaneOffset < (
int)lanes.size());
2542 if (lanes[i].bestContinuations[0] != 0) {
2544 lanes[i].bestContinuations.insert(lanes[i].bestContinuations.begin(), (
MSLane*)0);
2546 if (startLane->
getLinkCont()[0]->getLane() == lanes[i].lane) {
2549 assert(&(lanes[i].lane->getEdge()) == nextEdge);
2562 myLastBestLanesEdge = &startLane->
getEdge();
2566 const MSEdge* nextStopEdge = 0;
2567 const MSLane* nextStopLane = 0;
2571 nextStopLane = nextStop.
lane;
2572 nextStopEdge = &nextStopLane->
getEdge();
2580 if (nextStopEdge != 0) {
2589 bool progress =
true;
2591 std::vector<LaneQ> currentLanes;
2592 const std::vector<MSLane*>* allowed = 0;
2593 const MSEdge* nextEdge = 0;
2595 nextEdge = *(ce + 1);
2598 const std::vector<MSLane*>& lanes = (*ce)->getLanes();
2599 for (std::vector<MSLane*>::const_iterator i = lanes.begin(); i != lanes.end(); ++i) {
2607 q.
allowsContinuation = allowed == 0 || find(allowed->begin(), allowed->end(), cl) != allowed->end();
2610 currentLanes.push_back(q);
2613 if (nextStopEdge == *ce) {
2615 for (std::vector<LaneQ>::iterator q = currentLanes.begin(); q != currentLanes.end(); ++q) {
2616 if (nextStopLane != 0 && nextStopLane != (*q).lane) {
2617 (*q).allowsContinuation =
false;
2618 (*q).length = nextStopPos;
2619 (*q).currentLength = (*q).length;
2626 seenLength += currentLanes[0].lane->getLength();
2628 progress &= (seen <= 4 || seenLength < 3000);
2629 progress &= seen <= 8;
2641 int bestThisIndex = 0;
2644 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
2645 if ((*j).length > bestLength) {
2646 bestLength = (*j).length;
2647 bestThisIndex = index;
2651 for (std::vector<LaneQ>::iterator j = last.begin(); j != last.end(); ++j, ++index) {
2652 if ((*j).length < bestLength) {
2653 (*j).bestLaneOffset = bestThisIndex - index;
2657 #ifdef DEBUG_BESTLANES 2659 std::cout <<
" last edge:\n";
2661 for (std::vector<LaneQ>::iterator j = laneQs.begin(); j != laneQs.end(); ++j) {
2662 std::cout <<
" lane=" << (*j).lane->getID() <<
" length=" << (*j).length <<
" bestOffset=" << (*j).bestLaneOffset <<
"\n";
2668 for (std::vector<std::vector<LaneQ> >::reverse_iterator i =
myBestLanes.rbegin() + 1; i !=
myBestLanes.rend(); ++i) {
2669 std::vector<LaneQ>& nextLanes = (*(i - 1));
2670 std::vector<LaneQ>& clanes = (*i);
2671 MSEdge& cE = clanes[0].lane->getEdge();
2675 for (std::vector<LaneQ>::iterator j = nextLanes.begin(); j != nextLanes.end(); ++j, ++index) {
2676 if ((*j).lane->isApproachedFrom(&cE) && bestConnectedLength < (*j).length) {
2677 bestConnectedLength = (*j).length;
2679 if (bestLength < (*j).length) {
2680 bestLength = (*j).length;
2684 int bestThisIndex = 0;
2685 if (bestConnectedLength > 0) {
2687 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2688 LaneQ bestConnectedNext;
2689 bestConnectedNext.
length = -1;
2690 if ((*j).allowsContinuation) {
2691 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m) {
2692 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
2693 if (bestConnectedNext.
length < (*m).length || (bestConnectedNext.
length == (*m).length &&
abs(bestConnectedNext.
bestLaneOffset) >
abs((*m).bestLaneOffset))) {
2694 bestConnectedNext = *m;
2699 (*j).
length += bestLength;
2701 (*j).length += bestConnectedNext.
length;
2706 if (clanes[bestThisIndex].length < (*j).length
2707 || (clanes[bestThisIndex].length == (*j).length &&
abs(clanes[bestThisIndex].bestLaneOffset) >
abs((*j).bestLaneOffset))
2708 || (clanes[bestThisIndex].length == (*j).length &&
abs(clanes[bestThisIndex].bestLaneOffset) ==
abs((*j).bestLaneOffset) &&
2711 bestThisIndex = index;
2714 #ifdef DEBUG_BESTLANES 2716 std::cout <<
" edge=" << cE.
getID() <<
"\n";
2717 std::vector<LaneQ>& laneQs = clanes;
2718 for (std::vector<LaneQ>::iterator j = laneQs.begin(); j != laneQs.end(); ++j) {
2719 std::cout <<
" lane=" << (*j).lane->getID() <<
" length=" << (*j).length <<
" bestOffset=" << (*j).bestLaneOffset <<
"\n";
2726 int bestNextIndex = 0;
2727 int bestDistToNeeded = (int) clanes.size();
2729 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2730 if ((*j).allowsContinuation) {
2732 for (std::vector<LaneQ>::const_iterator m = nextLanes.begin(); m != nextLanes.end(); ++m, ++nextIndex) {
2733 if ((*m).lane->isApproachedFrom(&cE, (*j).lane)) {
2734 if (bestDistToNeeded >
abs((*m).bestLaneOffset)) {
2735 bestDistToNeeded =
abs((*m).bestLaneOffset);
2736 bestThisIndex = index;
2737 bestNextIndex = nextIndex;
2743 clanes[bestThisIndex].length += nextLanes[bestNextIndex].length;
2744 copy(nextLanes[bestNextIndex].bestContinuations.begin(), nextLanes[bestNextIndex].bestContinuations.end(), back_inserter(clanes[bestThisIndex].bestContinuations));
2749 for (std::vector<LaneQ>::iterator j = clanes.begin(); j != clanes.end(); ++j, ++index) {
2750 if ((*j).length < clanes[bestThisIndex].length
2751 || ((*j).length == clanes[bestThisIndex].length &&
abs((*j).bestLaneOffset) >
abs(clanes[bestThisIndex].bestLaneOffset))
2754 (*j).bestLaneOffset = bestThisIndex - index;
2757 (*j).length = (*j).currentLength;
2760 (*j).bestLaneOffset = 0;
2765 #ifdef DEBUG_BESTLANES 2776 if (conts.size() < 2) {
2792 std::vector<LaneQ>& currLanes = *
myBestLanes.begin();
2793 std::vector<LaneQ>::iterator i;
2794 for (i = currLanes.begin(); i != currLanes.end(); ++i) {
2796 for (std::vector<MSLane*>::const_iterator j = (*i).bestContinuations.begin() + 1; j != (*i).bestContinuations.end(); ++j) {
2797 nextOccupation += (*j)->getBruttoVehLenSum();
2799 (*i).nextOccupation = nextOccupation;
2800 if ((*i).lane == startLane) {
2807 const std::vector<MSLane*>&
2812 return (*myCurrentLaneInBestLanes).bestContinuations;
2816 const std::vector<MSLane*>&
2827 if ((*i).lane == lane) {
2828 return (*i).bestContinuations;
2840 return (*myCurrentLaneInBestLanes).bestLaneOffset;
2847 std::vector<MSVehicle::LaneQ>& preb =
myBestLanes.front();
2848 assert(laneIndex < (
int)preb.size());
2849 preb[laneIndex].occupation = density + preb[laneIndex].nextOccupation;
2864 if (
isOnRoad() && destEdge != NULL) {
2878 std::pair<const MSVehicle* const, SUMOReal>
2881 return std::make_pair(static_cast<const MSVehicle*>(0), -1);
2888 MSLane::VehCont::const_iterator it = std::find(vehs.begin(), vehs.end(),
this);
2889 if (it != vehs.end() && it + 1 != vehs.end()) {
2893 std::pair<const MSVehicle* const, SUMOReal> result(
2908 std::pair<const MSVehicle* const, SUMOReal> leaderInfo =
getLeader();
2909 if (leaderInfo.first == 0 ||
getSpeed() == 0) {
2972 int numExpected = (int)
myStops.front().awaitedPersons.size();
2973 if (numExpected != 0) {
2978 numExpected = (int)
myStops.front().awaitedPersons.size();
2980 if (numExpected == 0) {
2994 int numExpected = (int)
myStops.front().awaitedContainers.size();
2995 if (numExpected != 0) {
2996 myStops.front().awaitedContainers.erase(container->
getID());
2997 numExpected = (int)
myStops.front().awaitedContainers.size();
2999 if (numExpected == 0) {
3006 const std::vector<MSTransportable*>&
3016 const std::vector<MSTransportable*>&
3045 }
else if ((state &
LCA_RIGHT) != 0 && (state & LCA_SUBLANE) == 0) {
3057 switch ((*link)->getDirection()) {
3077 if (currentTime % 1000 == 0) {
3132 #ifdef DEBUG_FURTHER 3142 for (
int i = 0; i < (int)shadowFurther.size(); ++i) {
3144 if (shadowFurther[i] == lane) {
3164 #ifdef DEBUG_FURTHER 3172 #ifdef DEBUG_FURTHER 3178 for (
int i = 0; i < (int)shadowFurther.size(); ++i) {
3179 if (shadowFurther[i] == lane) {
3180 #ifdef DEBUG_FURTHER 3183 <<
" lane=" << lane->
getID()
3208 for (DriveItemVector::iterator i = lfLinks.begin(); i != lfLinks.end(); ++i) {
3209 if ((*i).myLink != 0) {
3210 (*i).myLink->removeApproaching(
this);
3230 while (!lane->
isLinkEnd(link) && seen <= dist) {
3233 || !(*link)->havePriority())) {
3237 if ((*di).myLink != 0) {
3238 const MSLane* diPredLane = (*di).myLink->getApproachingLane();
3239 if (diPredLane != 0) {
3250 const SUMOTime leaveTime = (*link)->getLeaveTime((*di).myArrivalTime, (*di).myArrivalSpeed,
3252 if ((*link)->hasApproachingFoe((*di).myArrivalTime, leaveTime, (*di).myArrivalSpeed,
getCarFollowModel().getMaxDecel())) {
3259 lane = (*link)->getViaLaneOrLane();
3302 result.push_back(line1[0]);
3303 result.push_back(line2[0]);
3304 result.push_back(line2[1]);
3305 result.push_back(line1[1]);
3308 result.push_back(line1[1]);
3309 result.push_back(line2[1]);
3310 result.push_back(line2[0]);
3311 result.push_back(line1[0]);
3323 const bool parking,
const bool triggered,
const bool containerTriggered, std::string& errorMsg) {
3325 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
3326 if (iter->lane == lane && fabs(iter->endPos - endPos) <
POSITION_EPS) {
3327 if (duration == 0 && !iter->reached) {
3330 iter->duration = duration;
3341 newStop.
until = until;
3346 const bool result =
addStop(newStop, errorMsg);
3356 const bool triggered,
const bool containerTriggered,
const bool isContainerStop, std::string& errorMsg) {
3358 for (std::list<Stop>::iterator iter =
myStops.begin(); iter !=
myStops.end(); iter++) {
3359 const Named*
const stop = isContainerStop ? (
Named*)iter->containerstop : iter->busstop;
3360 if (stop != 0 && stop->
getID() == stopId) {
3361 if (duration == 0 && !iter->reached) {
3364 iter->duration = duration;
3372 if (isContainerStop) {
3376 errorMsg =
"The container stop '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
3383 errorMsg =
"The bus stop '" + stopId +
"' is not known for vehicle '" +
getID() +
"'";
3388 newStop.
until = until;
3396 const bool result =
addStop(newStop, errorMsg);
3416 if (
myStops.front().busstop != 0) {
3418 myStops.front().busstop->leaveFrom(
this);
3421 if (
myStops.front().containerstop != 0) {
3423 myStops.front().containerstop->leaveFrom(
this);
3502 std::vector<SUMOTime> internals;
3516 throw ProcessError(
"Error: Invalid vehicles in state (may be a meso state)!");
3523 myDeparture -= offset;
bool signalSet(int which) const
Returns whether the given signal is on.
void setAngle(SUMOReal angle)
Set a custom vehicle angle in rad.
const MSLane * myLastBestLanesInternalLane
The link is a partial left direction.
bool isRemoteControlled() const
Returns the information whether the vehicle is fully controlled via TraCI.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
const MSVehicleType * myType
This Vehicle's type.
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
SUMOReal getSpeedAfterMaxDecel(SUMOReal v) const
Returns the velocity after maximum deceleration.
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
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
SUMOReal getMaxSpeed() const
Get vehicle's maximum speed [m/s].
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...
bool amVehicleSpecific() const
Returns whether this type belongs to a single vehicle only (was modified)
SUMOReal speed() const
Speed of this state.
SUMOTime timeToBoardNextPerson
The time at which the vehicle is able to board another person.
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.
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
SUMOReal rotationAtOffset(SUMOReal pos) const
Returns the rotation at the given length.
void remove(MSVehicle *veh)
Remove a vehicle from this transfer object.
const SUMOReal SUMO_const_laneWidth
MSEdgeWeightsStorage * myEdgeWeights
SUMOReal backPos() const
back Position of this state
MoveReminderCont myMoveReminders
Current lane's move reminder.
SUMOReal myArrivalPos
The position on the destination lane where the vehicle stops.
The action is due to the default of keeping right "Rechtsfahrgebot".
The action is done to help someone else.
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) ...
LaneChangeMode myRightDriveLC
changing to the rightmost lane
const MSEdge * getInternalFollower() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
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.
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)
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 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) ...
bool isChangingLanes() const
return true if the vehicle currently performs a lane change maneuver
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.
const std::vector< SUMOReal > & getShadowFurtherLanesPosLat() const
SUMOReal getMaxSpeed() const
Returns the maximum speed.
DriveItemVector myLFLinkLanes
SUMOReal pos() const
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) ...
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
static const SUMOReal ZIPPER_ADAPT_DIST
SUMOReal getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive...
SUMOReal getImpatience() const
Returns this vehicles impatience.
void setBlinkerInformation()
MSLane * getOpposite() const
return the opposite direction lane for lane changing or 0
void addContainer(MSTransportable *container)
Adds a container.
SUMOReal getLeaveSpeed() const
virtual void drawOutsideNetwork(bool) const
register vehicle for drawing while outside the network
bool unsafeLinkAhead(const MSLane *lane) const
whether the vehicle may safely move to the given lane with regard to upcoming links ...
SUMOReal myAcceleration
The current acceleration after dawdling in m/s.
bool hasPersons() const
Returns whether persons are simulated.
SUMOReal getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
The vehicle arrived at a junction.
void setRespectJunctionPriority(bool value)
Sets whether junction priority rules shall be respected.
bool isVTDControlled() const
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
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 getLength() const
Returns the lane's length.
Position getPosition(const SUMOReal offset=0) const
Return current position (x/y, cartesian)
SUMOReal departSpeed
(optional) The initial speed of the vehicle
virtual SUMOReal maxNextSpeed(SUMOReal speed, const MSVehicle *const veh) const
Returns the maximum speed given the current speed.
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) ...
The car-following model abstraction.
bool myConsiderMaxAcceleration
Whether the maximum acceleration shall be regarded.
SUMOReal arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
int getShadowDirection() const
return the direction in which the current shadow lane lies
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)
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
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 ...
SUMOReal getHCEmissions() const
Returns HC emission of the current state.
bool myRespectJunctionPriority
Whether the junction priority rules are respected.
SUMOReal getWidth() const
Returns the lane's width.
bool reached
Information whether the stop has been reached.
const MSLane * getBackLane() const
void registerEmergencyStop()
register emergency stop
SUMOReal getEndLanePosition() const
Returns the end position of this stop.
void scaleRelative(SUMOReal factor)
enlarges/shrinks the polygon by a factor based at the centroid
State & operator=(const State &state)
Assignment operator.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
const MSRoute & getRoute() const
Returns the current route.
vehicle doesn't want to change
TraciLaneChangePriority
modes for prioritizing traci lane change requests
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
const std::string & getID() const
returns the id of the transportable
bool hasDeparted() const
Returns whether this vehicle has already departed.
SUMOReal getCenterOnEdge() const
The vehicle got vaporized.
void postProcessVTD(MSVehicle *v)
SUMOReal estimateLeaveSpeed(const MSLink *const link, const SUMOReal vLinkPass) const
estimate leaving speed when accelerating across a link
SUMOTime until
The time at which the vehicle may continue its journey.
WaitingTimeCollector myWaitingTimeCollector
SUMOReal mySpeed
the stored speed
Definition of vehicle stop (position and duration)
This is an uncontrolled, right-before-left link.
render as a sedan passenger vehicle ("Stufenheck")
SUMOReal getCO2Emissions() const
Returns CO2 emission of the current state.
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.
SUMOTime myMemorySize
the maximal memory to store
std::pair< const MSVehicle *const, SUMOReal > getLeader(SUMOReal dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
SUMOReal getPositionOnLane() const
Get the vehicle's position along the lane.
int myArrivalLane
The destination lane where the vehicle stops.
const SUMOVehicleParameter * myParameter
This Vehicle's parameter.
const std::vector< SUMOVehicleParameter::Stop > & getStops() const
Returns the stops.
The base class for microscopic and mesoscopic vehicles.
bool myHaveToWaitOnNextLink
void adaptToLeaders(const MSLeaderInfo &ahead, SUMOReal latOffset, const SUMOReal seen, DriveProcessItem *const lastLink, const MSLane *const lane, SUMOReal &v, SUMOReal &vLinkPass) const
SUMOReal processNextStop(SUMOReal currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
A storage for edge travel times and efforts.
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
const Position geometryPositionAtOffset(SUMOReal offset, SUMOReal lateralOffset=0) const
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.
SUMOReal getBruttoVehLenSum() const
Returns the sum of lengths of vehicles, including their minGaps, which were on the lane during the la...
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)
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
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.
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
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()
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
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
Right blinker lights are switched on.
PositionVector reverse() const
reverse position vector
SUMOReal nextOccupation
As occupation, but without the first lane.
virtual MSTransportableControl & getContainerControl()
Returns the container control.
SUMOReal getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
SUMOReal getElectricityConsumption() const
Returns electricity consumption of the current state.
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.
SUMOReal slopeDegreeAtOffset(SUMOReal pos) const
Returns the slope at the given length.
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.
int getContainerNumber() const
Returns the number of containers.
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
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
The vehicle changes lanes (micro only)
MSLane * lane
The described lane.
void checkRewindLinkLanes(const SUMOReal lengthsInFront, DriveItemVector &lfLinks) const
SUMOReal getLength() const
return the length of the edge
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.
Left blinker lights are switched on.
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
void setEmergencyBrakeRedLight(bool value)
Sets whether red lights shall be a reason to brake.
SUMOReal brakeGap(const SUMOReal speed) const
Returns the distance the vehicle needs to halt including driver's reaction time.
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
const MSLane & getLane() const
Returns the lane this stop is located at.
SUMOReal computeAngle() const
compute the current vehicle angle
SUMOReal implicitSpeedVTD(const MSVehicle *veh, SUMOReal oldSpeed)
return the speed that is implicit in the new VTD position
bool allowsVehicleClass(SUMOVehicleClass vclass) const
SUMOReal startPos
The stopping position start.
SUMOReal getLateralOverlap() const
return the amount by which the vehicle extends laterally outside it's primary lane ...
The edge is a district edge.
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.
The vehicle got a new route.
void workOnMoveReminders(SUMOReal oldPos, SUMOReal newPos, SUMOReal newSpeed)
Processes active move reminder.
MSStoppingPlace * getBusStop(const std::string &id) const
Returns the named bus stop.
vehicle want's to change to right lane
#define DIST_TO_STOPLINE_EXPECT_PRIORITY
void removeApproachingInformation(DriveItemVector &lfLinks) const
unregister approach from all upcoming links
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...
PositionVector getBoundingBox() const
get bounding rectangle
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
Encapsulated SAX-Attributes.
SUMOReal getMinGap() const
Get the free space in front of vehicles of this class.
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...
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.
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the subpart of best lanes that describes the vehicle's current lane and their successors...
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.
MSLane * getLane() const
Returns the connected lane.
bool willPass(const MSEdge *const edge) const
Returns whether the vehicle wil pass the given edge.
SUMOReal myAngle
the angle (
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.
virtual SUMOReal getFloat(int id) const =0
Returns the SUMOReal-value of the named (by its enum-value) attribute.
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.
SUMOReal myOriginalSpeed
The velocity before influence.
std::vector< SUMOReal > myFurtherLanesPosLat
const std::vector< MSLane * > & getShadowFurtherLanes() const
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
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.
bool isStoppedInRange(SUMOReal pos) const
return whether the given position is within range of the current stop
bool myConsiderMaxDeceleration
Whether the maximum deceleration shall be regarded.
SUMOReal getLastFreePos(const SUMOVehicle &forVehicle) const
Returns the last free position on this stop.
void adaptLeaveSpeed(const SUMOReal v)
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...
const MSLeaderInfo & getLastVehicleInformation(const MSVehicle *ego, SUMOReal latOffset, SUMOReal minPos=0, bool allowCached=true) const
Returns the last vehicles on the lane.
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
SUMOReal getDistanceToPosition(SUMOReal destPos, const MSEdge *destEdge) const
const ConstMSEdgeVector & getEdges() const
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
Position positionAtOffset(SUMOReal pos, SUMOReal lateralOffset=0) const
Returns the position at the given length.
SUMOReal getSpaceTillLastStanding(const MSLane *l, bool &foundStopped) const
void removeShadowApproachingInformation() const
SUMOTime duration
The stopping duration.
bool isRoundabout() const
MSVehicle()
invalidated default constructor
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
The link is a (hard) right direction.
The action is needed to follow the route (navigational lc)
virtual SUMOReal stopSpeed(const MSVehicle *const veh, const SUMOReal speed, SUMOReal gap2pred) const =0
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling) ...
std::vector< LinkLeader > LinkLeaders
SUMOReal estimateSpeedAfterDistance(const SUMOReal dist, const SUMOReal v, const SUMOReal accel) const
void addTransportable(MSTransportable *transportable)
Add a passenger.
A blue emergency light is on.
A structure representing the best lanes for continuing the route.
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.
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 getMaxDecel() const
Get the vehicle type's maximum deceleration [m/s^2].
SUMOReal changeRequestRemainingSeconds(const SUMOTime currentTime) const
Return the remaining number of seconds of the current laneTimeLine assuming one exists.
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. ...
void fixPosition()
repair errors in vehicle position after changing between internal edges
void getSubLanes(const MSVehicle *veh, SUMOReal latOffset, int &rightmost, int &leftmost) const
render as a passenger 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
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.
bool isInternal() const
return whether this edge is an internal edge
void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector &lfLinks, SUMOReal &myStopDist) const
The link is a partial right direction.
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons) ...
virtual SUMOReal getHeadwayTime() const
Get the driver's reaction time [s].
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
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
State(SUMOReal pos, SUMOReal speed, SUMOReal posLat, SUMOReal backPos)
Constructor.
int getPersonNumber() const
Returns the number of persons.
bool allowsContinuation
Whether this lane allows to continue the drive.
SUMOReal getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
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.
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.
SUMOReal getOriginalSpeed() const
Returns the originally longitudinal speed to use.
SUMOReal getNOxEmissions() const
Returns NOx emission of the current state.
SUMOReal getRightSideOnLane() const
Get the vehicle's lateral position on the lane:
std::string lane
The lane to stop at.
bool myEmergencyBrakeRedLight
Whether red lights are a reason to brake.
MSEdgeWeightsStorage & _getWeightsStorage() const
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.
void forceVehicleInsertion(MSVehicle *veh, SUMOReal pos, MSMoveReminder::Notification notification, SUMOReal posLat=0)
Inserts the given vehicle at the given position.
void setShadowApproachingInformation(MSLink *link) const
set approach information for the shadow vehicle
SUMOReal getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
SUMOReal getPMxEmissions() const
Returns PMx emission of the current state.
SUMOReal getCOEmissions() const
Returns CO emission of the current state.
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
SUMOReal getWidth() const
Get the width which vehicles of this class shall have when being drawn.
SUMOReal getLatOffset(const MSLane *lane) const
Get the offset that that must be added to interpret myState.myPosLat for the given lane...
std::vector< const MSLane * > getOutgoingLanes() const
get the list of outgoing lanes
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
The vehicle starts or ends parking.
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, SUMOReal > > &speedTimeLine)
Sets a new velocity timeline.
EdgeBasicFunction getPurpose() const
Returns the edge type (EdgeBasicFunction)
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.
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...
virtual VehicleVariables * createVehicleVariables() const
Returns model specific values which are stored inside a vehicle and must be used with casting...
std::vector< std::pair< SUMOTime, SUMOReal > > mySpeedTimeLine
The velocity time line to apply.
SUMOReal getSlope() const
Returns the slope of the road at vehicle's position.
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.
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
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) ...
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) ...
SUMOReal interpolateLanePosToGeometryPos(SUMOReal lanePos) const
Definition of vehicle stop (position and duration)
SUMOReal getBeginLanePosition() const
Returns the begin 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.
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
void onDepart()
Called when the vehicle is inserted into the network.
SUMOReal getFuelConsumption() const
Returns fuel consumption of the current state.
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
The link has red light (must brake)
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
SUMOTime until
The time at which the vehicle may continue its journey.
static SUMOReal gLateralResolution
void setConsiderSafeVelocity(bool value)
Sets whether the safe velocity shall be regarded.
MSStoppingPlace * getContainerStop(const std::string &id) const
Returns the named container stop.
bool replaceRouteEdges(ConstMSEdgeVector &edges, bool onInit=false, bool check=false)
Replaces the current route by the given edges.
const ConstMSEdgeVector getStopEdges() const
Returns the list of still pending stop edges.
int index
at which position in the stops list
MSRouteIterator edge
The edge in the route to stop at.
const waitingIntervalList & getWaitingIntervals() const
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)
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.
const std::string & getID() const
Returns the name of the vehicle type.
The vehicle ends to stop.
SUMOReal getSpeed() const
Returns the vehicle's current speed.
int myNumberReroutes
The number of reroutings.
bool isFrontOnLane(const MSLane *lane) const
Returns the information whether the front of the vehicle is on the given lane.
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.
void setLaneChangeMode(int value)
Sets lane changing behavior.
SUMOReal myPos
the stored position
virtual void prepareStep()
bool isStoppedTriggered() const
Returns whether the vehicle is on a triggered stop.
SUMOReal getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
waitingIntervalList myWaitingIntervals
std::vector< DriveProcessItem > DriveItemVector
Container for used Links/visited Lanes during lookForward.
const PositionVector & getShape() const
Returns this lane's shape.
SUMOReal endPos
The stopping position end.
The action is due to a TraCI request.
SUMOReal distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
SUMOReal getOppositePos(SUMOReal pos) const
return the corresponding position on the opposite lane
void move2side(SUMOReal amount)
move position vector to side using certain ammount
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.
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.
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.
SUMOReal myBackPos
the stored back position
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.
virtual ~MSVehicle()
Destructor.
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.
The link has yellow light, has to brake anyway.
void release() const
deletes the route if there are no further references to it
SUMOReal getVehicleMaxSpeed(const SUMOVehicle *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
bool mySpeedAdaptationStarted
Whether influencing the speed has already started.
SUMOEmissionClass getEmissionClass() const
Get this vehicle type's emission class.
MSLane * getLane() const
Returns the lane the vehicle is on.
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")
SUMOReal getTimeGap() const
Returns the time gap in seconds to the leader of the vehicle looking for a fixed distance.
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.
SUMOReal getBackPositionOnLane() const
Get the vehicle's position relative to its current lane.
static MSAbstractLaneChangeModel * build(LaneChangeModel lcm, MSVehicle &vehicle)
Factory method for instantiating new lane changing models.
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.
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
std::vector< MSDevice * > myDevices
The devices this vehicle has.
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
The link has red light (must brake) but indicates upcoming green.
void passedJunction(const MSVehicle *vehicle)
erase vehicle from myLinkLeaders of this links junction
bool isVTDAffected(SUMOTime t) const
Interface for lane-change models.
int getBestLaneOffset() const
returns the current offset from the best lane
SUMOReal posLat() const
Lateral Position of this state (m relative to the centerline of the lane).
SUMOReal angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position ...
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.
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
static const SUMOTime NOT_YET_DEPARTED
MSDevice_Transportable * myContainerDevice
The containers this vehicle may have.
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.
SUMOReal getRightSideOnEdge() const
const std::string & getID() const
Returns the name of the vehicle.
int size() const
Return the number of passengers / containers.
void endLaneChangeManeuver(const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_LANE_CHANGE)
const Position getBackPosition() const