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-2016 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 
62  virtual ~MSPModel() {};
63 
65  virtual PedestrianState* add(MSPerson* person, MSPerson::MSPersonStage_Walking* stage, SUMOTime now) = 0;
66 
68  virtual bool blockedAtDist(const MSLane* lane, SUMOReal distToCrossing, std::vector<const MSPerson*>* collectBlockers) = 0;
69 
70  virtual void cleanupHelper() {};
71 
72  // @brief walking directions
73  static const int FORWARD;
74  static const int BACKWARD;
75  static const int UNDEFINED_DIRECTION;
76 
77  // @brief the safety gap to keep between the car and the pedestrian in all directions
78  static const SUMOReal SAFETY_GAP;
79 
81  static const SUMOReal SIDEWALK_OFFSET;
82 
84  static bool canTraverse(int dir, const ConstMSEdgeVector& route);
85 
86 private:
87  static MSPModel* myModel;
88 
89 };
90 
91 
94 public:
95  virtual ~PedestrianState() {};
96 
98  virtual SUMOReal getEdgePos(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const = 0;
99 
101  virtual Position getPosition(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const = 0;
102 
104  virtual SUMOReal getAngle(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const = 0;
105 
107  virtual SUMOTime getWaitingTime(const MSPerson::MSPersonStage_Walking& stage, SUMOTime now) const = 0;
108 
110  virtual SUMOReal getSpeed(const MSPerson::MSPersonStage_Walking& stage) const = 0;
111 
113  virtual const MSEdge* getNextEdge(const MSPerson::MSPersonStage_Walking& stage) const = 0;
114 };
115 
116 
117 
118 #endif /* MSPModel_h */
119 
virtual void cleanupHelper()
Definition: MSPModel.h:70
long long int SUMOTime
Definition: SUMOTime.h:43
static const SUMOReal SAFETY_GAP
Definition: MSPModel.h:78
virtual ~PedestrianState()
Definition: MSPModel.h:95
The base class for an intersection.
Definition: MSJunction.h:64
static const int FORWARD
Definition: MSPModel.h:70
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:78
static MSPModel * myModel
Definition: MSPModel.h:87
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:80
static const int UNDEFINED_DIRECTION
Definition: MSPModel.h:75
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:63
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
virtual ~MSPModel()
Definition: MSPModel.h:62
abstract base class for managing callbacks to retrieve various state information from the model ...
Definition: MSPModel.h:93
static const SUMOReal SIDEWALK_OFFSET
the offset for computing person positions when walking on edges without a sidewalk ...
Definition: MSPModel.h:81
static void cleanup()
remove state at simulation end
Definition: MSPModel.cpp:81
static const int BACKWARD
Definition: MSPModel.h:74
#define SUMOReal
Definition: config.h:213
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:91