SUMO - Simulation of Urban MObility
MSPModel.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // The pedestrian following model (prototype)
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2014-2015 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef MSPModel_h
21 #define MSPModel_h
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include <string>
33 #include <limits>
34 #include <utils/common/SUMOTime.h>
35 #include <utils/common/Command.h>
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
41 class MSNet;
42 class MSLane;
43 class MSJunction;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
54 class MSPModel {
55 public:
56 
57  static MSPModel* getModel();
58 
60  static void cleanup();
61 
63  static MSLane* getSidewalk(const MSEdge* edge);
64 
65  virtual ~MSPModel() {};
66 
68  virtual PedestrianState* add(MSPerson* person, MSPerson::MSPersonStage_Walking* stage, SUMOTime now) = 0;
69 
71  virtual bool blockedAtDist(const MSLane* lane, SUMOReal distToCrossing, std::vector<const MSPerson*>* collectBlockers) = 0;
72 
73  virtual void cleanupHelper() {};
74 
75  // @brief walking directions
76  static const int FORWARD;
77  static const int BACKWARD;
78  static const int UNDEFINED_DIRECTION;
79 
80  // @brief the safety gap to keep between the car and the pedestrian in all directions
81  static const SUMOReal SAFETY_GAP;
82 
84  static const SUMOReal SIDEWALK_OFFSET;
85 
87  static bool canTraverse(int dir, const ConstMSEdgeVector& route);
88 
89 private:
90  static MSPModel* myModel;
91 
92 };
93 
94 
97 public:
98  virtual ~PedestrianState() {};
99 
101  virtual SUMOReal getEdgePos(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const = 0;
102 
104  virtual Position getPosition(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const = 0;
105 
107  virtual SUMOReal getAngle(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const = 0;
108 
110  virtual SUMOTime getWaitingTime(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const = 0;
111 
113  virtual SUMOReal getSpeed(const MSPerson::MSPersonStage_Walking& stage) const = 0;
114 
116  virtual const MSEdge* getNextEdge(const MSPerson::MSPersonStage_Walking& stage) const = 0;
117 };
118 
119 
120 
121 #endif /* MSPModel_h */
122 
virtual void cleanupHelper()
Definition: MSPModel.h:73
long long int SUMOTime
Definition: SUMOTime.h:43
static const SUMOReal SAFETY_GAP
Definition: MSPModel.h:81
virtual ~PedestrianState()
Definition: MSPModel.h:98
The base class for an intersection.
Definition: MSJunction.h:61
static const int FORWARD
Definition: MSPModel.h:73
static MSLane * getSidewalk(const MSEdge *edge)
return the appropriate lane to walk on
Definition: MSPModel.cpp:93
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:79
static MSPModel * myModel
Definition: MSPModel.h:90
The simulated network and simulation perfomer.
Definition: MSNet.h:94
virtual PedestrianState * add(MSPerson *person, MSPerson::MSPersonStage_Walking *stage, SUMOTime now)=0
register the given person as a pedestrian
The pedestrian following model.
Definition: MSPModel.h:54
A road/street connecting two junctions.
Definition: MSEdge.h:81
static const int UNDEFINED_DIRECTION
Definition: MSPModel.h:78
virtual bool blockedAtDist(const MSLane *lane, SUMOReal distToCrossing, std::vector< const MSPerson * > *collectBlockers)=0
whether a pedestrian is blocking the crossing of lane at offset distToCrossing
static MSPModel * getModel()
Definition: MSPModel.cpp:65
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
virtual ~MSPModel()
Definition: MSPModel.h:65
abstract base class for managing callbacks to retrieve various state information from the model ...
Definition: MSPModel.h:96
static const SUMOReal SIDEWALK_OFFSET
the offset for computing person positions when walking on edges without a sidewalk ...
Definition: MSPModel.h:84
static void cleanup()
remove state at simulation end
Definition: MSPModel.cpp:83
static const int BACKWARD
Definition: MSPModel.h:77
#define SUMOReal
Definition: config.h:214
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
static bool canTraverse(int dir, const ConstMSEdgeVector &route)
return whether the route may traversed with the given starting direction
Definition: MSPModel.cpp:109