48 #define DEBUGCOND(PED) ((PED).myPerson->isSelected()) 49 #define DEBUGCOND2(LANE) ((LANE)->isSelected()) 53 for (
int i = 0; i < (int)obs.size(); ++i) {
55 <<
"(" << obs[i].description
56 <<
" x=(" << obs[i].xBack <<
"," << obs[i].xFwd
57 <<
") s=" << obs[i].speed
100 #define MINGAP_TO_VEHICLE 0.25 129 const MSLane* lane = getSidewalk<MSEdge, MSLane>(person->
getEdge());
131 std::string error =
"Person '" + person->
getID() +
"' could not find sidewalk on edge '" + person->
getEdge()->
getID() +
"', time=" 157 const MSLane* lane =
dynamic_cast<PState*
>(state)->myLane;
159 for (Pedestrians::iterator it = pedestrians.begin(); it != pedestrians.end(); ++it) {
161 pedestrians.erase(it);
170 double oncomingGap, std::vector<const MSPerson*>* collectBlockers) {
172 for (Pedestrians::const_iterator it_ped = pedestrians.begin(); it_ped != pedestrians.end(); ++it_ped) {
173 const PState& ped = **it_ped;
175 const double leaderBackDist = leaderFrontDist + ped.
getLength();
178 <<
" vehSide=" << vehSide
179 <<
" vehWidth=" << vehWidth
180 <<
" lBD=" << leaderBackDist
181 <<
" lFD=" << leaderFrontDist
184 if (leaderBackDist >= -vehWidth
185 && (leaderFrontDist < 0
190 if (collectBlockers == 0) {
193 collectBlockers->push_back(ped.
myPerson);
197 if (collectBlockers == 0) {
200 return collectBlockers->size() > 0;
224 double closest = std::numeric_limits<double>::max();
226 for (Pedestrians::const_iterator it_ped = pedestrians.begin(); it_ped != pedestrians.end(); ++it_ped) {
227 const PState& ped = **it_ped;
230 if (ped.
myRelX > minPos && (result.first == 0 || closest > relX2)) {
233 const bool overlap = (center + halfWidth > minRight && center - halfWidth < maxLeft);
235 std::cout <<
" nextBlocking lane=" << lane->
getID()
236 <<
" minPos=" << minPos <<
" minRight=" << minRight <<
" maxLeft=" << maxLeft
237 <<
" stopTime=" << stopTime
240 <<
" relX2=" << relX2
241 <<
" center=" << center
242 <<
" pedLeft=" << center + halfWidth
243 <<
" pedRight=" << center - halfWidth
244 <<
" overlap=" << overlap
286 if (from == 0 || to == 0) {
306 const MSLane* walkingArea = getSidewalk<MSEdge, MSLane>(edge);
310 std::vector<const MSLane*> lanes;
312 for (
int j = 0; j < (int)incoming.size(); ++j) {
313 lanes.push_back(getSidewalk<MSEdge, MSLane>(incoming[j]));
316 for (
int j = 0; j < (int)outgoing.size(); ++j) {
317 lanes.push_back(getSidewalk<MSEdge, MSLane>(outgoing[j]));
320 for (
int j = 0; j < (int)lanes.size(); ++j) {
321 for (
int k = 0; k < (int)lanes.size(); ++k) {
324 const MSLane* from = lanes[j];
325 const MSLane* to = lanes[k];
331 const double maxExtent = fromPos.
distanceTo2D(toPos) / 4;
332 const double extrapolateBy =
MIN2(maxExtent, walkingArea->
getWidth() / 2);
334 shape.push_back(fromPos);
344 if (shape.size() < 2) {
348 assert(shape.size() == 2);
356 myMinNextLengths[walkingArea] =
MIN2(myMinNextLengths[walkingArea], wap.
length);
368 std::vector<const MSLane*> lanes;
370 for (
int j = 0; j < (int)incoming.size(); ++j) {
371 lanes.push_back(getSidewalk<MSEdge, MSLane>(incoming[j]));
374 for (
int j = 0; j < (int)outgoing.size(); ++j) {
375 lanes.push_back(getSidewalk<MSEdge, MSLane>(outgoing[j]));
377 if (lanes.size() < 1) {
378 throw ProcessError(
"Invalid walkingarea '" + walkingArea->
getID() +
"' does not allow continuation.");
389 const MSLane* nextRouteLane = getSidewalk<MSEdge, MSLane>(nextRouteEdge);
391 const MSLane* nextLane = nextRouteLane;
395 if (nextRouteLane == 0 && nextRouteEdge != 0) {
396 std::string error =
"Person '" + ped.
myPerson->
getID() +
"' could not find sidewalk on edge '" + nextRouteEdge->
getID() +
"', time=" 400 nextRouteLane = nextRouteEdge->
getLanes().front();
406 if (nextRouteLane != 0) {
411 nextLane = currentLane->
getLinkCont()[0]->getViaLaneOrLane();
416 std::cout <<
" internal\n";
421 nextLane = currentLane->
getLinkCont()[0]->getLane();
426 std::cout <<
" crossing\n";
433 const double arrivalPos = (nextRouteEdge == ped.
myStage->
getRoute().back()
438 prohibited.push_back(&prevLane->
getEdge());
443 <<
" nre=" << nextRouteEdge->
getID()
444 <<
" nreDir=" << nextRouteEdgeDir
445 <<
" aPos=" << arrivalPos
446 <<
" crossingRoute=" <<
toString(crossingRoute)
449 if (crossingRoute.size() > 1) {
450 const MSEdge* nextEdge = crossingRoute[1];
451 nextLane = getSidewalk<MSEdge, MSLane>(crossingRoute[1]);
453 assert(nextLane != prevLane);
456 std::cout <<
" nextDir=" << nextDir <<
"\n";
472 <<
" no route from '" << (currentEdge == 0 ?
"NULL" : currentEdge->
getID())
473 <<
"' to '" << (nextRouteEdge == 0 ?
"NULL" : nextRouteEdge->
getID())
477 +
"' from walkingArea '" + currentEdge->
getID()
478 +
"' to edge '" + nextRouteEdge->
getID() +
"', time=" +
481 nextLane = nextRouteLane;
483 }
else if (currentEdge == nextRouteEdge) {
485 nextDir = -ped.
myDir;
493 std::cout <<
" next walkingArea " << (nextDir ==
FORWARD ?
"forward" :
"backward") <<
"\n";
504 std::cout <<
" direct forward\n";
512 std::cout <<
" direct backward\n";
515 if (nextLane !=
nullptr) {
517 while (nextLane->getLinkCont()[0]->getViaLaneOrLane()->isInternal()) {
518 nextLane = nextLane->getLinkCont()[0]->getViaLaneOrLane();
526 nextLane = nextRouteLane;
528 std::cout <<
SIMTIME <<
" no next lane found for " << currentLane->
getID() <<
" dir=" << ped.
myDir <<
"\n";
532 +
"' from edge '" + currentEdge->
getID()
533 +
"' to edge '" + nextRouteEdge->
getID() +
"', time=" +
538 nextLane = nextRouteLane;
545 <<
" l=" << currentLane->
getID()
546 <<
" nl=" << (nextLane == 0 ?
"NULL" : nextLane->getID())
547 <<
" nrl=" << (nextRouteLane == 0 ?
"NULL" : nextRouteLane->
getID())
550 <<
" pedDir=" << ped.
myDir 553 assert(nextLane != 0 || nextRouteLane == 0);
562 for (MSLinkCont::const_iterator it = links.begin(); it != links.end(); ++it) {
563 if ((*it)->getLane()->getEdge().isWalkingArea()) {
569 const std::vector<MSLane::IncomingLaneInfo>& laneInfos = currentLane->
getIncomingLanes();
570 for (std::vector<MSLane::IncomingLaneInfo>::const_iterator it = laneInfos.begin(); it != laneInfos.end(); ++it) {
571 if ((*it).lane->getEdge().isWalkingArea()) {
572 link = (*it).viaLink;
583 const PState& ego = *pedestrians[egoIndex];
585 std::vector<bool> haveBlocker(stripes,
false);
586 for (
int index = egoIndex + 1; index < (int)pedestrians.size(); index++) {
587 const PState& p = *pedestrians[index];
594 std::cout <<
" dist=" << ego.
distanceTo(o) << std::endl;
602 haveBlocker[p.
stripe()] =
true;
605 if (!haveBlocker[p.
stripe()]) {
623 int offset = (destStripes - origStripes) / 2;
625 offset += (destStripes - origStripes) % 2;
633 MSLane* lane,
const MSLane* nextLane,
int stripes,
int nextDir,
634 double currentLength,
int currentDir) {
635 if (nextLanesObs.count(nextLane) == 0) {
642 const int offset =
getStripeOffset(nextStripes, stripes, currentDir != nextDir && nextStripes > stripes);
653 if (nextStripes < stripes) {
655 for (
int ii = 0; ii < stripes; ++ii) {
656 if (ii < offset || ii >= nextStripes + offset) {
667 if ((stripes - nextStripes) % 2 != 0) {
670 nextDir = currentDir;
672 for (
int ii = 0; ii < (int)pedestrians.size(); ++ii) {
673 PState& p = *pedestrians[ii];
678 const double newY = relPos.
y() + lateral_offset;
689 sort(pedestrians.begin(), pedestrians.end(),
by_xpos_sorter(nextDir));
690 for (
int ii = 0; ii < (int)pedestrians.size(); ++ii) {
691 const PState& p = *pedestrians[ii];
697 if (nextDir != currentDir) {
702 const int stripe = p.
stripe(newY);
703 if (stripe >= 0 && stripe < stripes) {
707 if (otherStripe >= 0 && otherStripe < stripes) {
708 obs[otherStripe] = pObs;
721 nextLanesObs[nextLane] = obs;
723 return nextLanesObs[nextLane];
728 for (
int ii = 0; ii < (int)obs.size(); ++ii) {
732 o.
xFwd += currentLength;
733 o.
xBack += currentLength;
735 const double tmp = o.
xFwd;
736 o.
xFwd = currentLength + nextLength - o.
xBack;
737 o.
xBack = currentLength + nextLength - tmp;
741 const double tmp = o.
xFwd;
745 o.
xFwd -= nextLength;
746 o.
xBack -= nextLength;
755 if (stripe >= 0 && stripe < numStripes) {
756 if ((dir ==
FORWARD && x - width / 2. < obs[stripe].xBack) || (dir ==
BACKWARD && x + width / 2. > obs[stripe].xFwd)) {
757 obs[stripe] =
Obstacle(x, 0, type,
id, width);
765 const MSLane* lane = it_lane->first;
767 if (pedestrians.size() == 0) {
778 std::set<const WalkingAreaPath*, walkingarea_path_sorter> paths;
779 for (Pedestrians::iterator it = pedestrians.begin(); it != pedestrians.end(); ++it) {
782 if (p->
myDir == dir) {
786 std::cout <<
SIMTIME <<
" debugging WalkingAreaPath from=" << debugPath->
from->
getID() <<
" to=" << debugPath->
to->
getID() <<
"\n";
790 for (std::set<const WalkingAreaPath*, walkingarea_path_sorter>::iterator it = paths.begin(); it != paths.end(); ++it) {
794 transformedPeds.reserve(pedestrians.size());
795 for (Pedestrians::iterator it_p = pedestrians.begin(); it_p != pedestrians.end(); ++it_p) {
800 transformedPeds.push_back(p);
801 if (path == debugPath) std::cout <<
" ped=" << p->
myPerson->
getID() <<
" relX=" << p->
myRelX <<
" relY=" << p->
myRelY <<
" (untransformed), vecCoord=" 805 const double newY = relPos.
y() + lateral_offset;
813 toDelete.push_back(tp);
814 transformedPeds.push_back(tp);
815 if (path == debugPath) {
816 std::cout <<
" ped=" << p->
myPerson->
getID() <<
" relX=" << relPos.
x() <<
" relY=" << newY <<
" (transformed), vecCoord=" << relPos <<
"\n";
819 if (path == debugPath) {
820 std::cout <<
" ped=" << p->
myPerson->
getID() <<
" relX=" << relPos.
x() <<
" relY=" << newY <<
" (invalid), vecCoord=" << relPos <<
"\n";
828 for (Pedestrians::iterator it_p = toDelete.begin(); it_p != toDelete.end(); ++it_p) {
843 sort(pedestrians.begin(), pedestrians.end(),
by_xpos_sorter(dir));
845 for (
int i = 0; i < (int)pedestrians.size(); i++) {
846 PState*
const p = pedestrians[i];
850 pedestrians.erase(pedestrians.begin() + i);
872 sort(pedestrians.begin(), pedestrians.end(),
by_xpos_sorter(dir));
875 bool hasCrossingVehObs =
false;
877 hasCrossingVehObs =
addCrossingVehs(lane, stripes, 0, dir, crossingVehs);
880 for (
int ii = 0; ii < (int)pedestrians.size(); ++ii) {
881 PState& p = *pedestrians[ii];
911 nextLanesObs, lane, nextLane, stripes,
930 const double passingClearanceTime = 2;
931 const double passingLength = p.
getLength() + passingClearanceTime * speed;
937 <<
" opened=" << (link ==
nullptr ?
"NULL" :
toString(link->opened(currentTime -
DELTA_T, speed, speed, passingLength, p.
getImpatience(currentTime), speed, 0, 0, 0, p.
ignoreRed(link)))) <<
"\n";
973 if (hasCrossingVehObs) {
982 p.
walk(currentObs, currentTime);
989 for (
int coll = 0; coll < ii; ++coll) {
990 PState& c = *pedestrians[coll];
997 +
"', lane='" + lane->
getID() +
"', time=" +
time2string(currentTime) +
".");
1010 bool hasCrossingVehObs =
false;
1012 if (linkLeaders.size() > 0) {
1013 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
1015 const MSVehicle* veh = (*it).vehAndGap.first;
1022 if ((*it).fromLeft) {
1023 vehYmin = -(*it).vehAndGap.second + lateral_offset;
1027 vehYmax = crossing->
getWidth() + (*it).vehAndGap.second - lateral_offset;
1033 if ((dir ==
FORWARD && obs[s].xBack > vo.xBack)
1034 || (dir ==
BACKWARD && obs[s].xFwd < vo.xFwd)) {
1036 hasCrossingVehObs =
true;
1041 <<
" crossingVeh=" << veh->
getID()
1042 <<
" lane=" << crossing->
getID()
1043 <<
" latOffset=" << lateral_offset
1045 <<
" stripes=" << stripes
1046 <<
" dist=" << (*it).distToCrossing
1047 <<
" gap=" << (*it).vehAndGap.second
1048 <<
" brakeGap=" << bGap
1049 <<
" fromLeft=" << (*it).fromLeft
1050 <<
" ymin=" << vehYmin
1051 <<
" ymax=" << vehYmax
1060 return hasCrossingVehObs;
1095 const double vehNextSpeed =
MAX2(veh->
getSpeed(), 1.0);
1097 if ((dir ==
FORWARD && vehFront + clearance > minX && vehBack <= maxX + LOOKAHEAD_SAMEDIR)
1109 if (s == current && vehFront +
SAFETY_GAP < minX) {
1111 if (pRelY - pWidth < vehYmax &&
1112 pRelY + pWidth > vehYmin && dir ==
FORWARD) {
1114 std::cout <<
" ignoring vehicle on stripe " << s <<
"\n";
1125 std::cout <<
SIMTIME <<
" ped=" << pID <<
" veh=" << veh->
getID() <<
" obstacle on lane=" << lane->
getID()
1127 <<
" ymin=" << vehYmin
1128 <<
" ymax=" << vehYmax
1131 <<
" relY=" << pRelY
1132 <<
" current=" << current
1154 xFwd(ped.getMaxX()),
1155 xBack(ped.getMinX()),
1156 speed(ped.myDir * ped.mySpeed),
1172 myRelX(stage->getDepartPos()),
1173 myRelY(stage->getDepartPosLat()),
1176 myWaitingToEnter(true),
1178 myWalkingAreaPath(0),
1181 myAngle(std::numeric_limits<double>::max()) {
1184 assert(!route.empty());
1185 if (route.size() == 1) {
1191 if (route.front()->isWalkingArea()) {
1198 std::cout <<
" initialize dir for " <<
myPerson->
getID() <<
" forward=" << mayStartForward <<
" backward=" << mayStartBackward <<
"\n";
1200 if (mayStartForward && mayStartBackward) {
1204 if (crossingRoute.size() > 1) {
1206 const MSEdge* nextEdge = crossingRoute[1];
1212 std::cout <<
" crossingRoute=" <<
toString(crossingRoute) <<
"\n";
1274 const int s =
stripe(relY);
1278 if (offset > threshold) {
1280 }
else if (offset < -threshold) {
1326 const int oldDir =
myDir;
1334 <<
" moveToNextLane old=" << oldLane->
getID()
1336 <<
" oldDir=" << oldDir
1337 <<
" newDir=" <<
myDir 1397 if (-dist > newLength) {
1404 myRelX = newLength + dist;
1410 <<
" newLength=" << newLength
1416 if (
myDir != oldDir) {
1427 <<
" od=" << oldDir <<
" nd=" <<
myDir 1428 <<
" offset=" << offset <<
"\n";
1440 myAngle = std::numeric_limits<double>::max();
1441 const int stripes = (int)obs.size();
1442 const int sMax = stripes - 1;
1446 const int current =
stripe();
1449 std::vector<double> distance(stripes);
1450 for (
int i = 0; i < stripes; ++i) {
1454 std::vector<double> utility(stripes, 0);
1456 for (
int i = 0; i < stripes; ++i) {
1462 for (
int j = 0; j <= i; ++j) {
1467 for (
int j = i; j < stripes; ++j) {
1479 for (
int i = 0; i < reserved; ++i) {
1483 for (
int i = sMax; i > sMax - reserved; --i) {
1488 for (
int i = 0; i < stripes; ++i) {
1489 if (obs[i].speed *
myDir < 0) {
1492 utility[i - 1] -= 0.5;
1494 utility[i + 1] -= 0.5;
1498 const double walkDist =
MAX2(0., distance[i]);
1502 std::cout <<
" util=" << utility[i] <<
" exp=" << expectedDist <<
" dist=" << distance[i] <<
"\n";
1504 if (expectedDist >= 0) {
1505 utility[i] += expectedDist;
1519 for (
int i = 0; i < stripes; ++i) {
1525 int chosen = current;
1526 for (
int i = 0; i < stripes; ++i) {
1527 if (utility[chosen] < utility[i]) {
1532 const int next = (chosen == current ? current : (chosen < current ? current - 1 : current + 1));
1533 const double xDist =
MIN3(distance[current], distance[other], distance[next]);
1541 std::cout <<
" xSpeedPotential=" << xSpeed <<
"\n";
1548 (xDist == distance[current] && obs[current].type >=
OBSTACLE_END)
1549 || (xDist == distance[other] && obs[other].type >=
OBSTACLE_END)
1550 || (xDist == distance[next] && obs[next].type >=
OBSTACLE_END))
1591 ySpeed = (yDist > 0 ?
1610 <<
" cur=" << current
1611 <<
" cho=" << chosen
1615 <<
" dawdle=" << dawdle
1622 <<
"\n distance=" <<
toString(distance)
1623 <<
"\n utility=" <<
toString(utility)
1680 if (
myAngle != std::numeric_limits<double>::max()) {
1716 double lanePosLat,
double angle,
int routeOffset,
1735 const MSLane* sidewalk = getSidewalk<MSEdge, MSLane>(&lane->
getEdge());
1736 if (lane != sidewalk) {
1741 pm->
add(
this, lane);
1743 if (edges.empty()) {
1767 const double maxX =
getMaxX(includeMinGap);
1768 const double minX =
getMinX(includeMinGap);
1772 if ((obs.
xFwd >= maxX && obs.
xBack <= maxX) || (obs.
xFwd <= maxX && obs.
xFwd >= minX)) {
1786 for (
int i = 0; i < (int)into.size(); ++i) {
1788 std::cout <<
" i=" << i <<
" intoDist=" <<
distanceTo(into[i]) <<
" obs2Dist=" <<
distanceTo(obs2[i]) <<
"\n";
1794 }
else if (dO == dI && (
1804 for (
int i = 0; i < (int)into.size(); ++i) {
1805 int i2 = i + offset;
1806 if (i2 >= 0 && i2 < (
int)obs2.size()) {
1808 if (obs2[i2].xBack < into[i].xBack) {
1812 if (obs2[i2].xFwd > into[i].xFwd) {
1825 if (ignoreRedTime >= 0) {
1828 std::cout <<
SIMTIME <<
" ignoreRedTime=" << ignoreRedTime <<
" redDuration=" << redDuration <<
"\n";
1830 return ignoreRedTime > redDuration;
1846 std::set<MSPerson*> changedLane;
1851 for (ActiveLanes::const_iterator it_lane =
myModel->getActiveLanes().begin(); it_lane !=
myModel->getActiveLanes().end(); ++it_lane) {
1852 const MSLane* lane = it_lane->first;
1854 if (pedestrians.size() == 0) {
1859 for (
int ii = 0; ii < (int)pedestrians.size(); ++ii) {
1860 const PState& p = *pedestrians[ii];
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
bool gDebugFlag1
global utility flags for debugging
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...
double getImpatience(SUMOTime now) const
returns the impatience
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
double brakeGap(const double speed) const
Returns the distance the vehicle needs to halt including driver's reaction time tau (i...
void moveInDirection(SUMOTime currentTime, std::set< MSPerson *> &changedLane, int dir)
move all pedestrians forward and advance to the next lane if applicable
MSEdge & getEdge() const
Returns the lane's edge.
Representation of a vehicle in the micro simulation.
double getJMParam(const SumoXMLAttr attr, const double defaultValue) const
Returns the named value from the map, or the default if it is not contained there.
static const double LATERAL_SPEED_FACTOR
static const double SQUEEZE
MSPerson::MSPersonStage_Walking * myStage
static const double DIST_BEHIND
void moveInDirectionOnLane(Pedestrians &pedestrians, const MSLane *lane, SUMOTime currentTime, std::set< MSPerson *> &changedLane, int dir)
move pedestrians forward on one lane
static const double LOOKAHEAD_ONCOMING
static int numStripes(const MSLane *lane)
return the maximum number of pedestrians walking side by side
static Obstacles getNeighboringObstacles(const Pedestrians &pedestrians, int egoIndex, int stripes)
MSLane * getLane() const
Returns the connected lane.
Obstacle(int dir, double dist=DIST_FAR_AWAY)
create No-Obstacle
const MSEdge * getEdge() const
Returns the current edge.
double getMinGap() const
return the minimum gap of the pedestrian
sorts the persons by position on the lane. If dir is forward, higher x positions come first...
static WalkingAreaPath * getArbitraryPath(const MSEdge *walkingArea)
return an arbitrary path across the given walkingArea
static const MSLane * getNextWalkingArea(const MSLane *currentLane, const int dir, MSLink *&link)
return the next walkingArea in the given direction
bool ignoreRed(const MSLink *link) const
whether the pedestrian may ignore a red light
static int connectedDirection(const MSLane *from, const MSLane *to)
returns the direction in which these lanes are connectioned or 0 if they are not
WalkingAreaPath * myWalkingAreaPath
the current walkingAreaPath or 0
static const double MIN_STARTUP_DIST
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
The pedestrian following model.
information regarding surround Pedestrians (and potentially other things)
const MSEdge * getDestination() const
returns the destination edge
const MSEdgeVector & getPredecessors() const
SUMOTime getLastStateChange() const
The base class for an intersection.
double y() const
Returns the y-position.
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
double getMaxSpeed(const MSPerson *person) const
accessors to be used by MSPModel
PState(MSPerson *person, MSPerson::MSPersonStage_Walking *stage, const MSLane *lane)
const MSEdge * getEdge() const
Returns the current edge.
AnyVehicleIterator is a structure, which manages the iteration through all vehicles on the lane...
std::string time2string(SUMOTime t)
double x() const
Returns the x-position.
void registerJammed()
register a jammed transportable
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
void remove(PedestrianState *state)
remove the specified person from the pedestrian simulation
double getLength() const
Returns the lane's length.
const PositionVector & getShape() const
Returns this lane's shape.
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
PositionVector reverse() const
reverse position vector
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
std::vector< const MSEdge * > ConstMSEdgeVector
bool usingInternalLanes()
whether movements on intersections are modelled /
std::map< std::pair< const MSLane *, const MSLane * >, WalkingAreaPath > WalkingAreaPaths
const std::string & getID() const
Returns the id.
bool moveToNextLane(SUMOTime currentTime)
return whether this pedestrian has passed the end of the current lane and update myRelX if so ...
Position getLanePosition(const MSLane *lane, double at, double offset) const
get position on lane at length at with orthogonal offset
void moveToXY(MSPerson *p, Position pos, MSLane *lane, double lanePos, double lanePosLat, double angle, int routeOffset, const ConstMSEdgeVector &edges, SUMOTime t)
try to move person to the given position
static bool usingInternalLanesStatic()
static MSPModel * myModel
double getLength() const
return the length of the edge
double getMaxX(const bool includeMinGap=true) const
return the maximum position on the lane
static WalkingAreaPaths myWalkingAreaPaths
store for walkinArea elements
const MSJunction * getToJunction() const
double getLength() const
return the length of the pedestrian
#define MINGAP_TO_VEHICLE
static const double LATERAL_PENALTY
double getWidth() const
Returns the lane's width.
#define UNUSED_PARAMETER(x)
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 ...
double mySpeed
the current walking speed
static const double OBSTRUCTION_THRESHOLD
#define WRITE_WARNING(msg)
The simulated network and simulation perfomer.
bool myAmJammed
whether the person is jammed
int getVehicleNumberWithPartials() const
Returns the number of vehicles on this lane (including partial occupators)
static OptionsCont & getOptions()
Retrieves the options.
static Pedestrians noPedestrians
empty pedestrian vector
static bool gCheck4Accidents
void mergeObstacles(Obstacles &into, const Obstacles &obs2)
replace obstacles in the first vector with obstacles from the second if they are closer to me ...
NextLaneInfo myNLI
information about the upcoming lane
static const double RESERVE_FOR_ONCOMING_FACTOR_JUNCTIONS
A road/street connecting two junctions.
Pedestrians & getPedestrians(const MSLane *lane)
retrieves the pedestian vector for the given lane (may be empty)
static int canTraverse(int dir, const ConstMSEdgeVector &route)
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
double xFwd
maximal position on the current lane in forward direction
static const int UNDEFINED_DIRECTION
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
SUMOTime execute(SUMOTime currentTime)
Executes the command.
static const double OBSTRUCTED_PENALTY
bool opened(SUMOTime arrivalTime, double arrivalSpeed, double leaveSpeed, double vehicleLength, double impatience, double decel, SUMOTime waitingTime, double posLat=0, std::vector< const SUMOVehicle *> *collectFoes=0, bool ignoreRed=false, const SUMOVehicle *ego=0) const
Returns the information whether the link may be passed.
const MSTrafficLightLogic * getTLLogic() const
Returns the TLS index.
static const double DIST_OVERLAP
static MSPModel * getModel()
virtual MSTransportableControl & getPersonControl()
Returns the person control.
void walk(const Obstacles &obs, SUMOTime currentTime)
perform position update
A point in 2D or 3D with translation and scaling methods.
static int getStripeOffset(int origStripes, int destStripes, bool addRemainder)
static Obstacles getVehicleObstacles(const MSLane *lane, int dir, PState *ped=0)
retrieve vehicle obstacles on the given lane
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...
double myRelY
the orthogonal shift on the current lane
Position myRemoteXYPos
remote-controlled position
double xBack
maximal position on the current lane in backward direction
double myRelX
the advancement along the current lane
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
double myAngle
cached angle
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
double getSpeed(const MSPerson::MSPersonStage_Walking &stage) const
return the current speed of the person
static double fromNaviDegree(const double angle)
Position getPosition(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const
return the network coordinate of the person
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
double distToLaneEnd() const
the absolute distance to the end of the lane in walking direction (or to the arrivalPos) ...
SUMOTime string2time(const std::string &r)
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
AnyVehicleIterator anyVehiclesEnd() const
end iterator for iterating over all vehicles touching this lane in downstream direction ...
AnyVehicleIterator anyVehiclesBegin() const
begin iterator for iterating over all vehicles touching this lane in downstream direction ...
const std::string & getID() const
returns the id of the transportable
std::vector< LinkLeader > LinkLeaders
bool hasInternalLinks() const
return whether the network contains internal links
static bool gUsingInternalLanes
Information whether the simulation regards internal lanes.
double getMinGap() const
Get the free space in front of vehicles of this class.
std::map< const MSLane *, Obstacles, lane_by_numid_sorter > NextLanesObstacles
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
AnyVehicleIterator anyVehiclesUpstreamBegin() const
begin iterator for iterating over all vehicles touching this lane in upstream direction ...
double getArrivalPos() const
bool isCrossing() const
return whether this edge is a pedestrian crossing
bool isInternal() const
return whether this edge is an internal edge
SUMOTime myWaitingTime
the consecutive time spent at speed 0
const ConstMSEdgeVector & getRoute() const
int myDir
the walking direction on the current lane (1 forward, -1 backward)
static const double LOOKAHEAD_SAMEDIR
const SUMOVTypeParameter & getParameter() const
MSPedestrianRouter & getPedestrianRouter(const MSEdgeVector &prohibited=MSEdgeVector()) const
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
double speed
speed relative to lane direction (positive means in the same direction)
const Obstacles & getNextLaneObstacles(NextLanesObstacles &nextLanesObs, const MSLane *lane, const MSLane *nextLane, int stripes, int nextDir, double currentLength, int currentDir)
void cleanupHelper()
remove state at simulation end
PedestrianState * add(MSPerson *person, MSPerson::MSPersonStage_Walking *stage, SUMOTime now)
register the given person as a pedestrian
static const double RESERVE_FOR_ONCOMING_FACTOR
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
void arriveAndAdvance(Pedestrians &pedestrians, SUMOTime currentTime, std::set< MSPerson *> &changedLane, int dir)
handle arrivals and lane advancement
static void transformToCurrentLanePositions(Obstacles &o, int currentDir, int nextDir, double currentLength, double nextLength)
abstract base class for managing callbacks to retrieve various state information from the model ...
MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
std::pair< const MSPerson *, double > PersonDist
bool hasPedestrians(const MSLane *lane)
whether the given lane has pedestrians on it
const MSEdgeVector & getSuccessors(SUMOVehicleClass vClass=SVC_IGNORING) const
Returns the following edges, restricted by vClass.
const std::vector< const MSEdge * >::iterator getRouteStep() const
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
std::map< const MSLane *, double > MinNextLengths
ObstacleType type
whether this obstacle denotes a border or a pedestrian
static const double DIST_FAR_AWAY
double getEdgePos(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const
abstract methods inherited from PedestrianState
static const double ONCOMING_CONFLICT_PENALTY
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
const MSEdge * getNextEdge(const MSPerson::MSPersonStage_Walking &stage) const
return the list of internal edges if the pedestrian is on an intersection
std::vector< PState * > Pedestrians
SUMOTime getWaitingTime(SUMOTime now) const
the time this transportable spent waiting
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
static double stripeWidth
model parameters
static const double INAPPROPRIATE_PENALTY
bool myWaitingToEnter
whether the pedestrian is waiting to start its walk
static MSLink * getConnectingLink(const MSLane &from, const MSLane &to)
Returns the link connecting both lanes Both lanes have to be non-internal; 0 may be returned if no co...
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
const MSJunction * getFromJunction() const
double distanceTo(const Obstacle &obs, const bool includeMinGap=true) const
bool moveToNextEdge(MSPerson *person, SUMOTime currentTime, MSEdge *nextInternal=nullptr)
move forward and return whether the person arrived
A storage for options typed value containers)
Container for pedestrian state and individual position update function.
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
std::vector< Obstacle > Obstacles
double getLength() const
Get vehicle's length [m].
AnyVehicleIterator anyVehiclesUpstreamEnd() const
end iterator for iterating over all vehicles touching this lane in upstream direction ...
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
static const int BACKWARD
bool isWalkingArea() const
return whether this edge is walking area
const MSVehicleType & getVehicleType() const
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
const MSEdge * getRouteEdge() const
static const double SAFETY_GAP
double getMinX(const bool includeMinGap=true) const
return the minimum position on the lane
void push_back_noDoublePos(const Position &p)
insert in back a non double position
static void DEBUG_PRINT(const Obstacles &obs)
double getImpatience() const
Returns this type's impatience.
static void addCloserObstacle(Obstacles &obs, double x, int stripe, int numStripes, const std::string &id, double width, int dir, ObstacleType type)
const MSEdge * getNextRouteEdge() const
std::vector< MSEdge * > MSEdgeVector
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
int myNumActivePedestrians
the total number of active pedestrians
double getAngle(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const
return the direction in which the person faces in degrees
static MinNextLengths myMinNextLengths
double getSpeed() const
Returns the vehicle's current speed.
std::string description
the id / description of the obstacle
SUMOTime getWaitingTime(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const
return the time the person spent standing
static void initWalkingAreaPaths(const MSNet *net)
MSPModel_Striping(const OptionsCont &oc, MSNet *net)
Constructor (it should not be necessary to construct more than one instance)
const std::string & getID() const
Returns the name of the vehicle.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const double MAX_WAIT_TOLERANCE
Representation of a lane in the micro simulation.
static const MSLane * getInternalFollowingLane(const MSLane *fromLane, const MSLane *followerAfterInternal)
ActiveLanes myActiveLanes
store of all lanes which have pedestrians on them
const MSLane * myLane
the current lane of this pedestrian
Position transformToVectorCoordinates(const Position &p, bool extend=false) const
return position p within the length-wise coordinate system defined by this position vector...
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 ...
SumoXMLEdgeFunc getFunction() const
Returns the edge type (SumoXMLEdgeFunc)
bool haveRed() const
Returns whether this link is blocked by a red (or redyellow) traffic light.
static const Position INVALID
used to indicate that a position is valid
static bool addCrossingVehs(const MSLane *crossing, int stripes, double lateral_offset, int dir, Obstacles &crossingVehs)
add vehicles driving across
static const double LOOKAROUND_VEHICLES
StageType getCurrentStageType() const
the current stage type of the transportable
void setRouteIndex(MSPerson *person, int routeOffset)
place person on a previously passed edge