53 #define DEBUGCOND(PED) ((PED).myPerson->isSelected()) 54 #define DEBUGCOND2(LANE) ((LANE)->isSelected()) 58 for (
int i = 0; i < (int)obs.size(); ++i) {
60 <<
"(" << obs[i].description
61 <<
" x=(" << obs[i].xBack <<
"," << obs[i].xFwd
62 <<
") s=" << obs[i].speed
105 #define MINGAP_TO_VEHICLE 0.25 135 const MSLane* lane = getSidewalk<MSEdge, MSLane>(person->
getEdge());
137 std::string error =
"Person '" + person->
getID() +
"' could not find sidewalk on edge '" + person->
getEdge()->
getID() +
"', time=" 155 const MSLane* lane =
dynamic_cast<PState*
>(state)->myLane;
157 for (Pedestrians::iterator it = pedestrians.begin(); it != pedestrians.end(); ++it) {
160 pedestrians.erase(it);
169 double oncomingGap, std::vector<const MSPerson*>* collectBlockers) {
171 for (Pedestrians::const_iterator it_ped = pedestrians.begin(); it_ped != pedestrians.end(); ++it_ped) {
172 const PState& ped = **it_ped;
174 const double leaderBackDist = leaderFrontDist + ped.
getLength();
177 <<
" vehSide=" << vehSide
178 <<
" vehWidth=" << vehWidth
179 <<
" lBD=" << leaderBackDist
180 <<
" lFD=" << leaderFrontDist
183 if (leaderBackDist >= -vehWidth
184 && (leaderFrontDist < 0
189 if (collectBlockers == 0) {
192 collectBlockers->push_back(ped.
myPerson);
196 if (collectBlockers == 0) {
199 return collectBlockers->size() > 0;
218 double closest = std::numeric_limits<double>::max();
220 for (Pedestrians::const_iterator it_ped = pedestrians.begin(); it_ped != pedestrians.end(); ++it_ped) {
221 const PState& ped = **it_ped;
224 if (ped.
myRelX > minPos && (result.first == 0 || closest > relX2)) {
227 const bool overlap = (center + halfWidth > minRight && center - halfWidth < maxLeft);
229 std::cout <<
" nextBlocking lane=" << lane->
getID()
230 <<
" minPos=" << minPos <<
" minRight=" << minRight <<
" maxLeft=" << maxLeft
231 <<
" stopTime=" << stopTime
234 <<
" relX2=" << relX2
235 <<
" center=" << center
236 <<
" pedLeft=" << center + halfWidth
237 <<
" pedRight=" << center - halfWidth
238 <<
" overlap=" << overlap
267 for (Pedestrians::iterator it_p = it_lane->second.begin(); it_p != it_lane->second.end(); ++it_p) {
285 if (from == 0 || to == 0) {
305 const MSLane* walkingArea = getSidewalk<MSEdge, MSLane>(edge);
309 std::vector<const MSLane*> lanes;
311 for (
int j = 0; j < (int)incoming.size(); ++j) {
312 lanes.push_back(getSidewalk<MSEdge, MSLane>(incoming[j]));
315 for (
int j = 0; j < (int)outgoing.size(); ++j) {
316 lanes.push_back(getSidewalk<MSEdge, MSLane>(outgoing[j]));
319 for (
int j = 0; j < (int)lanes.size(); ++j) {
320 for (
int k = 0; k < (int)lanes.size(); ++k) {
323 const MSLane* from = lanes[j];
324 const MSLane* to = lanes[k];
330 const double maxExtent = fromPos.
distanceTo2D(toPos) / 4;
331 const double extrapolateBy =
MIN2(maxExtent, walkingArea->
getWidth() / 2);
333 shape.push_back(fromPos);
343 if (shape.size() < 2) {
347 assert(shape.size() == 2);
355 myMinNextLengths[walkingArea] =
MIN2(myMinNextLengths[walkingArea], wap.
length);
367 std::vector<const MSLane*> lanes;
369 for (
int j = 0; j < (int)incoming.size(); ++j) {
370 lanes.push_back(getSidewalk<MSEdge, MSLane>(incoming[j]));
373 for (
int j = 0; j < (int)outgoing.size(); ++j) {
374 lanes.push_back(getSidewalk<MSEdge, MSLane>(outgoing[j]));
376 if (lanes.size() < 1) {
377 throw ProcessError(
"Invalid walkingarea '" + walkingArea->
getID() +
"' does not allow continuation.");
388 const MSLane* nextRouteLane = getSidewalk<MSEdge, MSLane>(nextRouteEdge);
390 const MSLane* nextLane = nextRouteLane;
394 if (nextRouteLane == 0 && nextRouteEdge != 0) {
395 std::string error =
"Person '" + ped.
myPerson->
getID() +
"' could not find sidewalk on edge '" + nextRouteEdge->
getID() +
"', time=" 399 nextRouteLane = nextRouteEdge->
getLanes().front();
405 if (nextRouteLane != 0) {
410 std::cout <<
" internal\n";
415 nextLane = currentLane->
getLinkCont()[0]->getLane();
420 std::cout <<
" crossing\n";
427 const double arrivalPos = (nextRouteEdge == ped.
myStage->
getRoute().back()
432 prohibited.push_back(&prevLane->
getEdge());
437 <<
" nre=" << nextRouteEdge->
getID()
438 <<
" nreDir=" << nextRouteEdgeDir
439 <<
" aPos=" << arrivalPos
440 <<
" crossingRoute=" <<
toString(crossingRoute)
443 if (crossingRoute.size() > 1) {
444 const MSEdge* nextEdge = crossingRoute[1];
445 nextLane = getSidewalk<MSEdge, MSLane>(crossingRoute[1]);
447 assert(nextLane != prevLane);
450 std::cout <<
" nextDir=" << nextDir <<
"\n";
465 <<
" no route from '" << (currentEdge == 0 ?
"NULL" : currentEdge->
getID())
466 <<
"' to '" << (nextRouteEdge == 0 ?
"NULL" : nextRouteEdge->
getID())
473 }
else if (currentEdge == nextRouteEdge) {
475 nextDir = -ped.
myDir;
483 std::cout <<
" next walkingArea " << (nextDir ==
FORWARD ?
"forward" :
"backward") <<
"\n";
494 std::cout <<
" direct forward\n";
502 std::cout <<
" direct backward\n";
510 nextLane = nextRouteLane;
512 std::cout <<
SIMTIME <<
" no next lane found for " << currentLane->
getID() <<
" dir=" << ped.
myDir <<
"\n";
516 nextLane = nextRouteLane;
523 <<
" l=" << currentLane->
getID()
524 <<
" nl=" << (nextLane == 0 ?
"NULL" : nextLane->getID())
525 <<
" nrl=" << (nextRouteLane == 0 ?
"NULL" : nextRouteLane->
getID())
528 <<
" pedDir=" << ped.
myDir 539 for (MSLinkCont::const_iterator it = links.begin(); it != links.end(); ++it) {
540 if ((*it)->getLane()->getEdge().isWalkingArea()) {
546 const std::vector<MSLane::IncomingLaneInfo>& laneInfos = currentLane->
getIncomingLanes();
547 for (std::vector<MSLane::IncomingLaneInfo>::const_iterator it = laneInfos.begin(); it != laneInfos.end(); ++it) {
548 if ((*it).lane->getEdge().isWalkingArea()) {
549 link = (*it).viaLink;
560 const PState& ego = *pedestrians[egoIndex];
562 std::vector<bool> haveBlocker(stripes,
false);
563 for (
int index = egoIndex + 1; index < (int)pedestrians.size(); index++) {
564 const PState& p = *pedestrians[index];
571 std::cout <<
" dist=" << ego.
distanceTo(o) << std::endl;
579 haveBlocker[p.
stripe()] =
true;
582 if (!haveBlocker[p.
stripe()]) {
600 int offset = (destStripes - origStripes) / 2;
602 offset += (destStripes - origStripes) % 2;
610 MSLane* lane,
const MSLane* nextLane,
int stripes,
int nextDir,
611 double currentLength,
int currentDir) {
612 if (nextLanesObs.count(nextLane) == 0) {
619 const int offset =
getStripeOffset(nextStripes, stripes, currentDir != nextDir && nextStripes > stripes);
630 if (nextStripes < stripes) {
632 for (
int ii = 0; ii < stripes; ++ii) {
633 if (ii < offset || ii >= nextStripes + offset) {
644 if ((stripes - nextStripes) % 2 != 0) {
647 nextDir = currentDir;
649 for (
int ii = 0; ii < (int)pedestrians.size(); ++ii) {
650 PState& p = *pedestrians[ii];
655 const double newY = relPos.
y() + lateral_offset;
666 sort(pedestrians.begin(), pedestrians.end(),
by_xpos_sorter(nextDir));
667 for (
int ii = 0; ii < (int)pedestrians.size(); ++ii) {
668 const PState& p = *pedestrians[ii];
674 if (nextDir != currentDir) {
679 const int stripe = p.
stripe(newY);
680 if (stripe >= 0 && stripe < stripes) {
684 if (otherStripe >= 0 && otherStripe < stripes) {
685 obs[otherStripe] = pObs;
694 nextLanesObs[nextLane] = obs;
696 return nextLanesObs[nextLane];
701 for (
int ii = 0; ii < (int)obs.size(); ++ii) {
705 o.
xFwd += currentLength;
706 o.
xBack += currentLength;
708 const double tmp = o.
xFwd;
709 o.
xFwd = currentLength + nextLength - o.
xBack;
710 o.
xBack = currentLength + nextLength - tmp;
714 const double tmp = o.
xFwd;
718 o.
xFwd -= nextLength;
719 o.
xBack -= nextLength;
728 if (stripe >= 0 && stripe < numStripes) {
729 if ((dir ==
FORWARD && x - width / 2. < obs[stripe].xBack) || (dir ==
BACKWARD && x + width / 2. > obs[stripe].xFwd)) {
730 obs[stripe] =
Obstacle(x, 0, type,
id, width);
738 const MSLane* lane = it_lane->first;
740 if (pedestrians.size() == 0) {
751 std::set<const WalkingAreaPath*, walkingarea_path_sorter> paths;
752 for (Pedestrians::iterator it = pedestrians.begin(); it != pedestrians.end(); ++it) {
755 if (p->
myDir == dir) {
759 std::cout <<
SIMTIME <<
" debugging WalkingAreaPath from=" << debugPath->
from->
getID() <<
" to=" << debugPath->
to->
getID() <<
"\n";
763 for (std::set<const WalkingAreaPath*, walkingarea_path_sorter>::iterator it = paths.begin(); it != paths.end(); ++it) {
767 transformedPeds.reserve(pedestrians.size());
768 for (Pedestrians::iterator it_p = pedestrians.begin(); it_p != pedestrians.end(); ++it_p) {
773 transformedPeds.push_back(p);
774 if (path == debugPath) std::cout <<
" ped=" << p->
myPerson->
getID() <<
" relX=" << p->
myRelX <<
" relY=" << p->
myRelY <<
" (untransformed), vecCoord=" 778 const double newY = relPos.
y() + lateral_offset;
786 toDelete.push_back(tp);
787 transformedPeds.push_back(tp);
788 if (path == debugPath) {
789 std::cout <<
" ped=" << p->
myPerson->
getID() <<
" relX=" << relPos.
x() <<
" relY=" << newY <<
" (transformed), vecCoord=" << relPos <<
"\n";
792 if (path == debugPath) {
793 std::cout <<
" ped=" << p->
myPerson->
getID() <<
" relX=" << relPos.
x() <<
" relY=" << newY <<
" (invalid), vecCoord=" << relPos <<
"\n";
801 for (Pedestrians::iterator it_p = toDelete.begin(); it_p != toDelete.end(); ++it_p) {
816 sort(pedestrians.begin(), pedestrians.end(),
by_xpos_sorter(dir));
818 for (
int i = 0; i < (int)pedestrians.size(); i++) {
819 PState*
const p = pedestrians[i];
823 pedestrians.erase(pedestrians.begin() + i);
844 sort(pedestrians.begin(), pedestrians.end(),
by_xpos_sorter(dir));
847 bool hasCrossingVehObs =
false;
849 hasCrossingVehObs =
addCrossingVehs(lane, stripes, 0, dir, crossingVehs);
852 for (
int ii = 0; ii < (int)pedestrians.size(); ++ii) {
853 PState& p = *pedestrians[ii];
883 nextLanesObs, lane, nextLane, stripes,
930 const int current = p.
stripe();
957 std::cout <<
" ignoring vehicle on stripe " << s <<
"\n";
970 <<
" ymin=" << vehYmin
971 <<
" ymax=" << vehYmax
975 <<
" current=" << current
986 if (hasCrossingVehObs) {
995 p.
walk(currentObs, currentTime);
1002 for (
int coll = 0; coll < ii; ++coll) {
1003 PState& c = *pedestrians[coll];
1010 +
"', lane='" + lane->
getID() +
"', time=" +
time2string(currentTime) +
".");
1023 bool hasCrossingVehObs =
false;
1025 if (linkLeaders.size() > 0) {
1026 for (MSLink::LinkLeaders::const_iterator it = linkLeaders.begin(); it != linkLeaders.end(); ++it) {
1028 const MSVehicle* veh = (*it).vehAndGap.first;
1035 if ((*it).fromLeft) {
1036 vehYmin = -(*it).vehAndGap.second + lateral_offset;
1040 vehYmax = crossing->
getWidth() + (*it).vehAndGap.second - lateral_offset;
1046 if ((dir ==
FORWARD && obs[s].xBack > vo.xBack)
1047 || (dir ==
BACKWARD && obs[s].xFwd < vo.xFwd)) {
1049 hasCrossingVehObs =
true;
1054 <<
" crossingVeh=" << veh->
getID()
1055 <<
" lane=" << crossing->
getID()
1056 <<
" latOffset=" << lateral_offset
1058 <<
" stripes=" << stripes
1059 <<
" dist=" << (*it).distToCrossing
1060 <<
" gap=" << (*it).vehAndGap.second
1061 <<
" brakeGap=" << bGap
1062 <<
" fromLeft=" << (*it).fromLeft
1063 <<
" ymin=" << vehYmin
1064 <<
" ymax=" << vehYmax
1073 return hasCrossingVehObs;
1089 xFwd(ped.getMaxX()),
1090 xBack(ped.getMinX()),
1091 speed(ped.myDir * ped.mySpeed),
1107 myRelX(stage->getDepartPos()),
1108 myRelY(stage->getDepartPosLat()),
1111 myWaitingToEnter(true),
1113 myWalkingAreaPath(0),
1117 assert(!route.empty());
1118 if (route.size() == 1) {
1124 if (route.front()->isWalkingArea()) {
1131 std::cout <<
" initialize dir for " <<
myPerson->
getID() <<
" forward=" << mayStartForward <<
" backward=" << mayStartBackward <<
"\n";
1133 if (mayStartForward && mayStartBackward) {
1137 if (crossingRoute.size() > 1) {
1139 const MSEdge* nextEdge = crossingRoute[1];
1145 std::cout <<
" crossingRoute=" <<
toString(crossingRoute) <<
"\n";
1207 const int s =
stripe(relY);
1211 if (offset > threshold) {
1213 }
else if (offset < -threshold) {
1259 const int oldDir =
myDir;
1267 <<
" moveToNextLane old=" << oldLane->
getID()
1269 <<
" oldDir=" << oldDir
1270 <<
" newDir=" <<
myDir 1325 if (-dist > newLength) {
1331 myRelX = newLength + dist;
1337 <<
" newLength=" << newLength
1343 if (
myDir != oldDir) {
1354 <<
" od=" << oldDir <<
" nd=" <<
myDir 1355 <<
" offset=" << offset <<
"\n";
1367 const int stripes = (int)obs.size();
1368 const int sMax = stripes - 1;
1372 const int current =
stripe();
1375 std::vector<double> distance(stripes);
1376 for (
int i = 0; i < stripes; ++i) {
1380 std::vector<double> utility(stripes, 0);
1382 for (
int i = 0; i < stripes; ++i) {
1388 for (
int j = 0; j <= i; ++j) {
1393 for (
int j = i; j < stripes; ++j) {
1405 for (
int i = 0; i < reserved; ++i) {
1409 for (
int i = sMax; i > sMax - reserved; --i) {
1414 for (
int i = 0; i < stripes; ++i) {
1415 if (obs[i].speed *
myDir < 0) {
1418 utility[i - 1] -= 0.5;
1420 utility[i + 1] -= 0.5;
1424 const double walkDist =
MAX2(0., distance[i]);
1428 std::cout <<
" util=" << utility[i] <<
" exp=" << expectedDist <<
" dist=" << distance[i] <<
"\n";
1430 if (expectedDist >= 0) {
1431 utility[i] += expectedDist;
1445 for (
int i = 0; i < stripes; ++i) {
1451 int chosen = current;
1452 for (
int i = 0; i < stripes; ++i) {
1453 if (utility[chosen] < utility[i]) {
1458 const int next = (chosen == current ? current : (chosen < current ? current - 1 : current + 1));
1459 const double xDist =
MIN3(distance[current], distance[other], distance[next]);
1467 std::cout <<
" xSpeedPotential=" << xSpeed <<
"\n";
1474 (xDist == distance[current] && obs[current].type >=
OBSTACLE_END)
1475 || (xDist == distance[other] && obs[other].type >=
OBSTACLE_END)
1476 || (xDist == distance[next] && obs[next].type >=
OBSTACLE_END))
1517 ySpeed = (yDist > 0 ?
1536 <<
" cur=" << current
1537 <<
" cho=" << chosen
1541 <<
" dawdle=" << dawdle
1548 <<
"\n distance=" <<
toString(distance)
1549 <<
"\n utility=" <<
toString(utility)
1638 double lanePosLat,
double angle,
int routeOffset,
1667 const double maxX =
getMaxX(includeMinGap);
1668 const double minX =
getMinX(includeMinGap);
1672 if ((obs.
xFwd >= maxX && obs.
xBack <= maxX) || (obs.
xFwd <= maxX && obs.
xFwd >= minX)) {
1685 for (
int i = 0; i < (int)into.size(); ++i) {
1687 std::cout <<
" i=" << i <<
" intoDist=" <<
distanceTo(into[i]) <<
" obs2Dist=" <<
distanceTo(obs2[i]) <<
"\n";
1700 if (ignoreRedTime >= 0) {
1703 std::cout <<
SIMTIME <<
" ignoreRedTime=" << ignoreRedTime <<
" redDuration=" << redDuration <<
"\n";
1705 return ignoreRedTime > redDuration;
1721 std::set<MSPerson*> changedLane;
1726 for (ActiveLanes::const_iterator it_lane =
myModel->getActiveLanes().begin(); it_lane !=
myModel->getActiveLanes().end(); ++it_lane) {
1727 const MSLane* lane = it_lane->first;
1729 if (pedestrians.size() == 0) {
1734 for (
int ii = 0; ii < (int)pedestrians.size(); ++ii) {
1735 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
information regarding surround Pedestrians (and potentially other things)
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).
MSPedestrianRouterDijkstra & getPedestrianRouter(const MSEdgeVector &prohibited=MSEdgeVector()) const
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 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)
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
bool moveToNextEdge(MSPerson *person, SUMOTime currentTime, MSEdge *nextInternal=0)
move forward and return whether the person arrived
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.
static const double DIST_OVERLAP
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)
double myRelY
the orthogonal shift on the current lane
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)
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
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
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 ...
std::pair< const MSPerson *, double > PersonDist
bool hasPedestrians(const MSLane *lane)
whether the given lane has pedestrians on it
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
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...
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
const MSStoppingPlace * getDestinationStop() const
returns the destination stop (if any)
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
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
const MSEdgeVector & getSuccessors() const
Returns the following edges.
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 MSEdge & getDestination() const
returns the destination edge
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
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 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
static bool canTraverse(int dir, const ConstMSEdgeVector &route)
return whether the route may traversed with the given starting direction