61 const std::string
id = inputStorage.
readString();
85 if (inputStorage.
readInt() != 2) {
106 if (inputStorage.
readInt() != 2) {
128 tempContent.
writeInt((
int)bestLanes.size());
130 for (std::vector<libsumo::TraCIBestLanesData>::const_iterator i = bestLanes.begin(); i != bestLanes.end(); ++i) {
158 const int cnt = 1 + (int)nextTLS.size() * 4;
162 for (std::vector<libsumo::TraCINextTLSData>::iterator it = nextTLS.begin(); it != nextTLS.end(); ++it) {
177 const int cnt = 1 + (int)nextStops.size() * 4;
181 for (std::vector<libsumo::TraCINextStopData>::iterator it = nextStops.begin(); it != nextStops.end(); ++it) {
201 if (inputStorage.
readInt() != 2) {
213 std::string roadID = inputStorage.
readString();
258 std::string paramName =
"";
282 std::string warning =
"";
317 std::cout <<
SIMTIME <<
" processSet veh=" <<
id <<
"\n";
319 const bool shouldExist = variable !=
ADD && variable !=
ADD_FULL;
321 if (sumoVehicle ==
nullptr) {
327 if (v ==
nullptr && shouldExist) {
336 int compoundSize = inputStorage.
readInt();
337 if (compoundSize < 4 || compoundSize > 7) {
359 if (compoundSize >= 5) {
365 if (compoundSize >= 6) {
371 if (compoundSize >= 7) {
384 int compoundSize = inputStorage.
readInt();
385 if (compoundSize != 1) {
388 std::string parkingAreaID;
400 if (inputStorage.
readInt() != 0) {
411 int compounds = inputStorage.
readInt();
412 if (compounds != 3 && compounds != 2) {
421 double duration = 0.;
427 if (compounds == 3) {
433 if ((laneIndex < 0) || (laneIndex >= (
int)(v->
getEdge()->
getLanes().size()) && relative < 1)) {
456 if (inputStorage.
readInt() != 2) {
466 double duration = 0.;
488 const int nParameter = inputStorage.
readInt();
489 if (nParameter != 4 && nParameter != 5) {
492 double newTimeHeadway = 0;
496 double newSpaceHeadway = 0;
500 double duration = 0.;
504 double changeRate = 0;
509 if (newTimeHeadway == -1 && newSpaceHeadway == -1 && duration == -1 && changeRate == -1) {
512 if (newTimeHeadway <= 0) {
513 if (newTimeHeadway != -1) {
517 if (newSpaceHeadway < 0) {
523 if (changeRate <= 0) {
526 double maxDecel = -1;
527 if (nParameter == 5) {
531 if (changeRate <= 0) {
556 std::vector<std::string> edgeIDs;
567 int parameterCount = inputStorage.
readInt();
570 double endTime = std::numeric_limits<double>::max();
572 if (parameterCount == 4) {
589 }
else if (parameterCount == 2) {
598 }
else if (parameterCount == 1) {
613 int parameterCount = inputStorage.
readInt();
616 double endTime = std::numeric_limits<double>::max();
618 if (parameterCount == 4) {
635 }
else if (parameterCount == 2) {
643 }
else if (parameterCount == 1) {
659 if (inputStorage.
readInt() != 0) {
669 if (inputStorage.
readInt() != 0) {
687 if (inputStorage.
readInt() != 2) {
721 int laneChangeMode = 0;
741 libsumo::Vehicle::setColor(
id, col);
748 if (inputStorage.
readInt() != 6) {
765 depart =
"triggered";
767 depart =
"containerTriggered";
772 double departPosCode;
776 std::string departPos =
toString(departPosCode);
778 departPos =
"random";
780 departPos =
"random_free";
791 double departSpeedCode;
795 std::string departSpeed =
toString(departSpeedCode);
797 departSpeed =
"random";
806 std::string departLane =
toString(departLaneCode);
808 departLane =
"random";
812 departLane =
"allowed";
816 departLane =
"first";
825 if (inputStorage.
readInt() != 14) {
840 std::string departLane;
844 std::string departPos;
848 std::string departSpeed;
852 std::string arrivalLane;
856 std::string arrivalPos;
860 std::string arrivalSpeed;
884 libsumo::Vehicle::add(
id, routeID, vTypeID, depart, departLane, departPos, departSpeed, arrivalLane, arrivalPos, arrivalSpeed,
885 fromTaz, toTaz, line, personCapacity, personNumber);
900 const int numArgs = inputStorage.
readInt();
901 if (numArgs != 5 && numArgs != 6) {
930 int keepRouteFlag = 1;
944 libsumo::Vehicle::setSpeedFactor(
id, factor);
956 std::vector<std::string> edgeIDs;
990 if (fabs(value) == std::numeric_limits<double>::infinity()) {
993 bool resetActionOffset = value >= 0.0;
994 libsumo::Vehicle::setActionStepLength(
id, fabs(value), resetActionOffset);
The departure is person triggered.
static std::vector< TraCIBestLanesData > getBestLanes(const std::string &vehicleID)
static void setStop(const std::string &vehicleID, const std::string &edgeID, double pos=1., int laneIndex=0, double duration=INVALID_DOUBLE_VALUE, int flags=STOP_DEFAULT, double startPos=INVALID_DOUBLE_VALUE, double until=INVALID_DOUBLE_VALUE)
bool readTypeCheckingColor(tcpip::Storage &inputStorage, libsumo::TraCIColor &into)
Reads the value type and a color, verifying the type.
static void setEffort(const std::string &vehicleID, const std::string &edgeID, double effort=INVALID_DOUBLE_VALUE, double begSeconds=0, double endSeconds=std::numeric_limits< double >::max())
Representation of a vehicle in the micro simulation.
#define VAR_EMISSIONCLASS
#define REQUEST_DRIVINGDIST
static void setLine(const std::string &vehicleID, const std::string &line)
bool allowsContinuation
Whether this lane allows continuing the route.
static void updateBestLanes(const std::string &vehicleID)
#define RESPONSE_GET_VEHICLE_VARIABLE
The vehicle is discarded if emission fails (not fully implemented yet)
#define CMD_GET_VEHICLE_VARIABLE
static void setRoute(const std::string &vehicleID, const std::vector< std::string > &edgeIDs)
static bool processSet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value command (Command 0xc4: Change Vehicle State)
The departure is container triggered.
static void deactivateGapControl(const std::string &vehicleID)
static void setParameter(const std::string &vehicleID, const std::string &key, const std::string &value)
virtual double readDouble()
The least occupied lane is used.
static std::string getTypeID(const std::string &vehicleID)
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
#define CMD_CHANGESUBLANE
static void setRoutingMode(const std::string &vehicleID, int routingMode)
double occupation
The traffic density along length.
bool readTypeCheckingInt(tcpip::Storage &inputStorage, int &into)
Reads the value type and an int, verifying the type.
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
std::string laneID
The id of the lane.
static void setSpeedMode(const std::string &vehicleID, int speedMode)
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.
The speed is chosen randomly.
static void rerouteParkingArea(const std::string &vehicleID, const std::string &parkingAreaID)
The lane is chosen randomly.
#define VAR_UPDATE_BESTLANES
static void setRouteID(const std::string &vehicleID, const std::string &routeID)
const std::string & getID() const
Returns the id.
virtual void writeUnsignedByte(int)
bool writeErrorStatusCmd(int commandId, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage with status = RTYPE_ERR.
The least occupied lane from best lanes.
The position is chosen randomly.
virtual void writeInt(int)
virtual int readUnsignedByte()
static std::pair< int, int > getLaneChangeState(const std::string &vehicleID, int direction)
static bool processGet(TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a get value command (Command 0xa4: Get Vehicle Variable)
static void rerouteTraveltime(const std::string &vehicleID)
static double getEffort(const std::string &vehicleID, double time, const std::string &edgeID)
int bestLaneOffset
The offset of this lane from the best lane.
static void resume(const std::string &vehicleID)
#define INVALID_DOUBLE_VALUE
static std::vector< TraCINextTLSData > getNextTLS(const std::string &vehicleID)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Representation of a vehicle.
static void setLaneChangeMode(const std::string &vehicleID, int laneChangeMode)
static void setVia(const std::string &vehicleID, const std::vector< std::string > &via)
The least occupied lane from lanes which allow the continuation.
#define VAR_ACTIONSTEPLENGTH
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
#define CMD_REROUTE_TO_PARKING
static void add(const std::string &vehicleID, const std::string &routeID, const std::string &typeID="DEFAULT_VEHTYPE", const std::string &depart="now", const std::string &departLane="first", const std::string &departPos="base", const std::string &departSpeed="0", const std::string &arrivalLane="current", const std::string &arrivalPos="max", const std::string &arrivalSpeed="current", const std::string &fromTaz="", const std::string &toTaz="", const std::string &line="", int personCapacity=4, int personNumber=0)
virtual void writeByte(int)
#define VAR_EMERGENCY_DECEL
bool readTypeCheckingStringList(tcpip::Storage &inputStorage, std::vector< std::string > &into)
Reads the value type and a string list, verifying the type.
virtual void writeStringList(const std::vector< std::string > &s)
The maximum speed is used.
#define CMD_SET_VEHICLE_VARIABLE
static void moveTo(const std::string &vehicleID, const std::string &laneID, double position)
tcpip::Storage & getWrapperStorage()
virtual std::string readString()
static void changeLane(const std::string &vehicleID, int laneIndex, double duration)
#define CMD_REROUTE_EFFORT
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
TraCI server used to control sumo by a remote TraCI client.
virtual void writeStorage(tcpip::Storage &store)
static void setSpeed(const std::string &vehicleID, double speed)
If a fixed number of random choices fails, a free position is chosen.
static double getAdaptedTraveltime(const std::string &vehicleID, double time, const std::string &edgeID)
The rightmost lane the vehicle may use.
void writeResponseWithLength(tcpip::Storage &outputStorage, tcpip::Storage &tempMsg)
static std::string getParameter(const std::string &vehicleID, const std::string &key)
#define VAR_EDGE_TRAVELTIME
static bool setVariable(const int cmd, const int variable, const std::string &id, TraCIServer &server, tcpip::Storage &inputStorage, tcpip::Storage &outputStorage)
Processes a set value for the given type.
virtual void writeString(const std::string &s)
static void changeTarget(const std::string &vehicleID, const std::string &edgeID)
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
static void setSignals(const std::string &vehicleID, int signals)
std::string toHex(const T i, std::streamsize numDigits=0)
#define CMD_REROUTE_TRAVELTIME
static void moveToXY(const std::string &vehicleID, const std::string &edgeID, const int laneIndex, const double x, const double y, double angle=INVALID_DOUBLE_VALUE, const int keepRoute=1)
static double getDrivingDistance2D(const std::string &vehicleID, double x, double y)
static std::pair< std::string, double > getLeader(const std::string &vehicleID, double dist=0.)
const std::string & getID() const
Returns the name of the vehicle type.
static void slowDown(const std::string &vehicleID, double speed, double duration)
virtual void writeDouble(double)
static void setAdaptedTraveltime(const std::string &vehicleID, const std::string &edgeID, double time=INVALID_DOUBLE_VALUE, double begSeconds=0, double endSeconds=std::numeric_limits< double >::max())
static void changeLaneRelative(const std::string &vehicleID, int laneChange, double duration)
void writeStatusCmd(int commandId, int status, const std::string &description, tcpip::Storage &outputStorage)
Writes a status command to the given storage.
static void remove(const std::string &vehicleID, char reason=REMOVE_VAPORIZED)
#define VAR_APPARENT_DECEL
double length
The length than can be driven from that lane without lane change.
#define VAR_LANECHANGE_MODE
void initWrapper(const int domainID, const int variable, const std::string &objID)
A free position is chosen.
Insert behind the last vehicle as close as possible to still allow the specified departSpeed. Fallback to DEPART_POS_BASE if there is no vehicle on the departLane yet.
static void setType(const std::string &vehicleID, const std::string &typeID)
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
static double getDrivingDistance(const std::string &vehicleID, const std::string &edgeID, double position, int laneIndex=0)
static void changeSublane(const std::string &vehicleID, double latDist)
static std::vector< TraCINextStopData > getNextStops(const std::string &vehicleID)
static void openGap(const std::string &vehicleID, double newTimeHeadway, double newSpaceHeadway, double duration, double changeRate, double maxDecel)
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
bool readTypeCheckingByte(tcpip::Storage &inputStorage, int &into)
Reads the value type and a byte, verifying the type.
static void rerouteEffort(const std::string &vehicleID)