90#define DEBUG_COND (isSelected())
92#define DEBUG_COND2(obj) ((obj != 0 && (obj)->isSelected()))
134 for (
auto p : persons) {
163 if (nextIsMyVehicles()) {
164 if (myI1 != myI1End) {
166 }
else if (myI3 != myI3End) {
180 if (nextIsMyVehicles()) {
181 if (myI1 != myI1End) {
182 return myLane->myVehicles[myI1];
183 }
else if (myI3 != myI3End) {
184 return myLane->myTmpVehicles[myI3];
186 assert(myI2 == myI2End);
190 return myLane->myPartialVehicles[myI2];
201 if (myI1 == myI1End && myI3 == myI3End) {
202 if (myI2 != myI2End) {
208 if (myI2 == myI2End) {
211 MSVehicle* cand = myI1 == myI1End ? myLane->myTmpVehicles[myI3] : myLane->myVehicles[myI1];
219 if (cand->
getPositionOnLane() < myLane->myPartialVehicles[myI2]->getPositionOnLane(myLane)) {
222 return !myDownstream;
236 int index,
bool isRampAccel,
237 const std::string& type) :
267#pragma warning(disable: 4355)
269 mySimulationTask(*this, 0),
277 assert(
myRNGs.size() > 0);
329 veh->addReminder(rem);
341 std::cout <<
SIMTIME <<
" setPartialOccupation. lane=" <<
getID() <<
" veh=" << v->
getID() <<
"\n";
361 std::cout <<
SIMTIME <<
" resetPartialOccupation. lane=" <<
getID() <<
" veh=" << v->
getID() <<
"\n";
381 std::cout <<
SIMTIME <<
" setManeuverReservation. lane=" <<
getID() <<
" veh=" << v->
getID() <<
"\n";
392 std::cout <<
SIMTIME <<
" resetManeuverReservation(): lane=" <<
getID() <<
" veh=" << v->
getID() <<
"\n";
437 if (leader ==
nullptr) {
442 leader = leaderInfo.first;
448 if (leader ==
nullptr) {
454 if (leaderBack >= frontGapNeeded) {
455 pos =
MIN2(pos, leaderBack - frontGapNeeded);
477 if (missingRearGap > 0) {
478 if (minPos + missingRearGap <=
myLength) {
485 return isInsertionSuccess(&veh, mspeed, minPos + missingRearGap, posLat,
true, notification);
496 const double speed = leader->
getSpeed();
498 if (leaderPos >= frontGapNeeded) {
508 MSLane::VehCont::iterator predIt =
myVehicles.begin();
519 double speed = mspeed;
520 if (leader !=
nullptr) {
526 if (leader !=
nullptr) {
529 frontMax = leaderRearPos - frontGapNeeded;
537 if (frontMax > minPos && backMin + POSITION_EPS < frontMax) {
539 if (
isInsertionSuccess(&veh, speed, backMin + POSITION_EPS, posLat,
true, notification)) {
580 if (last !=
nullptr) {
632 bool patchSpeed =
true;
649 for (
int i = 0; i < 10; i++) {
686 for (
int i = 0; i < 10; i++) {
713#ifdef DEBUG_EXTRAPOLATE_DEPARTPOS
722 double dist = speed *
STEPS2TIME(relevantDelay);
724 if (leaderInfo.first !=
nullptr) {
728 dist =
MIN2(dist, leaderInfo.second - frontGapNeeded);
740 if (nspeed < speed) {
742 speed =
MIN2(nspeed, speed);
744 }
else if (speed > 0) {
751 if (emergencyBrakeGap <= dist) {
759 if (errorMsg !=
"") {
760 WRITE_ERROR(
"Vehicle '" + aVehicle->
getID() +
"' will not be able to depart using the given velocity (" + errorMsg +
")!");
772 double speed,
double pos,
double posLat,
bool patchSpeed,
776 WRITE_WARNINGF(
TL(
"Invalid departPos % given for vehicle '%'. Inserting at lane end instead."),
777 pos, aVehicle->
getID());
781#ifdef DEBUG_INSERTION
783 std::cout <<
"\nIS_INSERTION_SUCCESS\n"
785 <<
" veh '" << aVehicle->
getID()
795 std::vector<MSLane*>::const_iterator ri = bestLaneConts.begin();
802#ifdef DEBUG_INSERTION
804 std::cout <<
" bidi-lane occupied\n";
810 MSLink* firstRailSignal =
nullptr;
811 double firstRailSignalDist = -1;
817 if (nextStop.
lane ==
this) {
818 std::stringstream msg;
819 msg <<
"scheduled stop on lane '" <<
myID <<
"' too close";
820 const double distToStop = nextStop.
pars.
endPos - pos;
821 if (
checkFailure(aVehicle, speed, dist,
MAX2(0.0, cfModel.
stopSpeed(aVehicle, speed, distToStop, MSCFModel::CalcReason::FUTURE)),
832 MSLane* currentLane =
this;
835 while ((seen < dist || (isRail && firstRailSignal ==
nullptr)) && ri != bestLaneConts.end()) {
837 std::vector<MSLink*>::const_iterator link =
succLinkSec(*aVehicle, nRouteSuccs, *currentLane, bestLaneConts);
860 if (isRail && firstRailSignal ==
nullptr) {
861 std::string constraintInfo;
862 bool isInsertionOrder;
864 setParameter((isInsertionOrder ?
"insertionOrder" :
"insertionConstraint:")
865 + aVehicle->
getID(), constraintInfo);
866#ifdef DEBUG_INSERTION
868 std::cout <<
" insertion constraint at link " << (*link)->getDescription() <<
" not cleared \n";
876 if (firstRailSignal ==
nullptr && (*link)->
getTLLogic() !=
nullptr) {
877 firstRailSignal = *link;
878 firstRailSignalDist = seen;
885 bool brakeBeforeSignal = patchSpeed || speed <= vSafe;
887#ifdef DEBUG_INSERTION
889 std::cout <<
" oncoming rail traffic at link " << (*link)->getDescription() <<
"\n";
896 if (brakeBeforeSignal) {
897 speed =
MIN2(speed, vSafe);
901 cfModel.
getMaxDecel(), 0, posLat,
nullptr,
false, aVehicle)
902 || !(*link)->havePriority()) {
904 std::string errorMsg =
"";
905 const LinkState state = (*link)->getState();
911 errorMsg =
"unpriorised junction too close";
912 }
else if ((*link)->getTLLogic() !=
nullptr && !(*link)->getTLLogic()->getsMajorGreen((*link)->getTLIndex())) {
914 errorMsg =
"tlLogic '" + (*link)->getTLLogic()->getID() +
"' link " +
toString((*link)->getTLIndex()) +
" never switches to 'G'";
922#ifdef DEBUG_INSERTION
924 std::cout <<
"trying insertion before minor link: "
925 <<
"insertion speed = " << speed <<
" dist=" << dist
932 nextLane = (*link)->getViaLaneOrLane();
934 if (nextLane !=
nullptr) {
947 if (nextStop.
lane == nextLane) {
948 std::stringstream msg;
949 msg <<
"scheduled stop on lane '" << nextStop.
lane->
getID() <<
"' too close";
950 const double distToStop = seen + nextStop.
pars.
endPos;
963#ifdef DEBUG_INSERTION
965 std::cout <<
SIMTIME <<
" leader on lane '" << nextLane->
getID() <<
"': " << leaders.
toString() <<
" nspeed=" << nspeed <<
"\n";
970#ifdef DEBUG_INSERTION
972 std::cout <<
" isInsertionSuccess lane=" <<
getID()
973 <<
" veh=" << aVehicle->
getID()
975 <<
" posLat=" << posLat
976 <<
" patchSpeed=" << patchSpeed
977 <<
" speed=" << speed
978 <<
" nspeed=" << nspeed
979 <<
" nextLane=" << nextLane->
getID()
981 <<
" failed (@641)!\n";
991 const double nspeed = cfModel.
freeSpeed(aVehicle, speed, seen, nextLane->
getVehicleMaxSpeed(aVehicle),
true, MSCFModel::CalcReason::FUTURE);
992 if (nspeed < speed) {
999 WRITE_WARNINGF(
TL(
"Vehicle '%' is inserted too fast and will violate the speed limit on a lane '%'."),
1003 WRITE_ERROR(
"Vehicle '" + aVehicle->
getID() +
"' will not be able to depart using the given velocity (slow lane ahead)!");
1014 if ((*link)->hasApproachingFoe(arrivalTime, leaveTime, speed, cfModel.
getMaxDecel())) {
1022 currentLane = nextLane;
1023 if ((*link)->getViaLane() ==
nullptr) {
1037#ifdef DEBUG_INSERTION
1039 std::cout <<
SIMTIME <<
" isInsertionSuccess lane=" <<
getID()
1040 <<
" veh=" << aVehicle->
getID()
1042 <<
" posLat=" << posLat
1043 <<
" patchSpeed=" << patchSpeed
1044 <<
" speed=" << speed
1045 <<
" nspeed=" << nspeed
1046 <<
" nextLane=" << nextLane->
getID()
1047 <<
" leaders=" << leaders.
toString()
1048 <<
" failed (@700)!\n";
1053#ifdef DEBUG_INSERTION
1055 std::cout <<
SIMTIME <<
" speed = " << speed <<
" nspeed = " << nspeed << std::endl;
1060 for (
int i = 0; i < followers.
numSublanes(); ++i) {
1061 const MSVehicle* follower = followers[i].first;
1062 if (follower !=
nullptr) {
1064 if (followers[i].second < backGapNeeded
1068#ifdef DEBUG_INSERTION
1070 std::cout <<
SIMTIME <<
" isInsertionSuccess lane=" <<
getID()
1071 <<
" veh=" << aVehicle->
getID()
1073 <<
" posLat=" << posLat
1074 <<
" patchSpeed=" << patchSpeed
1075 <<
" speed=" << speed
1076 <<
" nspeed=" << nspeed
1077 <<
" follower=" << follower->
getID()
1078 <<
" backGapNeeded=" << backGapNeeded
1079 <<
" gap=" << followers[i].second
1080 <<
" failure (@719)!\n";
1093#ifdef DEBUG_INSERTION
1098 if (shadowLane !=
nullptr) {
1100 for (
int i = 0; i < shadowFollowers.
numSublanes(); ++i) {
1101 const MSVehicle* follower = shadowFollowers[i].first;
1102 if (follower !=
nullptr) {
1104 if (shadowFollowers[i].second < backGapNeeded
1108#ifdef DEBUG_INSERTION
1111 <<
" isInsertionSuccess shadowlane=" << shadowLane->
getID()
1112 <<
" veh=" << aVehicle->
getID()
1114 <<
" posLat=" << posLat
1115 <<
" patchSpeed=" << patchSpeed
1116 <<
" speed=" << speed
1117 <<
" nspeed=" << nspeed
1118 <<
" follower=" << follower->
getID()
1119 <<
" backGapNeeded=" << backGapNeeded
1120 <<
" gap=" << shadowFollowers[i].second
1121 <<
" failure (@812)!\n";
1131 if (veh !=
nullptr) {
1138#ifdef DEBUG_INSERTION
1141 <<
" isInsertionSuccess shadowlane=" << shadowLane->
getID()
1142 <<
" veh=" << aVehicle->
getID()
1144 <<
" posLat=" << posLat
1145 <<
" patchSpeed=" << patchSpeed
1146 <<
" speed=" << speed
1147 <<
" nspeed=" << nspeed
1148 <<
" leader=" << veh->
getID()
1149 <<
" gapNeeded=" << gapNeeded
1151 <<
" failure (@842)!\n";
1163 if (missingRearGap > 0
1166#ifdef DEBUG_INSERTION
1169 <<
" isInsertionSuccess lane=" <<
getID()
1170 <<
" veh=" << aVehicle->
getID()
1172 <<
" posLat=" << posLat
1173 <<
" patchSpeed=" << patchSpeed
1174 <<
" speed=" << speed
1175 <<
" nspeed=" << nspeed
1176 <<
" missingRearGap=" << missingRearGap
1177 <<
" failure (@728)!\n";
1184 speed =
MAX2(0.0, speed);
1188#ifdef DEBUG_INSERTION
1191 <<
" isInsertionSuccess lane=" <<
getID()
1192 <<
" veh=" << aVehicle->
getID()
1194 <<
" posLat=" << posLat
1195 <<
" patchSpeed=" << patchSpeed
1196 <<
" speed=" << speed
1197 <<
" nspeed=" << nspeed
1198 <<
" failed (@733)!\n";
1205 if (extraReservation > 0) {
1206 std::stringstream msg;
1207 msg <<
"too many lane changes required on lane '" <<
myID <<
"'";
1210 double stopSpeed = cfModel.
stopSpeed(aVehicle, speed, distToStop, MSCFModel::CalcReason::FUTURE);
1211#ifdef DEBUG_INSERTION
1213 std::cout <<
"\nIS_INSERTION_SUCCESS\n"
1214 <<
SIMTIME <<
" veh=" << aVehicle->
getID() <<
" bestLaneOffset=" << bestLaneOffset <<
" bestLaneDist=" << aVehicle->
getBestLaneDist() <<
" extraReservation=" << extraReservation
1215 <<
" distToStop=" << distToStop <<
" v=" << speed <<
" v2=" << stopSpeed <<
"\n";
1226 return v->getPositionOnLane() >= pos;
1228#ifdef DEBUG_INSERTION
1231 <<
" isInsertionSuccess lane=" <<
getID()
1232 <<
" veh=" << aVehicle->
getID()
1234 <<
" posLat=" << posLat
1235 <<
" patchSpeed=" << patchSpeed
1236 <<
" speed=" << speed
1237 <<
" nspeed=" << nspeed
1241 <<
"\n leaders=" << leaders.
toString()
1264 return v->getPositionOnLane() >= pos;
1271 double nspeed = speed;
1272#ifdef DEBUG_INSERTION
1274 std::cout <<
SIMTIME <<
" safeInsertionSpeed veh=" << veh->
getID() <<
" speed=" << speed <<
"\n";
1279 if (leader !=
nullptr) {
1288 nspeed =
MIN2(nspeed,
1290#ifdef DEBUG_INSERTION
1292 std::cout <<
" leader=" << leader->
getID() <<
" nspeed=" << nspeed <<
"\n";
1307 int freeSublanes = 1;
1312 while (freeSublanes > 0 && veh !=
nullptr) {
1313#ifdef DEBUG_PLAN_MOVE
1316 std::cout <<
" getLastVehicleInformation lane=" <<
getID() <<
" minPos=" << minPos <<
" veh=" << veh->
getID() <<
" pos=" << veh->
getPositionOnLane(
this) <<
"\n";
1321 freeSublanes = leaderTmp.
addLeader(veh,
true, vehLatOffset);
1322#ifdef DEBUG_PLAN_MOVE
1324 std::cout <<
" latOffset=" << vehLatOffset <<
" newLeaders=" << leaderTmp.
toString() <<
"\n";
1330 if (ego ==
nullptr && minPos == 0) {
1338#ifdef DEBUG_PLAN_MOVE
1367 int freeSublanes = 1;
1369 while (freeSublanes > 0 && veh !=
nullptr) {
1370#ifdef DEBUG_PLAN_MOVE
1372 std::cout <<
" veh=" << veh->
getID() <<
" pos=" << veh->
getPositionOnLane(
this) <<
" maxPos=" << maxPos <<
"\n";
1379#ifdef DEBUG_PLAN_MOVE
1381 std::cout <<
" veh=" << veh->
getID() <<
" latOffset=" << vehLatOffset <<
"\n";
1384 freeSublanes = followerTmp.
addLeader(veh,
true, vehLatOffset);
1388 if (ego ==
nullptr && maxPos == std::numeric_limits<double>::max()) {
1393#ifdef DEBUG_PLAN_MOVE
1416 double cumulatedVehLength = 0.;
1420 VehCont::reverse_iterator veh =
myVehicles.rbegin();
1423#ifdef DEBUG_PLAN_MOVE
1427 <<
" planMovements() lane=" <<
getID()
1435#ifdef DEBUG_PLAN_MOVE
1437 std::cout <<
" plan move for: " << (*veh)->getID();
1441#ifdef DEBUG_PLAN_MOVE
1443 std::cout <<
" leaders=" << leaders.
toString() <<
"\n";
1446 (*veh)->planMove(t, leaders, cumulatedVehLength);
1447 cumulatedVehLength += (*veh)->getVehicleType().getLengthWithGap();
1456 veh->setApproachingForAllLinks(t);
1465 bool nextToConsiderIsPartial;
1468 while (moreReservationsAhead || morePartialVehsAhead) {
1469 if ((!moreReservationsAhead || (*vehRes)->getPositionOnLane(
this) <= veh->
getPositionOnLane())
1470 && (!morePartialVehsAhead || (*vehPart)->getPositionOnLane(
this) <= veh->
getPositionOnLane())) {
1476 if (moreReservationsAhead && !morePartialVehsAhead) {
1477 nextToConsiderIsPartial =
false;
1478 }
else if (morePartialVehsAhead && !moreReservationsAhead) {
1479 nextToConsiderIsPartial =
true;
1481 assert(morePartialVehsAhead && moreReservationsAhead);
1483 nextToConsiderIsPartial = (*vehPart)->getPositionOnLane(
this) > (*vehRes)->getPositionOnLane(
this);
1486 if (nextToConsiderIsPartial) {
1487 const double latOffset = (*vehPart)->getLatOffset(
this);
1488#ifdef DEBUG_PLAN_MOVE
1490 std::cout <<
" partial ahead: " << (*vehPart)->getID() <<
" latOffset=" << latOffset <<
"\n";
1494 && !(*vehPart)->getLaneChangeModel().isChangingLanes())) {
1495 ahead.
addLeader(*vehPart,
false, latOffset);
1500 const double latOffset = (*vehRes)->getLatOffset(
this);
1501#ifdef DEBUG_PLAN_MOVE
1503 std::cout <<
" reservation ahead: " << (*vehRes)->getID() <<
" latOffset=" << latOffset <<
"\n";
1506 ahead.
addLeader(*vehRes,
false, latOffset);
1517#ifdef DEBUG_COLLISIONS
1519 std::vector<const MSVehicle*> all;
1521 all.push_back(*last);
1523 std::cout <<
SIMTIME <<
" detectCollisions stage=" << stage <<
" lane=" <<
getID() <<
":\n"
1526 <<
" all=" <<
toString(all) <<
"\n"
1535 std::set<const MSVehicle*, ComparatorNumericalIdLess> toRemove;
1536 std::set<const MSVehicle*, ComparatorNumericalIdLess> toTeleport;
1539#ifdef DEBUG_JUNCTION_COLLISIONS
1541 std::cout <<
SIMTIME <<
" detect junction Collisions stage=" << stage <<
" lane=" <<
getID() <<
":\n"
1548 const std::vector<const MSLane*>& foeLanes =
myLinks.front()->getFoeLanes();
1555 for (
const MSLane*
const foeLane : foeLanes) {
1556#ifdef DEBUG_JUNCTION_COLLISIONS
1558 std::cout <<
" foeLane " << foeLane->getID()
1559 <<
" foeVehs=" <<
toString(foeLane->myVehicles)
1560 <<
" foePart=" <<
toString(foeLane->myPartialVehicles) <<
"\n";
1565 const MSVehicle*
const victim = *it_veh;
1566 if (victim == collider) {
1570#ifdef DEBUG_JUNCTION_COLLISIONS
1573 <<
" bound=" << colliderBoundary <<
" foeBound=" << victim->
getBoundingBox()
1588 foeLane->handleCollisionBetween(timestep, stage, victim, collider, -1, 0, toRemove, toTeleport);
1597 if (
myLinks.front()->getWalkingAreaFoe() !=
nullptr) {
1600 if (
myLinks.front()->getWalkingAreaFoeExit() !=
nullptr) {
1608#ifdef DEBUG_PEDESTRIAN_COLLISIONS
1610 std::cout <<
SIMTIME <<
" detect pedestrian collisions stage=" << stage <<
" lane=" <<
getID() <<
"\n";
1624#ifdef DEBUG_PEDESTRIAN_COLLISIONS
1627 <<
" dist=" << leader.second <<
" jammed=" << leader.first->isJammed() <<
"\n";
1630 if (leader.first != 0 && leader.second < length && !leader.first->isJammed()) {
1633 WRITE_WARNINGF(
TL(
"Vehicle '%' collision with person '%', lane='%', gap=%, time=%, stage=%."),
1646 VehCont::reverse_iterator lastVeh =
myVehicles.rend() - 1;
1647 for (VehCont::reverse_iterator pred =
myVehicles.rbegin(); pred != lastVeh; ++pred) {
1648 VehCont::reverse_iterator veh = pred + 1;
1659 double high = (*veh)->getPositionOnLane(
this);
1660 double low = (*veh)->getBackPositionOnLane(
this);
1672 double low2 =
myLength - (*veh2)->getPositionOnLane(bidiLane);
1673 double high2 =
myLength - (*veh2)->getBackPositionOnLane(bidiLane);
1679 if (!(high < low2 || high2 < low)) {
1680#ifdef DEBUG_COLLISIONS
1682 std::cout <<
SIMTIME <<
" bidi-collision veh=" << (*veh)->getID() <<
" bidiVeh=" << (*veh2)->getID()
1683 <<
" vehFurther=" <<
toString((*veh)->getFurtherLanes())
1684 <<
" high=" << high <<
" low=" << low <<
" high2=" << high2 <<
" low2=" << low2 <<
"\n";
1713 if (lead == follow) {
1728 for (std::set<const MSVehicle*, ComparatorNumericalIdLess>::iterator it = toRemove.begin(); it != toRemove.end(); ++it) {
1732 if (toTeleport.count(veh) > 0) {
1744 SUMOTime timestep,
const std::string& stage) {
1746#ifdef DEBUG_PEDESTRIAN_COLLISIONS
1748 std::cout <<
SIMTIME <<
" detect pedestrian junction collisions stage=" << stage <<
" lane=" <<
getID() <<
" foeLane=" << foeLane->
getID() <<
"\n";
1752 for (std::vector<MSTransportable*>::const_iterator it_p = persons.begin(); it_p != persons.end(); ++it_p) {
1753#ifdef DEBUG_PEDESTRIAN_COLLISIONS
1755 std::cout <<
" collider=" << collider->
getID()
1756 <<
" ped=" << (*it_p)->getID()
1757 <<
" colliderBoundary=" << colliderBoundary
1758 <<
" pedBoundary=" << (*it_p)->getBoundingBox()
1762 if (colliderBoundary.
overlapsWith((*it_p)->getBoundingBox())
1764 std::string collisionType =
"junctionPedestrian";
1766 collisionType =
"crossing";
1768 collisionType =
"walkingarea";
1772 WRITE_WARNINGF(
TL(
"Vehicle '%' collision with person '%', lane='%', time=%, stage=%."),
1784 std::set<const MSVehicle*, ComparatorNumericalIdLess>& toRemove,
1785 std::set<const MSVehicle*, ComparatorNumericalIdLess>& toTeleport)
const {
1792 if (collider == victim) {
1798 const bool bothOpposite = victimOpposite && colliderOpposite;
1814 }
else if (colliderOpposite) {
1818#ifdef DEBUG_COLLISIONS
1821 <<
" thisLane=" <<
getID()
1822 <<
" collider=" << collider->
getID()
1823 <<
" victim=" << victim->
getID()
1824 <<
" colOpposite=" << colliderOpposite
1825 <<
" vicOpposite=" << victimOpposite
1828 <<
" colPos=" << colliderPos
1829 <<
" vicBack=" << victimBack
1833 <<
" minGapFactor=" << minGapFactor
1838 if (gap < -NUMERICAL_EPS) {
1843 if (latGap + NUMERICAL_EPS > 0) {
1849 double gapDelta = 0;
1850 const MSVehicle* otherLaneVeh = collider->
getLane() ==
this ? victim : collider;
1855 if (&cand->getEdge() == &
getEdge()) {
1856 gapDelta =
getLength() - cand->getLength();
1861 if (gap + gapDelta >= 0) {
1869 && victim->
getLane() !=
this) {
1873#ifdef DEBUG_COLLISIONS
1875 std::cout <<
SIMTIME <<
" detectedCollision gap=" << gap <<
" latGap=" << latGap <<
"\n";
1887 double gap,
double latGap, std::set<const MSVehicle*, ComparatorNumericalIdLess>& toRemove,
1888 std::set<const MSVehicle*, ComparatorNumericalIdLess>& toTeleport)
const {
1894 ?
"frontal collision"
1895 : (
isInternal() ?
"junction collision" :
"collision"));
1900 std::string prefix =
"Vehicle '" + collider->
getID() +
"'; " + collisionType +
" with vehicle '" + victim->
getID() ;
1905 std::string dummyError;
1911 double victimSpeed = victim->
getSpeed();
1912 double colliderSpeed = collider->
getSpeed();
1915 if (collisionAngle < 45) {
1917 colliderSpeed =
MIN2(colliderSpeed, victimSpeed);
1918 }
else if (collisionAngle < 135) {
1957 prefix =
"Teleporting vehicle '" + collider->
getID() +
"'; " + collisionType +
" with vehicle '" + victim->
getID() ;
1958 toRemove.insert(collider);
1959 toTeleport.insert(collider);
1962 prefix =
"Removing " + collisionType +
" participants: vehicle '" + collider->
getID() +
"', vehicle '" + victim->
getID();
1963 bool removeCollider =
true;
1964 bool removeVictim =
true;
1968 toRemove.insert(victim);
1970 if (removeCollider) {
1971 toRemove.insert(collider);
1973 if (!removeVictim) {
1974 if (!removeCollider) {
1975 prefix =
"Keeping remote-controlled " + collisionType +
" participants: vehicle '" + collider->
getID() +
"', vehicle '" + victim->
getID();
1977 prefix =
"Removing " + collisionType +
" participant: vehicle '" + collider->
getID() +
"', keeping remote-controlled vehicle '" + victim->
getID();
1979 }
else if (!removeCollider) {
1980 prefix =
"Keeping remote-controlled " + collisionType +
" participant: vehicle '" + collider->
getID() +
"', removing vehicle '" + victim->
getID();
1988 if (collisionType ==
"frontal collision") {
1989 collisionType =
"frontal";
1990 }
else if (collisionType ==
"junction collision") {
1991 collisionType =
"junction";
1996 +
"', lane='" +
getID()
2000 +
" stage=" + stage +
".");
2005#ifdef DEBUG_COLLISIONS
2007 toRemove.erase(collider);
2008 toTeleport.erase(collider);
2011 toRemove.erase(victim);
2012 toTeleport.erase(victim);
2037#ifdef DEBUG_EXEC_MOVE
2039 std::cout <<
SIMTIME <<
" veh " << veh->
getID() <<
" has arrived." << std::endl;
2044 }
else if (target !=
nullptr && moved) {
2066 WRITE_WARNINGF(
TL(
"Teleporting vehicle '%'; beyond end of lane, target lane='%', time=%."),
2073 WRITE_WARNINGF(
TL(
"Removing vehicle '%' after earlier collision, lane='%', time=%."),
2078 WRITE_WARNINGF(
TL(
"Teleporting vehicle '%' after earlier collision, lane='%', time=%."),
2082 if (firstNotStopped ==
nullptr && !(*i)->
isStopped() && (*i)->getLane() ==
this) {
2083 firstNotStopped = *i;
2089 if (firstNotStopped ==
nullptr && !(*i)->
isStopped() && (*i)->getLane() ==
this) {
2090 firstNotStopped = *i;
2098 i = VehCont::reverse_iterator(
myVehicles.erase(i.base()));
2100 if (firstNotStopped !=
nullptr) {
2104 const bool wrongLane = !
appropriate(firstNotStopped);
2105 const bool r1 = ttt > 0 && firstNotStopped->
getWaitingTime() > ttt;
2110 && firstNotStopped->
succEdge(1) !=
nullptr
2112 const bool r4 = !r1 && !r2 && !r3 && tttb > 0
2114 if (r1 || r2 || r3 || r4) {
2116 const bool minorLink = !wrongLane && (link !=
myLinks.end()) && !((*link)->havePriority());
2117 std::string reason = (wrongLane ?
" (wrong lane" : (minorLink ?
" (yield" :
" (jam"));
2124 reason =
" (blocked";
2126 WRITE_WARNINGF(
"Teleporting vehicle '%'; waited too long" + reason
2127 + (r2 ?
", highway" :
"")
2128 + (r3 ?
", disconnected" :
"")
2129 + (r4 ?
", bidi" :
"")
2133 }
else if (minorLink) {
2186 const MSLane* firstInternal =
this;
2188 while (pred !=
nullptr && pred->
isInternal()) {
2189 firstInternal = pred;
2193 return firstInternal;
2200 const DictType::iterator it =
myDict.lower_bound(
id);
2201 if (it ==
myDict.end() || it->first !=
id) {
2203 myDict.emplace_hint(it,
id, ptr);
2212 const DictType::iterator it =
myDict.find(
id);
2213 if (it ==
myDict.end()) {
2223 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
2232 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
2233 into.push_back((*i).first);
2238template<
class RTREE>
void
2240 for (DictType::iterator i =
myDict.begin(); i !=
myDict.end(); ++i) {
2244 const float cmin[2] = {(float) b.
xmin(), (float) b.
ymin()};
2245 const float cmax[2] = {(float) b.
xmax(), (float) b.
ymax()};
2246 into.Insert(cmin, cmax, l);
2250template void MSLane::fill<NamedRTree>(
NamedRTree& into);
2271 return (link !=
myLinks.end());
2281 assert(veh->getLane() ==
this);
2295#ifdef DEBUG_VEHICLE_CONTAINER
2315 std::cout <<
"sortManeuverReservations on lane " <<
getID()
2378std::vector<MSLink*>::const_iterator
2380 const MSLane& succLinkSource,
const std::vector<MSLane*>& conts) {
2383 if (nRouteEdge ==
nullptr) {
2385 return succLinkSource.
myLinks.end();
2389 assert(succLinkSource.
myLinks.size() == 1);
2392 return succLinkSource.
myLinks.begin();
2403 if (nRouteSuccs < (
int)conts.size()) {
2405 for (std::vector<MSLink*>::const_iterator link = succLinkSource.
myLinks.begin(); link != succLinkSource.
myLinks.end(); ++link) {
2406 if ((*link)->getLane() !=
nullptr && (*link)->getLane()->myEdge == nRouteEdge && (*link)->getLane()->allowsVehicleClass(veh.
getVehicleType().
getVehicleClass())) {
2408 if ((*link)->getLane() == conts[nRouteSuccs]) {
2415 return succLinkSource.
myLinks.end();
2418#ifdef DEBUG_NO_CONNECTION
2420 WRITE_WARNING(
"Could not find connection between lane " + succLinkSource.
getID() +
" and lane " + conts[nRouteSuccs]->getID() +
2423 return succLinkSource.
myLinks.end();
2431 if ((internal && l->getViaLane() == target) || (!internal && l->getLane() == target)) {
2442 if (l->getLane() == target) {
2443 return l->getViaLane();
2455 const MSLane* internal =
this;
2457 assert(lane !=
nullptr);
2461 assert(lane !=
nullptr);
2504 assert(remVehicle->
getLane() ==
this);
2506 if (remVehicle == *it) {
2541 }
else if (!approachingEdge->
isInternal() && warnMultiCon) {
2544 WRITE_WARNINGF(
TL(
"Lane '%' is approached multiple times from edge '%'. This may cause collisions."),
2553 std::map<MSEdge*, std::vector<MSLane*> >::const_iterator i =
myApproachingLanes.find(edge);
2557 const std::vector<MSLane*>& lanes = (*i).second;
2558 return std::find(lanes.begin(), lanes.end(), lane) != lanes.end();
2569 const MSVehicle* v = followerInfo.first;
2588std::pair<MSVehicle* const, double>
2589MSLane::getLeader(
const MSVehicle* veh,
const double vehPos,
const std::vector<MSLane*>& bestLaneConts,
double dist,
bool checkTmpVehicles)
const {
2597 if (checkTmpVehicles) {
2606 std::cout << std::setprecision(
gPrecision) <<
" getLeader lane=" <<
getID() <<
" ego=" << veh->
getID() <<
" egoPos=" << vehPos <<
" pred=" << pred->
getID() <<
" predPos=" << pred->
getPositionOnLane() <<
"\n";
2622 std::cout <<
" getLeader lane=" <<
getID() <<
" ego=" << veh->
getID() <<
" egoPos=" << vehPos
2639 if (bestLaneConts.size() > 0) {
2647 std::cout <<
" getLeader lane=" <<
getID() <<
" seen=" << seen <<
" dist=" << dist <<
"\n";
2651 return std::pair<MSVehicle* const, double>(
static_cast<MSVehicle*
>(
nullptr), -1);
2655 return std::make_pair(
static_cast<MSVehicle*
>(
nullptr), -1);
2660std::pair<MSVehicle* const, double>
2662 const std::vector<MSLane*>& bestLaneConts)
const {
2665 std::cout <<
" getLeaderOnConsecutive lane=" <<
getID() <<
" ego=" << veh.
getID() <<
" seen=" << seen <<
" dist=" << dist <<
" conts=" <<
toString(bestLaneConts) <<
"\n";
2669 return std::make_pair(
static_cast<MSVehicle*
>(
nullptr), -1);
2684 return std::pair<MSVehicle* const, double>(pred, gap);
2692 const MSLane* nextLane =
this;
2696 std::vector<MSLink*>::const_iterator link =
succLinkSec(veh, view, *nextLane, bestLaneConts);
2700 std::cout <<
" cannot continue after nextLane=" << nextLane->
getID() <<
"\n";
2707 const bool laneChanging = veh.
getLane() !=
this;
2710 if (linkLeaders.size() > 0) {
2711 std::pair<MSVehicle*, double> result;
2712 double shortestGap = std::numeric_limits<double>::max();
2713 for (
auto ll : linkLeaders) {
2714 double gap = ll.vehAndGap.second;
2716 if (lVeh !=
nullptr) {
2723 <<
" isLeader=" << veh.
isLeader(*link, lVeh, gap)
2724 <<
" gap=" << ll.vehAndGap.second
2725 <<
" gap+brakeing=" << gap
2730 if (lVeh !=
nullptr && !laneChanging && !veh.
isLeader(*link, lVeh, ll.vehAndGap.second)) {
2733 if (gap < shortestGap) {
2735 result = ll.vehAndGap;
2738 if (shortestGap != std::numeric_limits<double>::max()) {
2741 std::cout <<
" found linkLeader after nextLane=" << nextLane->
getID() <<
"\n";
2748 bool nextInternal = (*link)->getViaLane() !=
nullptr;
2749 nextLane = (*link)->getViaLaneOrLane();
2750 if (nextLane ==
nullptr) {
2755 if (leader !=
nullptr) {
2758 std::cout <<
" found leader " << leader->
getID() <<
" on nextLane=" << nextLane->
getID() <<
"\n";
2763 return std::make_pair(leader, leaderDist);
2770 if (!nextInternal) {
2773 }
while (seen <= dist || nextLane->
isInternal());
2777 return std::make_pair(
static_cast<MSVehicle*
>(
nullptr), -1);
2781std::pair<MSVehicle* const, double>
2785 std::cout <<
SIMTIME <<
" getCriticalLeader. lane=" <<
getID() <<
" veh=" << veh.
getID() <<
"\n";
2789 std::pair<MSVehicle*, double> result = std::make_pair(
static_cast<MSVehicle*
>(
nullptr), -1);
2790 double safeSpeed = std::numeric_limits<double>::max();
2795 const MSLane* nextLane =
this;
2799 std::vector<MSLink*>::const_iterator link =
succLinkSec(veh, view, *nextLane, bestLaneConts);
2816 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
2817 const MSVehicle* leader = (*it).vehAndGap.first;
2818 if (leader !=
nullptr && leader != result.first) {
2822 double tmpSpeed = safeSpeed;
2823 veh.
adaptToJunctionLeader((*it).vehAndGap, seen,
nullptr, nextLane, tmpSpeed, tmpSpeed, (*it).distToCrossing);
2826 std::cout <<
" linkLeader=" << leader->
getID() <<
" gap=" << result.second <<
" tmpSpeed=" << tmpSpeed <<
" safeSpeed=" << safeSpeed <<
"\n";
2829 if (tmpSpeed < safeSpeed) {
2830 safeSpeed = tmpSpeed;
2831 result = (*it).vehAndGap;
2835 bool nextInternal = (*link)->getViaLane() !=
nullptr;
2836 nextLane = (*link)->getViaLaneOrLane();
2837 if (nextLane ==
nullptr) {
2841 if (leader !=
nullptr && leader != result.first) {
2844 if (tmpSpeed < safeSpeed) {
2845 safeSpeed = tmpSpeed;
2846 result = std::make_pair(leader, gap);
2857 if (!nextInternal) {
2860 }
while (seen <= dist || nextLane->
isInternal());
2870 for (MSEdgeVector::iterator i = pred.begin(); i != pred.end();) {
2879 if (pred.size() != 0) {
2881 MSEdge* best = *pred.begin();
2903 if (&(cand.lane->getEdge()) == &fromEdge) {
2928#ifdef DEBUG_LANE_SORTER
2944 std::vector<MSLink*> candidateLinks =
myLinks;
2947 MSLane* best = (*candidateLinks.begin())->getViaLaneOrLane();
2948#ifdef DEBUG_LANE_SORTER
2949 std::cout <<
"\nBest successor lane for lane '" <<
myID <<
"': '" << best->
getID() <<
"'" << std::endl;
2959 if (pred ==
nullptr) {
2967const std::vector<std::pair<const MSLane*, const MSEdge*> >
2969 std::vector<std::pair<const MSLane*, const MSEdge*> > result;
2971 assert(link->getLane() !=
nullptr);
2972 result.push_back(std::make_pair(link->getLane(), link->getViaLane() ==
nullptr ?
nullptr : &link->getViaLane()->getEdge()));
2977std::vector<const MSLane*>
2979 std::vector<const MSLane*> result = {};
2981 for (std::vector<MSLane*>::const_iterator it_lane = (*it).second.begin(); it_lane != (*it).second.end(); ++it_lane) {
2982 if (!((*it_lane)->isInternal())) {
2983 result.push_back(*it_lane);
3007 for (std::vector<MSLink*>::const_iterator i =
myLinks.begin(); i !=
myLinks.end(); ++i) {
3008 if ((*i)->getLane()->getEdge().isCrossing()) {
3009 return (
int)(i -
myLinks.begin());
3025 if (cand->getLane() == bidi) {
3026 sum += (brutto ? cand->getVehicleType().getLengthWithGap() : cand->getVehicleType().getLength());
3028 sum +=
myLength - cand->getBackPositionOnLane(
this);
3072 wtime += (*i)->getWaitingSeconds();
3087 v += veh->getSpeed();
3109 v += veh->getSpeed();
3128 if (vehs.size() == 0) {
3132 for (MSLane::VehCont::const_iterator i = vehs.begin(); i != vehs.end(); ++i) {
3133 double sv = (*i)->getHarmonoise_NoiseEmissions();
3134 ret += (double) pow(10., (sv / 10.));
3167 myLaneDir(e->getLanes()[0]->
getShape().angleAt2D(0)) {
3178 if (ae1 !=
nullptr && ae1->size() != 0) {
3188 if (ae2 !=
nullptr && ae2->size() != 0) {
3208 myLaneDir(targetLane->
getShape().angleAt2D(0)) {}
3226#ifdef DEBUG_LANE_SORTER
3227 std::cout <<
"\nincoming_lane_priority sorter()\n"
3228 <<
"noninternal predecessor for lane '" << laneInfo1.
lane->
getID()
3229 <<
"': '" << noninternal1->
getID() <<
"'\n"
3230 <<
"noninternal predecessor for lane '" << laneInfo2.
lane->
getID()
3231 <<
"': '" << noninternal2->
getID() <<
"'\n";
3239 bool priorized1 =
true;
3240 bool priorized2 =
true;
3242#ifdef DEBUG_LANE_SORTER
3243 std::cout <<
"FoeLinks of '" << noninternal1->
getID() <<
"'" << std::endl;
3246#ifdef DEBUG_LANE_SORTER
3247 std::cout << foeLink->getLaneBefore()->getID() << std::endl;
3249 if (foeLink == link2) {
3255#ifdef DEBUG_LANE_SORTER
3256 std::cout <<
"FoeLinks of '" << noninternal2->
getID() <<
"'" << std::endl;
3259#ifdef DEBUG_LANE_SORTER
3260 std::cout << foeLink->getLaneBefore()->getID() << std::endl;
3263 if (foeLink == link1) {
3271 if (priorized1 != priorized2) {
3285 myLaneDir(sourceLane->
getShape().angleAt2D(0)) {}
3291 if (target2 ==
nullptr) {
3294 if (target1 ==
nullptr) {
3298#ifdef DEBUG_LANE_SORTER
3299 std::cout <<
"\noutgoing_lane_priority sorter()\n"
3300 <<
"noninternal successors for lane '" << myLane->
getID()
3301 <<
"': '" << target1->
getID() <<
"' and "
3302 <<
"'" << target2->
getID() <<
"'\n";
3309 if (priority1 != priority2) {
3310 return priority1 > priority2;
3336 if (link->getApproaching().size() > 0) {
3345 const bool toRailJunction =
myLinks.size() > 0 && (
3348 const bool hasVehicles =
myVehicles.size() > 0;
3357 if (toRailJunction) {
3359 if (link->getApproaching().size() > 0) {
3362 for (
auto item : link->getApproaching()) {
3372 if (item.second.latOffset != 0) {
3404 for (
const std::string&
id : vehIds) {
3447 bool allSublanes,
double searchDist,
MinorLinkMode mLinkMode)
const {
3456 std::cout <<
SIMTIME <<
" getFollowers lane=" <<
getID() <<
" ego=" << ego->
getID()
3457 <<
" backOffset=" << backOffset <<
" pos=" << egoPos
3458 <<
" allSub=" << allSublanes <<
" searchDist=" << searchDist <<
" ignoreMinor=" << mLinkMode
3459 <<
" egoLatDist=" << egoLatDist
3460 <<
" getOppositeLeaders=" << getOppositeLeaders
3476 std::cout <<
SIMTIME <<
" getFollowers lane=" <<
getID() <<
" ego=" << ego->
getID()
3499 std::cout <<
" (1) added veh=" << veh->
getID() <<
" latOffset=" << latOffset <<
" result=" << result.
toString() <<
"\n";
3506 std::cout <<
" result.numFreeSublanes=" << result.
numFreeSublanes() <<
"\n";
3514 if (searchDist == -1) {
3518 std::cout <<
" computed searchDist=" << searchDist <<
"\n";
3522 std::set<const MSEdge*> egoFurther;
3524 egoFurther.insert(&further->getEdge());
3537 std::vector<MSLane::IncomingLaneInfo> newFound;
3539 while (toExamine.size() != 0) {
3540 for (std::vector<MSLane::IncomingLaneInfo>::iterator it = toExamine.begin(); it != toExamine.end(); ++it) {
3541 MSLane* next = (*it).lane;
3547 std::cout <<
" next=" << next->
getID() <<
" seen=" << (*it).length <<
" first=" << first.
toString() <<
" firstFront=" << firstFront.
toString() <<
" backOffset=" << backOffset <<
"\n";
3551 if (backOffset + (*it).length - next->
getLength() < 0
3552 && egoFurther.count(&next->
getEdge()) != 0
3558 for (
const auto& ll : linkLeaders) {
3559 if (ll.vehAndGap.first !=
nullptr) {
3560 const bool egoIsLeader = ll.vehAndGap.first->isLeader((*it).viaLink, ego, ll.vehAndGap.second);
3563 const double gap = (egoIsLeader
3564 ? -ll.vehAndGap.second - ll.vehAndGap.first->getVehicleType().getLengthWithGap() - ego->
getVehicleType().
getMinGap()
3569 std::cout <<
SIMTIME <<
" ego=" << ego->
getID() <<
" link=" << (*it).viaLink->getViaLaneOrLane()->getID()
3571 <<
" gap=" << ll.vehAndGap.second <<
" dtC=" << ll.distToCrossing
3572 <<
" egoIsLeader=" << egoIsLeader <<
" gap2=" << gap
3586 const MSVehicle* v = first[i] == ego ? firstFront[i] : first[i];
3589 if (v !=
nullptr && v != ego) {
3596 agap = (*it).length - next->
getLength() + backOffset
3601 std::cout <<
" agap1=" << agap <<
"\n";
3607 if (!getOppositeLeaders) {
3612 if (v !=
nullptr && v != ego) {
3621 if (!(*it).viaLink->havePriority() && !ego->
onFurtherEdge(&(*it).lane->getEdge())
3626 agap =
MAX2(agap, 0.0);
3637 if ((*it).length < searchDist) {
3638 const std::vector<MSLane::IncomingLaneInfo>& followers = next->
getIncomingLanes();
3639 for (std::vector<MSLane::IncomingLaneInfo>::const_iterator j = followers.begin(); j != followers.end(); ++j) {
3640 if (visited.find((*j).lane) == visited.end() && (((*j).viaLink->havePriority() && !(*j).viaLink->isTurnaround())
3641 || mLinkMode == MinorLinkMode::FOLLOW_ALWAYS
3642 || (mLinkMode == MinorLinkMode::FOLLOW_ONCOMING && (*j).viaLink->getDirection() ==
LinkDirection::STRAIGHT))) {
3643 visited.insert((*j).lane);
3645 ili.
lane = (*j).lane;
3646 ili.
length = (*j).length + (*it).length;
3648 newFound.push_back(ili);
3654 swap(newFound, toExamine);
3666 bool oppositeDirection)
const {
3685 const MSLane* nextLane =
this;
3690 bool nextInternal =
false;
3691 if (oppositeDirection) {
3692 if (view >= (
int)bestLaneConts.size()) {
3695 nextLane = bestLaneConts[view];
3697 std::vector<MSLink*>::const_iterator link =
succLinkSec(*ego, view, *nextLane, bestLaneConts);
3703 if (linkLeaders.size() > 0) {
3715 std::cout <<
" linkleader=" << veh->
getID() <<
" gap=" << ll.
vehAndGap.second <<
"\n";
3726 nextInternal = (*link)->getViaLane() !=
nullptr;
3727 nextLane = (*link)->getViaLaneOrLane();
3728 if (nextLane ==
nullptr) {
3736 std::cout <<
SIMTIME <<
" getLeadersOnConsecutive lane=" <<
getID() <<
" nextLane=" << nextLane->
getID() <<
" leaders=" << leaders.
toString() <<
"\n";
3741 for (
int i = 0; i < iMax; ++i) {
3743 if (veh !=
nullptr) {
3760 if (!nextInternal) {
3774#ifdef DEBUG_SURROUNDING
3776 std::cout <<
" addLeaders lane=" <<
getID() <<
" veh=" << vehicle->
getID() <<
" vehPos=" << vehPos <<
" opposite=" << opposite <<
"\n";
3780 for (
int i = 0; i < aheadSamePos.
numSublanes(); ++i) {
3782 if (veh !=
nullptr && veh != vehicle) {
3784#ifdef DEBUG_SURROUNDING
3795 double speed = vehicle->
getSpeed();
3802#ifdef DEBUG_SURROUNDING
3804 std::cout <<
" aborting forward search. dist=" << dist <<
" seen=" << seen <<
"\n";
3809#ifdef DEBUG_SURROUNDING
3811 std::cout <<
" add consecutive before=" << result.
toString() <<
" seen=" << seen <<
" dist=" << dist;
3816#ifdef DEBUG_SURROUNDING
3818 std::cout <<
" upstreamOpposite=" <<
toString(bestLaneConts);
3826#ifdef DEBUG_SURROUNDING
3828 std::cout <<
" after=" << result.
toString() <<
"\n";
3844 std::cout <<
SIMTIME <<
" getPartialBehind lane=" <<
getID() <<
" ego=" << ego->
getID() <<
" found=" << veh->
getID() <<
"\n";
3875 assert(checkedLanes !=
nullptr);
3876 if (checkedLanes->find(
this) != checkedLanes->end()) {
3877#ifdef DEBUG_SURROUNDING
3878 std::cout <<
"Skipping previously scanned lane: " <<
getID() << std::endl;
3880 return std::set<MSVehicle*>();
3883 (*checkedLanes)[
this] = std::make_pair(
MAX2(0.0, startPos - upstreamDist),
MIN2(startPos + downstreamDist,
getLength()));
3885#ifdef DEBUG_SURROUNDING
3886 std::cout <<
"Scanning on lane " <<
myID <<
"(downstr. " << downstreamDist <<
", upstr. " << upstreamDist <<
", startPos " << startPos <<
"): " << std::endl;
3889 if (startPos < upstreamDist) {
3892 MSLane* incoming = incomingInfo.lane;
3893#ifdef DEBUG_SURROUNDING
3894 std::cout <<
"Checking on incoming: " << incoming->
getID() << std::endl;
3895 if (checkedLanes->find(incoming) != checkedLanes->end()) {
3896 std::cout <<
"Skipping previous: " << incoming->
getID() << std::endl;
3900 foundVehicles.insert(newVehs.begin(), newVehs.end());
3904 if (
getLength() < startPos + downstreamDist) {
3908#ifdef DEBUG_SURROUNDING
3909 std::cout <<
"Checking on outgoing: " << l->getViaLaneOrLane()->getID() << std::endl;
3911 std::set<MSVehicle*> newVehs = l->getViaLaneOrLane()->getSurroundingVehicles(0.0, downstreamDist - (
myLength - startPos), upstreamDist, checkedLanes);
3912 foundVehicles.insert(newVehs.begin(), newVehs.end());
3915#ifdef DEBUG_SURROUNDING
3916 std::cout <<
"On lane (2) " <<
myID <<
": \nFound vehicles: " << std::endl;
3918 std::cout << v->getID() <<
" pos = " << v->getPositionOnLane() << std::endl;
3921 return foundVehicles;
3927 std::set<MSVehicle*> res;
3930 if (!vehs.empty()) {
3932 if (veh->getPositionOnLane() >= a) {
3933 if (veh->getBackPositionOnLane() > b) {
3945std::vector<const MSJunction*>
3948 std::vector<const MSJunction*> junctions;
3950 junctions.insert(junctions.end(), l->getJunction());
3956std::vector<const MSLink*>
3958#ifdef DEBUG_SURROUNDING
3959 std::cout <<
"getUpcoming links on lane '" <<
getID() <<
"' with pos=" << pos
3960 <<
" range=" << range << std::endl;
3963 std::vector<const MSLink*> links;
3966 const MSLane* lane =
this;
3969 std::vector<MSLane*>::const_iterator contLanesIt = contLanes.begin();
3973 const MSLink* link =
nullptr;
3975 assert(*contLanesIt ==
nullptr);
3977 links.insert(links.end(), link);
3982 assert(*(contLanesIt + 1) == lane);
3984 while (++contLanesIt != contLanes.end()) {
3988#ifdef DEBUG_SURROUNDING
3989 std::cout <<
"Distance until end of lane '" << lane->
getID() <<
"' is " << dist <<
"." << std::endl;
3995 if (link !=
nullptr) {
3996 links.insert(links.end(), link);
3998 lane = *contLanesIt;
4021std::pair<MSVehicle* const, double>
4028 std::cout <<
" getFollower lane=" <<
getID() <<
" egoPos=" << egoPos <<
" pred=" << pred->
getID() <<
" predPos=" << pred->
getPositionOnLane(
this) <<
"\n";
4036 if (dist > 0 && backOffset > dist) {
4037 return std::make_pair(
nullptr, -1);
4041 return std::make_pair(
const_cast<MSVehicle*
>(result.first), result.second);
4044std::pair<MSVehicle* const, double>
4046#ifdef DEBUG_OPPOSITE
4048 <<
" ego=" << ego->
getID()
4052 <<
" oppositeDir=" << oppositeDir
4060 std::pair<MSVehicle* const, double> result =
getFollower(ego, egoPos + egoLength, dist, mLinkMode);
4061 if (result.first !=
nullptr) {
4063 if (result.first->getLaneChangeModel().isOpposite()) {
4064 result.second -= result.first->getVehicleType().getLength();
4072std::pair<MSVehicle* const, double>
4074#ifdef DEBUG_OPPOSITE
4076 <<
" ego=" << ego->
getID()
4086 std::pair<MSVehicle*, double> result =
getLeader(ego, vehPos, std::vector<MSLane*>());
4089 while (result.first ==
nullptr && dist > 0) {
4094 if (next ==
nullptr) {
4098 result = next->
getLeader(ego, vehPos, std::vector<MSLane*>());
4100 if (result.first !=
nullptr) {
4101 if (result.first->getLaneChangeModel().isOpposite()) {
4102 result.second -= result.first->getVehicleType().getLength();
4104 if (result.second > POSITION_EPS) {
4106 return std::make_pair(
static_cast<MSVehicle*
>(
nullptr), -1);
4117 const std::string action = oc.
getString(
"collision.action");
4118 if (action ==
"none") {
4120 }
else if (action ==
"warn") {
4122 }
else if (action ==
"teleport") {
4124 }
else if (action ==
"remove") {
4127 WRITE_ERROR(
"Invalid collision.action '" + action +
"'.");
4186#ifdef DEBUG_INSERTION
4188 std::cout <<
SIMTIME <<
" check for pedestrians on lane=" <<
getID() <<
" pos=" << pos <<
"\n";
4193 if (leader.first != 0) {
4199#ifdef DEBUG_INSERTION
4201 <<
" isInsertionSuccess lane=" <<
getID()
4202 <<
" veh=" << aVehicle->
getID()
4205 <<
" patchSpeed=" << patchSpeed
4206 <<
" speed=" << speed
4207 <<
" stopSpeed=" << stopSpeed
4208 <<
" pedestrianLeader=" << leader.first->getID()
4209 <<
" failed (@796)!\n";
4222 const int numRNGs = oc.
getInt(
"thread-rngs");
4223 const bool random = oc.
getBool(
"random");
4224 int seed = oc.
getInt(
"seed");
4226 for (
int i = 0; i < numRNGs; i++) {
4245 throw ProcessError(
"State was saved with more than " +
toString(
getNumRNGs()) +
" threads. Change the number of threads or do not load RNG state");
4254 if (bidiEdge ==
nullptr) {
4258 assert(bidiEdge->
getLanes().size() == 1);
4279 foundStopped =
true;
4280 const double lastBrakeGap = last->getCarFollowModel().brakeGap(last->getSpeed());
4281 const double ret = last->getBackPositionOnLane() + lastBrakeGap - lengths;
4285 lengths += last->getVehicleType().getLengthWithGap() * (last->getVehicleType().getWidth() + last->getVehicleType().getMinGapLat()) /
getWidth();
4287 lengths += last->getVehicleType().getLengthWithGap();
std::vector< MSEdge * > MSEdgeVector
std::pair< const MSVehicle *, double > CLeaderDist
std::pair< const MSPerson *, double > PersonDist
ConstMSEdgeVector::const_iterator MSRouteIterator
#define WRITE_WARNINGF(...)
#define WRITE_WARNING(msg)
std::string time2string(SUMOTime t)
convert SUMOTime to string
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
const SVCPermissions SVCAll
all VClasses are allowed
bool isRailway(SVCPermissions permissions)
Returns whether an edge with the given permission is a railway edge.
@ SVC_SHIP
is an arbitrary ship
@ SVC_BICYCLE
vehicle is a bicycle
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const int STOP_DURATION_SET
@ GIVEN
The speed is given.
@ RANDOM
The lateral position is chosen randomly.
@ RIGHT
At the rightmost side of the lane.
@ GIVEN
The position is given.
@ DEFAULT
No information given; use default.
@ LEFT
At the leftmost side of the lane.
@ FREE
A free lateral position is chosen.
@ CENTER
At the center of the lane.
@ RANDOM_FREE
If a fixed number of random choices fails, a free lateral position is chosen.
@ RANDOM
The position is set by the vehroute device.
@ GIVEN
The position is given.
@ DEFAULT
No information given; use default.
@ STOP
depart position is endPos of first stop
@ FREE
A free position is chosen.
@ BASE
Back-at-zero position.
@ LAST
Insert behind the last vehicle as close as possible to still allow the specified departSpeed....
@ RANDOM_FREE
If a fixed number of random choices fails, a free position is chosen.
@ RANDOM
The speed is chosen randomly.
@ MAX
The maximum safe speed is used.
@ GIVEN
The speed is given.
@ LIMIT
The maximum lane speed is used (speedLimit)
@ DEFAULT
No information given; use default.
@ DESIRED
The maximum lane speed is used (speedLimit * speedFactor)
@ LAST
The speed of the last vehicle. Fallback to DepartSpeedDefinition::DESIRED if there is no vehicle on t...
@ AVG
The average speed on the lane. Fallback to DepartSpeedDefinition::DESIRED if there is no vehicle on t...
InsertionCheck
different checking levels for vehicle insertion
@ SUMO_TAG_LINK
Link information for state-saving.
@ SUMO_TAG_APPROACHING
Link-approaching vehicle information for state-saving.
@ SUMO_TAG_VIEWSETTINGS_VEHICLES
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ STRAIGHT
The link is a straight direction.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
@ LINKSTATE_ALLWAY_STOP
This is an uncontrolled, all-way stop link.
@ LINKSTATE_STOP
This is an uncontrolled, minor link, has to stop.
@ LINKSTATE_EQUAL
This is an uncontrolled, right-before-left link.
@ LINKSTATE_DEADEND
This is a dead end link.
@ LINKSTATE_MINOR
This is an uncontrolled, minor link, has to brake.
@ SUMO_ATTR_ARRIVALSPEEDBRAKING
@ SUMO_ATTR_STATE
The state of a link.
int gPrecision
the precision for floating point outputs
double roundDecimal(double x, int precision)
round to the given number of decimal digits
bool gDebugFlag1
global utility flags for debugging
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
double ymin() const
Returns minimum y-coordinate.
double xmin() const
Returns minimum x-coordinate.
Boundary & grow(double by)
extends the boundary by the given amount
double ymax() const
Returns maximum y-coordinate.
double xmax() const
Returns maximum x-coordinate.
static double angleDiff(const double angle1, const double angle2)
Returns the difference of the second angle to the first angle in radiants.
static double sum(double val)
Computes the resulting noise.
Container & getContainer()
bool hasBlueLight() const
MSLane * getShadowLane() const
Returns the lane the vehicle's shadow is on during continuous/sublane lane change.
virtual double getExtraReservation(int) const
reserve extra space for unseen blockers when more tnan one lane change is required
bool isChangingLanes() const
return true if the vehicle currently performs a lane change maneuver
The base class for microscopic and mesoscopic vehicles.
double getImpatience() const
Returns this vehicles impatience.
const MSEdge * succEdge(int nSuccs) const
Returns the nSuccs'th successor of edge the vehicle is currently at.
virtual double getArrivalPos() const
Returns this vehicle's desired arrivalPos for its current route (may change on reroute)
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
double getChosenSpeedFactor() const
Returns the precomputed factor by which the driver wants to be faster than the speed limit.
bool isParking() const
Returns whether the vehicle is parking.
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
bool hasDeparted() const
Returns whether this vehicle has already departed.
double basePos(const MSEdge *edge) const
departure position where the vehicle fits fully onto the edge (if possible)
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
SUMOVehicleClass getVClass() const
Returns the vehicle's access class.
NumericalID getNumericalID() const
return the numerical ID which is only for internal usage
const MSRoute & getRoute() const
Returns the current route.
SUMOTime getDepartDelay() const
Returns the depart delay.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
bool isStopped() const
Returns whether the vehicle is at a stop.
The car-following model abstraction.
virtual double getSecureGap(const MSVehicle *const, const MSVehicle *const, const double speed, const double leaderSpeed, const double leaderMaxDecel) const
Returns the minimum gap to reserve if the leader is braking at maximum (>=0)
double getCollisionMinGapFactor() const
Get the factor of minGap that must be maintained to avoid a collision event.
double getEmergencyDecel() const
Get the vehicle type's maximal phisically possible deceleration [m/s^2].
virtual double freeSpeed(const MSVehicle *const veh, double speed, double seen, double maxSpeed, const bool onInsertion=false, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's safe speed without a leader.
virtual double insertionFollowSpeed(const MSVehicle *const veh, double speed, double gap2pred, double predSpeed, double predMaxDecel, const MSVehicle *const pred=0) const
Computes the vehicle's safe speed (no dawdling) This method is used during the insertion stage....
double brakeGap(const double speed) const
Returns the distance the vehicle needs to halt including driver's reaction time tau (i....
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
double stopSpeed(const MSVehicle *const veh, const double speed, double gap, const CalcReason usage=CalcReason::CURRENT) const
Computes the vehicle's safe speed for approaching a non-moving obstacle (no dawdling)
virtual double insertionStopSpeed(const MSVehicle *const veh, double speed, double gap) const
Computes the vehicle's safe speed for approaching an obstacle at insertion without constraints due to...
std::string toString() const
print a debugging representation
int addFollower(const MSVehicle *veh, const MSVehicle *ego, double gap, double latOffset=0, int sublane=-1)
void gotActive(MSLane *l)
Informs the control that the given lane got active.
void checkCollisionForInactive(MSLane *l)
trigger collision checking for inactive lane
void needsVehicleIntegration(MSLane *const l)
A road/street connecting two junctions.
void changeLanes(SUMOTime t) const
Performs lane changing on this edge.
bool isCrossing() const
return whether this edge is a pedestrian crossing
int getPriority() const
Returns the priority of the edge.
const std::set< MSTransportable *, ComparatorNumericalIdLess > & getPersons() const
Returns this edge's persons set.
bool isWalkingArea() const
return whether this edge is walking area
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
const MSEdge * getNormalSuccessor() const
if this edge is an internal edge, return its first normal successor, otherwise the edge itself
const MSEdge * getBidiEdge() const
return opposite superposable/congruent edge, if it exist and 0 else
bool isNormal() const
return whether this edge is an internal edge
std::vector< MSTransportable * > getSortedPersons(SUMOTime timestep, bool includeRiding=false) const
Returns this edge's persons sorted by pos.
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING) const
Get the allowed lanes to reach the destination-edge.
void recalcCache()
Recalculates the cached values.
bool hasLaneChanger() const
const MSJunction * getToJunction() const
bool isInternal() const
return whether this edge is an internal edge
bool isVaporizing() const
Returns whether vehicles on this edge shall be vaporized.
MSLane * parallelLane(const MSLane *const lane, int offset, bool includeOpposite=true) const
Returns the lane with the given offset parallel to the given lane one or 0 if it does not exist.
const std::string & getEdgeType() const
Returns the type of the edge.
const MSEdgeVector & getPredecessors() const
static SUMOTime gTimeToTeleportDisconnected
static SUMOTime gTimeToGridlockHighways
static double gGridlockHighwaysSpeed
static bool gRemoveGridlocked
static SUMOTime gTimeToTeleportBidi
static double gLateralResolution
static bool gClearState
whether the simulation is in the process of clearing state (MSNet::clearState)
static bool gComputeLC
whether the simulationLoop is in the lane changing phase
static bool gEmergencyInsert
static int gNumSimThreads
how many threads to use for simulation
static bool gSublane
whether sublane simulation is enabled (sublane model or continuous lanechanging)
static SUMOTime gLaneChangeDuration
static bool gUnitTests
whether unit tests are being run
static SUMOTime gTimeToGridlock
void retractDescheduleDeparture(const SUMOVehicle *veh)
reverts a previous call to descheduleDeparture (only needed for departPos="random_free")
void descheduleDeparture(const SUMOVehicle *veh)
stops trying to emit the given vehicle (and delete it)
SumoXMLNodeType getType() const
return the type of this Junction
AnyVehicleIterator is a structure, which manages the iteration through all vehicles on the lane,...
bool nextIsMyVehicles() const
AnyVehicleIterator & operator++()
const MSVehicle * operator*()
void add(const MSLane *const l) const
Adds the given object to the container.
std::set< const Named * > & myObjects
The container.
const PositionVector & myShape
Sorts edges by their angle relative to the given edge (straight comes first)
by_connections_to_sorter(const MSEdge *const e)
constructor
int operator()(const MSEdge *const e1, const MSEdge *const e2) const
comparing operator
Sorts lanes (IncomingLaneInfos) by their priority or, if this doesn't apply, wrt. the angle differenc...
incoming_lane_priority_sorter(const MSLane *targetLane)
constructor
int operator()(const IncomingLaneInfo &lane1, const IncomingLaneInfo &lane2) const
comparing operator
Sorts lanes (their origin link) by the priority of their noninternal target edges or,...
outgoing_lane_priority_sorter(const MSLane *sourceLane)
constructor
int operator()(const MSLink *link1, const MSLink *link2) const
comparing operator
int operator()(MSVehicle *v1, MSVehicle *v2) const
Comparing operator.
Sorts vehicles by their position (descending)
int operator()(MSVehicle *v1, MSVehicle *v2) const
Comparing operator.
Representation of a lane in the micro simulation.
void addApproachingLane(MSLane *lane, bool warnMultiCon)
bool detectCollisionBetween(SUMOTime timestep, const std::string &stage, MSVehicle *collider, MSVehicle *victim, std::set< const MSVehicle *, ComparatorNumericalIdLess > &toRemove, std::set< const MSVehicle *, ComparatorNumericalIdLess > &toTeleport) const
detect whether there is a collision between the two vehicles
MFXSynchQue< MSVehicle *, std::vector< MSVehicle * > > myVehBuffer
Buffer for vehicles that moved from their previous lane onto this one. Integrated after all vehicles ...
SVCPermissions myPermissions
The vClass permissions for this lane.
MSLane * myLogicalPredecessorLane
virtual void setJunctionApproaches(const SUMOTime t) const
Register junction approaches for all vehicles after velocities have been planned.
std::set< const MSBaseVehicle * > myParkingVehicles
bool checkForPedestrians(const MSVehicle *aVehicle, double &speed, double &dist, double pos, bool patchSpeed) const
check whether pedestrians on this lane interfere with vehicle insertion
std::pair< MSVehicle *const, double > getFollower(const MSVehicle *ego, double egoPos, double dist, MinorLinkMode mLinkMode) const
Find follower vehicle for the given ego vehicle (which may be on the opposite direction lane)
std::pair< const MSPerson *, double > nextBlocking(double minPos, double minRight, double maxLeft, double stopTime=0, bool bidi=false) const
This is just a wrapper around MSPModel::nextBlocking. You should always check using hasPedestrians be...
MSLane * getParallelLane(int offset, bool includeOpposite=true) const
Returns the lane with the given offset parallel to this one or 0 if it does not exist.
double myRightSideOnEdge
the combined width of all lanes with lower index on myEdge
const StopOffset & getLaneStopOffsets() const
Returns vehicle class specific stopOffsets.
virtual void removeParking(MSBaseVehicle *veh)
remove parking vehicle. This must be syncrhonized when running with GUI
virtual ~MSLane()
Destructor.
bool insertVehicle(MSVehicle &v)
Tries to insert the given vehicle.
const MSLeaderInfo getFirstVehicleInformation(const MSVehicle *ego, double latOffset, bool onlyFrontOnLane, double maxPos=std::numeric_limits< double >::max(), bool allowCached=true) const
analogue to getLastVehicleInformation but in the upstream direction
virtual void integrateNewVehicles()
Insert buffered vehicle into the real lane.
double myLength
Lane length [m].
bool isApproachedFrom(MSEdge *const edge)
double getNettoOccupancy() const
Returns the netto (excluding minGaps) occupancy of this lane during the last step (including minGaps)
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
int getCrossingIndex() const
return the index of the link to the next crossing if this is walkingArea, else -1
PositionVector myShape
The shape of the lane.
std::map< long long, SVCPermissions > myPermissionChanges
const std::map< SUMOVehicleClass, double > * myRestrictions
The vClass speed restrictions for this lane.
virtual void incorporateVehicle(MSVehicle *veh, double pos, double speed, double posLat, const MSLane::VehCont::iterator &at, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Inserts the vehicle into this lane, and informs it about entering the network.
void initRestrictions()
initialized vClass-specific speed limits
std::vector< MSMoveReminder * > myMoveReminders
This lane's move reminder.
bool hasApproaching() const
void addParking(MSBaseVehicle *veh)
add parking vehicle. This should only used during state loading
VehCont myTmpVehicles
Container for lane-changing vehicles. After completion of lane-change- process, the containers will b...
double getDepartSpeed(const MSVehicle &veh, bool &patchSpeed)
MSLeaderInfo myFollowerInfo
followers on all sublanes as seen by vehicles on consecutive lanes (cached)
int getVehicleNumber() const
Returns the number of vehicles on this lane (for which this lane is responsible)
static SUMOTime myCollisionStopTime
static CollisionAction myCollisionAction
the action to take on collisions
MSLane * myCanonicalSuccessorLane
Main successor lane,.
SVCPermissions myChangeLeft
The vClass permissions for changing from this lane.
void getLeadersOnConsecutive(double dist, double seen, double speed, const MSVehicle *ego, const std::vector< MSLane * > &bestLaneConts, MSLeaderDistanceInfo &result, bool oppositeDirection=false) const
Returns the immediate leaders and the distance to them (as getLeaderOnConsecutive but for the sublane...
std::vector< IncomingLaneInfo > myIncomingLanes
All direct predecessor lanes.
AnyVehicleIterator anyVehiclesEnd() const
end iterator for iterating over all vehicles touching this lane in downstream direction
static void insertIDs(std::vector< std::string > &into)
Adds the ids of all stored lanes into the given vector.
bool hadPermissionChanges() const
void sortPartialVehicles()
sorts myPartialVehicles
double myFrictionCoefficient
Lane-wide friction coefficient [0..1].
MSVehicle * getFirstAnyVehicle() const
returns the first vehicle that is fully or partially on this lane
const MSLink * getEntryLink() const
Returns the entry link if this is an internal lane, else nullptr.
int getVehicleNumberWithPartials() const
Returns the number of vehicles on this lane (including partial occupators)
static bool myCheckJunctionCollisions
static void clear()
Clears the dictionary.
virtual void resetManeuverReservation(MSVehicle *v)
Unregisters a vehicle, which previously registered for maneuvering into this lane.
SVCPermissions myOriginalPermissions
The original vClass permissions for this lane (before temporary modifications)
MSEdge *const myEdge
The lane's edge, for routing only.
double myNettoVehicleLengthSum
The current length of all vehicles on this lane, excluding their minGaps.
static std::vector< MSLink * >::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts)
double getMissingRearGap(const MSVehicle *leader, double backOffset, double leaderSpeed) const
return by how much further the leader must be inserted to avoid rear end collisions
double myMaxSpeed
Lane-wide speedlimit [m/s].
void saveState(OutputDevice &out)
Saves the state of this lane into the given stream.
const MSLink * getLinkTo(const MSLane *const) const
returns the link to the given lane or nullptr, if it is not connected
int myRightmostSublane
the index of the rightmost sublane of this lane on myEdge
const bool myIsRampAccel
whether this lane is an acceleration lane
virtual void planMovements(const SUMOTime t)
Compute safe velocities for all vehicles based on positions and speeds from the last time step....
static void saveRNGStates(OutputDevice &out)
save random number generator states to the given output device
SUMOTime myFollowerInfoTime
time step for which myFollowerInfo was last updated
MSLeaderInfo myLeaderInfo
leaders on all sublanes as seen by approaching vehicles (cached)
bool isInsertionSuccess(MSVehicle *vehicle, double speed, double pos, double posLat, bool recheckNextLanes, MSMoveReminder::Notification notification)
Tries to insert the given vehicle with the given state (speed and pos)
void forceVehicleInsertion(MSVehicle *veh, double pos, MSMoveReminder::Notification notification, double posLat=0)
Inserts the given vehicle at the given position.
double getVehicleStopOffset(const MSVehicle *veh) const
Returns vehicle class specific stopOffset for the vehicle.
static void initCollisionOptions(const OptionsCont &oc)
int myNumericalID
Unique numerical ID (set on reading by netload)
VehCont myVehicles
The lane's vehicles. This container holds all vehicles that have their front (longitudinally) and the...
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
MSLeaderInfo getPartialBeyond() const
get all vehicles that are inlapping from consecutive edges
std::vector< MSVehicle * > VehCont
Container for vehicles.
bool checkFailure(const MSVehicle *aVehicle, double &speed, double &dist, const double nspeed, const bool patchSpeed, const std::string errorMsg, InsertionCheck check) const
static DictType myDict
Static dictionary to associate string-ids with objects.
static void fill(RTREE &into)
Fills the given RTree with lane instances.
double safeInsertionSpeed(const MSVehicle *veh, double seen, const MSLeaderInfo &leaders, double speed)
return the maximum safe speed for insertion behind leaders (a negative value indicates that safe inse...
std::vector< const MSJunction * > getUpcomingJunctions(double pos, double range, const std::vector< MSLane * > &contLanes) const
Returns all upcoming junctions within given range along the given (non-internal) continuation lanes m...
void addIncomingLane(MSLane *lane, MSLink *viaLink)
const MSEdge * getNextNormal() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
void addLink(MSLink *link)
Delayed initialization.
std::set< MSVehicle * > getVehiclesInRange(const double a, const double b) const
Returns all vehicles on the lane overlapping with the interval [a,b].
void enteredByLaneChange(MSVehicle *v)
double getDepartPosLat(const MSVehicle &veh)
std::pair< MSVehicle *const, double > getOppositeLeader(const MSVehicle *ego, double dist, bool oppositeDir, MinorLinkMode mLinkMode=MinorLinkMode::FOLLOW_NEVER) const
LinkState getIncomingLinkState() const
get the state of the link from the logical predecessor to this lane
void updateLengthSum()
updated current vehicle length sum (delayed to avoid lane-order-dependency)
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
static const long CHANGE_PERMISSIONS_PERMANENT
MSLane * getCanonicalPredecessorLane() const
void resetPermissions(long long transientID)
MSVehicle * getLastFullVehicle() const
returns the last vehicle for which this lane is responsible or 0
static void loadRNGState(int index, const std::string &state)
load random number generator state for the given rng index
const std::string myLaneType
the type of this lane
VehCont myManeuverReservations
The vehicles which registered maneuvering into the lane within their current action step....
void addLeaders(const MSVehicle *vehicle, double vehPos, MSLeaderDistanceInfo &result, bool oppositeDirection=false)
get leaders for ego on the given lane
static double myCheckJunctionCollisionMinGap
double getLength() const
Returns the lane's length.
double myBruttoVehicleLengthSum
The current length of all vehicles on this lane, including their minGaps.
const PositionVector & getShape() const
Returns this lane's shape.
std::vector< const MSLink * > getUpcomingLinks(double pos, double range, const std::vector< MSLane * > &contLanes) const
Returns all upcoming links within given range along the given (non-internal) continuation lanes measu...
const MSLane * getFirstInternalInConnection(double &offset) const
Returns 0 if the lane is not internal. Otherwise the first part of the connection (sequence of intern...
static int getNumRNGs()
return the number of RNGs
void handleCollisionBetween(SUMOTime timestep, const std::string &stage, const MSVehicle *collider, const MSVehicle *victim, double gap, double latGap, std::set< const MSVehicle *, ComparatorNumericalIdLess > &toRemove, std::set< const MSVehicle *, ComparatorNumericalIdLess > &toTeleport) const
take action upon collision
double getMaximumBrakeDist() const
compute maximum braking distance on this lane
const MSLane * getInternalFollowingLane(const MSLane *const) const
returns the internal lane leading to the given lane or nullptr, if there is none
static std::vector< SumoRNG > myRNGs
virtual void swapAfterLaneChange(SUMOTime t)
moves myTmpVehicles int myVehicles after a lane change procedure
std::pair< MSVehicle *const, double > getCriticalLeader(double dist, double seen, double speed, const MSVehicle &veh) const
Returns the most dangerous leader and the distance to him.
StopOffset myLaneStopOffset
const MSLeaderInfo getLastVehicleInformation(const MSVehicle *ego, double latOffset, double minPos=0, bool allowCached=true) const
Returns the last vehicles on the lane.
static void initRNGs(const OptionsCont &oc)
initialize rngs
std::set< MSVehicle * > getSurroundingVehicles(double startPos, double downstreamDist, double upstreamDist, std::shared_ptr< LaneCoverageInfo > checkedLanes) const
Returns all vehicles closer than downstreamDist along the road network starting on the given position...
MSLane(const std::string &id, double maxSpeed, double friction, double length, MSEdge *const edge, int numericalID, const PositionVector &shape, double width, SVCPermissions permissions, SVCPermissions changeLeft, SVCPermissions changeRight, int index, bool isRampAccel, const std::string &type)
Constructor.
void clearState()
Remove all vehicles before quick-loading state.
MSLane * myCanonicalPredecessorLane
Similar to LogicalPredecessorLane,.
bool myNeedsCollisionCheck
whether a collision check is currently needed
bool isLinkEnd(std::vector< MSLink * >::const_iterator &i) const
virtual double setPartialOccupation(MSVehicle *v)
Sets the information about a vehicle lapping into this lane.
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
double getRightSideOnEdge() const
std::pair< MSVehicle *const, double > getOppositeFollower(const MSVehicle *ego) const
bool hasPedestrians() const
whether the lane has pedestrians on it
const std::vector< std::pair< const MSLane *, const MSEdge * > > getOutgoingViaLanes() const
get the list of outgoing lanes
MSVehicle * getPartialBehind(const MSVehicle *ego) const
void setLaneStopOffset(const StopOffset &stopOffset)
Set vehicle class specific stopOffsets.
double myBruttoVehicleLengthSumToRemove
The length of all vehicles that have left this lane in the current step (this lane,...
void leftByLaneChange(MSVehicle *v)
MSLane * getCanonicalSuccessorLane() const
std::vector< StopWatch< std::chrono::nanoseconds > > myStopWatch
void setPermissions(SVCPermissions permissions, long long transientID)
Sets the permissions to the given value. If a transientID is given, the permissions are recored as te...
const double myWidth
Lane width [m].
bool lastInsertion(MSVehicle &veh, double mspeed, double posLat, bool patchSpeed)
inserts vehicle as close as possible to the last vehicle on this lane (or at the end of the lane if t...
void changeLanes(const SUMOTime time)
double getOppositePos(double pos) const
return the corresponding position on the opposite lane
SVCPermissions myChangeRight
const double myLengthGeometryFactor
precomputed myShape.length / myLength
virtual void executeMovements(const SUMOTime t)
Executes planned vehicle movements with regards to right-of-way.
const std::set< const MSBaseVehicle * > & getParkingVehicles() const
retrieve the parking vehicles (see GUIParkingArea)
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
double getBruttoOccupancy() const
Returns the brutto (including minGaps) occupancy of this lane during the last step.
AnyVehicleIterator anyVehiclesUpstreamEnd() const
end iterator for iterating over all vehicles touching this lane in upstream direction
int myIndex
The lane index.
double getMeanSpeedBike() const
get the mean speed of all bicycles on this lane
void updateLeaderInfo(const MSVehicle *veh, VehCont::reverse_iterator &vehPart, VehCont::reverse_iterator &vehRes, MSLeaderInfo &ahead) const
This updates the MSLeaderInfo argument with respect to the given MSVehicle. All leader-vehicles on th...
double getWaitingSeconds() const
Returns the overall waiting time on this lane.
void setMaxSpeed(double val)
Sets a new maximum speed for the lane (used by TraCI and MSCalibrator)
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
void detectPedestrianJunctionCollision(const MSVehicle *collider, const PositionVector &colliderBoundary, const MSLane *foeLane, SUMOTime timestep, const std::string &stage)
detect whether a vehicle collids with pedestrians on the junction
virtual void detectCollisions(SUMOTime timestep, const std::string &stage)
Check if vehicles are too close.
std::vector< MSLink * > myLinks
MSVehicle * getLastAnyVehicle() const
returns the last vehicle that is fully or partially on this lane
VehCont myPartialVehicles
The lane's partial vehicles. This container holds all vehicles that are partially on this lane but wh...
void sortManeuverReservations()
sorts myManeuverReservations
MinorLinkMode
determine whether/how getFollowers looks upstream beyond minor links
AnyVehicleIterator anyVehiclesUpstreamBegin() const
begin iterator for iterating over all vehicles touching this lane in upstream direction
std::vector< const MSLane * > getNormalIncomingLanes() const
get the list of all direct (disregarding internal predecessors) non-internal predecessor lanes of thi...
virtual void resetPartialOccupation(MSVehicle *v)
Removes the information about a vehicle lapping into this lane.
void setOpposite(MSLane *oppositeLane)
Adds a neighbor to this lane.
AnyVehicleIterator anyVehiclesBegin() const
begin iterator for iterating over all vehicles touching this lane in downstream direction
double getHarmonoise_NoiseEmissions() const
Returns the sum of last step noise emissions.
std::pair< MSVehicle *const, double > getLeader(const MSVehicle *veh, const double vehPos, const std::vector< MSLane * > &bestLaneConts, double dist=-1, bool checkTmpVehicles=false) const
Returns the immediate leader of veh and the distance to veh starting on this lane.
static bool myExtrapolateSubstepDepart
MSLane * getOpposite() const
return the neighboring opposite direction lane for lane changing or nullptr
void setLength(double val)
Sets a new length for the lane (used by TraCI only)
std::map< MSEdge *, std::vector< MSLane * > > myApproachingLanes
All direct internal and direct (disregarding internal predecessors) non-internal predecessor lanes of...
virtual const VehCont & getVehiclesSecure() const
Returns the vehicles container; locks it for microsimulation.
virtual void releaseVehicles() const
Allows to use the container for microsimulation again.
bool mustCheckJunctionCollisions() const
whether this lane must check for junction collisions
virtual void setManeuverReservation(MSVehicle *v)
Registers the lane change intentions (towards this lane) for the given vehicle.
MSLane * getBidiLane() const
retrieve bidirectional lane or nullptr
static double myCollisionMinGapFactor
std::pair< MSVehicle *const, double > getLeaderOnConsecutive(double dist, double seen, double speed, const MSVehicle &veh, const std::vector< MSLane * > &bestLaneConts) const
Returns the immediate leader and the distance to him.
SUMOTime myLeaderInfoTime
time step for which myLeaderInfo was last updated
@ COLLISION_ACTION_TELEPORT
@ COLLISION_ACTION_REMOVE
MSLane * getParallelOpposite() const
return the opposite direction lane of this lanes edge or nullptr
std::map< std::string, MSLane * > DictType
definition of the static dictionary type
double getFractionalVehicleLength(bool brutto) const
return length of fractional vehicles on this lane
MSEdge & getEdge() const
Returns the lane's edge.
double getSpaceTillLastStanding(const MSVehicle *ego, bool &foundStopped) const
return the empty space up to the last standing vehicle or the empty space on the whole lane if no veh...
const MSLane * getNormalPredecessorLane() const
get normal lane leading to this internal lane, for normal lanes, the lane itself is returned
virtual bool appropriate(const MSVehicle *veh) const
MSLeaderDistanceInfo getFollowersOnConsecutive(const MSVehicle *ego, double backOffset, bool allSublanes, double searchDist=-1, MinorLinkMode mLinkMode=FOLLOW_ALWAYS) const
return the sublane followers with the largest missing rear gap among all predecessor lanes (within di...
double getWidth() const
Returns the lane's width.
const std::vector< MSLink * > & getLinkCont() const
returns the container with all links !!!
bool freeInsertion(MSVehicle &veh, double speed, double posLat, MSMoveReminder::Notification notification=MSMoveReminder::NOTIFICATION_DEPARTED)
Tries to insert the given vehicle on any place.
virtual void addMoveReminder(MSMoveReminder *rem)
Add a move-reminder to move-reminder container.
double getMeanSpeed() const
Returns the mean speed on this lane.
double myNettoVehicleLengthSumToRemove
The length of all vehicles that have left this lane in the current step (this lane,...
void loadState(const std::vector< std::string > &vehIDs, MSVehicleControl &vc)
Loads the state of this segment with the given parameters.
void setFrictionCoefficient(double val)
Sets a new friction coefficient for the lane [to be later (used by TraCI and MSCalibrator)].
static CollisionAction getCollisionAction()
saves leader/follower vehicles and their distances relative to an ego vehicle
virtual std::string toString() const
print a debugging representation
CLeaderDist getClosest() const
return vehicle with the smalles gap
virtual int addLeader(const MSVehicle *veh, double gap, double latOffset=0, int sublane=-1)
void setSublaneOffset(int offset)
set number of sublanes by which to shift positions
int numFreeSublanes() const
virtual int addLeader(const MSVehicle *veh, bool beyond, double latOffset=0.)
virtual std::string toString() const
print a debugging representation
int getSublaneOffset() const
LinkState getState() const
Returns the current state of the link.
MSJunction * getJunction() const
MSLane * getLane() const
Returns the connected lane.
const std::vector< MSLink * > & getFoeLinks() const
std::vector< LinkLeader > LinkLeaders
double getInternalLengthsAfter() const
Returns the cumulative length of all internal lanes after this link.
const MSTrafficLightLogic * getTLLogic() const
Returns the TLS index.
Something on a lane to be noticed about vehicle movement.
Notification
Definition of a vehicle state.
@ NOTIFICATION_ARRIVED
The vehicle arrived at its destination (is deleted)
@ NOTIFICATION_TELEPORT_ARRIVED
The vehicle was teleported out of the net.
@ NOTIFICATION_DEPARTED
The vehicle has departed (was inserted into the network)
@ NOTIFICATION_VAPORIZED_VAPORIZER
The vehicle got vaporized with a vaporizer.
@ NOTIFICATION_VAPORIZED_COLLISION
The vehicle got removed by a collision.
@ NOTIFICATION_LOAD_STATE
The vehicle has been loaded from a state file.
@ NOTIFICATION_TELEPORT
The vehicle is being teleported.
The simulated network and simulation perfomer.
@ COLLISION
The vehicle is involved in a collision.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
static const std::string STAGE_MOVEMENTS
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
const std::map< SUMOVehicleClass, double > * getRestrictions(const std::string &id) const
Returns the restrictions for an edge type If no restrictions are present, 0 is returned.
void informVehicleStateListener(const SUMOVehicle *const vehicle, VehicleState to, const std::string &info="")
Informs all added listeners about a vehicle's state change.
bool hasPersons() const
Returns whether persons are simulated.
MSInsertionControl & getInsertionControl()
Returns the insertion control.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
virtual MSTransportableControl & getPersonControl()
Returns the person control.
bool registerCollision(const SUMOTrafficObject *collider, const SUMOTrafficObject *victim, const std::string &collisionType, const MSLane *lane, double pos)
register collision and return whether it was the first one involving these vehicles
MSEdgeControl & getEdgeControl()
Returns the edge control.
virtual PersonDist nextBlocking(const MSLane *lane, double minPos, double minRight, double maxLeft, double stopTime=0, bool bidi=false)
returns the next pedestrian beyond minPos that is laterally between minRight and maxLeft or 0
virtual bool hasPedestrians(const MSLane *lane)
whether the given lane has pedestrians on it
static bool hasOncomingRailTraffic(MSLink *link, const MSVehicle *ego, bool &brakeBeforeSignal)
static bool hasInsertionConstraint(MSLink *link, const MSVehicle *veh, std::string &info, bool &isInsertionOrder)
const MSEdge * getLastEdge() const
returns the destination edge
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
const MSLane * lane
The lane to stop at (microsim only)
double getEndPos(const SUMOVehicle &veh) const
return halting position for upcoming stop;
const SUMOVehicleParameter::Stop pars
The stop parameter.
MSPModel * getMovementModel()
Returns the default movement model for this kind of transportables.
bool isRemoteAffected(SUMOTime t) const
The class responsible for building and deletion of vehicles.
void registerTeleportYield()
register one non-collision-related teleport
double getMinDeceleration() const
return the minimum deceleration capability for all vehicles that ever entered the network
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
void registerTeleportJam()
register one non-collision-related teleport
double getMaxSpeedFactor() const
return the maximum speed factor for all vehicles that ever entered the network
void scheduleVehicleRemoval(SUMOVehicle *veh, bool checkDuplicate=false)
Removes a vehicle after it has ended.
void registerTeleportWrongLane()
register one non-collision-related teleport
void registerCollision(bool teleport)
registers one collision-related teleport
Representation of a vehicle in the micro simulation.
double getRightSideOnEdge(const MSLane *lane=0) const
Get the vehicle's lateral position on the edge of the given lane (or its current edge if lane == 0)
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
SUMOTime getLastActionTime() const
Returns the time of the vehicle's last action point.
PositionVector getBoundingPoly(double offset=0) const
get bounding polygon
void setTentativeLaneAndPosition(MSLane *lane, double pos, double posLat=0)
set tentative lane and position during insertion to ensure that all cfmodels work (some of them requi...
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
void registerInsertionApproach(MSLink *link, double dist)
register approach on insertion
void enterLaneAtInsertion(MSLane *enteredLane, double pos, double speed, double posLat, MSMoveReminder::Notification notification)
Update when the vehicle enters a new lane in the emit step.
bool isFrontOnLane(const MSLane *lane) const
Returns the information whether the front of the vehicle is on the given lane.
MSAbstractLaneChangeModel & getLaneChangeModel()
double getLeftSideOnLane() const
Get the lateral position of the vehicles left side on the lane:
double getActionStepLengthSecs() const
Returns the vehicle's action step length in secs, i.e. the interval between two action points.
const std::vector< MSLane * > getUpstreamOppositeLanes() const
Returns the sequence of opposite lanes corresponding to past lanes.
PositionVector getBoundingBox(double offset=0) const
get bounding rectangle
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
bool ignoreCollision() const
whether this vehicle is except from collision checks
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
bool resumeFromStopping()
int getBestLaneOffset() const
void adaptToJunctionLeader(const std::pair< const MSVehicle *, double > leaderInfo, const double seen, DriveProcessItem *const lastLink, const MSLane *const lane, double &v, double &vLinkPass, double distToCrossing=-1) const
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
void resetActionOffset(const SUMOTime timeUntilNextAction=0)
Resets the action offset for the vehicle.
void leaveLane(const MSMoveReminder::Notification reason, const MSLane *approachedLane=0)
Update of members if vehicle leaves a new lane in the lane change step or at arrival.
double getLatOffset(const MSLane *lane) const
Get the offset that that must be added to interpret myState.myPosLat for the given lane.
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge)
SUMOTime collisionStopTime() const
Returns the remaining time a vehicle needs to stop due to a collision. A negative value indicates tha...
double getBestLaneDist() const
returns the distance that can be driven without lane change
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
const MSLane * getLane() const
Returns the lane the vehicle is on.
bool isLeader(const MSLink *link, const MSVehicle *veh, const double gap) const
whether the given vehicle must be followed at the given junction
MSLane * getMutableLane() const
Returns the lane the vehicle is on Non const version indicates that something volatile is going on.
Influencer & getInfluencer()
double getRightSideOnLane() const
Get the lateral position of the vehicles right side on the lane:
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
double getSpeed() const
Returns the vehicle's current speed.
const std::vector< MSLane * > & getFurtherLanes() const
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
double processNextStop(double currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
double getPositionOnLane() const
Get the vehicle's position along the lane.
bool onFurtherEdge(const MSEdge *edge) const
whether this vehicle has its back (and no its front) on the given edge
double getLateralOverlap() const
return the amount by which the vehicle extends laterally outside it's primary lane
double getAngle() const
Returns the vehicle's direction in radians.
bool hasInfluencer() const
whether the vehicle is individually influenced (via TraCI or special parameters)
void executeFractionalMove(double dist)
move vehicle forward by the given distance during insertion
double getCenterOnEdge(const MSLane *lane=0) const
Get the vehicle's lateral position on the edge of the given lane (or its current edge if lane == 0)
static MSVehicleTransfer * getInstance()
Returns the instance of this object.
void add(const SUMOTime t, MSVehicle *veh)
Adds a vehicle to this transfer object.
double getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
double getMinGap() const
Get the free space in front of vehicles of this class.
double getLength() const
Get vehicle's length [m].
const SUMOVTypeParameter & getParameter() const
Base class for objects which have an id.
std::string myID
The name of the object.
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.
A RT-tree for efficient storing of SUMO's Named objects.
A storage for options typed value containers)
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
int getInt(const std::string &name) const
Returns the int-value of the named option (only for Option_Integer)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void unsetParameter(const std::string &key)
Removes a parameter.
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
bool overlapsWith(const AbstractPoly &poly, double offset=0) const
Returns the information whether the given polygon overlaps with this.
double distance2D(const Position &p, bool perpendicular=false) const
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector)
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
double angleAt2D(int pos) const
get angle in certain position of position vector
static void loadState(const std::string &state, SumoRNG *rng=nullptr)
load rng state from string
static void initRand(SumoRNG *which=nullptr, const bool random=false, const int seed=23423)
Initialises the random number generator with hardware randomness or seed.
static double rand(SumoRNG *rng=nullptr)
Returns a random real number in [0, 1)
static std::string saveState(SumoRNG *rng=nullptr)
save rng state to string
virtual const MSVehicleType & getVehicleType() const =0
Returns the object's "vehicle" type.
SUMOTime getTimeToTeleport(SUMOTime defaultValue) const
return time-to-teleport (either custom or default)
SUMOTime getTimeToTeleportBidi(SUMOTime defaultValue) const
return time-to-teleport.bidi (either custom or default)
Representation of a vehicle.
virtual const MSEdge * succEdge(int nSuccs) const =0
Returns the nSuccs'th successor of edge the vehicle is currently at.
Definition of vehicle stop (position and duration)
std::string lane
The lane to stop at.
double startPos
The stopping position start.
int parametersSet
Information for the output which parameter were set.
double endPos
The stopping position end.
bool collision
Whether this stop was triggered by a collision.
SUMOTime duration
The stopping duration.
Structure representing possible vehicle parameter.
double departPosLat
(optional) The lateral position the vehicle shall depart from
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
double departSpeed
(optional) The initial speed of the vehicle
DepartPosLatDefinition departPosLatProcedure
Information how the vehicle shall choose the lateral departure position.
double departPos
(optional) The position the vehicle shall depart from
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
int insertionChecks
bitset of InsertionCheck
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
A scoped lock which only triggers on condition.
bool isDefined() const
check if stopOffset was defined
SVCPermissions getPermissions() const
get permissions
double getOffset() const
get offset
TRACI_CONST int CMD_GET_VEHICLE_VARIABLE
TRACI_CONST int CMD_GET_EDGE_VARIABLE
TRACI_CONST int CMD_GET_PERSON_VARIABLE
TRACI_CONST int CMD_GET_LANE_VARIABLE
NLOHMANN_BASIC_JSON_TPL_DECLARATION void swap(nlohmann::NLOHMANN_BASIC_JSON_TPL &j1, nlohmann::NLOHMANN_BASIC_JSON_TPL &j2) noexcept(//NOLINT(readability-inconsistent-declaration-parameter-name) is_nothrow_move_constructible< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value &&//NOLINT(misc-redundant-expression) is_nothrow_move_assignable< nlohmann::NLOHMANN_BASIC_JSON_TPL >::value)
exchanges the values of two JSON objects
std::pair< MSVehicle *, double > vehAndGap