50 const std::string
id = inputStorage.
readString();
140 std::vector<libsumo::TraCICollision> collisions = libsumo::Simulation::getCollisions();
142 const int cnt = 1 + (int)collisions.size() * 4;
146 for (
const auto& c : collisions) {
182 const int compoundSize = inputStorage.
readInt();
183 if (compoundSize < 2 || compoundSize > 3) {
195 if (inputStorage.
readInt() != 3) {
206 if (inputStorage.
readInt() != 5) {
209 std::string from, to, vtype;
234 if (inputStorage.
readInt() != 13) {
237 std::string from, to, modes, ptype, vtype, destStop;
238 double depart, speed, walkFactor, departPos, arrivalPos, departPosLat;
279 const std::vector<libsumo::TraCIStage>& result = libsumo::Simulation::findIntermodalRoute(from, to, modes, depart, routingMode, speed, walkFactor, departPos, arrivalPos, departPosLat, ptype, vtype, destStop);
288 if (!libsumo::Simulation::handleVariable(
id, variable, &server, &inputStorage)) {
304 std::string warning =
"";
329 libsumo::Simulation::setScale(value);
338 libsumo::Simulation::clearPending(route);
347 libsumo::Simulation::saveState(file);
356 double time = libsumo::Simulation::loadState(file);
361 StoHelp::readCompound(inputStorage, 2,
"A compound object of size 2 is needed for setting a parameter.");
362 const std::string name =
StoHelp::readTypedString(inputStorage,
"The name of the parameter must be given as a string.");
363 const std::string value =
StoHelp::readTypedString(inputStorage,
"The value of the parameter must be given as a string.");
364 libsumo::Simulation::setParameter(
id, name, value);
372 libsumo::Simulation::writeMessage(msg);
390 outputStorage.
writeInt((
int) ids.size());
406 outputStorage.
writeInt((
int)ids.size());
421 const int commandId) {
422 std::pair<MSLane*, double> roadPos;
430 switch (srcPosType) {
441 cartesianPos.
set(x, y);
450 const std::string roadID = inputStorage.
readString();
456 z = cartesianPos.
z();
476 if (compoundSize == 3) {
478 const std::string& vClassString = inputStorage.
readString();
486 switch (destPosType) {
490 if (roadPos.first ==
nullptr) {
496 outputStorage.
writeString(roadPos.first->getEdge().getID());
530 std::pair<const MSLane*, double> roadPos1;
531 std::pair<const MSLane*, double> roadPos2;
538 std::string roadID = inputStorage.
readString();
541 pos1 = roadPos1.first->geometryPositionAtOffset(roadPos1.second);
580 std::string roadID = inputStorage.
readString();
583 pos2 = roadPos2.first->geometryPositionAtOffset(roadPos2.second);
620 double distance = 0.0;
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_IGNORING
vehicles ignoring classes
std::string toHex(const T i, std::streamsize numDigits=0)
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
VehicleState
Definition of a vehicle state.
@ ENDING_PARKING
The vehicle ends to park.
@ STARTING_STOP
The vehicles starts to stop.
@ BUILT
The vehicle was built, but has not yet departed.
@ STARTING_PARKING
The vehicles starts to park.
@ STARTING_TELEPORT
The vehicle started to teleport.
@ ENDING_STOP
The vehicle ends to stop.
@ ENDING_TELEPORT
The vehicle ended being teleported.
@ ARRIVED
The vehicle arrived at his destination (is deleted)
@ DEPARTED
The vehicle has departed (was inserted into the network)
@ COLLISION
The vehicle is involved in a collision.
@ EMERGENCYSTOP
The vehicle had to brake harder than permitted.
@ MANEUVERING
Vehicle maneuvering either entering or exiting a parking space.
TransportableState
Definition of a transportable state.
@ PERSON_DEPARTED
The transportable person has departed (was inserted into the network)
@ PERSON_ARRIVED
The transportable person arrived at his destination (is deleted)
A point in 2D or 3D with translation and scaling methods.
void set(double x, double y)
set positions x and y
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimensions
double x() const
Returns the x-position.
double z() const
Returns the z-position.
double y() const
Returns the y-position.
static bool commandPositionConversion(TraCIServer &server, tcpip::Storage &inputStorage, const int compoundSize, tcpip::Storage &outputStorage, const int commandId)
static bool commandDistanceRequest(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage, int commandId)
static void writeTransportableStateIDs(TraCIServer &server, tcpip::Storage &outputStorage, MSNet::TransportableState state)
static void writeTransportableStateNumber(TraCIServer &server, tcpip::Storage &outputStorage, MSNet::TransportableState state)
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xcb: Set Simulation Variable)
static void writeVehicleStateIDs(TraCIServer &server, tcpip::Storage &outputStorage, MSNet::VehicleState state)
static void writeVehicleStateNumber(TraCIServer &server, tcpip::Storage &outputStorage, MSNet::VehicleState state)
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xab: Get Simulation Variable)
TraCI server used to control sumo by a remote TraCI client.
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
void stateLoaded(SUMOTime targetTime)
updates myTargetTime and resets vehicle state changes after loading a simulation state
tcpip::Storage & getWrapperStorage()
bool readTypeCheckingUnsignedByte(tcpip::Storage &inputStorage, int &into)
Reads the value type and an unsigned byte, verifying the type.
void initWrapper(const int domainID, const int variable, const std::string &objID)
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
static TraCIServer * getInstance()
bool readTypeCheckingInt(tcpip::Storage &inputStorage, int &into)
Reads the value type and an int, verifying the type.
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
const std::map< MSNet::VehicleState, std::vector< std::string > > & getVehicleStateChanges() const
const std::map< MSNet::TransportableState, std::vector< std::string > > & getTransportableStateChanges() const
static double getDrivingDistance(std::pair< const MSLane *, double > &roadPos1, std::pair< const MSLane *, double > &roadPos2)
static std::pair< MSLane *, double > convertCartesianToRoadMap(const Position &pos, const SUMOVehicleClass vClass)
static const MSLane * getLaneChecking(const std::string &edgeID, int laneIndex, double pos)
static int readCompound(tcpip::Storage &ret, int expectedSize=-1, const std::string &error="")
static std::string readTypedString(tcpip::Storage &ret, const std::string &error="")
static void writeStage(tcpip::Storage &outputStorage, const libsumo::TraCIStage &stage)
An error which allows to continue.
virtual std::string readString()
virtual void writeString(const std::string &s)
virtual void writeInt(int)
virtual void writeDouble(double)
virtual int readUnsignedByte()
virtual void writeStringList(const std::vector< std::string > &s)
virtual void writeUnsignedByte(int)
virtual void writeByte(int)
virtual double readDouble()
TRACI_CONST int CMD_SAVE_SIMSTATE
TRACI_CONST int VAR_STOP_ENDING_VEHICLES_IDS
TRACI_CONST int POSITION_3D
TRACI_CONST int POSITION_ROADMAP
TRACI_CONST int VAR_ARRIVED_VEHICLES_NUMBER
TRACI_CONST int VAR_STOP_STARTING_VEHICLES_NUMBER
TRACI_CONST int VAR_SCALE
TRACI_CONST int VAR_DEPARTED_VEHICLES_NUMBER
TRACI_CONST int CMD_LOAD_SIMSTATE
TRACI_CONST int VAR_COLLIDING_VEHICLES_NUMBER
TRACI_CONST int VAR_COLLISIONS
TRACI_CONST int CMD_CLEAR_PENDING_VEHICLES
TRACI_CONST int VAR_PARKING_ENDING_VEHICLES_IDS
TRACI_CONST int VAR_PARKING_STARTING_VEHICLES_IDS
TRACI_CONST int TYPE_COMPOUND
TRACI_CONST int VAR_PARKING_MANEUVERING_VEHICLES_IDS
TRACI_CONST int FIND_INTERMODAL_ROUTE
TRACI_CONST int VAR_DEPARTED_PERSONS_NUMBER
TRACI_CONST int VAR_PARKING_MANEUVERING_VEHICLES_NUMBER
TRACI_CONST int POSITION_2D
TRACI_CONST int VAR_ARRIVED_PERSONS_IDS
TRACI_CONST int TYPE_POLYGON
TRACI_CONST int VAR_NET_BOUNDING_BOX
TRACI_CONST int TYPE_STRINGLIST
TRACI_CONST int CMD_SET_SIM_VARIABLE
TRACI_CONST int TYPE_INTEGER
TRACI_CONST int POSITION_LON_LAT
TRACI_CONST int VAR_EMERGENCYSTOPPING_VEHICLES_IDS
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int VAR_DEPARTED_VEHICLES_IDS
TRACI_CONST int VAR_TELEPORT_ENDING_VEHICLES_NUMBER
TRACI_CONST int CMD_GET_SIM_VARIABLE
TRACI_CONST int CMD_MESSAGE
TRACI_CONST int VAR_PARKING_ENDING_VEHICLES_NUMBER
TRACI_CONST int VAR_LOADED_VEHICLES_IDS
TRACI_CONST int REQUEST_DRIVINGDIST
TRACI_CONST int VAR_DEPARTED_PERSONS_IDS
TRACI_CONST int VAR_ARRIVED_PERSONS_NUMBER
TRACI_CONST int RESPONSE_GET_SIM_VARIABLE
TRACI_CONST int VAR_STOP_STARTING_VEHICLES_IDS
TRACI_CONST int FIND_ROUTE
TRACI_CONST int VAR_STOP_ENDING_VEHICLES_NUMBER
TRACI_CONST int POSITION_CONVERSION
TRACI_CONST int TYPE_DOUBLE
TRACI_CONST int DISTANCE_REQUEST
TRACI_CONST int VAR_LOADED_VEHICLES_NUMBER
TRACI_CONST int VAR_TELEPORT_ENDING_VEHICLES_IDS
TRACI_CONST int VAR_COLLIDING_VEHICLES_IDS
TRACI_CONST int VAR_TELEPORT_STARTING_VEHICLES_NUMBER
TRACI_CONST int VAR_TELEPORT_STARTING_VEHICLES_IDS
TRACI_CONST int RTYPE_ERR
TRACI_CONST int VAR_ARRIVED_VEHICLES_IDS
TRACI_CONST int VAR_PARKING_STARTING_VEHICLES_NUMBER
TRACI_CONST int POSITION_LON_LAT_ALT
TRACI_CONST int VAR_EMERGENCYSTOPPING_VEHICLES_NUMBER
TRACI_CONST int TYPE_STRING
std::vector< TraCIPosition > value