SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-sim.org/
10 // Copyright (C) 2014-2014 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>
36 #include <microsim/MSPerson.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 std::vector<const MSEdge*>& 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 };
115 
116 
117 
118 #endif /* MSPModel_h */
119