170 if (inputStorage.
readInt() != 2) {
181 if (inputStorage.
readInt() != 3) {
192 if (inputStorage.
readInt() != 5) {
195 std::string from, to, vtype;
220 if (inputStorage.
readInt() != 12) {
223 std::string from, to, modes, ptype, vtype;
224 double depart, speed, walkFactor, departPos, arrivalPos, departPosLat;
262 const std::vector<libsumo::TraCIStage> result =
libsumo::Simulation::findIntermodalRoute(from, to, modes,
TIME2STEPS(depart), routingMode, speed, walkFactor, departPos, arrivalPos, departPosLat, ptype, vtype);
264 tempMsg.
writeInt((
int)result.size());
280 std::string paramName =
"";
301 std::string warning =
"";
346 outputStorage.
writeInt((
int) ids.size());
377 std::pair<MSLane*, double>
379 std::pair<MSLane*, double> result;
380 std::vector<std::string> allEdgeIds;
381 double minDistance = std::numeric_limits<double>::max();
384 for (std::vector<std::string>::iterator itId = allEdgeIds.begin(); itId != allEdgeIds.end(); itId++) {
386 for (std::vector<MSLane*>::const_iterator itLane = allLanes.begin(); itLane != allLanes.end(); itLane++) {
387 const double newDistance = (*itLane)->getShape().distance2D(pos);
388 if (newDistance < minDistance) {
389 minDistance = newDistance;
390 result.first = (*itLane);
395 result.second = result.first->getShape().nearest_offset_to_point2D(pos,
false);
403 std::pair<MSLane*, double> roadPos;
411 switch (srcPosType) {
422 cartesianPos.
set(x, y);
431 std::string roadID = inputStorage.
readString();
437 z = cartesianPos.
z();
456 switch (destPosType) {
462 outputStorage.
writeString(roadPos.first->getEdge().getID());
464 const std::vector<MSLane*> lanes = roadPos.first->getEdge().getLanes();
465 outputStorage.
writeUnsignedByte((
int)distance(lanes.begin(), find(lanes.begin(), lanes.end(), roadPos.first)));
498 std::pair<const MSLane*, double> roadPos1;
499 std::pair<const MSLane*, double> roadPos2;
506 std::string roadID = inputStorage.
readString();
509 pos1 = roadPos1.first->getShape().positionAtOffset(roadPos1.second);
536 std::string roadID = inputStorage.
readString();
539 pos2 = roadPos2.first->getShape().positionAtOffset(roadPos2.second);
564 double distance = 0.0;
567 if ((roadPos1.first == roadPos2.first) && (roadPos1.second <= roadPos2.second)) {
569 distance = roadPos2.second - roadPos1.second;
572 if (roadPos2.first->isInternal()) {
573 distance = roadPos2.second;
574 roadPos2.first = roadPos2.first->getLogicalPredecessorLane();
575 roadPos2.second = roadPos2.first->getLength();
579 MSRoute route(
"", newRoute,
false, 0, std::vector<SUMOVehicleParameter::Stop>());
580 distance += route.
getDistanceBetween(roadPos1.second, roadPos2.second, &roadPos1.first->getEdge(), &roadPos2.first->getEdge());
The vehicle has departed (was inserted into the network)
#define CMD_CLEAR_PENDING_VEHICLES
int type
The type of stage (walking, driving, ...)
#define REQUEST_DRIVINGDIST
static void writeVehicleStateIDs(TraCIServer &server, tcpip::Storage &outputStorage, MSNet::VehicleState state)
std::string line
The line or the id of the vehicle type.
double z() const
Returns the z-position.
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
A lane area vehicles can halt at.
#define VAR_PARKING_STARTING_VEHICLES_IDS
#define VAR_STOP_ENDING_VEHICLES_IDS
#define VAR_PARKING_ENDING_VEHICLES_NUMBER
static void writeStage(tcpip::Storage &outputStorage, const libsumo::TraCIStage &stage)
#define POSITION_LON_LAT_ALT
std::string destStop
The id of the destination stop.
double y() const
Returns the y-position.
virtual double readDouble()
static SUMOTime getCurrentTime()
double getDistanceBetween(double fromPos, double toPos, const MSEdge *fromEdge, const MSEdge *toEdge, bool includeInternal=true) const
Compute the distance between 2 given edges on this route, including the length of internal lanes...
double x() const
Returns the x-position.
virtual bool compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E *> &into)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
#define VAR_LOADED_VEHICLES_IDS
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xab: Get Simulation Variable)
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).
static std::string getParameter(const std::string &objectID, const std::string &key)
bool readTypeCheckingString(tcpip::Storage &inputStorage, std::string &into)
Reads the value type and a string, verifying the type.
bool readTypeCheckingDouble(tcpip::Storage &inputStorage, double &into)
Reads the value type and a double, verifying the type.
const PositionVector & getShape() const
Returns this lane's shape.
#define RESPONSE_GET_SIM_VARIABLE
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary...
#define VAR_TELEPORT_STARTING_VEHICLES_IDS
std::vector< const MSEdge * > ConstMSEdgeVector
int getTransportableNumber() const
Returns the number of transportables waiting on this stop.
static TraCIStage findRoute(const std::string &from, const std::string &to, const std::string &typeID, const SUMOTime depart, const int routingMode)
virtual void writeUnsignedByte(int)
void set(double x, double y)
set positions x and y
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
#define VAR_LOADED_VEHICLES_NUMBER
#define VAR_STOP_STARTING_VEHICLES_NUMBER
static void writeVehicleStateNumber(TraCIServer &server, tcpip::Storage &outputStorage, MSNet::VehicleState state)
virtual void writeInt(int)
virtual int readUnsignedByte()
std::vector< std::string > getEdgeNames() const
Returns the list of names of all known edges.
The vehicles starts to stop.
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
#define POSITION_CONVERSION
#define CMD_SAVE_SIMSTATE
#define VAR_DEPARTED_VEHICLES_NUMBER
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xcb: Set Simulation Variable)
#define VAR_MIN_EXPECTED_VEHICLES
The vehicle arrived at his destination (is deleted)
The vehicles starts to park.
#define VAR_STOP_STARTING_VEHICLES_IDS
#define VAR_NET_BOUNDING_BOX
A point in 2D or 3D with translation and scaling methods.
std::vector< std::string > edges
The sequence of edges to travel.
#define VAR_TELEPORT_STARTING_VEHICLES_NUMBER
virtual void writeStringList(const std::vector< std::string > &s)
static bool commandPositionConversion(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage, int commandId)
#define VAR_TELEPORT_ENDING_VEHICLES_IDS
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
The vehicle started to teleport.
#define CMD_GET_SIM_VARIABLE
virtual std::string readString()
#define VAR_DEPARTED_VEHICLES_IDS
void clearPendingVehicles(std::string &route)
clears out all pending vehicles from a route, "" for all routes
The vehicle ends to park.
bool readTypeCheckingUnsignedByte(tcpip::Storage &inputStorage, int &into)
Reads the value type and an unsigned byte, verifying the type.
TraCI server used to control sumo by a remote TraCI client.
#define CMD_SET_SIM_VARIABLE
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
VehicleState
Definition of a vehicle state.
static bool commandDistanceRequest(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage, int commandId)
The vehicle was built, but has not yet departed.
#define VAR_ARRIVED_VEHICLES_NUMBER
static TraCIBoundary getNetBoundary()
virtual void writeString(const std::string &s)
std::string toHex(const T i, std::streamsize numDigits=0)
#define VAR_STOP_ENDING_VEHICLES_NUMBER
MSInsertionControl & getInsertionControl()
Returns the insertion control.
const std::map< MSNet::VehicleState, std::vector< std::string > > & getVehicleStateChanges() const
double travelTime
duration of the stage
#define VAR_PARKING_ENDING_VEHICLES_IDS
The vehicle ends to stop.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
static std::vector< TraCIStage > findIntermodalRoute(const std::string &from, const std::string &to, const std::string &modes, const SUMOTime depart, const int routingMode, const double speed, const double walkFactor, const double departPos, const double arrivalPos, const double departPosLat, const std::string &pType, const std::string &vehType)
static std::pair< MSLane *, double > convertCartesianToRoadMap(Position pos)
virtual void writeDouble(double)
#define VAR_TELEPORT_ENDING_VEHICLES_NUMBER
static int getMinExpectedNumber()
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation. ...
double distanceTo(const Position &p2) const
returns the euclidean distance in 3 dimension
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
MSEdgeControl & getEdgeControl()
Returns the edge control.
#define VAR_PARKING_STARTING_VEHICLES_NUMBER
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT(const MSEdgeVector &prohibited=MSEdgeVector()) const
static const MSLane * getLaneChecking(const std::string &edgeID, int laneIndex, double pos)
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
static SUMOTime getDeltaT()
#define VAR_ARRIVED_VEHICLES_IDS
The vehicle ended being teleported.
#define FIND_INTERMODAL_ROUTE
#define VAR_BUS_STOP_WAITING
static void saveState(const std::string &file, SUMOTime step)
Saves the current state.