Eclipse SUMO - Simulation of Urban MObility
MSPModel_Remote.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2014-2020 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 /****************************************************************************/
18 // The pedestrian following model for remote controlled pedestrian movement
19 /****************************************************************************/
20 #pragma once
21 
23 #include <microsim/MSNet.h>
24 #include <utils/geom/Boundary.h>
25 #include "MSPModel.h"
26 
27 
28 // ===========================================================================
29 // class definitions
30 // ===========================================================================
35 class MSPModel_Remote : public MSPModel {
36 public:
37  MSPModel_Remote(const OptionsCont& oc, MSNet* net);
38 
41  void remove(MSTransportableStateAdapter* state) override;
42  bool usingInternalLanes();
43 
45  class Event : public Command {
46  public:
47  explicit Event(MSPModel_Remote* remoteModel)
48  : myRemoteModel(remoteModel) { }
49  SUMOTime execute(SUMOTime currentTime) override {
50  return myRemoteModel->execute(currentTime);
51  }
52  private:
54  };
55 
58  return (int)remoteIdPStateMapping.size();
59  }
60 
61 private:
67  public:
68  PState(MSPerson* person, MSStageMoving* stage);
69  ~PState() override;
70  double getEdgePos(const MSStageMoving& stage, SUMOTime now) const override;
71  Position getPosition(const MSStageMoving& stage, SUMOTime now) const override;
72  double getAngle(const MSStageMoving& stage, SUMOTime now) const override;
73  SUMOTime getWaitingTime(const MSStageMoving& stage, SUMOTime now) const override;
74  double getSpeed(const MSStageMoving& stage) const override;
75  const MSEdge* getNextEdge(const MSStageMoving& stage) const override;
78 
79  void setPosition(double x, double y);
80  void setPhi(double phi);
81  private:
83  double myPhi;
86  };
87 
88 
91  void initialize();
92 
93  std::map<int, PState*> remoteIdPStateMapping;
94  std::map<const MSEdge*, std::tuple<int, int>> edgesTransitionsMapping;
95  std::map<int, const MSEdge*> transitionsEdgesMapping;
96  int myLastId = 0;
98 
99  MSLane* getFirstPedestrianLane(const MSEdge* const& edge);
100 };
long long int SUMOTime
Definition: SUMOTime.h:31
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
Base (microsim) event class.
Definition: Command.h:49
A road/street connecting two junctions.
Definition: MSEdge.h:77
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
The simulated network and simulation perfomer.
Definition: MSNet.h:89
MSPModel_Remote * myRemoteModel
SUMOTime execute(SUMOTime currentTime) override
Executes the command.
Event(MSPModel_Remote *remoteModel)
Container for pedestrian state and individual position update function.
const MSEdge * getNextEdge(const MSStageMoving &stage) const override
return the list of internal edges if the transportable is on an intersection
void setPosition(double x, double y)
Position getPosition(const MSStageMoving &stage, SUMOTime now) const override
return the network coordinate of the transportable
double getSpeed(const MSStageMoving &stage) const override
return the current speed of the transportable
double getAngle(const MSStageMoving &stage, SUMOTime now) const override
return the direction in which the transportable faces in degrees
double getEdgePos(const MSStageMoving &stage, SUMOTime now) const override
return the offset from the start of the current edge measured in its natural direction
PState(MSPerson *person, MSStageMoving *stage)
MSStageMoving * myStage
SUMOTime getWaitingTime(const MSStageMoving &stage, SUMOTime now) const override
return the time the transportable spent standing
MSStageMoving * getStage()
The pedestrian following model connected to the external JuPedSim simulation.
std::map< int, const MSEdge * > transitionsEdgesMapping
MSLane * getFirstPedestrianLane(const MSEdge *const &edge)
MSTransportableStateAdapter * add(MSTransportable *person, MSStageMoving *stage, SUMOTime now) override
register the given person as a pedestrian
std::map< int, PState * > remoteIdPStateMapping
void remove(MSTransportableStateAdapter *state) override
remove the specified person from the pedestrian simulation
SUMOTime execute(SUMOTime time)
int getActiveNumber()
return the number of active objects
std::map< const MSEdge *, std::tuple< int, int > > edgesTransitionsMapping
MSPModel_Remote(const OptionsCont &oc, MSNet *net)
bool usingInternalLanes()
whether movements on intersections are modelled
The pedestrian (and also sometimes container) movement model.
Definition: MSPModel.h:51
abstract base class for managing callbacks to retrieve various state information from the model
Definition: MSPModel.h:130
A storage for options typed value containers)
Definition: OptionsCont.h:89
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36