 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
50 const std::string
id = inputStorage.
readString();
166 const int compoundSize = inputStorage.
readInt();
167 if (compoundSize < 2 || compoundSize > 3) {
179 if (inputStorage.
readInt() != 3) {
190 if (inputStorage.
readInt() != 5) {
193 std::string from, to, vtype;
218 if (inputStorage.
readInt() != 13) {
221 std::string from, to, modes, ptype, vtype, destStop;
222 double depart, speed, walkFactor, departPos, arrivalPos, departPosLat;
263 const std::vector<libsumo::TraCIStage>& result =
libsumo::Simulation::findIntermodalRoute(from, to, modes, depart, routingMode, speed, walkFactor, departPos, arrivalPos, departPosLat, ptype, vtype, destStop);
272 std::string paramName =
"";
295 std::string warning =
"";
350 outputStorage.
writeInt((
int) ids.size());
416 const int commandId) {
417 std::pair<MSLane*, double> roadPos;
425 switch (srcPosType) {
436 cartesianPos.
set(x, y);
445 const std::string roadID = inputStorage.
readString();
451 z = cartesianPos.
z();
471 if (compoundSize == 3) {
473 const std::string& vClassString = inputStorage.
readString();
481 switch (destPosType) {
485 if (roadPos.first ==
nullptr) {
491 outputStorage.
writeString(roadPos.first->getEdge().getID());
525 std::pair<const MSLane*, double> roadPos1;
526 std::pair<const MSLane*, double> roadPos2;
533 std::string roadID = inputStorage.
readString();
536 pos1 = roadPos1.first->geometryPositionAtOffset(roadPos1.second);
563 std::string roadID = inputStorage.
readString();
566 pos2 = roadPos2.first->geometryPositionAtOffset(roadPos2.second);
591 double distance = 0.0;
594 if ((roadPos1.first == roadPos2.first) && (roadPos1.second <= roadPos2.second)) {
596 distance = roadPos2.second - roadPos1.second;
599 while (roadPos2.first->isInternal() && roadPos2.first != roadPos1.first) {
600 distance += roadPos2.second;
601 roadPos2.first = roadPos2.first->getLogicalPredecessorLane();
602 roadPos2.second = roadPos2.first->getLength();
606 if (newRoute.size() == 0) {
609 MSRoute route(
"", newRoute,
false,
nullptr, std::vector<SUMOVehicleParameter::Stop>());
610 distance += route.
getDistanceBetween(roadPos1.second, roadPos2.second, &roadPos1.first->getEdge(), &roadPos2.first->getEdge());
static bool commandPositionConversion(TraCIServer &server, tcpip::Storage &inputStorage, const int compoundSize, tcpip::Storage &outputStorage, const int commandId)
virtual bool compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &into, bool silent=false)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
virtual void writeUnsignedByte(int)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
static void writeVehicleStateIDs(TraCIServer &server, tcpip::Storage &outputStorage, MSNet::VehicleState state)
TRACI_CONST int VAR_EMERGENCYSTOPPING_VEHICLES_IDS
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const int rngIndex, const MSEdgeVector &prohibited=MSEdgeVector()) const
TRACI_CONST int VAR_PARKING_STARTING_VEHICLES_IDS
TRACI_CONST int VAR_LOADED_VEHICLES_NUMBER
TRACI_CONST int VAR_STOP_ENDING_VEHICLES_NUMBER
@ VEHICLE_STATE_DEPARTED
The vehicle has departed (was inserted into the network)
TRACI_CONST int CMD_SAVE_SIMSTATE
TRACI_CONST double INVALID_DOUBLE_VALUE
TRACI_CONST int POSITION_3D
bool readTypeCheckingUnsignedByte(tcpip::Storage &inputStorage, int &into)
Reads the value type and an unsigned byte, verifying the type.
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
TRACI_CONST int VAR_TELEPORT_ENDING_VEHICLES_NUMBER
double z() const
Returns the z-position.
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xab: Get Simulation Variable)
TRACI_CONST int VAR_TELEPORT_STARTING_VEHICLES_NUMBER
static int getMinExpectedNumber()
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
TRACI_CONST int VAR_BUS_STOP_WAITING
TRACI_CONST int RESPONSE_GET_SIM_VARIABLE
TRACI_CONST int VAR_EMERGENCYSTOPPING_VEHICLES_NUMBER
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
static TraCIPositionVector getNetBoundary()
std::vector< const MSEdge * > ConstMSEdgeVector
TRACI_CONST int CMD_SET_SIM_VARIABLE
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int VAR_TIME_STEP
std::string intended
id of the intended vehicle for public transport ride
@ VEHICLE_STATE_ARRIVED
The vehicle arrived at his destination (is deleted)
tcpip::Storage & getWrapperStorage()
static void writeStage(tcpip::Storage &outputStorage, const libsumo::TraCIStage &stage)
TRACI_CONST int FIND_ROUTE
TRACI_CONST int VAR_BUS_STOP_WAITING_IDS
double arrivalPos
position on the lane when ending the stage
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
@ VEHICLE_STATE_EMERGENCYSTOP
The vehicle had to brake harder than permitted.
static libsumo::TraCIStage * readStage(TraCIServer &server, tcpip::Storage &inputStorage)
static void clearPending(const std::string &routeID="")
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
static const MSLane * getLaneChecking(const std::string &edgeID, int laneIndex, double pos)
virtual void writeDouble(double)
TRACI_CONST int CMD_CLEAR_PENDING_VEHICLES
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
void initWrapper(const int domainID, const int variable, const std::string &objID)
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xcb: Set Simulation Variable)
TRACI_CONST int VAR_STOP_STARTING_VEHICLES_NUMBER
double travelTime
duration of the stage in seconds
virtual void writeString(const std::string &s)
static void writeMessage(const std::string &msg)
virtual void writeInt(int)
@ VEHICLE_STATE_STARTING_PARKING
The vehicles starts to park.
TRACI_CONST int TYPE_DOUBLE
TRACI_CONST int TYPE_POLYGON
static std::vector< std::string > getBusStopWaitingIDList(const std::string &id)
Returns the IDs of the transportables on a given bus stop.
virtual int readUnsignedByte()
TRACI_CONST int VAR_NET_BOUNDING_BOX
std::string description
arbitrary description string
TRACI_CONST int POSITION_LON_LAT
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
TRACI_CONST int TYPE_INTEGER
VehicleState
Definition of a vehicle state.
TRACI_CONST int VAR_DEPARTED_VEHICLES_IDS
virtual void writeStringList(const std::vector< std::string > &s)
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
void set(double x, double y)
set positions x and y
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
std::string line
The line or the id of the vehicle type.
TRACI_CONST int VAR_DELTA_T
TRACI_CONST int RTYPE_ERR
TRACI_CONST int VAR_PARKING_MANEUVERING_VEHICLES_IDS
TRACI_CONST int VAR_TELEPORT_ENDING_VEHICLES_IDS
TRACI_CONST int VAR_TELEPORT_STARTING_VEHICLES_IDS
@ VEHICLE_STATE_COLLISION
The vehicle is involved in a collision.
std::string toHex(const T i, std::streamsize numDigits=0)
@ VEHICLE_STATE_STARTING_TELEPORT
The vehicle started to teleport.
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
@ VEHICLE_STATE_BUILT
The vehicle was built, but has not yet departed.
A point in 2D or 3D with translation and scaling methods.
double x() const
Returns the x-position.
TRACI_CONST int CMD_GET_SIM_VARIABLE
virtual void writeByte(int)
@ VEHICLE_STATE_STARTING_STOP
The vehicles starts to stop.
TRACI_CONST int VAR_ARRIVED_VEHICLES_NUMBER
static int getCurrentTime()
TRACI_CONST int POSITION_ROADMAP
TRACI_CONST int DISTANCE_REQUEST
TRACI_CONST int VAR_STOP_ENDING_VEHICLES_IDS
static double getDeltaT()
bool readTypeCheckingStringList(tcpip::Storage &inputStorage, std::vector< std::string > &into)
Reads the value type and a string list, verifying the type.
double depart
intended depart time for public transport ride or INVALID_DOUBLE_VALUE
TRACI_CONST int VAR_PARKING_STARTING_VEHICLES_NUMBER
TRACI_CONST int CMD_MESSAGE
static std::vector< std::string > getBusStopIDList()
TRACI_CONST int VAR_COLLIDING_VEHICLES_IDS
TRACI_CONST int TYPE_STRINGLIST
const std::map< MSNet::VehicleState, std::vector< std::string > > & getVehicleStateChanges() const
static int getBusStopWaiting(const std::string &id)
@ VEHICLE_STATE_MANEUVERING
Vehicle maneuvering either entering or exiting a parking space.
bool readTypeCheckingInt(tcpip::Storage &inputStorage, int &into)
Reads the value type and an int, verifying the type.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
double y() const
Returns the y-position.
TRACI_CONST int FIND_INTERMODAL_ROUTE
int type
The type of stage (walking, driving, ...)
TRACI_CONST int POSITION_2D
TRACI_CONST int VAR_PARKING_MANEUVERING_VEHICLES_NUMBER
TRACI_CONST int TYPE_STRING
static void saveState(const std::string &fileName)
std::vector< std::string > edges
The sequence of edges to travel.
static std::vector< TraCIStage > findIntermodalRoute(const std::string &fromEdge, const std::string &toEdge, const std::string &modes="", double depart=-1., const int routingMode=0, double speed=-1., double walkFactor=-1., double departPos=0, double arrivalPos=INVALID_DOUBLE_VALUE, const double departPosLat=0, const std::string &pType="", const std::string &vType="", const std::string &destStop="")
TRACI_CONST int VAR_DEPARTED_VEHICLES_NUMBER
@ VEHICLE_STATE_ENDING_PARKING
The vehicle ends to park.
TRACI_CONST int POSITION_CONVERSION
TRACI_CONST int POSITION_LON_LAT_ALT
@ VEHICLE_STATE_ENDING_TELEPORT
The vehicle ended being teleported.
static std::string getParameter(const std::string &objectID, const std::string &key)
TRACI_CONST int VAR_PARKING_ENDING_VEHICLES_IDS
TRACI_CONST int VAR_LOADED_VEHICLES_IDS
bool wrapStringList(const std::string &objID, const int variable, const std::vector< std::string > &value)
TRACI_CONST int VAR_STOP_STARTING_VEHICLES_IDS
static bool commandDistanceRequest(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage, int commandId)
virtual std::string readString()
TRACI_CONST int VAR_ARRIVED_VEHICLES_IDS
TRACI_CONST int VAR_COLLIDING_VEHICLES_NUMBER
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
virtual double readDouble()
std::vector< TraCIPosition > TraCIPositionVector
double departPos
position on the lane when starting the stage
TraCI server used to control sumo by a remote TraCI client.
TRACI_CONST int REQUEST_DRIVINGDIST
std::string vType
The vehicle type when using a private car or bike.
TRACI_CONST int VAR_BUS_STOP_ID_LIST
std::string destStop
The id of the destination stop.
@ SVC_IGNORING
vehicles ignoring classes
double getDistanceBetween(double fromPos, double toPos, const MSEdge *fromEdge, const MSEdge *toEdge, bool includeInternal=true, int routePosition=0) const
Compute the distance between 2 given edges on this route, including the length of internal lanes....
@ VEHICLE_STATE_ENDING_STOP
The vehicle ends to stop.
static std::pair< MSLane *, double > convertCartesianToRoadMap(const Position &pos, const SUMOVehicleClass vClass)
TRACI_CONST int VAR_MIN_EXPECTED_VEHICLES
static TraCIStage findRoute(const std::string &fromEdge, const std::string &toEdge, const std::string &vType="", const double depart=-1., const int routingMode=0)
TRACI_CONST int VAR_PARKING_ENDING_VEHICLES_NUMBER
TRACI_CONST int TYPE_COMPOUND
static void writeVehicleStateNumber(TraCIServer &server, tcpip::Storage &outputStorage, MSNet::VehicleState state)
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.