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-2023 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#include <config.h>
22
24#include <microsim/MSNet.h>
25#include <utils/geom/Boundary.h>
26#include "MSPModel.h"
27
28
29// ===========================================================================
30// class definitions
31// ===========================================================================
36class MSPModel_Remote : public MSPModel {
37public:
38 MSPModel_Remote(const OptionsCont& oc, MSNet* net);
39
42 void remove(MSTransportableStateAdapter* state) override;
43 bool usingInternalLanes();
44
46 class Event : public Command {
47 public:
48 explicit Event(MSPModel_Remote* remoteModel)
49 : myRemoteModel(remoteModel) { }
50 SUMOTime execute(SUMOTime currentTime) override {
51 return myRemoteModel->execute(currentTime);
52 }
53 private:
55 };
56
59 return (int)remoteIdPStateMapping.size();
60 }
61
63 void clearState();
64
65private:
71 public:
72 PState(MSPerson* person, MSStageMoving* stage);
73 ~PState() override;
74 double getEdgePos(const MSStageMoving& stage, SUMOTime now) const override;
75 int getDirection(const MSStageMoving& stage, SUMOTime now) const override;
76 Position getPosition(const MSStageMoving& stage, SUMOTime now) const override;
77 double getAngle(const MSStageMoving& stage, SUMOTime now) const override;
78 SUMOTime getWaitingTime(const MSStageMoving& stage, SUMOTime now) const override;
79 double getSpeed(const MSStageMoving& stage) const override;
80 const MSEdge* getNextEdge(const MSStageMoving& stage) const override;
83
84 void setPosition(double x, double y);
85 void setPhi(double phi);
86 private:
88 double myPhi;
91 };
92
93
96 void initialize();
97
98 std::map<int, PState*> remoteIdPStateMapping;
99 std::map<const MSEdge*, std::tuple<int, int>> edgesTransitionsMapping;
100 std::map<int, const MSEdge*> transitionsEdgesMapping;
101 int myLastId = 0;
103
104 MSLane* getFirstPedestrianLane(const MSEdge* const& edge);
105};
long long int SUMOTime
Definition: GUI.h:36
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
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
The simulated network and simulation perfomer.
Definition: MSNet.h:88
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
int getDirection(const MSStageMoving &stage, SUMOTime now) const override
return the walking direction (FORWARD, BACKWARD)
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
void clearState()
Resets pedestrians when quick-loading state.
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:150
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:37