Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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>
31#include <utils/geom/Position.h>
35
36
37// ===========================================================================
38// class declarations
39// ===========================================================================
40class MSNet;
41class MSEdge;
42class MSLane;
43class OutputDevice;
45class MSStoppingPlace;
46class SUMOVehicle;
47class MSVehicleType;
48class MSPModel;
49class MSMoveReminder;
50
51typedef std::vector<const MSEdge*> ConstMSEdgeVector;
52
53// ===========================================================================
54// class definitions
55// ===========================================================================
61class MSPerson : public MSTransportable {
62public:
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:
126 const double myDist;
127 const bool myAmExit;
130 };
131
132public:
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 replaceWalk(const ConstMSEdgeVector& newEdges, double departPos, int firstIndex, int nextIndex);
169
170
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
191
193
194 bool isRemoteControlled() const;
195
196 bool isRemoteAffected(SUMOTime t) const;
197
198 private:
207 };
208
209
216
217 const Influencer* getInfluencer() const;
218
219 bool hasInfluencer() const {
220 return myInfluencer != 0;
221 }
222
225
226private:
229
231
232private:
235
238
239};
long long int SUMOTime
Definition GUI.h:36
std::vector< const MSEdge * > ConstMSEdgeVector
Definition MSEdge.h:74
std::vector< const MSEdge * > ConstMSEdgeVector
Definition MSPerson.h:51
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:323
Influencer()
Constructor.
Definition MSPerson.cpp:291
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:298
~Influencer()
Destructor.
Definition MSPerson.cpp:294
Position myRemoteXYPos
Definition MSPerson.h:199
MSLane * myRemoteLane
Definition MSPerson.h:200
bool isRemoteAffected(SUMOTime t) const
Definition MSPerson.cpp:317
bool isRemoteControlled() const
Definition MSPerson.cpp:311
SUMOTime execute(SUMOTime currentTime)
Executes the command.
Definition MSPerson.cpp:128
ProceedCmd(MSTransportable *person, MSEdge *edge)
Definition MSPerson.h:112
ProceedCmd & operator=(const ProceedCmd &)
Invalidated assignment operator.
double getDistance() const
get travel distance in this stage
Definition MSPerson.h:91
double getSpeed() const
the speed of the person in this stage
Definition MSPerson.cpp:111
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
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:235
void setChosenSpeedFactor(const double factor)
Definition MSPerson.h:158
double getImpatience() const
Definition MSPerson.cpp:210
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.
void replaceWalk(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:247
bool isJammed() const
whether the person is jammed as defined by the current pedestrian model
MSPerson & operator=(const MSPerson &)
Invalidated assignment operator.
bool hasInfluencer() const
whether the vehicle is individually influenced (via TraCI or special parameters)
Definition MSPerson.h:219
virtual ~MSPerson()
destructor
Definition MSPerson.cpp:148
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Definition MSPerson.cpp:273
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:216
void setRemoteState(Position xyPos)
sets position outside the road network
A lane area vehicles can halt at.
virtual double getAngle() const
return the current angle of the transportable
bool isPerson() const
Whether it is a person.
virtual Position getPosition() const
Return the Network coordinate of the transportable.
std::vector< MSStage * > MSTransportablePlan
the structure holding the plan of a transportable
The car-following model and parameter.
Static storage of an output device and its base (abstract) implementation.
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:62
Structure representing possible vehicle parameter.