54 #define DEBUGCOND(PED) ((PED).myPerson->isSelected()) 55 #define DEBUGCOND2(LANE) ((LANE)->isSelected()) 59 for (
int i = 0; i < (int)obs.size(); ++i) {
61 <<
"(" << obs[i].description
62 <<
" x=(" << obs[i].xBack <<
"," << obs[i].xFwd
63 <<
") s=" << obs[i].speed
106 #define MINGAP_TO_VEHICLE 0.25 136 const MSLane* lane = getSidewalk<MSEdge, MSLane>(person->
getEdge());
138 std::string error =
"Pedestrian '" + person->
getID() +
"' could not find sidewalk on edge '" + person->
getEdge()->
getID() +
"', time=" 156 const MSLane* lane =
dynamic_cast<PState*
>(state)->myLane;
158 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;
216 for (Pedestrians::const_iterator it_ped = pedestrians.begin(); it_ped != pedestrians.end(); ++it_ped) {
217 const PState& ped = **it_ped;
220 if (ped.
myRelX > minPos && (result.first == 0 || closest > relX2)) {
223 const bool overlap = (center + halfWidth > minRight && center - halfWidth < maxLeft);
225 std::cout <<
" nextBlocking lane=" << lane->
getID()
226 <<
" minPos=" << minPos <<
" minRight=" << minRight <<
" maxLeft=" << maxLeft
227 <<
" stopTime=" << stopTime
230 <<
" relX2=" << relX2
231 <<
" center=" << center
232 <<
" pedLeft=" << center + halfWidth
233 <<
" pedRight=" << center - halfWidth
234 <<
" overlap=" << overlap
263 for (Pedestrians::iterator it_p = it_lane->second.begin(); it_p != it_lane->second.end(); ++it_p) {
281 if (from == 0 || to == 0) {
301 const MSLane* walkingArea = getSidewalk<MSEdge, MSLane>(edge);
305 std::vector<const MSLane*> lanes;
307 for (
int j = 0; j < (int)incoming.size(); ++j) {
308 lanes.push_back(getSidewalk<MSEdge, MSLane>(incoming[j]));
311 for (
int j = 0; j < (int)outgoing.size(); ++j) {
312 lanes.push_back(getSidewalk<MSEdge, MSLane>(outgoing[j]));
315 for (
int j = 0; j < (int)lanes.size(); ++j) {
316 for (
int k = 0; k < (int)lanes.size(); ++k) {
319 const MSLane* from = lanes[j];
320 const MSLane* to = lanes[k];
326 const double maxExtent = fromPos.
distanceTo2D(toPos) / 4;
327 const double extrapolateBy =
MIN2(maxExtent, walkingArea->
getWidth() / 2);
329 shape.push_back(fromPos);
339 if (shape.size() < 2) {
343 assert(shape.size() == 2);
351 myMinNextLengths[walkingArea] =
MIN2(myMinNextLengths[walkingArea], wap.
length);
363 std::vector<const MSLane*> lanes;
365 for (
int j = 0; j < (int)incoming.size(); ++j) {
366 lanes.push_back(getSidewalk<MSEdge, MSLane>(incoming[j]));
369 for (
int j = 0; j < (int)outgoing.size(); ++j) {
370 lanes.push_back(getSidewalk<MSEdge, MSLane>(outgoing[j]));
372 if (lanes.size() < 1) {
373 throw ProcessError(
"Invalid walkingarea '" + walkingArea->
getID() +
"' does not allow continuation.");
384 const MSLane* nextRouteLane = getSidewalk<MSEdge, MSLane>(nextRouteEdge);
386 const MSLane* nextLane = nextRouteLane;
390 if (nextRouteLane == 0 && nextRouteEdge != 0) {
391 std::string error =
"Pedestrian '" + ped.
myPerson->
getID() +
"' could not find sidewalk on edge '" + nextRouteEdge->
getID() +
"', time=" 395 nextRouteLane = nextRouteEdge->
getLanes().front();
401 if (nextRouteLane != 0) {
406 std::cout <<
" internal\n";
411 nextLane = currentLane->
getLinkCont()[0]->getLane();
416 std::cout <<
" crossing\n";
423 const double arrivalPos = (nextRouteEdge == ped.
myStage->
getRoute().back()
428 prohibited.push_back(&prevLane->
getEdge());
433 <<
" nre=" << nextRouteEdge->
getID()
434 <<
" nreDir=" << nextRouteEdgeDir
435 <<
" aPos=" << arrivalPos
436 <<
" crossingRoute=" <<
toString(crossingRoute)
439 if (crossingRoute.size() > 1) {
440 const MSEdge* nextEdge = crossingRoute[1];
441 nextLane = getSidewalk<MSEdge, MSLane>(crossingRoute[1]);
443 assert(nextLane != prevLane);
446 std::cout <<
" nextDir=" << nextDir <<
"\n";
461 <<
" no route from '" << (currentEdge == 0 ?
"NULL" : currentEdge->
getID())
462 <<
"' to '" << (nextRouteEdge == 0 ?
"NULL" : nextRouteEdge->
getID())
469 }
else if (currentEdge == nextRouteEdge) {
471 nextDir = -ped.
myDir;
479 std::cout <<
" next walkingArea " << (nextDir ==
FORWARD ?
"forward" :
"backward") <<
"\n";
490 std::cout <<
" direct forward\n";
498 std::cout <<
" direct backward\n";
506 nextLane = nextRouteLane;
508 std::cout <<
SIMTIME <<
" no next lane found for " << currentLane->
getID() <<
" dir=" << ped.
myDir <<
"\n";
512 nextLane = nextRouteLane;
519 <<
" l=" << currentLane->
getID()
520 <<
" nl=" << (nextLane == 0 ?
"NULL" : nextLane->getID())
521 <<
" nrl=" << (nextRouteLane == 0 ?
"NULL" : nextRouteLane->
getID())
524 <<
" pedDir=" << ped.
myDir 535 for (MSLinkCont::const_iterator it = links.begin(); it != links.end(); ++it) {
536 if ((*it)->getLane()->getEdge().isWalkingArea()) {
542 const std::vector<MSLane::IncomingLaneInfo>& laneInfos = currentLane->
getIncomingLanes();
543 for (std::vector<MSLane::IncomingLaneInfo>::const_iterator it = laneInfos.begin(); it != laneInfos.end(); ++it) {
544 if ((*it).lane->getEdge().isWalkingArea()) {
545 link = (*it).viaLink;
556 const PState& ego = *pedestrians[egoIndex];
558 std::vector<bool> haveBlocker(stripes,
false);
559 for (
int index = egoIndex + 1; index < (int)pedestrians.size(); index++) {
560 const PState& p = *pedestrians[index];
567 std::cout <<
" dist=" << ego.
distanceTo(o) << std::endl;
575 haveBlocker[p.
stripe()] =
true;
578 if (!haveBlocker[p.
stripe()]) {
596 int offset = (destStripes - origStripes) / 2;
598 offset += (destStripes - origStripes) % 2;
606 MSLane* lane,
const MSLane* nextLane,
int stripes,
int nextDir,
607 double currentLength,
int currentDir) {
608 if (nextLanesObs.count(nextLane) == 0) {
615 const int offset =
getStripeOffset(nextStripes, stripes, currentDir != nextDir && nextStripes > stripes);
626 if (nextStripes < stripes) {
628 for (
int ii = 0; ii < stripes; ++ii) {
629 if (ii < offset || ii >= nextStripes + offset) {
640 if ((stripes - nextStripes) % 2 != 0) {
643 nextDir = currentDir;
645 for (
int ii = 0; ii < (int)pedestrians.size(); ++ii) {
646 PState& p = *pedestrians[ii];
651 const double newY = relPos.
y() + lateral_offset;
662 sort(pedestrians.begin(), pedestrians.end(),
by_xpos_sorter(nextDir));
663 for (
int ii = 0; ii < (int)pedestrians.size(); ++ii) {
664 const PState& p = *pedestrians[ii];
670 if (nextDir != currentDir) {
675 const int stripe = p.
stripe(newY);
676 if (stripe >= 0 && stripe < stripes) {
680 if (otherStripe >= 0 && otherStripe < stripes) {
681 obs[otherStripe] = pObs;
690 nextLanesObs[nextLane] = obs;
692 return nextLanesObs[nextLane];
697 for (
int ii = 0; ii < (int)obs.size(); ++ii) {
701 o.
xFwd += currentLength;
702 o.
xBack += currentLength;
704 const double tmp = o.
xFwd;
705 o.
xFwd = currentLength + nextLength - o.
xBack;
706 o.
xBack = currentLength + nextLength - tmp;
710 const double tmp = o.
xFwd;
714 o.
xFwd -= nextLength;
715 o.
xBack -= nextLength;
724 if (stripe >= 0 && stripe < numStripes) {
725 if ((dir ==
FORWARD && x - width / 2. < obs[stripe].xBack) || (dir ==
BACKWARD && x + width / 2. > obs[stripe].xFwd)) {
726 obs[stripe] =
Obstacle(x, 0, type,
id, width);
734 const MSLane* lane = it_lane->first;
736 if (pedestrians.size() == 0) {
747 std::set<const WalkingAreaPath*, walkingarea_path_sorter> paths;
748 for (Pedestrians::iterator it = pedestrians.begin(); it != pedestrians.end(); ++it) {
751 if (p->
myDir == dir) {
755 std::cout <<
SIMTIME <<
" debugging WalkingAreaPath from=" << debugPath->
from->
getID() <<
" to=" << debugPath->
to->
getID() <<
"\n";
759 for (std::set<const WalkingAreaPath*, walkingarea_path_sorter>::iterator it = paths.begin(); it != paths.end(); ++it) {
763 transformedPeds.reserve(pedestrians.size());
764 for (Pedestrians::iterator it_p = pedestrians.begin(); it_p != pedestrians.end(); ++it_p) {
769 transformedPeds.push_back(p);
770 if (path == debugPath) std::cout <<
" ped=" << p->
myPerson->
getID() <<
" relX=" << p->
myRelX <<
" relY=" << p->
myRelY <<
" (untransformed), vecCoord=" 774 const double newY = relPos.
y() + lateral_offset;
782 toDelete.push_back(tp);
783 transformedPeds.push_back(tp);
784 if (path == debugPath) {
785 std::cout <<
" ped=" << p->
myPerson->
getID() <<
" relX=" << relPos.
x() <<
" relY=" << newY <<
" (transformed), vecCoord=" << relPos <<
"\n";
788 if (path == debugPath) {
789 std::cout <<
" ped=" << p->
myPerson->
getID() <<
" relX=" << relPos.
x() <<
" relY=" << newY <<
" (invalid), vecCoord=" << relPos <<
"\n";
797 for (Pedestrians::iterator it_p = toDelete.begin(); it_p != toDelete.end(); ++it_p) {
812 sort(pedestrians.begin(), pedestrians.end(),
by_xpos_sorter(dir));
814 for (
int i = 0; i < (int)pedestrians.size(); i++) {
815 PState*
const p = pedestrians[i];
819 pedestrians.erase(pedestrians.begin() + i);
840 sort(pedestrians.begin(), pedestrians.end(),
by_xpos_sorter(dir));
843 bool hasCrossingVehObs =
false;
845 hasCrossingVehObs =
addCrossingVehs(lane, stripes, 0, dir, crossingVehs);
848 for (
int ii = 0; ii < (int)pedestrians.size(); ++ii) {
849 PState& p = *pedestrians[ii];
879 nextLanesObs, lane, nextLane, stripes,
926 const int current = p.
stripe();
947 std::cout <<
" ignoring vehicle on stripe " << s <<
"\n";
960 <<
" ymin=" << vehYmin
961 <<
" ymax=" << vehYmax
965 <<
" current=" << current
976 if (hasCrossingVehObs) {
985 p.
walk(currentObs, currentTime);
992 for (
int coll = 0; coll < ii; ++coll) {
993 PState& c = *pedestrians[coll];
1000 +
"', lane='" + lane->
getID() +
"', time=" +
time2string(currentTime) +
".");
1013 bool hasCrossingVehObs =
false;
1015 if (linkLeaders.size() > 0) {
1016 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
1018 const MSVehicle* veh = (*it).vehAndGap.first;
1025 if ((*it).fromLeft) {
1026 vehYmin = -(*it).vehAndGap.second + lateral_offset;
1030 vehYmax = crossing->
getWidth() + (*it).vehAndGap.second - lateral_offset;
1036 if ((dir ==
FORWARD && obs[s].xBack > vo.xBack)
1037 || (dir ==
BACKWARD && obs[s].xFwd < vo.xFwd)) {
1039 hasCrossingVehObs =
true;
1044 <<
" crossingVeh=" << veh->
getID()
1045 <<
" lane=" << crossing->
getID()
1046 <<
" latOffset=" << lateral_offset
1048 <<
" stripes=" << stripes
1049 <<
" dist=" << (*it).distToCrossing
1050 <<
" gap=" << (*it).vehAndGap.second
1051 <<
" brakeGap=" << bGap
1052 <<
" fromLeft=" << (*it).fromLeft
1053 <<
" ymin=" << vehYmin
1054 <<
" ymax=" << vehYmax
1063 return hasCrossingVehObs;
1079 xFwd(ped.getMaxX()),
1080 xBack(ped.getMinX()),
1081 speed(ped.myDir * ped.mySpeed),
1097 myRelX(stage->getDepartPos()),
1098 myRelY(stage->getDepartPosLat()),
1101 myWaitingToEnter(true),
1103 myWalkingAreaPath(0),
1107 assert(!route.empty());
1108 if (route.size() == 1) {
1114 if (route.front()->isWalkingArea()) {
1121 std::cout <<
" initialize dir for " <<
myPerson->
getID() <<
" forward=" << mayStartForward <<
" backward=" << mayStartBackward <<
"\n";
1123 if (mayStartForward && mayStartBackward) {
1127 if (crossingRoute.size() > 1) {
1129 const MSEdge* nextEdge = crossingRoute[1];
1135 std::cout <<
" crossingRoute=" <<
toString(crossingRoute) <<
"\n";
1197 const int s =
stripe(relY);
1201 if (offset > threshold) {
1203 }
else if (offset < -threshold) {
1249 const int oldDir =
myDir;
1257 <<
" moveToNextLane old=" << oldLane->
getID()
1259 <<
" oldDir=" << oldDir
1260 <<
" newDir=" <<
myDir 1305 if (-dist > newLength) {
1311 myRelX = newLength + dist;
1317 <<
" newLength=" << newLength
1323 if (
myDir != oldDir) {
1334 <<
" od=" << oldDir <<
" nd=" <<
myDir 1335 <<
" offset=" << offset <<
"\n";
1347 const int stripes = (int)obs.size();
1348 const int sMax = stripes - 1;
1352 const int current =
stripe();
1355 std::vector<double> distance(stripes);
1356 for (
int i = 0; i < stripes; ++i) {
1360 std::vector<double> utility(stripes, 0);
1362 for (
int i = 0; i < stripes; ++i) {
1368 for (
int j = 0; j <= i; ++j) {
1373 for (
int j = i; j < stripes; ++j) {
1385 for (
int i = 0; i < reserved; ++i) {
1389 for (
int i = sMax; i > sMax - reserved; --i) {
1394 for (
int i = 0; i < stripes; ++i) {
1395 if (obs[i].speed *
myDir < 0) {
1398 utility[i - 1] -= 0.5;
1400 utility[i + 1] -= 0.5;
1404 const double walkDist =
MAX2(0., distance[i]);
1408 std::cout <<
" util=" << utility[i] <<
" exp=" << expectedDist <<
" dist=" << distance[i] <<
"\n";
1410 if (expectedDist >= 0) {
1411 utility[i] += expectedDist;
1425 for (
int i = 0; i < stripes; ++i) {
1431 int chosen = current;
1432 for (
int i = 0; i < stripes; ++i) {
1433 if (utility[chosen] < utility[i]) {
1438 const int next = (chosen == current ? current : (chosen < current ? current - 1 : current + 1));
1439 const double xDist =
MIN3(distance[current], distance[other], distance[next]);
1447 std::cout <<
" xSpeedPotential=" << xSpeed <<
"\n";
1454 (xDist == distance[current] && obs[current].type >=
OBSTACLE_END)
1455 || (xDist == distance[other] && obs[other].type >=
OBSTACLE_END)
1456 || (xDist == distance[next] && obs[next].type >=
OBSTACLE_END))
1497 ySpeed = (yDist > 0 ?
1516 <<
" cur=" << current
1517 <<
" cho=" << chosen
1521 <<
" dawdle=" << dawdle
1528 <<
"\n distance=" <<
toString(distance)
1529 <<
"\n utility=" <<
toString(utility)
1620 const double maxX =
getMaxX(includeMinGap);
1621 const double minX =
getMinX(includeMinGap);
1625 if ((obs.
xFwd >= maxX && obs.
xBack <= maxX) || (obs.
xFwd <= maxX && obs.
xFwd >= minX)) {
1638 for (
int i = 0; i < (int)into.size(); ++i) {
1640 std::cout <<
" i=" << i <<
" intoDist=" <<
distanceTo(into[i]) <<
" obs2Dist=" <<
distanceTo(obs2[i]) <<
"\n";
1653 if (ignoreRedTime >= 0) {
1656 std::cout <<
SIMTIME <<
" ignoreRedTime=" << ignoreRedTime <<
" redDuration=" << redDuration <<
"\n";
1658 return ignoreRedTime > redDuration;
1674 std::set<MSPerson*> changedLane;
1679 for (ActiveLanes::const_iterator it_lane =
myModel->getActiveLanes().begin(); it_lane !=
myModel->getActiveLanes().end(); ++it_lane) {
1680 const MSLane* lane = it_lane->first;
1682 if (pedestrians.size() == 0) {
1687 for (
int ii = 0; ii < (int)pedestrians.size(); ++ii) {
1688 const PState& p = *pedestrians[ii];
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 getLength() const
return the length of the edge
double getMinGap() const
Get the free space in front of vehicles of this class.
double getMinX(const bool includeMinGap=true) const
return the minimum position on the lane
MSEdge & getEdge() const
Returns the lane's edge.
double getImpatience() const
Returns this type's impatience.
double getWidth() const
Returns the lane's width.
Representation of a vehicle in the micro simulation.
static const double LATERAL_SPEED_FACTOR
const MSEdge * getNextRouteEdge() const
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
static const double SQUEEZE
MSPerson::MSPersonStage_Walking * myStage
static const double DIST_BEHIND
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)
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
Obstacle(int dir, double dist=DIST_FAR_AWAY)
create No-Obstacle
sorts the persons by position on the lane. If dir is forward, higher x positions come first...
double getMaxX(const bool includeMinGap=true) const
return the maximum position on the lane
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
double getArrivalPos() const
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static int connectedDirection(const MSLane *from, const MSLane *to)
returns the direction in which these lanes are connectioned or 0 if they are not
double distanceTo(const Obstacle &obs, const bool includeMinGap=true) const
WalkingAreaPath * myWalkingAreaPath
the current walkingAreaPath or 0
static const double MIN_STARTUP_DIST
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
information regarding surround Pedestrians (and potentially other things)
double x() const
Returns the x-position.
The base class for an intersection.
const MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
static double rand(std::mt19937 *rng=0)
Returns a random real number in [0, 1)
bool isWalkingArea() const
return whether this edge is walking area
PState(MSPerson *person, MSPerson::MSPersonStage_Walking *stage, const MSLane *lane)
std::string time2string(SUMOTime t)
MSPedestrianRouterDijkstra & getPedestrianRouter(const MSEdgeVector &prohibited=MSEdgeVector()) const
void registerJammed()
register a jammed transportable
double getSpeed(const MSPerson::MSPersonStage_Walking &stage) const
return the current speed of the person
double getLength() const
Returns the lane's length.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
void remove(PedestrianState *state)
remove the specified person from the pedestrian simulation
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
const std::string & getID() const
returns the id of the transportable
std::vector< const MSEdge * > ConstMSEdgeVector
std::map< std::pair< const MSLane *, const MSLane * >, WalkingAreaPath > WalkingAreaPaths
bool moveToNextLane(SUMOTime currentTime)
return whether this pedestrian has passed the end of the current lane and update myRelX if so ...
static MSPModel * myModel
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
static WalkingAreaPaths myWalkingAreaPaths
store for walkinArea elements
#define MINGAP_TO_VEHICLE
static const double LATERAL_PENALTY
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
static OptionsCont & getOptions()
Retrieves the options.
const MSEdge * getEdge() const
Returns the current edge.
static Pedestrians noPedestrians
empty pedestrian vector
static bool gCheck4Accidents
SumoXMLEdgeFunc getFunction() const
Returns the edge type (SumoXMLEdgeFunc)
PositionVector reverse() const
reverse position vector
void moveInDirection(SUMOTime currentTime, std::set< MSPerson * > &changedLane, int dir)
move all pedestrians forward and advance to the next lane if applicable
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
const MSEdge & getDestination() const
returns the destination edge
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
const std::string & getID() const
Returns the id.
A road/street connecting two junctions.
Pedestrians & getPedestrians(const MSLane *lane)
retrieves the pedestian vector for the given lane (may be empty)
double xFwd
maximal position on the current lane in forward direction
static const int UNDEFINED_DIRECTION
void arriveAndAdvance(Pedestrians &pedestrians, SUMOTime currentTime, std::set< MSPerson * > &changedLane, int dir)
handle arrivals and lane advancement
const MSVehicleType & getVehicleType() const
MSLane * getLogicalPredecessorLane() const
get the most likely precedecessor lane (sorted using by_connections_to_sorter). The result is cached ...
bool moveToNextEdge(MSPerson *person, SUMOTime currentTime, MSEdge *nextInternal=0)
move forward and return whether the person arrived
const SUMOVTypeParameter & getParameter() const
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const MSEdge * getEdge() const
Returns the current edge.
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 MSEdgeVector & getPredecessors() const
static const double DIST_OVERLAP
virtual MSTransportableControl & getPersonControl()
Returns the person control.
void walk(const Obstacles &obs, SUMOTime currentTime)
perform position update
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
A point in 2D or 3D with translation and scaling methods.
static int getStripeOffset(int origStripes, int destStripes, bool addRemainder)
const ConstMSEdgeVector & getRoute() const
MSLane * getLane() const
Returns the connected lane.
double myRelY
the orthogonal shift on the current lane
double xBack
maximal position on the current lane in backward direction
StageType getCurrentStageType() const
the current stage type of the transportable
double myRelX
the advancement along the current lane
MSEventControl * getBeginOfTimestepEvents()
Returns the event control for events executed at the begin of a time step.
SUMOTime getWaitingTime(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const
return the time the person spent standing
double y() const
Returns the y-position.
virtual void addEvent(Command *operation, SUMOTime execTimeStep=-1)
Adds an Event.
int getVehicleNumberWithPartials() const
Returns the number of vehicles on this lane (including partial occupators)
SUMOTime string2time(const std::string &r)
double getEdgePos(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const
abstract methods inherited from PedestrianState
std::vector< LinkLeader > LinkLeaders
Position getPosition(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const
return the network coordinate of the person
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
std::map< const MSLane *, Obstacles, lane_by_numid_sorter > NextLanesObstacles
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
SUMOTime myWaitingTime
the consecutive time spent at speed 0
bool isInternal() const
return whether this edge is an internal edge
int myDir
the walking direction on the current lane (1 forward, -1 backward)
static const double LOOKAHEAD_SAMEDIR
bool 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...
SUMOTime getWaitingTime(SUMOTime now) const
the time this transportable spent waiting
double getImpatience(SUMOTime now) const
returns the impatience
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
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.
PedestrianState * add(MSPerson *person, MSPerson::MSPersonStage_Walking *stage, SUMOTime now)
register the given person as a pedestrian
static const double RESERVE_FOR_ONCOMING_FACTOR
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 ...
SUMOTime getLastStateChange() const
double getMaxSpeed() const
accessors to be used by MSPModel
std::pair< const MSPerson *, double > PersonDist
bool hasPedestrians(const MSLane *lane)
whether the given lane has pedestrians on it
std::map< const MSLane *, double > MinNextLengths
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
ObstacleType type
whether this obstacle denotes a border or a pedestrian
static const double DIST_FAR_AWAY
double getLength() const
Get vehicle's length [m].
static const double ONCOMING_CONFLICT_PENALTY
void extrapolate(const double val, const bool onlyFirst=false, const bool onlyLast=false)
extrapolate position vector
bool ignoreRed(const MSLink *link) const
whether the pedestrian may ignore a red light
std::vector< PState * > Pedestrians
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 double stripeWidth
model parameters
static const double INAPPROPRIATE_PENALTY
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
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.
MSLane * getViaLaneOrLane() const
return the via lane if it exists and the lane otherwise
double getAngle(const MSPerson::MSPersonStage_Walking &stage, SUMOTime now) const
return the direction in which the person faces in degrees
A storage for options typed value containers)
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
Container for pedestrian state and individual position update function.
bool haveRed() const
Returns whether this link is blocked by a red (or redyellow) traffic light.
std::vector< Obstacle > Obstacles
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
static const int BACKWARD
const PositionVector & getShape() const
Returns this lane's shape.
const MSEdge * getNextEdge(const MSPerson::MSPersonStage_Walking &stage) const
return the list of internal edges if the pedestrian is on an intersection
static const double SAFETY_GAP
bool isCrossing() const
return whether this edge is a pedestrian crossing
const MSJunction * getFromJunction() const
const MSEdgeVector & getSuccessors() const
Returns the following edges.
MovePedestrians * myCommand
the MovePedestrians command that is registered
void push_back_noDoublePos(const Position &p)
insert in back a non double position
static void DEBUG_PRINT(const Obstacles &obs)
double distToLaneEnd() const
the absolute distance to the end of the lane in walking direction (or to the arrivalPos) ...
const MSLinkCont & getLinkCont() const
returns the container with all links !!!
static void addCloserObstacle(Obstacles &obs, double x, int stripe, int numStripes, const std::string &id, double width, int dir, ObstacleType type)
std::vector< MSEdge * > MSEdgeVector
int myNumActivePedestrians
the total number of active pedestrians
static MinNextLengths myMinNextLengths
const std::vector< IncomingLaneInfo > & getIncomingLanes() const
std::string description
the id / description of the obstacle
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)
static const double MAX_WAIT_TOLERANCE
double getLength() const
return the length of the pedestrian
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
AnyVehicleIterator anyVehiclesUpstreamEnd() const
end iterator for iterating over all vehicles touching this lane in upstream direction ...
const MSLane * myLane
the current lane of this pedestrian
double getMinGap() const
return the minimum gap of the pedestrian
double brakeGap(const double speed) const
Returns the distance the vehicle needs to halt including driver's reaction time tau (i...
void moveInDirectionOnLane(Pedestrians &pedestrians, const MSLane *lane, SUMOTime currentTime, std::set< MSPerson * > &changedLane, int dir)
move pedestrians forward on one lane
Position getLanePosition(const MSLane *lane, double at, double offset) const
get position on lane at length at with orthogonal offset
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
Position transformToVectorCoordinates(const Position &p, bool extend=false) const
return position p within the length-wise coordinate system defined by this position vector...
const MSJunction * getToJunction() const
static const double LOOKAROUND_VEHICLES
const std::string & getID() const
Returns the name of the vehicle.
static bool canTraverse(int dir, const ConstMSEdgeVector &route)
return whether the route may traversed with the given starting direction
double getSpeed() const
Returns the vehicle's current speed.
AnyVehicleIterator anyVehiclesUpstreamBegin() const
begin iterator for iterating over all vehicles touching this lane in upstream direction ...