18 #ifndef MSPModel_Striping_h 19 #define MSPModel_Striping_h 80 double oncomingGap, std::vector<const MSPerson*>* collectBlockers);
166 typedef std::map<const MSLane*, Pedestrians, lane_by_numid_sorter>
ActiveLanes;
206 Obstacle(
int dir,
double dist = DIST_FAR_AWAY);
210 Obstacle(
double _x,
double _speed,
ObstacleType _type,
const std::string& _description,
const double width = 0.)
211 : xFwd(_x + width / 2.), xBack(_x - width / 2.), speed(_speed), type(_type), description(_description) {};
231 length(_shape.length()) {
277 double lanePosLat,
double angle,
int routeOffset,
314 virtual double getMinX(
const bool includeMinGap =
true)
const;
317 virtual double getMaxX(
const bool includeMinGap =
true)
const;
320 double getLength()
const;
323 double getMinGap()
const;
326 double distToLaneEnd()
const;
329 bool moveToNextLane(
SUMOTime currentTime);
332 void walk(
const Obstacles& obs,
SUMOTime currentTime);
335 double getImpatience(
SUMOTime now)
const;
338 int otherStripe()
const;
340 static int stripe(
const double relY);
341 int otherStripe(
const double relY)
const;
349 double distanceTo(
const Obstacle& obs,
const bool includeMinGap =
true)
const;
352 void mergeObstacles(Obstacles& into,
const Obstacles& obs2);
355 static void mergeObstacles(Obstacles& into,
const Obstacles& obs2,
int dir,
int offset);
358 bool ignoreRed(
const MSLink* link)
const;
361 virtual const std::string& getID()
const;
364 virtual double getWidth()
const;
374 const std::string& getID()
const;
375 double getMinX(
const bool includeMinGap =
true)
const;
376 double getMaxX(
const bool includeMinGap =
true)
const;
377 double getWidth()
const;
459 int nextDir,
double currentLength,
int currentDir);
463 static void addCloserObstacle(Obstacles& obs,
double x,
int stripe,
int numStripes,
const std::string&
id,
double width,
int dir,
ObstacleType type);
472 static int getStripeOffset(
int origStripes,
int destStripes,
bool addRemainder);
475 static bool addCrossingVehs(
const MSLane* crossing,
int stripes,
double lateral_offset,
int dir, Obstacles& crossingVehs,
bool prio);
483 double minY,
double maxY, Pedestrians& toDelete, Pedestrians& transformedPeds);
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...
void moveInDirection(SUMOTime currentTime, std::set< MSPerson *> &changedLane, int dir)
move all pedestrians forward and advance to the next lane if applicable
bool myAmActive
whether an event for pedestrian processing was added
bool operator()(const WalkingAreaPath *p1, const WalkingAreaPath *p2) const
comparing operation
Representation of a vehicle in the micro simulation.
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 SUMOTime jamTimeCrossing
static Obstacles getNeighboringObstacles(const Pedestrians &pedestrians, int egoIndex, int stripes)
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
static int connectedDirection(const MSLane *from, const MSLane *to)
returns the direction in which these lanes are connectioned or 0 if they are not
virtual const std::string & getID() const
return the person id
WalkingAreaPath * myWalkingAreaPath
the current walkingAreaPath or 0
WalkingAreaPath(const MSLane *_from, const MSLane *_walkingArea, const MSLane *_to, const PositionVector &_shape)
static const double MIN_STARTUP_DIST
The pedestrian following model.
information regarding surround Pedestrians (and potentially other things)
The base class for an intersection.
MSPModel_Striping *const myModel
std::vector< const MSEdge * > ConstMSEdgeVector
bool usingInternalLanes()
whether movements on intersections are modelled /
std::map< std::pair< const MSLane *, const MSLane * >, WalkingAreaPath > WalkingAreaPaths
static bool usingInternalLanesStatic()
Base (microsim) event class.
static MSPModel * myModel
static WalkingAreaPaths myWalkingAreaPaths
store for walkinArea elements
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
The simulated network and simulation perfomer.
bool myAmJammed
whether the person is jammed
Obstacle(double _x, double _speed, ObstacleType _type, const std::string &_description, const double width=0.)
create an obstacle from explict values
static Pedestrians noPedestrians
empty pedestrian vector
int getNumericalID() const
Returns this lane's numerical id.
NextLaneInfo myNLI
information about the upcoming lane
The pedestrian following model.
static const double RESERVE_FOR_ONCOMING_FACTOR_JUNCTIONS
A road/street connecting two junctions.
const MSVehicle * myVehicle
Pedestrians & getPedestrians(const MSLane *lane)
retrieves the pedestian vector for the given lane (may be empty)
static bool addCrossingVehs(const MSLane *crossing, int stripes, double lateral_offset, int dir, Obstacles &crossingVehs, bool prio)
add vehicles driving across
double xFwd
maximal position on the current lane in forward direction
static const int UNDEFINED_DIRECTION
static const double OBSTRUCTED_PENALTY
static const double DIST_OVERLAP
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
by_xpos_sorter(int dir)
constructor
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
bool operator()(const PState *p1, const PState *p2) const
comparing operation
double myAngle
cached angle
std::map< const MSLane *, Pedestrians, lane_by_numid_sorter > ActiveLanes
std::map< const MSLane *, Obstacles, lane_by_numid_sorter > NextLanesObstacles
SUMOTime myWaitingTime
the consecutive time spent at speed 0
int myDir
the walking direction on the current lane (1 forward, -1 backward)
static const double LOOKAHEAD_SAMEDIR
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
MovePedestrians(MSPModel_Striping *model)
static void transformToCurrentLanePositions(Obstacles &o, int currentDir, int nextDir, double currentLength, double nextLength)
void arriveAndAdvance(Pedestrians &pedestrians, SUMOTime currentTime, std::set< MSPerson *> &changedLane, int dir)
handle arrivals and lane advancement
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
std::map< const MSLane *, double > MinNextLengths
ObstacleType type
whether this obstacle denotes a border or a pedestrian
static const double DIST_FAR_AWAY
static const double ONCOMING_CONFLICT_PENALTY
static std::map< const MSEdge *, std::vector< const MSLane * > > myWalkingAreaFoes
std::vector< PState * > Pedestrians
static double stripeWidth
model parameters
static const double INAPPROPRIATE_PENALTY
bool myWaitingToEnter
whether the pedestrian is waiting to start its walk
A storage for options typed value containers)
Container for pedestrian state and individual position update function.
NextLaneInfo(const MSLane *_lane, const MSLink *_link, int _dir)
std::vector< Obstacle > Obstacles
static void DEBUG_PRINT(const Obstacles &obs)
static void addCloserObstacle(Obstacles &obs, double x, int stripe, int numStripes, const std::string &id, double width, int dir, ObstacleType type)
const ActiveLanes & getActiveLanes()
int myNumActivePedestrians
the total number of active pedestrians
static MinNextLengths myMinNextLengths
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
Representation of a lane in the micro simulation.
ActiveLanes myActiveLanes
store of all lanes which have pedestrians on them
const MSLane * myLane
the current lane of this pedestrian
static bool addVehicleFoe(const MSVehicle *veh, const MSLane *walkingarea, const Position &relPos, double lateral_offset, double minY, double maxY, Pedestrians &toDelete, Pedestrians &transformedPeds)
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 ...
bool operator()(const MSLane *l1, const MSLane *l2) const
comparing operation
static const double LOOKAROUND_VEHICLES