48 #define DEBUGCOND(PED) ((PED).myPerson->isSelected())
49 #define DEBUGCOND2(LANE) ((LANE)->isSelected())
54 for (
int i = 0; i < (int)obs.size(); ++i) {
56 <<
"(" << obs[i].description
57 <<
" x=(" << obs[i].xBack <<
"," << obs[i].xFwd
58 <<
") s=" << obs[i].speed
103 #define MINGAP_TO_VEHICLE 0.25
111 myNumActivePedestrians(0),
157 const MSLane* lane = getSidewalk<MSEdge, MSLane>(person->
getEdge());
158 if (lane ==
nullptr) {
159 std::string error =
"Person '" + person->
getID() +
"' could not find sidewalk on edge '" + person->
getEdge()->
getID() +
"', time="
177 const MSLane* lane =
dynamic_cast<PState*
>(state)->myLane;
179 for (Pedestrians::iterator it = pedestrians.begin(); it != pedestrians.end(); ++it) {
181 pedestrians.erase(it);
191 double oncomingGap, std::vector<const MSPerson*>* collectBlockers) {
193 for (Pedestrians::const_iterator it_ped = pedestrians.begin(); it_ped != pedestrians.end(); ++it_ped) {
194 const PState& ped = **it_ped;
196 const double leaderBackDist = leaderFrontDist + ped.
getLength();
199 <<
" vehSide=" << vehSide
200 <<
" vehWidth=" << vehWidth
201 <<
" lBD=" << leaderBackDist
202 <<
" lFD=" << leaderFrontDist
205 if (leaderBackDist >= -vehWidth
206 && (leaderFrontDist < 0
211 if (collectBlockers ==
nullptr) {
214 collectBlockers->push_back(ped.
myPerson);
218 if (collectBlockers ==
nullptr) {
221 return collectBlockers->size() > 0;
245 double closest = std::numeric_limits<double>::max();
247 for (Pedestrians::const_iterator it_ped = pedestrians.begin(); it_ped != pedestrians.end(); ++it_ped) {
248 const PState& ped = **it_ped;
251 if (ped.
myRelX > minPos && (result.first == 0 || closest > relX2)) {
254 const bool overlap = (center + halfWidth > minRight && center - halfWidth < maxLeft);
256 std::cout <<
" nextBlocking lane=" << lane->
getID()
257 <<
" minPos=" << minPos <<
" minRight=" << minRight <<
" maxLeft=" << maxLeft
258 <<
" stopTime=" << stopTime
261 <<
" relX2=" << relX2
262 <<
" center=" << center
263 <<
" pedLeft=" << center + halfWidth
264 <<
" pedRight=" << center - halfWidth
265 <<
" overlap=" << overlap
298 if (from ==
nullptr || to ==
nullptr) {
300 }
else if (from->
getLinkTo(to) !=
nullptr) {
302 }
else if (to->
getLinkTo(from) !=
nullptr) {
320 for (
MSLink* link : lane->getLinkCont()) {
321 if (link->getWalkingAreaFoe() !=
nullptr) {
323 myWalkingAreaFoes[&link->getWalkingAreaFoe()->getEdge()].push_back(link->getLaneBefore());
326 if (link->getWalkingAreaFoeExit() !=
nullptr) {
328 myWalkingAreaFoes[&link->getWalkingAreaFoeExit()->getEdge()].push_back(link->getLaneBefore());
340 const MSLane* walkingArea = getSidewalk<MSEdge, MSLane>(edge);
344 std::vector<const MSLane*> lanes;
346 if (!in->isTazConnector()) {
347 lanes.push_back(getSidewalk<MSEdge, MSLane>(in));
351 if (!out->isTazConnector()) {
352 lanes.push_back(getSidewalk<MSEdge, MSLane>(out));
356 for (
int j = 0; j < (int)lanes.size(); ++j) {
357 for (
int k = 0; k < (int)lanes.size(); ++k) {
360 const MSLane*
const from = lanes[j];
361 const MSLane*
const to = lanes[k];
367 const double maxExtent = fromPos.
distanceTo2D(toPos) / 4;
368 const double extrapolateBy =
MIN2(maxExtent, walkingArea->
getWidth() / 2);
370 shape.push_back(fromPos);
371 if (extrapolateBy > POSITION_EPS) {
380 if (shape.size() < 2) {
384 assert(shape.size() == 2);
404 std::vector<const MSLane*> lanes;
406 lanes.push_back(getSidewalk<MSEdge, MSLane>(pred));
409 lanes.push_back(getSidewalk<MSEdge, MSLane>(succ));
411 if (lanes.size() < 1) {
412 throw ProcessError(
"Invalid walkingarea '" + walkingArea->
getID() +
"' does not allow continuation.");
420 const MSLane* swBefore = getSidewalk<MSEdge, MSLane>(before);
421 const MSLane* swAfter = getSidewalk<MSEdge, MSLane>(after);
424 return &pathIt->second;
428 bool useBefore = swBefore !=
nullptr && std::find(preds.begin(), preds.end(), before) != preds.end();
429 bool useAfter = swAfter !=
nullptr && std::find(succs.begin(), succs.end(), after) != succs.end();
433 }
else if (succs.size() > 0) {
435 return getWalkingAreaPath(walkingArea, swBefore, getSidewalk<MSEdge, MSLane>(succs.front()));
437 }
else if (useAfter && preds.size() > 0) {
439 return getWalkingAreaPath(walkingArea, getSidewalk<MSEdge, MSLane>(preds.front()), swAfter);
450 return &pathIt->second;
454 if (preds.size() > 0) {
456 const auto pathIt2 =
myWalkingAreaPaths.find(std::make_pair(getSidewalk<MSEdge, MSLane>(pred), after));
458 return &pathIt2->second;
472 const MSLane* nextRouteLane = getSidewalk<MSEdge, MSLane>(nextRouteEdge);
474 const MSLane* nextLane = nextRouteLane;
475 const MSLink* link =
nullptr;
481 if (nextRouteLane ==
nullptr && nextRouteEdge !=
nullptr) {
482 std::string error =
"Person '" + ped.
myPerson->
getID() +
"' could not find sidewalk on edge '" + nextRouteEdge->
getID() +
"', time="
486 nextRouteLane = nextRouteEdge->
getLanes().front();
492 if (nextRouteLane !=
nullptr) {
497 nextLane = currentLane->
getLinkCont()[0]->getViaLaneOrLane();
502 std::cout <<
" internal\n";
507 nextLane = currentLane->
getLinkCont()[0]->getLane();
512 std::cout <<
" crossing\n";
519 const double arrivalPos = (nextRouteEdge == ped.
myStage->
getRoute().back()
523 if (prevLane !=
nullptr) {
524 prohibited.push_back(&prevLane->
getEdge());
529 <<
" nre=" << nextRouteEdge->
getID()
530 <<
" nreDir=" << nextRouteEdgeDir
531 <<
" aPos=" << arrivalPos
532 <<
" crossingRoute=" <<
toString(crossingRoute)
535 if (crossingRoute.size() > 1) {
536 const MSEdge* nextEdge = crossingRoute[1];
537 nextLane = getSidewalk<MSEdge, MSLane>(crossingRoute[1]);
539 assert(nextLane != prevLane);
542 std::cout <<
" nextDir=" << nextDir <<
"\n";
551 link = oppositeWalkingArea->
getLinkTo(nextLane);
554 assert(link !=
nullptr);
558 <<
" no route from '" << (currentEdge ==
nullptr ?
"NULL" : currentEdge->
getID())
559 <<
"' to '" << (nextRouteEdge ==
nullptr ?
"NULL" : nextRouteEdge->
getID())
563 +
"' from walkingArea '" + currentEdge->
getID()
564 +
"' to edge '" + nextRouteEdge->
getID() +
"', time=" +
567 nextLane = nextRouteLane;
569 }
else if (currentEdge == nextRouteEdge) {
571 nextDir = -ped.
myDir;
576 if (nextLane !=
nullptr) {
579 std::cout <<
" next walkingArea " << (nextDir ==
FORWARD ?
"forward" :
"backward") <<
"\n";
587 link = currentLane->
getLinkTo(nextRouteLane);
588 if (link !=
nullptr) {
590 std::cout <<
" direct forward\n";
595 link = nextRouteLane->
getLinkTo(currentLane);
596 if (link !=
nullptr) {
598 std::cout <<
" direct backward\n";
601 if (nextLane !=
nullptr) {
603 while (nextLane->
getLinkCont()[0]->getViaLaneOrLane()->isInternal()) {
604 nextLane = nextLane->
getLinkCont()[0]->getViaLaneOrLane();
610 if (nextLane ==
nullptr) {
612 nextLane = nextRouteLane;
614 std::cout <<
SIMTIME <<
" no next lane found for " << currentLane->
getID() <<
" dir=" << ped.
myDir <<
"\n";
618 +
"' from edge '" + currentEdge->
getID()
619 +
"' to edge '" + nextRouteEdge->
getID() +
"', time=" +
622 }
else if (nextLane->
getLength() <= POSITION_EPS) {
634 nextLane = nextRouteLane;
643 <<
" l=" << currentLane->
getID()
644 <<
" nl=" << (nextLane ==
nullptr ?
"NULL" : nextLane->
getID())
645 <<
" nrl=" << (nextRouteLane ==
nullptr ?
"NULL" : nextRouteLane->
getID())
648 <<
" pedDir=" << ped.
myDir
651 assert(nextLane != 0 || nextRouteLane == 0);
660 if (l->getLane()->getEdge().isWalkingArea()) {
666 const std::vector<MSLane::IncomingLaneInfo>& laneInfos = currentLane->
getIncomingLanes();
667 for (std::vector<MSLane::IncomingLaneInfo>::const_iterator it = laneInfos.begin(); it != laneInfos.end(); ++it) {
668 if ((*it).lane->getEdge().isWalkingArea()) {
669 link = (*it).viaLink;
680 const PState& ego = *pedestrians[egoIndex];
681 const int egoStripe = ego.
stripe();
683 std::vector<bool> haveBlocker(stripes,
false);
684 for (
int index = egoIndex + 1; index < (int)pedestrians.size(); index++) {
685 const PState& p = *pedestrians[index];
687 std::cout <<
SIMTIME <<
" ped=" << ego.
getID() <<
" cur=" << egoStripe <<
" checking neighbor " << p.
getID()
693 std::cout <<
" dist=" << ego.
distanceTo(o) << std::endl;
701 haveBlocker[p.
stripe()] =
true;
712 if (!haveBlocker[p.
stripe()]) {
731 int offset = (destStripes - origStripes) / 2;
733 offset += (destStripes - origStripes) % 2;
741 MSLane* lane,
const MSLane* nextLane,
int stripes,
int nextDir,
742 double currentLength,
int currentDir) {
743 if (nextLanesObs.count(nextLane) == 0) {
750 const int offset =
getStripeOffset(nextStripes, stripes, currentDir != nextDir && nextStripes > stripes);
761 if (nextStripes < stripes) {
763 for (
int ii = 0; ii < stripes; ++ii) {
764 if (ii < offset || ii >= nextStripes + offset) {
775 if ((stripes - nextStripes) % 2 != 0) {
778 nextDir = currentDir;
780 for (
int ii = 0; ii < (int)pedestrians.size(); ++ii) {
781 PState& p = *pedestrians[ii];
786 const double newY = relPos.
y() + lateral_offset;
797 sort(pedestrians.begin(), pedestrians.end(),
by_xpos_sorter(nextDir));
798 for (
int ii = 0; ii < (int)pedestrians.size(); ++ii) {
799 const PState& p = *pedestrians[ii];
805 if (nextDir != currentDir) {
810 const int stripe = p.
stripe(newY);
811 if (stripe >= 0 && stripe < stripes) {
815 if (otherStripe >= 0 && otherStripe < stripes) {
816 obs[otherStripe] = pObs;
831 nextLanesObs[nextLane] = obs;
833 return nextLanesObs[nextLane];
838 for (
int ii = 0; ii < (int)obs.size(); ++ii) {
842 o.
xFwd += currentLength;
843 o.
xBack += currentLength;
845 const double tmp = o.
xFwd;
846 o.
xFwd = currentLength + nextLength - o.
xBack;
847 o.
xBack = currentLength + nextLength - tmp;
851 const double tmp = o.
xFwd;
855 o.
xFwd -= nextLength;
856 o.
xBack -= nextLength;
866 if ((dir ==
FORWARD && x - width / 2. < obs[stripe].xBack) || (dir ==
BACKWARD && x + width / 2. > obs[stripe].xFwd)) {
867 obs[stripe] =
Obstacle(x, 0, type,
id, width);
875 const MSLane* lane = it_lane->first;
877 if (pedestrians.size() == 0) {
883 const double minY =
stripeWidth * - 0.5 + NUMERICAL_EPS;
888 std::set<const WalkingAreaPath*, walkingarea_path_sorter> paths;
889 for (Pedestrians::iterator it = pedestrians.begin(); it != pedestrians.end(); ++it) {
892 if (p->
myDir == dir) {
896 std::cout <<
SIMTIME <<
" debugging WalkingAreaPath from=" << debugPath->from->getID() <<
" to=" << debugPath->to->getID() <<
"\n";
901 for (std::set<const WalkingAreaPath*, walkingarea_path_sorter>::iterator it = paths.begin(); it != paths.end(); ++it) {
905 transformedPeds.reserve(pedestrians.size());
906 for (Pedestrians::iterator it_p = pedestrians.begin(); it_p != pedestrians.end(); ++it_p) {
909 transformedPeds.push_back(p);
910 if (path == debugPath) std::cout <<
" ped=" << p->
myPerson->
getID() <<
" relX=" << p->
myRelX <<
" relY=" << p->
myRelY <<
" (untransformed), vecCoord="
915 transformedPeds.push_back(p);
916 if (path == debugPath) std::cout <<
" ped=" << p->
myPerson->
getID() <<
" relX=" << p->
myRelX <<
" relY=" << p->
myRelY <<
" (untransformed), vecCoord="
925 toDelete.push_back(tp);
926 transformedPeds.push_back(tp);
927 if (path == debugPath) std::cout <<
" ped=" << p->
myPerson->
getID() <<
" relX=" << p->
myRelX <<
" relY=" << p->
myRelY <<
" (semi-transformed), vecCoord="
932 const double newY = relPos.
y() + lateral_offset;
940 toDelete.push_back(tp);
941 transformedPeds.push_back(tp);
942 if (path == debugPath) {
943 std::cout <<
" ped=" << p->
myPerson->
getID() <<
" relX=" << relPos.
x() <<
" relY=" << newY <<
" (transformed), vecCoord=" << relPos <<
"\n";
946 if (path == debugPath) {
947 std::cout <<
" ped=" << p->
myPerson->
getID() <<
" relX=" << relPos.
x() <<
" relY=" << newY <<
" (invalid), vecCoord=" << relPos <<
"\n";
957 for (
const MSLane* foeLane : itFoe->second) {
963 if (
addVehicleFoe(veh, lane, relPos, lateral_offset, minY, maxY, toDelete, transformedPeds)
964 &&
addVehicleFoe(veh, lane, relPos2, lateral_offset, minY, maxY, toDelete, transformedPeds)) {
968 const double relDist = dist / length;
969 Position between = (relPos * relDist) + (relPos2 * (1 - relDist));
970 addVehicleFoe(veh, lane, between, lateral_offset, minY, maxY, toDelete, transformedPeds);
979 for (Pedestrians::iterator it_p = toDelete.begin(); it_p != toDelete.end(); ++it_p) {
995 const double newY = relPos.
y() + lateral_offset;
996 if (newY >= minY && newY <= maxY) {
999 toDelete.push_back(tp);
1000 transformedPeds.push_back(tp);
1011 sort(pedestrians.begin(), pedestrians.end(),
by_xpos_sorter(dir));
1013 for (
int i = 0; i < (int)pedestrians.size(); i++) {
1014 PState*
const p = pedestrians[i];
1021 pedestrians.erase(pedestrians.begin() + i);
1024 if (p->
myLane !=
nullptr) {
1043 sort(pedestrians.begin(), pedestrians.end(),
by_xpos_sorter(dir));
1046 bool hasCrossingVehObs =
false;
1049 hasCrossingVehObs =
addCrossingVehs(lane, stripes, 0, dir, crossingVehs,
true);
1052 for (
int ii = 0; ii < (int)pedestrians.size(); ++ii) {
1053 PState& p = *pedestrians[ii];
1083 nextLanesObs, lane, nextLane, stripes,
1102 const double passingClearanceTime = 2;
1103 const double passingLength = p.
getLength() + passingClearanceTime * speed;
1114 && !link->
opened(currentTime -
DELTA_T, speed, speed, passingLength, p.
getImpatience(currentTime), speed, 0, 0,
nullptr, p.
ignoreRed(link), p.
myPerson)) {
1146 if (hasCrossingVehObs) {
1155 p.
walk(currentObs, currentTime);
1162 for (
int coll = 0; coll < ii; ++coll) {
1163 PState& c = *pedestrians[coll];
1170 +
"', lane='" + lane->
getID() +
"', time=" +
time2string(currentTime) +
".");
1183 bool hasCrossingVehObs =
false;
1188 if (linkLeaders.size() > 0) {
1189 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
1191 const MSVehicle* veh = (*it).vehAndGap.first;
1192 if (veh !=
nullptr) {
1197 voBlock.
xBack = NUMERICAL_EPS;
1204 const double bGap = (prio
1206 : veh->
getSpeed() * distToCrossBeforeVeh);
1210 if ((*it).fromLeft) {
1211 vehYmin = -(*it).vehAndGap.second + lateral_offset;
1215 vehYmax = crossing->
getWidth() + (*it).vehAndGap.second - lateral_offset;
1229 hasCrossingVehObs =
true;
1234 <<
" crossingVeh=" << veh->
getID()
1235 <<
" lane=" << crossing->
getID()
1237 <<
" latOffset=" << lateral_offset
1239 <<
" stripes=" << stripes
1240 <<
" dist=" << (*it).distToCrossing
1241 <<
" gap=" << (*it).vehAndGap.second
1242 <<
" brakeGap=" << bGap
1243 <<
" fromLeft=" << (*it).fromLeft
1244 <<
" distToCrossBefore=" << distToCrossBeforeVeh
1245 <<
" ymin=" << vehYmin
1246 <<
" ymax=" << vehYmax
1255 return hasCrossingVehObs;
1270 if (ped !=
nullptr) {
1290 const double vehNextSpeed =
MAX2(veh->
getSpeed(), 1.0);
1305 if (s == current && vehFront +
SAFETY_GAP < minX) {
1307 if (pRelY - pWidth < vehYmax &&
1308 pRelY + pWidth > vehYmin && dir ==
FORWARD) {
1310 std::cout <<
" ignoring vehicle '" << veh->
getID() <<
" on stripe " << s <<
" vehFrontSG=" << vehFront +
SAFETY_GAP <<
" minX=" << minX <<
"\n";
1321 std::cout <<
SIMTIME <<
" ped=" << pID <<
" veh=" << veh->
getID() <<
" obstacle on lane=" << lane->
getID()
1323 <<
" ymin=" << vehYmin
1324 <<
" ymax=" << vehYmax
1327 <<
" relY=" << pRelY
1328 <<
" current=" << current
1329 <<
" vo.xFwd=" << vo.
xFwd
1330 <<
" vo.xBack=" << vo.
xBack
1346 type(OBSTACLE_NONE),
1352 xFwd(ped.getMaxX()),
1353 xBack(ped.getMinX()),
1354 speed(ped.myDir * ped.mySpeed),
1356 description(ped.getID()) {
1368 myRelX(stage->getDepartPos()),
1369 myRelY(stage->getDepartPosLat()),
1372 myWaitingToEnter(true),
1374 myWalkingAreaPath(nullptr),
1377 myAngle(std::numeric_limits<double>::max()) {
1380 assert(!route.empty());
1381 if (route.size() == 1) {
1387 if (route.front()->isWalkingArea()) {
1394 std::cout <<
" initialize dir for " <<
myPerson->
getID() <<
" forward=" << mayStartForward <<
" backward=" << mayStartBackward <<
"\n";
1396 if (mayStartForward && mayStartBackward) {
1400 if (crossingRoute.size() > 1) {
1402 const MSEdge* nextEdge = crossingRoute[1];
1408 std::cout <<
" crossingRoute=" <<
toString(crossingRoute) <<
"\n";
1437 myWaitingToEnter(false),
1439 myWalkingAreaPath(nullptr),
1442 myAngle(std::numeric_limits<double>::max()) {
1450 return myRelX - getLength();
1452 return myRelX - (includeMinGap ? getMinGap() : 0.);
1460 return myRelX + (includeMinGap ? getMinGap() : 0.);
1462 return myRelX + getLength();
1468 return myPerson->getVehicleType().getLength();
1474 return myPerson->getVehicleType().getMinGap();
1486 const int s = stripe(relY);
1490 if (offset > threshold) {
1492 }
else if (offset < -threshold) {
1517 if (myStage->getNextRouteEdge() ==
nullptr) {
1518 return myDir * (myStage->getArrivalPos() - myRelX) - POSITION_EPS;
1520 const double length = myWalkingAreaPath ==
nullptr ? myLane->getLength() : myWalkingAreaPath->length;
1521 return myDir ==
FORWARD ? length - myRelX : myRelX;
1528 double dist = distToLaneEnd();
1530 std::cout <<
SIMTIME <<
" ped=" << myPerson->getID() <<
" myRelX=" << myRelX <<
" dist=" << dist <<
"\n";
1538 const int oldDir = myDir;
1539 const MSLane* oldLane = myLane;
1540 myLane = myNLI.lane;
1542 const bool normalLane = (myLane ==
nullptr || myLane->getEdge().getFunction() ==
SumoXMLEdgeFunc::NORMAL || &myLane->getEdge() == myStage->getNextRouteEdge());
1545 <<
" ped=" << myPerson->getID()
1546 <<
" moveToNextLane old=" << oldLane->
getID()
1547 <<
" new=" << (myLane ==
nullptr ?
"NULL" : myLane->getID())
1548 <<
" oldDir=" << oldDir
1549 <<
" newDir=" << myDir
1550 <<
" myRelX=" << myRelX
1554 if (myLane ==
nullptr) {
1555 myRelX = myStage->getArrivalPos();
1558 if (myStage->getRouteStep() == myStage->getRoute().end() - 1) {
1561 const bool arrived = myStage->moveToNextEdge(myPerson, currentTime, normalLane ?
nullptr : &myLane->getEdge());
1566 assert(myNLI.lane != oldLane);
1568 std::cout <<
" nextLane=" << (myNLI.lane ==
nullptr ?
"NULL" : myNLI.lane->getID()) <<
"\n";
1570 if (myLane->getEdge().isWalkingArea()) {
1573 assert(myWalkingAreaPath->shape.size() >= 2);
1575 std::cout <<
" mWAPath shape=" << myWalkingAreaPath->shape <<
" length=" << myWalkingAreaPath->length <<
"\n";
1581 const MSEdge* currRouteEdge = *myStage->getRouteStep();
1582 const MSEdge* nextRouteEdge = myStage->getNextRouteEdge();
1590 myStage->moveToNextEdge(myPerson, currentTime,
nullptr);
1591 myLane = myNLI.lane;
1592 assert(myLane != 0);
1595 myWalkingAreaPath =
nullptr;
1597 throw ProcessError(
"Disconnected walk for person '" + myPerson->getID() +
"'.");
1601 myWalkingAreaPath =
nullptr;
1606 const double newLength = (myWalkingAreaPath ==
nullptr ? myLane->getLength() : myWalkingAreaPath->length);
1607 if (-dist > newLength) {
1614 myRelX = newLength + dist;
1619 std::cout <<
SIMTIME <<
" update myRelX ped=" << myPerson->getID()
1620 <<
" newLength=" << newLength
1622 <<
" myRelX=" << myRelX
1626 if (myDir != oldDir) {
1633 std::cout <<
SIMTIME <<
" transformY ped=" << myPerson->getID()
1635 <<
" newY=" << myRelY
1637 <<
" od=" << oldDir <<
" nd=" << myDir
1638 <<
" offset=" << offset <<
"\n";
1649 myAngle = std::numeric_limits<double>::max();
1650 const int stripes = (int)obs.size();
1651 const int sMax = stripes - 1;
1653 const double vMax = myStage->getMaxSpeed(myPerson);
1655 const int current = stripe();
1656 const int other = otherStripe();
1658 std::vector<double> distance(stripes);
1659 for (
int i = 0; i < stripes; ++i) {
1660 distance[i] = distanceTo(obs[i], obs[i].type ==
OBSTACLE_PED);
1663 std::vector<double> utility(stripes, 0);
1665 for (
int i = 0; i < stripes; ++i) {
1667 if (i == current && (!myWaitingToEnter || stripe() != stripe(myRelY))) {
1671 for (
int j = 0; j <= i; ++j) {
1676 for (
int j = i; j < stripes; ++j) {
1685 const bool onJunction = myLane->getEdge().isWalkingArea() || myLane->getEdge().isCrossing();
1688 for (
int i = 0; i < reserved; ++i) {
1692 for (
int i = sMax; i > sMax - reserved; --i) {
1697 for (
int i = 0; i < stripes; ++i) {
1698 if (obs[i].speed * myDir < 0) {
1700 if (myDir ==
FORWARD && i > 0) {
1701 utility[i - 1] -= 0.5;
1702 }
else if (myDir ==
BACKWARD && i < sMax) {
1703 utility[i + 1] -= 0.5;
1707 const double walkDist =
MAX2(0., distance[i]);
1709 const double expectedDist =
MIN2(vMax *
LOOKAHEAD_SAMEDIR, walkDist + obs[i].speed * myDir * lookAhead);
1711 std::cout <<
" util=" << utility[i] <<
" exp=" << expectedDist <<
" dist=" << distance[i] <<
"\n";
1713 if (expectedDist >= 0) {
1714 utility[i] += expectedDist;
1721 if (myDir ==
FORWARD && obs[0].speed < 0) {
1723 }
else if (myDir ==
BACKWARD && obs[sMax].speed > 0) {
1727 if (distance[current] > 0 && myWaitingTime == 0) {
1728 for (
int i = 0; i < stripes; ++i) {
1734 int chosen = current;
1735 for (
int i = 0; i < stripes; ++i) {
1741 const int next = (chosen == current ? current : (chosen < current ? current - 1 : current + 1));
1742 double xDist =
MIN3(distance[current], distance[other], distance[next]);
1743 if (next != chosen) {
1746 const int nextOther = chosen < current ? current - 2 : current + 2;
1747 xDist =
MIN2(xDist, distance[nextOther]);
1750 const double preferredGap = NUMERICAL_EPS;
1752 if (xSpeed < NUMERICAL_EPS) {
1756 std::cout <<
" xSpeedPotential=" << xSpeed <<
"\n";
1763 (xDist == distance[current] && obs[current].type >=
OBSTACLE_END)
1764 || (xDist == distance[other] && obs[other].type >=
OBSTACLE_END)
1765 || (xDist == distance[next] && obs[next].type >=
OBSTACLE_END))
1771 || (sMax == 0 && obs[0].speed * myDir < 0 && myWaitingTime >
jamTimeNarrow)
1777 +
"' is jammed on edge '" + myStage->getEdge()->getID()
1783 }
else if (stripe(myRelY) >= 0 && stripe(myRelY) <= sMax) {
1807 if (fabs(yDist) > NUMERICAL_EPS) {
1808 ySpeed = (yDist > 0 ?
1814 && stripe() == stripe(myRelY)
1816 && !myLane->getEdge().isCrossing()) {
1818 myRelY += myDir * vMax;
1823 <<
" ped=" << myPerson->getID()
1824 <<
" edge=" << myStage->getEdge()->getID()
1828 <<
" pvx=" << mySpeed
1829 <<
" cur=" << current
1830 <<
" cho=" << chosen
1834 <<
" dawdle=" << dawdle
1838 <<
" vMax=" << myStage->getMaxSpeed(myPerson)
1839 <<
" wTime=" << myStage->getWaitingTime(currentTime)
1840 <<
" jammed=" << myAmJammed
1841 <<
"\n distance=" <<
toString(distance)
1842 <<
"\n utility=" <<
toString(utility)
1850 myWaitingToEnter =
false;
1860 return MAX2(0.,
MIN2(1., myPerson->getVehicleType().getImpatience()
1874 return myRemoteXYPos;
1876 if (myLane ==
nullptr) {
1880 const double lateral_offset = myRelY + (
stripeWidth - myLane->getWidth()) * 0.5;
1881 if (myWalkingAreaPath ==
nullptr) {
1895 return myWalkingAreaPath->shape.positionAtOffset(myRelX, lateral_offset);
1902 if (myAngle != std::numeric_limits<double>::max()) {
1905 if (myLane ==
nullptr) {
1909 const PositionVector& shp = myWalkingAreaPath ==
nullptr ? myLane->getShape() : myWalkingAreaPath->shape;
1910 double geomX = myWalkingAreaPath ==
nullptr ? myLane->interpolateLanePosToGeometryPos(myRelX) : myRelX;
1922 return myWaitingTime;
1934 return myNLI.lane ==
nullptr ? nullptr : &myNLI.lane->getEdge();
1939 double lanePosLat,
double angle,
int routeOffset,
1942 assert(p == myPerson);
1943 assert(pm !=
nullptr);
1946 #ifdef DEBUG_MOVETOXY
1950 <<
" lane=" << lane->
getID()
1951 <<
" lanePos=" << lanePos
1952 <<
" lanePosLat=" << lanePosLat
1953 <<
" angle=" << angle
1954 <<
" routeOffset=" << routeOffset
1957 <<
" path=" << (myWalkingAreaPath ==
nullptr ?
"null" : (myWalkingAreaPath->from->getID() +
"->" + myWalkingAreaPath->to->getID())) <<
"\n";
1960 if (lane != myLane && myLane !=
nullptr) {
1964 if (lane !=
nullptr &&
1967 const MSEdge* old = myStage->getEdge();
1968 const MSLane* oldLane = myLane;
1969 if (lane != myLane) {
1973 if (edges.empty()) {
1975 myStage->setRouteIndex(myPerson, routeOffset);
1977 myStage->replaceRoute(myPerson, edges, routeOffset);
1980 myStage->moveToNextEdge(myPerson, t, &lane->
getEdge());
1986 if (myWalkingAreaPath ==
nullptr || myWalkingAreaPath->lane != lane) {
1988 myWalkingAreaPath =
guessPath(&lane->
getEdge(), old, myStage->getNextRouteEdge());
1989 #ifdef DEBUG_MOVETOXY
1991 <<
" path=" << myWalkingAreaPath->from->getID() <<
"->" << myWalkingAreaPath->to->getID() <<
"\n";
1996 const Position relPos = myWalkingAreaPath->shape.transformToVectorCoordinates(pos);
1999 myRemoteXYPos = pos;
2001 myRelX = relPos.
x();
2002 myRelY = lateral_offset + relPos.
y();
2005 myWalkingAreaPath =
nullptr;
2007 myRelY = lateral_offset - lanePosLat;
2011 if (myStage->getNextRouteEdge() !=
nullptr) {
2012 if (myStage->getEdge()->getToJunction() == myStage->getNextRouteEdge()->getFromJunction() ||
2013 myStage->getEdge()->getToJunction() == myStage->getNextRouteEdge()->getToJunction()) {
2020 if (angleDiff <= 90) {
2031 if (oldLane ==
nullptr || &oldLane->
getEdge() != &myLane->getEdge()) {
2032 const MSLane* sidewalk = getSidewalk<MSEdge, MSLane>(&myLane->getEdge());
2035 myNLI =
getNextLane(*
this, sidewalk ==
nullptr ? myLane : sidewalk,
nullptr);
2036 #ifdef DEBUG_MOVETOXY
2037 std::cout <<
" myNLI=" <<
Named::getIDSecure(myNLI.lane) <<
" link=" << (myNLI.link ==
nullptr ?
"NULL" : myNLI.link->getDescription()) <<
" dir=" << myNLI.dir <<
"\n";
2040 #ifdef DEBUG_MOVETOXY
2041 std::cout <<
" newRelPos=" <<
Position(myRelX, myRelY) <<
" edge=" << myPerson->getEdge()->getID() <<
" newPos=" << myPerson->getPosition()
2042 <<
" oldAngle=" << oldAngle <<
" angleDiff=" << angleDiff <<
" newDir=" << myDir <<
"\n";
2046 myRemoteXYPos = pos;
2065 const double maxX = getMaxX(includeMinGap);
2066 const double minX = getMinX(includeMinGap);
2070 if ((obs.
xFwd >= maxX && obs.
xBack <= maxX) || (obs.
xFwd <= maxX && obs.
xFwd >= minX)) {
2084 for (
int i = 0; i < (int)into.size(); ++i) {
2086 std::cout <<
" i=" << i <<
" maxX=" << getMaxX(
true) <<
" minX=" << getMinX(
true)
2087 <<
" into=" << into[i].description <<
" iDist=" << distanceTo(into[i], into[i].type ==
OBSTACLE_PED)
2088 <<
" obs2=" << obs2[i].description <<
" oDist=" << distanceTo(obs2[i], obs2[i].type ==
OBSTACLE_PED) <<
"\n";
2090 const double dO = distanceTo(obs2[i], obs2[i].type ==
OBSTACLE_PED);
2091 const double dI = distanceTo(into[i], into[i].type ==
OBSTACLE_PED);
2106 for (
int i = 0; i < (int)into.size(); ++i) {
2107 int i2 = i + offset;
2108 if (i2 >= 0 && i2 < (
int)obs2.size()) {
2110 if (obs2[i2].xBack < into[i].xBack) {
2114 if (obs2[i2].xFwd > into[i].xFwd) {
2127 if (ignoreRedTime >= 0) {
2130 std::cout <<
SIMTIME <<
" ignoreRedTime=" << ignoreRedTime <<
" redDuration=" << redDuration <<
"\n";
2132 return ignoreRedTime > redDuration;
2143 return myPerson->getID();
2148 return myPerson->getVehicleType().getWidth();
2154 return myPerson->hasInfluencer() && myPerson->getInfluencer().isRemoteControlled();
2170 return myVehicle->getID();
2175 return myVehicle->getVehicleType().getWidth();
2180 return myRelX - myVehicle->getVehicleType().getWidth() / 2 -
SAFETY_GAP ;
2185 return myRelX + myVehicle->getVehicleType().getWidth() / 2 +
SAFETY_GAP;
2194 std::set<MSPerson*> changedLane;
2195 myModel->moveInDirection(currentTime, changedLane,
FORWARD);
2196 myModel->moveInDirection(currentTime, changedLane,
BACKWARD);
2199 for (ActiveLanes::const_iterator it_lane = myModel->getActiveLanes().begin(); it_lane != myModel->getActiveLanes().end(); ++it_lane) {
2200 const MSLane* lane = it_lane->first;
2202 if (pedestrians.size() == 0) {
2207 for (
int ii = 0; ii < (int)pedestrians.size(); ++ii) {
2208 const PState& p = *pedestrians[ii];
std::vector< const MSEdge * > ConstMSEdgeVector
std::vector< MSEdge * > MSEdgeVector
std::pair< const MSPerson *, double > PersonDist
#define MINGAP_TO_VEHICLE
#define WRITE_WARNING(msg)
std::string time2string(SUMOTime t)
convert SUMOTime to string
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
@ SUMO_ATTR_JM_DRIVE_AFTER_RED_TIME
bool gDebugFlag1
global utility flags for debugging
#define UNUSED_PARAMETER(x)
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)
static double naviDegree(const double angle)
static double fromNaviDegree(const double angle)
static double getMinAngleDiff(double angle1, double angle2)
Returns the minimum distance (clockwise/counter-clockwise) between both angles.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
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].
A road/street connecting two junctions.
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
bool isCrossing() const
return whether this edge is a pedestrian crossing
const MSEdgeVector & getPredecessors() const
bool isWalkingArea() const
return whether this edge is walking area
bool isNormal() const
return whether this edge is an internal edge
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
const MSJunction * getFromJunction() const
double getLength() const
return the length of the edge
bool isInternal() const
return whether this edge is an internal edge
const MSJunction * getToJunction() const
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
static bool gCheck4Accidents
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
The base class for an intersection.
AnyVehicleIterator is a structure, which manages the iteration through all vehicles on the lane,...
Representation of a lane in the micro simulation.
const std::vector< MSLink * > & getLinkCont() const
returns the container with all links !!!
AnyVehicleIterator anyVehiclesEnd() const
end iterator for iterating over all vehicles touching this lane in downstream direction
int getVehicleNumberWithPartials() const
Returns the number of vehicles on this lane (including partial occupators)
const MSLink * getLinkTo(const MSLane *const) const
returns the link to the given lane or nullptr, if it is not connected
double getLength() const
Returns the lane's length.
const MSLane * getInternalFollowingLane(const MSLane *const) const
returns the internal lane leading to the given lane or nullptr, if there is none
MSLane * getCanonicalSuccessorLane() const
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
AnyVehicleIterator anyVehiclesUpstreamEnd() const
end iterator for iterating over all vehicles touching this lane in upstream direction
MSEdge & getEdge() const
Returns the lane's edge.
const PositionVector & getShape() const
Returns this lane's shape.
AnyVehicleIterator anyVehiclesUpstreamBegin() const
begin iterator for iterating over all vehicles touching this lane in upstream direction
AnyVehicleIterator anyVehiclesBegin() const
begin iterator for iterating over all vehicles touching this lane in downstream direction
double getWidth() const
Returns the lane's width.
SUMOTime getLastStateChange() const
MSLane * getLane() const
Returns the connected lane.
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
bool havePriority() const
Returns whether this link is a major link.
const LinkLeaders getLeaderInfo(const MSVehicle *ego, double dist, std::vector< const MSPerson * > *collectBlockers=0, bool isShadowLink=false) const
Returns all potential link leaders (vehicles on foeLanes) Valid during the planMove() phase.
std::vector< LinkLeader > LinkLeaders
const MSTrafficLightLogic * getTLLogic() const
Returns the TLS index.
bool opened(SUMOTime arrivalTime, double arrivalSpeed, double leaveSpeed, double vehicleLength, double impatience, double decel, SUMOTime waitingTime, double posLat=0, BlockingFoes *collectFoes=nullptr, bool ignoreRed=false, const SUMOTrafficObject *ego=nullptr) const
Returns the information whether the link may be passed.
bool haveRed() const
Returns whether this link is blocked by a red (or redyellow) traffic light.
The simulated network and simulation perfomer.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
bool hasPedestrianNetwork() const
return whether the network contains walkingareas and crossings
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
MSPedestrianRouter & getPedestrianRouter(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
virtual MSTransportableControl & getPersonControl()
Returns the person control.
bool hasInternalLinks() const
return whether the network contains internal links
SUMOTime execute(SUMOTime currentTime)
Executes the command.
Container for pedestrian state and individual position update function.
virtual double getMaxX(const bool includeMinGap=true) const
return the maximum position on the lane
bool isJammed() const
whether the transportable is jammed
bool myAmJammed
whether the person is jammed
Position myRemoteXYPos
remote-controlled position
bool myWaitingToEnter
whether the pedestrian is waiting to start its walk
const WalkingAreaPath * myWalkingAreaPath
the current walkingAreaPath or 0
SUMOTime getWaitingTime(const MSStageMoving &stage, SUMOTime now) const
return the time the transportable spent standing
PState()
constructor for PStateVehicle
double myRelX
the advancement along the current lane
double distToLaneEnd() const
the absolute distance to the end of the lane in walking direction (or to the arrivalPos)
int myDir
the walking direction on the current lane (1 forward, -1 backward)
double myRelY
the orthogonal shift on the current lane
void mergeObstacles(Obstacles &into, const Obstacles &obs2)
replace obstacles in the first vector with obstacles from the second if they are closer to me
bool isRemoteControlled() const
whether the person is currently being controlled via TraCI
const MSEdge * getNextEdge(const MSStageMoving &stage) const
return the list of internal edges if the transportable is on an intersection
void walk(const Obstacles &obs, SUMOTime currentTime)
perform position update
virtual double getWidth() const
return the person width
double mySpeed
the current walking speed
bool ignoreRed(const MSLink *link) const
whether the pedestrian may ignore a red light
virtual double getMinX(const bool includeMinGap=true) const
return the minimum position on the lane
bool moveToNextLane(SUMOTime currentTime)
return whether this pedestrian has passed the end of the current lane and update myRelX if so
double getMinGap() const
return the minimum gap of the pedestrian
void moveToXY(MSPerson *p, Position pos, MSLane *lane, double lanePos, double lanePosLat, double angle, int routeOffset, const ConstMSEdgeVector &edges, SUMOTime t)
try to move transportable to the given position
double getSpeed(const MSStageMoving &stage) const
return the current speed of the transportable
Position getPosition(const MSStageMoving &stage, SUMOTime now) const
return the network coordinate of the transportable
NextLaneInfo myNLI
information about the upcoming lane
const MSLane * myLane
the current lane of this pedestrian
double getAngle(const MSStageMoving &stage, SUMOTime now) const
return the direction in which the transportable faces in degrees
virtual const std::string & getID() const
return the person id
double getImpatience(SUMOTime now) const
returns the impatience
SUMOTime myWaitingTime
the consecutive time spent at speed 0
double distanceTo(const Obstacle &obs, const bool includeMinGap=true) const
const MSLane * getLane() const
whether the transportable is jammed
double getEdgePos(const MSStageMoving &stage, SUMOTime now) const
abstract methods inherited from PedestrianState
double getLength() const
return the length of the pedestrian
double getWidth() const
return the person width
double getMaxX(const bool includeMinGap=true) const
return the maximum position on the lane
double getMinX(const bool includeMinGap=true) const
return the minimum position on the lane
const std::string & getID() const
return the person id
PStateVehicle(const MSVehicle *veh, const MSLane *walkingarea, double relX, double relY)
sorts the persons by position on the lane. If dir is forward, higher x positions come first.
The pedestrian following model.
static const double MIN_STARTUP_DIST
static double RESERVE_FOR_ONCOMING_FACTOR
static MinNextLengths myMinNextLengths
static SUMOTime jamTimeCrossing
bool hasPedestrians(const MSLane *lane)
whether the given lane has pedestrians on it
void moveInDirection(SUMOTime currentTime, std::set< MSPerson * > &changedLane, int dir)
move all pedestrians forward and advance to the next lane if applicable
static void transformToCurrentLanePositions(Obstacles &o, int currentDir, int nextDir, double currentLength, double nextLength)
static const double LOOKAHEAD_SAMEDIR
static NextLaneInfo getNextLane(const PState &ped, const MSLane *currentLane, const MSLane *prevLane)
computes the successor lane for the given pedestrian and sets the link as well as the direction to us...
static void initWalkingAreaPaths(const MSNet *net)
std::vector< PState * > Pedestrians
ActiveLanes myActiveLanes
store of all lanes which have pedestrians on them
static const double LOOKAROUND_VEHICLES
static const double SQUEEZE
static SUMOTime jamTimeNarrow
static const WalkingAreaPath * getWalkingAreaPath(const MSEdge *walkingArea, const MSLane *before, const MSLane *after)
void arriveAndAdvance(Pedestrians &pedestrians, SUMOTime currentTime, std::set< MSPerson * > &changedLane, int dir)
handle arrivals and lane advancement
std::map< const MSLane *, double > MinNextLengths
static double RESERVE_FOR_ONCOMING_FACTOR_JUNCTIONS
static int getStripeOffset(int origStripes, int destStripes, bool addRemainder)
bool myAmActive
whether an event for pedestrian processing was added
static const WalkingAreaPath * guessPath(const MSEdge *walkingArea, const MSEdge *before, const MSEdge *after)
static double stripeWidth
model parameters
bool blockedAtDist(const MSLane *lane, double vehSide, double vehWidth, double oncomingGap, std::vector< const MSPerson * > *collectBlockers)
whether a pedestrian is blocking the crossing of lane for the given vehicle bondaries
static const double MAX_WAIT_TOLERANCE
static Obstacles getVehicleObstacles(const MSLane *lane, int dir, PState *ped=0)
retrieve vehicle obstacles on the given lane
static const double OBSTRUCTED_PENALTY
std::map< const MSLane *, Obstacles, lane_by_numid_sorter > NextLanesObstacles
static const MSLane * getNextWalkingArea(const MSLane *currentLane, const int dir, const MSLink *&link)
return the next walkingArea in the given direction
PersonDist nextBlocking(const MSLane *lane, double minPos, double minRight, double maxLeft, double stopTime=0)
returns the next pedestrian beyond minPos that is laterally between minRight and maxLeft or 0
MSTransportableStateAdapter * add(MSTransportable *transportable, MSStageMoving *stage, SUMOTime now)
register the given person as a pedestrian
static const double DIST_OVERLAP
static const WalkingAreaPath * getArbitraryPath(const MSEdge *walkingArea)
return an arbitrary path across the given walkingArea
static const double LATERAL_PENALTY
std::vector< Obstacle > Obstacles
void remove(MSTransportableStateAdapter *state)
remove the specified person from the pedestrian simulation
static const double DIST_BEHIND
bool usingInternalLanes()
whether movements on intersections are modelled /
void moveInDirectionOnLane(Pedestrians &pedestrians, const MSLane *lane, SUMOTime currentTime, std::set< MSPerson * > &changedLane, int dir)
move pedestrians forward on one lane
MSPModel_Striping(const OptionsCont &oc, MSNet *net)
Constructor (it should not be necessary to construct more than one instance)
static bool addVehicleFoe(const MSVehicle *veh, const MSLane *walkingarea, const Position &relPos, double lateral_offset, double minY, double maxY, Pedestrians &toDelete, Pedestrians &transformedPeds)
static bool usingInternalLanesStatic()
static Obstacles getNeighboringObstacles(const Pedestrians &pedestrians, int egoIndex, int stripes)
static Pedestrians noPedestrians
empty pedestrian vector
static void addCloserObstacle(Obstacles &obs, double x, int stripe, int numStripes, const std::string &id, double width, int dir, ObstacleType type)
Pedestrians & getPedestrians(const MSLane *lane)
retrieves the pedestian vector for the given lane (may be empty)
static int numStripes(const MSLane *lane)
return the maximum number of pedestrians walking side by side
static const double OBSTRUCTION_THRESHOLD
static bool addCrossingVehs(const MSLane *crossing, int stripes, double lateral_offset, int dir, Obstacles &crossingVehs, bool prio)
add vehicles driving across
static int connectedDirection(const MSLane *from, const MSLane *to)
returns the direction in which these lanes are connectioned or 0 if they are not
static void DEBUG_PRINT(const Obstacles &obs)
static const double LATERAL_SPEED_FACTOR
static const double INAPPROPRIATE_PENALTY
static const double ONCOMING_CONFLICT_PENALTY
int myNumActivePedestrians
the total number of active pedestrians
static const double LOOKAHEAD_ONCOMING
static std::map< const MSEdge *, std::vector< const MSLane * > > myWalkingAreaFoes
const Obstacles & getNextLaneObstacles(NextLanesObstacles &nextLanesObs, const MSLane *lane, const MSLane *nextLane, int stripes, int nextDir, double currentLength, int currentDir)
static const double DIST_FAR_AWAY
std::map< std::pair< const MSLane *, const MSLane * >, const WalkingAreaPath > WalkingAreaPaths
static WalkingAreaPaths myWalkingAreaPaths
store for walkinArea elements
static const int BACKWARD
static int canTraverse(int dir, const ConstMSEdgeVector &route)
static const double SIDEWALK_OFFSET
the offset for computing person positions when walking on edges without a sidewalk
static const int UNDEFINED_DIRECTION
static const double SAFETY_GAP
const MSEdge * getDestination() const
returns the destination edge
virtual double getArrivalPos() const
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
Position getLanePosition(const MSLane *lane, double at, double offset) const
get position on lane at length at with orthogonal offset
virtual const MSEdge * getNextRouteEdge() const =0
virtual bool moveToNextEdge(MSTransportable *transportable, SUMOTime currentTime, MSEdge *nextInternal=0)=0
move forward and return whether the transportable arrived
const std::vector< const MSEdge * > & getRoute() const
virtual double getMaxSpeed(const MSTransportable *const transportable=nullptr) const =0
the maximum speed of the transportable
MSPModel * getMovementModel()
Returns the default movement model for this kind of transportables.
void registerJammed()
register a jammed transportable
const MSVehicleType & getVehicleType() const
Returns the object's "vehicle" type.
bool isPerson() const
Whether it is a person.
MSStageType getCurrentStageType() const
the current stage type of the transportable
const MSEdge * getEdge() const
Returns the current edge.
abstract base class for managing callbacks to retrieve various state information from the model
Representation of a vehicle in the micro simulation.
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
const Position getBackPosition() const
double getSpeed() const
Returns the vehicle's current speed.
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
double getLength() const
Get vehicle's length [m].
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 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)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
static OptionsCont & getOptions()
Retrieves the options.
double compute(const E *from, const E *to, double departPos, double arrivalPos, double speed, SUMOTime msTime, const N *onlyNode, std::vector< const E * > &into, bool allEdges=false)
Builds the route between the given edges using the minimum effort at the given time The definition of...
A point in 2D or 3D with translation and scaling methods.
static const Position INVALID
used to indicate that a position is valid
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
double x() const
Returns the x-position.
double y() const
Returns the y-position.
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
void push_back_noDoublePos(const Position &p)
insert in back a non double position
PositionVector reverse() const
reverse position vector
Position transformToVectorCoordinates(const Position &p, bool extend=false) const
return position p within the length-wise coordinate system defined by this position vector....
static double rand(std::mt19937 *rng=nullptr)
Returns a random real number in [0, 1)
information regarding surround Pedestrians (and potentially other things)
double speed
speed relative to lane direction (positive means in the same direction)
double xFwd
maximal position on the current lane in forward direction
Obstacle(int dir, double dist=DIST_FAR_AWAY)
create No-Obstacle
std::string description
the id / description of the obstacle
ObstacleType type
whether this obstacle denotes a border or a pedestrian
double xBack
maximal position on the current lane in backward direction
const PositionVector shape