30#if __has_include(<boost/process/v1.hpp>)
31#include <boost/process/v1.hpp>
32namespace bp = boost::process::v1;
34#include <boost/process.hpp>
35namespace bp = boost::process;
48#pragma warning(disable: 4267 4371 4514 4710 4711 4946 5031 5204)
50#pragma push_macro("TS")
51#pragma push_macro("Min")
52#pragma push_macro("Max")
56#include <grpcpp/grpcpp.h>
57#include "jupedsim.grpc.pb.h"
58#pragma pop_macro("TS")
59#pragma pop_macro("Min")
60#pragma pop_macro("Max")
121 typedef std::tuple<JPS_StageId, const MSLane*, Position, double>
WaypointDesc;
140 void setPosition(
const double x,
const double y,
const double z = 0.);
231 std::unique_ptr<bp::child> myJuPedSimServer =
nullptr;
234 std::unique_ptr<sumo_jupedsim_api::JuPedSimService::Stub>
myGrpcStub;
238 const std::string
id;
248 std::vector<std::unique_ptr<AreaData> >
myAreas;
254 std::map<JPS_StageId, std::pair<const MSLane*, bool> >
myCrossings;
255 std::map<const MSLane*, JPS_StageId, ComparatorNumericalIdLess>
myLaneCenters;
274 static void convertToJPSPoints(
const GEOSGeometry* geometry, sumo_jupedsim_api::Polygon* into);
279 static const GEOSGeometry*
getLargestComponent(
const GEOSGeometry* polygon,
int& nbrComponents,
double& maxArea,
double& totalArea);
281 static void dumpGeometry(
const GEOSGeometry* polygon,
const std::string& filename,
bool useGeoCoordinates =
false);
285 template <
class Request,
class Response>
287 callGrpc(grpc::Status(sumo_jupedsim_api::JuPedSimService::Stub::*method)(grpc::ClientContext*, const Request&, Response*),
288 Request& request, const
std::string& what, const bool warnOnly = false) {
290 grpc::ClientContext context;
293 const grpc::Status status = ((*myGrpcStub).*method)(&context, request, &response);
#define WRITE_WARNING(msg)
Base (microsim) event class.
A road/street connecting two junctions.
Representation of a lane in the micro simulation.
The simulated network and simulation perfomer.
The abstract superclass for pedestrian models which actually interact with vehicles.
Container for pedestrian state and individual position update function.
double myEdgePos
the advancement along the current lane
const MSLane * myLane
the current lane of this pedestrian
MSStageMoving * myStage
the current stage of this pedestrian
double myAngle
cached angle
Position myRemoteXYPos
remote-controlled position
bool myWaitingToEnter
whether the pedestrian is waiting to start its walk
Event(MSPModel_JuPedSim *model)
MSPModel_JuPedSim * myModel
SUMOTime execute(SUMOTime currentTime) override
Executes the command.
Holds pedestrian state and performs updates.
JPS_StageId getStageId() const
first stage of the journey
void setAngle(double angle)
void setLane(MSLane *lane)
JPS_AgentId getAgentId() const
void setStage(MSStageMoving *const stage)
bool isFinished() const override
whether the transportable has finished walking
void setAgentId(JPS_AgentId id)
const MSPModel_JuPedSim::WaypointDesc * getNextWaypoint(const int offset=0) const
bool advanceNextWaypoint()
void setLanePosition(double lanePosition)
JPS_JourneyId myJourneyId
id of the journey, needed for modifying it
std::vector< MSPModel_JuPedSim::WaypointDesc > myWaypoints
const MSEdge * getNextEdge(const MSStageMoving &stage) const override
return the list of internal edges if the transportable is on an intersection
JPS_JourneyId getJourneyId() const
void reinit(MSStageMoving *stage, JPS_JourneyId journeyId, JPS_StageId stageId, const std::vector< WaypointDesc > &waypoints)
Position getPosition(const MSStageMoving &, SUMOTime) const override
return the network coordinate of the transportable
void setPosition(const double x, const double y, const double z=0.)
A pedestrian following model that acts as a proxy for pedestrian models provided by the JuPedSim thir...
bool usingShortcuts() override
whether travel times and distances can reliably be calculated from the network alone
int64_t buildJPSGeometryFromGEOSGeometry(const GEOSGeometry *polygon)
MSTransportableStateAdapter * add(MSTransportable *person, MSStageMoving *stage, SUMOTime now) override
register the given person as a pedestrian
void removePolygonFromDrawing(const std::string &polygonId)
const GEOSGeometry * myGEOSPedestrianNetworkLargestComponent
The GEOS polygon representing the largest (by area) connected component of the pedestrian network.
void preparePolygonForDrawing(const GEOSGeometry *polygon, const std::string &polygonId, const RGBColor &color)
static const RGBColor PEDESTRIAN_NETWORK_CARRIAGES_AND_RAMPS_COLOR
static const double GEOS_MITRE_LIMIT
@ GeneralizedCentrifugalForce
const double myExitTolerance
Threshold to decide if a pedestrian has ended its journey or not.
std::vector< SUMOTrafficObject::NumericalID > myAllStoppedTrainIDs
Array of stopped trains, used to detect whether to add carriages and ramps to the geometry.
bool usingDoors() override
precise lateral positioning when leaving trains is supported by JuPedSim
void registerArrived(const JPS_AgentId agentID)
static GEOSGeometry * createGeometryFromCenterLine(PositionVector centerLine, double width, int capStyle)
static PositionVector convertToSUMOPoints(const GEOSGeometry *geometry)
static const std::string PEDESTRIAN_NETWORK_CARRIAGES_AND_RAMPS_ID
static const RGBColor PEDESTRIAN_NETWORK_COLOR
static const std::string PEDESTRIAN_NETWORK_ID
std::map< const MSLane *, JPS_StageId, ComparatorNumericalIdLess > myLaneCenters
static GEOSGeometry * createGeometryFromShape(PositionVector shape, std::string junctionID=std::string(""), std::string shapeID=std::string(""), bool isInternalShape=false)
static GEOSCoordSequence * convertToGEOSPoints(PositionVector shape)
int64_t myJPSGeometry
The JPS polygon representing the largest connected component of the pedestrian network.
GEOSGeometry * myGEOSPedestrianNetwork
The GEOS polygon containing all computed connected components of the pedestrian network.
static void convertToJPSPoints(const GEOSGeometry *geometry, sumo_jupedsim_api::Polygon *into)
static void dumpGeometry(const GEOSGeometry *polygon, const std::string &filename, bool useGeoCoordinates=false)
bool myHaveAdditionalWalkableAreas
std::map< const MSLane *, std::pair< JPS_StageId, JPS_StageId >, ComparatorNumericalIdLess > myCrossingWaits
const SUMOTime myJPSDeltaT
Timestep used in the JuPedSim simulator.
MSNet *const myNetwork
The network on which the simulation runs.
std::shared_ptr< grpc::Channel > myGrpcChannel
void polygonChanged(const SUMOPolygon *const poly, const bool added, const bool removed) override
static const double GEOS_MIN_AREA
void initialize(const OptionsCont &oc)
GEOSGeometry * buildPedestrianNetwork(MSNet *network)
void remove(MSTransportableStateAdapter *state) override
remove the specified person from the pedestrian simulation
std::vector< StopWatch< std::chrono::nanoseconds > > myStopWatch
std::vector< std::unique_ptr< AreaData > > myAreas
Array of special areas.
static double getLinearRingArea(const GEOSGeometry *linearRing)
std::unique_ptr< sumo_jupedsim_api::JuPedSimService::Stub > myGrpcStub
SumoRNG myRNG
The random number generator for fluctuations on insertion.
std::tuple< JPS_StageId, const MSLane *, Position, double > WaypointDesc
void clearState() override
Resets pedestrians when quick-loading state.
Response callGrpc(grpc::Status(sumo_jupedsim_api::JuPedSimService::Stub::*method)(grpc::ClientContext *, const Request &, Response *), Request &request, const std::string &what, const bool warnOnly=false)
ShapeContainer & myShapeContainer
The shape container used to add polygons to the rendering pipeline.
std::vector< PState * > myPedestrianStates
JPS_StageId addWaitingSet(const MSLane *const crossing, const bool entry)
int64_t myJPSGeometryWithTrainsAndRamps
The JPS polygon representing the largest connected component plus carriages and ramps.
static const int GEOS_QUADRANT_SEGMENTS
static const std::vector< MSPModel_JuPedSim::PState * > noPedestrians
static const GEOSGeometry * getLargestComponent(const GEOSGeometry *polygon, int &nbrComponents, double &maxArea, double &totalArea)
static double getRadius(const MSVehicleType &vehType)
JPS_StageId addWaypoint(const std::string &agentID, WaypointDesc &waypoint, const MSStageMoving *const finalStage)
void tryPedestrianInsertion(PState *state, const Position &p)
SUMOTime execute(SUMOTime time)
static const double GEOS_BUFFERED_SEGMENT_WIDTH
std::map< JPS_StageId, std::pair< const MSLane *, bool > > myCrossings
abstract base class for managing callbacks to retrieve various state information from the model
The car-following model and parameter.
A storage for options typed value containers)
Static storage of an output device and its base (abstract) implementation.
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Storage for geometrical objects.
Interface for objects which want to be notified about shape updates.
Function-object for stable sorting of objects with numerical ids.
Structure that keeps data related to vanishing areas (and other types of areas).
const Parameterised::Map & params
SUMOTime lastRemovalTime
The last time a pedestrian was removed in a vanishing area.
sumo_jupedsim_api::Polygon areaBoundary
const std::string areaType