Eclipse SUMO - Simulation of Urban MObility
MSPerson.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
21 // The class for modelling person-movements
22 /****************************************************************************/
23 #pragma once
24 #include <config.h>
25 
26 #include <string>
27 #include <vector>
28 #include <set>
29 #include <utils/common/SUMOTime.h>
30 #include <utils/common/Command.h>
31 #include <utils/geom/Position.h>
35 
36 
37 // ===========================================================================
38 // class declarations
39 // ===========================================================================
40 class MSNet;
41 class MSEdge;
42 class MSLane;
43 class OutputDevice;
45 class MSStoppingPlace;
46 class SUMOVehicle;
47 class MSVehicleType;
48 class MSPModel;
49 class MSMoveReminder;
50 
51 typedef std::vector<const MSEdge*> ConstMSEdgeVector;
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
61 class MSPerson : public MSTransportable {
62 public:
67  class MSPersonStage_Access : public MSStage {
68  public:
70  MSPersonStage_Access(const MSEdge* destination, MSStoppingPlace* toStop,
71  const double arrivalPos, const double arrivalPosLat, const double dist, const bool isExit,
72  const Position& startPos, const Position& endPos);
73 
76 
77  MSStage* clone() const;
78 
80  virtual void proceed(MSNet* net, MSTransportable* person, SUMOTime now, MSStage* previous);
81 
83  std::string getStageDescription(const bool isPerson) const;
84  std::string getStageSummary(const bool isPerson) const;
85 
86  Position getPosition(SUMOTime now) const;
87 
88  double getAngle(SUMOTime now) const;
89 
91  double getDistance() const {
92  return myDist;
93  }
94 
96  double getSpeed() const;
97 
104  void tripInfoOutput(OutputDevice& os, const MSTransportable* const transportable) const;
105 
107  void routeOutput(const bool, OutputDevice&, const bool, const MSStage* const) const {};
108 
109  private:
110  class ProceedCmd : public Command {
111  public:
112  ProceedCmd(MSTransportable* person, MSEdge* edge) : myPerson(person), myStopEdge(edge) {}
114  SUMOTime execute(SUMOTime currentTime);
115  private:
118  private:
121  };
122 
123  private:
125  const MSEdge* myOrigin;
126  const double myDist;
127  const bool myAmExit;
130  };
131 
132 public:
134  MSPerson(const SUMOVehicleParameter* pars, MSVehicleType* vtype, MSTransportable::MSTransportablePlan* plan, const double speedFactor);
135 
137  virtual ~MSPerson();
138 
139  /* @brief check whether an access stage must be added and return whether a
140  * stage was added */
141  bool checkAccess(const MSStage* const prior, const bool waitAtStop = true);
142 
144  const std::string& getNextEdge() const;
145 
147  const MSEdge* getNextEdgePtr() const;
148 
150  virtual bool isSelected() const {
151  return false;
152  }
153 
154  inline double getChosenSpeedFactor() const {
155  return myChosenSpeedFactor;
156  }
157 
158  inline void setChosenSpeedFactor(const double factor) {
159  myChosenSpeedFactor = factor;
160  }
161 
162  double getImpatience() const;
163 
165  bool isJammed() const;
166 
168  void reroute(const ConstMSEdgeVector& newEdges, double departPos, int firstIndex, int nextIndex);
169 
170 
176  class Influencer {
177  public:
179  Influencer();
180 
181 
183  ~Influencer();
184 
185 
186  void setRemoteControlled(Position xyPos, MSLane* l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t);
187 
189  return myLastRemoteAccess;
190  }
191 
193 
194  bool isRemoteControlled() const;
195 
196  bool isRemoteAffected(SUMOTime t) const;
197 
198  private:
201  double myRemotePos;
207  };
208 
209 
216 
217  const Influencer* getInfluencer() const;
218 
219  bool hasInfluencer() const {
220  return myInfluencer != 0;
221  }
222 
225 
226 private:
229 
231 
232 private:
235 
238 
239 };
long long int SUMOTime
Definition: GUI.h:35
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:74
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSPerson.h:49
Base (microsim) event class.
Definition: Command.h:50
A road/street connecting two junctions.
Definition: MSEdge.h:77
Representation of a lane in the micro simulation.
Definition: MSLane.h:84
Something on a lane to be noticed about vehicle movement.
The simulated network and simulation perfomer.
Definition: MSNet.h:89
The pedestrian (and also sometimes container) movement model.
Definition: MSPModel.h:51
Changes the wished person speed and position.
Definition: MSPerson.h:176
SUMOTime myLastRemoteAccess
Definition: MSPerson.h:206
void postProcessRemoteControl(MSPerson *p)
Definition: MSPerson.cpp:325
Influencer()
Constructor.
Definition: MSPerson.cpp:293
SUMOTime getLastAccessTimeStep() const
Definition: MSPerson.h:188
ConstMSEdgeVector myRemoteRoute
Definition: MSPerson.h:205
void setRemoteControlled(Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector &route, SUMOTime t)
Definition: MSPerson.cpp:300
~Influencer()
Destructor.
Definition: MSPerson.cpp:296
Position myRemoteXYPos
Definition: MSPerson.h:199
MSLane * myRemoteLane
Definition: MSPerson.h:200
bool isRemoteAffected(SUMOTime t) const
Definition: MSPerson.cpp:319
bool isRemoteControlled() const
Definition: MSPerson.cpp:313
SUMOTime execute(SUMOTime currentTime)
Executes the command.
Definition: MSPerson.cpp:128
ProceedCmd & operator=(const ProceedCmd &)
Invalidated assignment operator.
ProceedCmd(MSTransportable *person, MSEdge *edge)
Definition: MSPerson.h:112
Position getPosition(SUMOTime now) const
returns the position of the transportable
Definition: MSPerson.cpp:99
double getDistance() const
get travel distance in this stage
Definition: MSPerson.h:91
MSPersonStage_Access(const MSEdge *destination, MSStoppingPlace *toStop, const double arrivalPos, const double arrivalPosLat, const double dist, const bool isExit, const Position &startPos, const Position &endPos)
constructor
Definition: MSPerson.cpp:58
double getSpeed() const
the speed of the person in this stage
Definition: MSPerson.cpp:111
MSStage * clone() const
Definition: MSPerson.cpp:71
void tripInfoOutput(OutputDevice &os, const MSTransportable *const transportable) const
Called on writing tripinfo output.
Definition: MSPerson.cpp:116
const MSEdge * myOrigin
the origin edge
Definition: MSPerson.h:125
void routeOutput(const bool, OutputDevice &, const bool, const MSStage *const) const
Called on writing vehroute output. Currently does nothing.
Definition: MSPerson.h:107
virtual void proceed(MSNet *net, MSTransportable *person, SUMOTime now, MSStage *previous)
proceeds to the next step
Definition: MSPerson.cpp:76
double getAngle(SUMOTime now) const
returns the angle of the transportable
Definition: MSPerson.cpp:105
std::string getStageDescription(const bool isPerson) const
returns the stage description as a string
Definition: MSPerson.cpp:87
std::string getStageSummary(const bool isPerson) const
return string summary of the current stage
Definition: MSPerson.cpp:93
bool checkAccess(const MSStage *const prior, const bool waitAtStop=true)
Definition: MSPerson.cpp:154
Influencer * myInfluencer
An instance of a speed/position influencing instance; built in "getInfluencer".
Definition: MSPerson.h:228
const MSEdge * getNextEdgePtr() const
returns the next edge ptr if this person is walking and the pedestrian model allows it
Definition: MSPerson.cpp:234
void setChosenSpeedFactor(const double factor)
Definition: MSPerson.h:158
double getImpatience() const
Definition: MSPerson.cpp:209
double getChosenSpeedFactor() const
the current speed factor of the transportable (where applicable)
Definition: MSPerson.h:154
double myChosenSpeedFactor
Definition: MSPerson.h:230
virtual bool isSelected() const
whether this person is selected in the GUI
Definition: MSPerson.h:150
MSPerson(const MSPerson &)
Invalidated copy constructor.
MSPerson & operator=(const MSPerson &)
Invalidated assignment operator.
bool isJammed() const
whether the person is jammed as defined by the current pedestrian model
bool hasInfluencer() const
whether the vehicle is individually influenced (via TraCI or special parameters)
Definition: MSPerson.h:219
void reroute(const ConstMSEdgeVector &newEdges, double departPos, int firstIndex, int nextIndex)
set new walk and replace the stages with relative indices in the interval [firstIndex,...
Definition: MSPerson.cpp:246
virtual ~MSPerson()
destructor
Definition: MSPerson.cpp:148
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Definition: MSPerson.cpp:275
const std::string & getNextEdge() const
return the list of internal edges if this person is walking and the pedestrian model allows it
Definition: MSPerson.cpp:215
MSPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
constructor
Definition: MSPerson.cpp:141
void setRemoteState(Position xyPos)
sets position outside the road network
A lane area vehicles can halt at.
bool isPerson() const
Whether it is a person.
std::vector< MSStage * > MSTransportablePlan
the structure holding the plan of a transportable
The car-following model and parameter.
Definition: MSVehicleType.h:63
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
A list of positions.
Representation of a vehicle.
Definition: SUMOVehicle.h:60
Structure representing possible vehicle parameter.