50 : outputFileName(outputFileName), answerLog(
"") {
51 answerLog.setf(std::ios::fixed , std::ios::floatfield);
64 std::ifstream defFile;
65 std::string fileContentStr;
66 std::stringstream fileContent;
67 std::string lineCommand;
68 std::stringstream msg;
70 bool commentRead =
false;
76 std::stringstream msg;
77 msg <<
"#Error while connecting: " << e.what();
83 defFile.open(fileName.c_str());
85 msg <<
"Can not open definition file " << fileName << std::endl;
89 defFile.unsetf(std::ios::dec);
91 while (defFile >> lineCommand) {
93 if (lineCommand.compare(
"%") == 0) {
95 commentRead = !commentRead;
102 if (lineCommand.compare(
"repeat") == 0) {
104 defFile >> lineCommand;
106 if (lineCommand.compare(
"simstep2") == 0) {
110 for (
int i = 0; i < repNo; i++) {
113 }
else if (lineCommand.compare(
"getvariable") == 0) {
117 defFile >> domID >> varID >> objID;
119 }
else if (lineCommand.compare(
"getvariable_plus") == 0) {
123 defFile >> domID >> varID >> objID;
124 std::stringstream msg;
127 std::string msgS = msg.str();
132 }
else if (lineCommand.compare(
"subscribevariable") == 0) {
135 double beginTime, endTime;
137 defFile >> domID >> objID >> beginTime >> endTime >> varNo;
139 }
else if (lineCommand.compare(
"subscribecontext") == 0) {
141 int domID, varNo, domain;
143 double beginTime, endTime;
145 defFile >> domID >> objID >> beginTime >> endTime >> domain >> range >> varNo;
147 }
else if (lineCommand.compare(
"setvalue") == 0) {
151 defFile >> domID >> varID >> objID;
153 }
else if (lineCommand.compare(
"testAPI") == 0) {
156 }
else if (lineCommand.compare(
"setorder") == 0) {
162 msg <<
"Error in definition file: " << lineCommand <<
" is not a valid command";
181 answerLog << std::endl <<
"-> Command sent: <SimulationStep>:" << std::endl;
183 std::string acknowledgement;
185 answerLog << acknowledgement << std::endl;
197 answerLog << std::endl <<
"-> Command sent: <Close>:" << std::endl;
199 std::string acknowledgement;
201 answerLog << acknowledgement << std::endl;
212 answerLog << std::endl <<
"-> Command sent: <SetOrder>:" << std::endl;
214 std::string acknowledgement;
216 answerLog << acknowledgement << std::endl;
228 answerLog << std::endl <<
"-> Command sent: <GetVariable>:" << std::endl
229 <<
" domID=" << domID <<
" varID=" << varID
230 <<
" objID=" << objID << std::endl;
231 std::string acknowledgement;
233 answerLog << acknowledgement << std::endl;
243 answerLog <<
" CommandID=" << (domID + 0x10) <<
" VariableID=" << variableID <<
" ObjectID=" << objectID;
245 answerLog <<
" valueDataType=" << valueDataType;
248 std::stringstream msg;
249 msg <<
"Error while receiving command: " << e.what();
258 std::stringstream msg;
261 std::string msgS = msg.str();
266 answerLog << std::endl <<
"-> Command sent: <SetValue>:" << std::endl
267 <<
" domID=" << domID <<
" varID=" << varID
268 <<
" objID=" << objID << std::endl;
270 std::string acknowledgement;
272 answerLog << acknowledgement << std::endl;
281 std::vector<int> vars;
282 for (
int i = 0; i < varNo; ++i) {
289 answerLog << std::endl <<
"-> Command sent: <SubscribeVariable>:" << std::endl
290 <<
" domID=" << domID <<
" objID=" << objID <<
" with " << varNo <<
" variables" << std::endl;
293 std::string acknowledgement;
295 answerLog << acknowledgement << std::endl;
305 int domain,
double range,
int varNo, std::ifstream& defFile) {
306 std::vector<int> vars;
307 for (
int i = 0; i < varNo; ++i) {
314 answerLog << std::endl <<
"-> Command sent: <SubscribeContext>:" << std::endl
315 <<
" domID=" << domID <<
" objID=" << objID <<
" domain=" << domain <<
" range=" << range
316 <<
" with " << varNo <<
" variables" << std::endl;
319 std::string acknowledgement;
321 answerLog << acknowledgement << std::endl;
336 std::cerr <<
"Unable to write result file" << std::endl;
339 locTime = localtime(&seconds);
340 outFile <<
"TraCITestClient output file. Date: " << asctime(locTime) << std::endl;
348 std::cerr << msg.str() << std::endl;
349 answerLog <<
"----" << std::endl << msg.str() << std::endl;
360 int noSubscriptions = inMsg.
readInt();
361 for (
int s = 0; s < noSubscriptions; ++s) {
366 }
catch (std::invalid_argument& e) {
367 answerLog <<
"#Error while reading message:" << e.what() << std::endl;
386 answerLog <<
" #variables=" << varNo << std::endl;
387 for (
int i = 0; i < varNo; ++i) {
392 answerLog <<
" valueDataType=" << valueDataType;
400 answerLog <<
" #variables=" << varNo << std::endl;
402 answerLog <<
" #objects=" << objNo << std::endl;
403 for (
int j = 0; j < objNo; ++j) {
405 for (
int i = 0; i < varNo; ++i) {
410 answerLog <<
" valueDataType=" << valueDataType;
415 answerLog <<
"#Error: received response with command id: " << cmdId <<
" but expected a subscription response (0xe0-0xef / 0x90-0x9f)" << std::endl;
418 }
catch (std::invalid_argument& e) {
419 answerLog <<
"#Error while reading message:" << e.what() << std::endl;
434 std::string dataTypeS;
435 defFile >> dataTypeS;
436 if (dataTypeS ==
"<airDist>") {
439 }
else if (dataTypeS ==
"<drivingDist>") {
442 }
else if (dataTypeS ==
"<objSubscription>") {
443 int beginTime, endTime, numVars;
444 defFile >> beginTime >> endTime >> numVars;
448 for (
int i = 0; i < numVars; ++i) {
453 return 4 + 4 + 4 + numVars;
457 if (dataTypeS ==
"<int>") {
462 }
else if (dataTypeS ==
"<byte>") {
467 }
else if (dataTypeS ==
"<ubyte>") {
472 }
else if (dataTypeS ==
"<double>") {
477 }
else if (dataTypeS ==
"<string>") {
480 if (valueS ==
"\"\"") {
485 return 4 + 1 + (int) valueS.length();
486 }
else if (dataTypeS ==
"<string*>") {
487 std::vector<std::string> slValue;
490 for (
int i = 0; i < valI; ++i) {
493 slValue.push_back(tmp);
494 length += 4 + int(tmp.length());
499 }
else if (dataTypeS ==
"<compound>") {
504 for (
int i = 0; i < valI; ++i) {
508 }
else if (dataTypeS ==
"<color>") {
512 for (
int i = 0; i < 3; ++i) {
517 }
else if (dataTypeS ==
"<position2D>") {
524 }
else if (dataTypeS ==
"<position3D>") {
532 return 1 + 8 + 8 + 8;
533 }
else if (dataTypeS ==
"<positionRoadmap>") {
538 int length = 1 + 8 + (int) valueS.length();
543 return length + 4 + 1;
544 }
else if (dataTypeS ==
"<shape>") {
549 for (
int i = 0; i < valI; ++i) {
558 msg <<
"## Unknown data type: " << dataTypeS;
567 answerLog <<
" Unsigned Byte Value: " << ubyte << std::endl;
570 answerLog <<
" Byte value: " << byte << std::endl;
573 answerLog <<
" Int value: " << integer << std::endl;
576 answerLog <<
" Double value: " << doublev << std::endl;
583 for (
int i = 0; i < size; i++) {
586 answerLog <<
"(" << x <<
"," << y <<
") ";
593 answerLog <<
" Position3DValue: " << std::endl;
595 <<
" z: " << z << std::endl;
600 answerLog <<
" RoadMapPositionValue: roadId=" << roadId
602 <<
" laneId=" << laneId << std::endl;
605 answerLog <<
" string value: " << s << std::endl;
608 answerLog <<
" string list value: [ " << std::endl;
609 for (std::vector<std::string>::iterator i = s.begin(); i != s.end(); ++i) {
610 if (i != s.begin()) {
618 answerLog <<
" compound value with " << no <<
" members: [ " << std::endl;
619 for (
int i = 0; i < no; ++i) {
621 answerLog <<
" valueDataType=" << currentValueDataType;
628 answerLog <<
" position value: (" << xv <<
"," << yv <<
")" << std::endl;
634 answerLog <<
" color value: (" << r <<
"," << g <<
"," << b <<
"," << a <<
")" << std::endl;
636 answerLog <<
"#Error: unknown valueDataType!" << std::endl;
650 const std::string edgeID =
"e_m0";
663 const std::string laneID =
"e_m6_0";
665 std::vector<libsumo::TraCIConnection> connections =
lane.
getLinks(laneID);
667 for (
int i = 0; i < (int)connections.size(); ++i) {
674 <<
" state=" << c.
state 684 answerLog <<
" caught TraCIException(" << e.what() <<
")\n";
688 answerLog <<
" getInternalFoes (invalid): ";
691 answerLog <<
" caught TraCIException(" << e.what() <<
")\n";
705 std::string shapeStr;
706 for (
auto pos : shape) {
707 shapeStr += pos.getString() +
" ";
711 answerLog <<
" getShape: " << shapeStr <<
"\n";
715 std::string shapeStr2;
717 shapeStr2 += pos.getString() +
" ";
719 answerLog <<
" getShape after modification: " << shapeStr2 <<
"\n";
724 std::vector<std::string> edges;
725 edges.push_back(
"e_u1");
726 edges.push_back(
"e_u0");
729 edges.push_back(
"e_m4");
750 answerLog <<
" copy type 't1' to 't1_copy' and set accel to 100.\n";
758 answerLog <<
" vehicle:\n";
760 std::vector<std::string> via;
761 via.push_back(
"e_shape1");
788 answerLog <<
" getColor: r=" << (int)col2.
r <<
" g=" << (
int)col2.
g <<
" b=" << (int)col2.
b <<
" a=" << (
int)col2.
a <<
"\n";
790 answerLog <<
" getSignals: " << signals <<
"\n";
794 answerLog <<
" getNextTLS:\n";
796 for (
int i = 0; i < (int)result.size(); ++i) {
798 answerLog <<
" tls=" << d.
id <<
" tlIndex=" << d.
tlIndex <<
" dist=" << d.
dist <<
" state=" << d.
state <<
"\n";
800 answerLog <<
" moveToXY, simStep:\n";
807 answerLog <<
" edges: " <<
joinToString(edges2,
" ") <<
"\n";
812 answerLog <<
" add:\n";
823 answerLog <<
" getLeader: " << leader.first <<
", " << leader.second <<
"\n";
825 answerLog <<
" getLaneChangeState (left): " << state.first <<
", " << state.second <<
"\n";
827 answerLog <<
" getLaneChangeState (right): " << state.first <<
", " << state.second <<
"\n";
830 answerLog <<
" remove:\n";
835 answerLog <<
" inductionloop:\n";
837 answerLog <<
" getVehicleData:\n";
839 for (
int i = 0; i < (int)result2.size(); ++i) {
845 answerLog <<
" simulation:\n";
847 answerLog <<
" getDistance2D_driving: " <<
simulation.
getDistance2D(2500, 500, 2000, 500,
false,
true) <<
"\n";
853 answerLog <<
" subscribe to road and pos of vehicle '1':\n";
854 std::vector<int> vars;
859 answerLog <<
" subscription results:\n";
863 answerLog <<
" subscribe to vehicles around edge 'e_u1':\n";
864 std::vector<int> vars2;
868 answerLog <<
" context subscription results:\n";
870 for (libsumo::SubscriptionResults::iterator it = result4.begin(); it != result4.end(); ++it) {
871 answerLog <<
" vehicle=" << it->first <<
" pos=" << it->second[
VAR_LANEPOSITION]->getString() <<
"\n";
875 answerLog <<
" person:\n";
903 std::vector<std::string> walkEdges;
904 walkEdges.push_back(
"e_u1");
905 walkEdges.push_back(
"e_shape1");
916 walkEdges.push_back(
"e_m5");
923 answerLog <<
" trafficlights:\n";
933 answerLog <<
" controlledLinks:\n";
934 for (
int i = 0; i < (int)links.size(); ++i) {
935 for (
int j = 0; j < (int)links[i].size(); ++j) {
936 answerLog <<
" index=" << i <<
" link=" << j <<
" fromLane=" << links[i][j].fromLane <<
" viaLane=" << links[i][j].viaLane <<
" toLane=" << links[i][j].toLane <<
"\n";
946 answerLog <<
" completeDefinition:\n";
947 for (
int i = 0; i < (int)logics.size(); ++i) {
948 answerLog <<
" subID=" << logics[i].programID <<
" type=" << logics[i].type <<
" phase=" << logics[i].currentPhaseIndex <<
"\n";
949 answerLog <<
" params=" <<
joinToString(logics[i].subParameter,
" ",
":") <<
"\n";
950 for (
int j = 0; j < (int)logics[i].phases.size(); ++j) {
951 answerLog <<
" phase=" << logics[i].phases[j].state
952 <<
" dur=" << logics[i].phases[j].duration
953 <<
" minDur=" << logics[i].phases[j].minDur
954 <<
" maxDur=" << logics[i].phases[j].maxDur
964 answerLog <<
" load:\n";
965 std::vector<std::string> args;
966 args.push_back(
"-n");
967 args.push_back(
"net.net.xml");
968 args.push_back(
"-r");
969 args.push_back(
"input_routes.rou.xml");
970 args.push_back(
"--no-step-log");
977 answerLog <<
" gui:\n";
979 answerLog <<
" setScheme: \n";
981 answerLog <<
" getScheme: " <<
gui.
getSchema(
"View #0") <<
"\n";
982 answerLog <<
" take screenshot: \n";
985 answerLog <<
" no support for gui commands\n";
std::vector< std::string > getIDList() const
EdgeScope edge
Scope for interaction with edges.
double getAngle(const std::string &personID) const
int run(std::string fileName, int port, std::string host="localhost")
Runs a test.
std::vector< libsumo::TraCINextTLSData > getNextTLS(const std::string &vehID) const
std::vector< std::string > getIDList() const
std::string getRouteID(const std::string &vehicleID) const
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
#define RESPONSE_SUBSCRIBE_INDUCTIONLOOP_CONTEXT
void setAccel(const std::string &typeID, double accel) const
void setRoute(const std::string &vehicleID, const std::vector< std::string > &edge) const
std::vector< std::string > getIDList() const
std::string getParameter(const std::string &objectID, const std::string &key) const
retrieve generic paramter
std::string id
The id of the next tls.
void send_commandSetValue(int domID, int varID, const std::string &objID, tcpip::Storage &content) const
Sends a SetVariable request.
void remove(const std::string &vehicleID, char reason=REMOVE_VAPORIZED) const
void setMinGapLat(const std::string &typeID, double minGapLat) const
double leaveTime
Leave-time of the vehicle in [s].
void readAndReportTypeDependent(tcpip::Storage &inMsg, int valueDataType)
Reads a value of the given type from the given storage and reports it.
void setWidth(const std::string &typeID, double width) const
void setColor(const std::string &vehicleID, const libsumo::TraCIColor &c) const
void appendDrivingStage(const std::string &personID, const std::string &toEdge, const std::string &lines, const std::string &stopID="")
#define REQUEST_DRIVINGDIST
std::vector< std::string > getIDList() const
void check_resultState(tcpip::Storage &inMsg, int command, bool ignoreCommandId=false, std::string *acknowledgement=0) const
Validates the result state of a command.
std::vector< std::vector< libsumo::TraCILink > > getControlledLinks(const std::string &tlsID) const
void connect(const std::string &host, int port)
Connects to the specified SUMO server.
libsumo::TraCIColor getColor(const std::string &poiID) const
double dist
The distance to the tls.
void setLength(const std::string &personID, double length) const
void commandSubscribeObjectVariable(int domID, const std::string &objID, double beginTime, double endTime, int varNo, std::ifstream &defFile)
Sends and validates a SubscribeVariable command.
std::string typeID
Type of the vehicle in.
void setSpeedFactor(const std::string &vehicleID, double factor) const
libsumo::TraCIColor getColor(const std::string &personID) const
void changeTarget(const std::string &vehicleID, const std::string &edgeID) const
void setOrder(int order)
set priority (execution order) for the client
#define CMD_GET_VEHICLE_VARIABLE
void commandSetOrder(int order)
Sends and validates a SetOrder command.
std::stringstream answerLog
Stream containing the log.
void setVia(const std::string &vehicleID, const std::vector< std::string > &via) const
virtual std::vector< std::string > readStringList()
#define RESPONSE_SUBSCRIBE_GUI_VARIABLE
mirrors MSInductLoop::VehicleData
void setRouteID(const std::string &vehicleID, const std::string &routeID) const
void testAPI()
call all API methods once
double getLineWidth(const std::string &polygonID) const
void setParameter(const std::string &objectID, const std::string &key, const std::string &value) const
set generic paramter
int setValueTypeDependant(tcpip::Storage &into, std::ifstream &defFile, std::stringstream &msg)
Parses the next value type / value pair from the stream and inserts it into the storage.
int getRoutingMode(const std::string &vehicleID) const
double getWaitingTime(const std::string &vehicleID) const
std::string getTypeID(const std::string &vehicleID) const
void send_commandGetVariable(int domID, int varID, const std::string &objID, tcpip::Storage *add=0) const
Sends a GetVariable request.
std::map< int, std::shared_ptr< TraCIResult > > TraCIResults
{variable->value}
std::pair< int, int > getLaneChangeState(const std::string &vehicleID, int direction) const
void setSignals(const std::string &vehicleID, int signals) const
double getEmergencyDecel(const std::string &typeID) const
LaneScope lane
Scope for interaction with lanes.
virtual double readDouble()
PersonScope person
Scope for interaction with persons.
double getMaxSpeedLat(const std::string &typeID) const
void rerouteTraveltime(const std::string &vehicleID, bool currentTravelTimes=true) const
void setMaxSpeedLat(const std::string &typeID, double speed) const
double getMaxSpeed(const std::string &vehicleID) const
void setLine(const std::string &vehicleID, const std::string &line) const
bool validateSubscription(tcpip::Storage &inMsg)
Validates whether the given message is a valid subscription return message.
std::string getRoadID(const std::string &vehicleID) const
void appendWaitingStage(const std::string &personID, double duration, const std::string &description="waiting", const std::string &stopID="")
std::vector< libsumo::TraCIVehicleData > getVehicleData(const std::string &loopID) const
double getNextSwitch(const std::string &tlsID) const
void load(const std::vector< std::string > &args)
Let sumo load a simulation using the given command line like options.
libsumo::TraCIColor getColor(const std::string &polygonID) const
double getSpeed(const std::string &personID) const
void send_commandSetOrder(int order) const
Sends a SetOrder command.
std::vector< std::string > getIDList() const
void closeSocket()
Closes the connection.
libsumo::TraCIPosition getPosition3D(const std::string &personID) const
std::string getNextEdge(const std::string &personID) const
std::string outputFileName
The name of the file to write the results log into.
virtual void writeUnsignedByte(int)
std::string getRedYellowGreenState(const std::string &tlsID) const
TrafficLightScope trafficlights
Scope for interaction with traffic lights.
int getPhase(const std::string &tlsID) const
std::vector< TraCIPhase > phases
std::string getLine(const std::string &vehicleID) const
double getDistanceRoad(const std::string &edgeID1, double pos1, const std::string &edgeID2, double pos2, bool isDriving=false)
void removeStage(const std::string &personID, int nextStageIndex) const
InductionLoopScope inductionloop
Scope for interaction with inductive loops.
virtual void writeInt(int)
std::vector< std::string > getRoute(const std::string &vehicleID) const
virtual int readUnsignedByte()
std::vector< libsumo::TraCIConnection > getLinks(const std::string &laneID) const
#define RESPONSE_SUBSCRIBE_INDUCTIONLOOP_VARIABLE
bool validateSimulationStep2(tcpip::Storage &inMsg)
Validates whether the given message is a valid answer to CMD_SIMSTEP.
const libsumo::SubscriptionResults getContextSubscriptionResults(const std::string &objID) const
void commandSetValue(int domID, int varID, const std::string &objID, std::ifstream &defFile)
Sends and validates a SetVariable command.
void moveToXY(const std::string &vehicleID, const std::string &edgeID, const int lane, const double x, const double y, const double angle, const int keepRoute) const
double getPhaseDuration(const std::string &tlsID) const
void rerouteTraveltime(const std::string &personID) const
void commandSimulationStep(double time)
Sends and validates a simulation step command.
void setCompleteRedYellowGreenDefinition(const std::string &tlsID, const libsumo::TraCILogic &logic) const
std::string getShapeClass(const std::string &vehicleID) const
std::string getTypeID(const std::string &personID) const
std::vector< std::string > getIDList() const
libsumo::TraCIColor getColor(const std::string &vehicleID) const
void setHeight(const std::string &personID, double height) const
std::vector< std::string > getVia(const std::string &vehicleID) const
void setType(const std::string &vehicleID, const std::string &typeID) const
std::string approachedInternal
void writeResult()
Writes the results file.
double getAccumulatedWaitingTime(const std::string &vehicleID) const
virtual void writeByte(int)
RouteScope route
Scope for interaction with routes.
double getLateralLanePosition(const std::string &vehicleID) const
void simulationStep(double time=0)
Advances by one step (or up to the given time)
void send_commandSubscribeObjectVariable(int domID, const std::string &objID, double beginTime, double endTime, const std::vector< int > &vars) const
Sends a SubscribeVariable request.
virtual void writeStringList(const std::vector< std::string > &s)
std::string getStreetName(const std::string &id) const
void setLateralAlignment(const std::string &typeID, const std::string &latAlignment) const
void send_commandSubscribeObjectContext(int domID, const std::string &objID, double beginTime, double endTime, int domain, double range, const std::vector< int > &vars) const
Sends a SubscribeContext request.
double getLanePosition(const std::string &personID) const
double getDistance2D(double x1, double y1, double x2, double y2, bool isGeo=false, bool isDriving=false)
void setRedYellowGreenState(const std::string &tlsID, const std::string &state) const
void subscribe(const std::string &objID, const std::vector< int > &vars, double beginTime, double endTime) const
double length
Length of the vehicle.
void add(const std::string &personID, const std::string &edgeID, double pos, double depart=DEPARTFLAG_NOW, const std::string typeID="DEFAULT_PEDTYPE")
double getWaitingTime(const std::string &personID) const
int getCurrentTime() const
std::string getRoadID(const std::string &personID) const
std::string id
The id of the vehicle.
virtual std::string readString()
bool isRouteValid(const std::string &vehicleID) const
void subscribeContext(const std::string &objID, int domain, double range, const std::vector< int > &vars, double beginTime, double endTime) const
void add(const std::string &routeID, const std::vector< std::string > &edges) const
void setLineWidth(const std::string &polygonID, const double lineWidth) const
double getSpeed(const std::string &vehicleID) const
std::string getProgram(const std::string &tlsID) const
void setWidth(const std::string &personID, double width) const
libsumo::TraCIPosition getPosition(const std::string &personID) const
void setSpeed(const std::string &personID, double speed) const
libsumo::TraCIPositionVector getShape(const std::string &polygonID) const
const libsumo::TraCIResults getSubscriptionResults(const std::string &objID) const
double getAcceleration(const std::string &vehicleID) const
void setShapeClass(const std::string &vehicleID, const std::string &clazz) const
std::string getVehicle(const std::string &personID) const
std::string approachedLane
TraCITestClient(std::string outputFileName="testclient_result.out")
Constructor.
int getRemainingStages(const std::string &personID) const
POIScope poi
Scope for interaction with POIs.
double getSlope(const std::string &vehicleID) const
void errorMsg(std::stringstream &msg)
Writes an error message.
#define RESPONSE_SUBSCRIBE_GUI_CONTEXT
void commandSubscribeContextVariable(int domID, const std::string &objID, double beginTime, double endTime, int domain, double range, int varNo, std::ifstream &defFile)
Sends and validates a SubscribeContext command.
void setShape(const std::string &polygonID, const libsumo::TraCIPositionVector &shape) const
int getLaneNumber(const std::string &edgeID) const
SimulationScope simulation
Scope for interaction with the simulation.
std::pair< std::string, double > getLeader(const std::string &vehicleID, double dist) const
virtual void writeString(const std::string &s)
void setMaxSpeed(const std::string &vehicleID, double speed) const
void setColor(const std::string &personID, const libsumo::TraCIColor &c) const
libsumo::TraCIPosition getPosition(const std::string &poiID) const
VehicleScope vehicle
Scope for interaction with vehicles.
double getHeight(const std::string &typeID) const
std::vector< std::string > getControlledLanes(const std::string &tlsID) const
#define ROUTING_MODE_AGGREGATED
int getLinkNumber(const std::string &laneID) const
char state
The current state of the tls.
void setEffort(const std::string &edgeID, double effort, double beginSeconds=0., double endSeconds=std::numeric_limits< double >::max()) const
PolygonScope polygon
Scope for interaction with polygons.
void adaptTraveltime(const std::string &edgeID, double time, double beginSeconds=0., double endSeconds=std::numeric_limits< double >::max()) const
void setEmergencyDecel(const std::string &typeID, double decel) const
void commandClose()
Sends and validates a Close command.
void send_commandSimulationStep(double time) const
Sends a SimulationStep command.
void send_commandClose() const
Sends a Close command.
void copy(const std::string &origTypeID, const std::string &newTypeID) const
int check_commandGetResult(tcpip::Storage &inMsg, int command, int expectedType=-1, bool ignoreCommandId=false) const
Validates the result state of a command.
int getSpeedMode(const std::string &vehicleID) const
void setSchema(const std::string &viewID, const std::string &schemeName) const
double getEffort(const std::string &edgeID, double time) const
std::vector< std::string > getIDList() const
virtual void writeDouble(double)
double getTraveltime(const std::string &edgeID) const
GUIScope gui
Scope for interaction with the gui.
void setMinGap(const std::string &personID, double minGap) const
std::string getLateralAlignment(const std::string &typeID) const
void appendWalkingStage(const std::string &personID, const std::vector< std::string > &edges, double arrivalPos, double duration=-1, double speed=-1, const std::string &stopID="")
void screenshot(const std::string &viewID, const std::string &filename, const int width=-1, const int height=-1) const
double getApparentDecel(const std::string &typeID) const
std::vector< std::string > getIDList() const
void setHeight(const std::string &typeID, double height) const
double getLength(const std::string &personID) const
std::string getLaneID(const std::string &vehicleID) const
int getStage(const std::string &personID, int nextStageIndex=0) const
double getLanePosition(const std::string &vehicleID) const
int getSignals(const std::string &vehicleID) const
double entryTime
Entry-time of the vehicle in [s].
void commandGetVariable(int domID, int varID, const std::string &objID, tcpip::Storage *addData=0)
Sends and validates a GetVariable command.
void removeStages(const std::string &personID) const
double getAccel(const std::string &typeID) const
void add(const std::string &vehicleID, const std::string &routeID, const std::string &typeID="DEFAULT_VEHTYPE", std::string depart="-1", 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=0, int personNumber=0) const
double getAdaptedTraveltime(const std::string &edgeID, double time) const
void setRoutingMode(const std::string &vehicleID, int routingMode) const
void setType(const std::string &personID, const std::string &typeID) const
void moveTo(const std::string &vehicleID, const std::string &laneID, double position) const
std::vector< std::string > getEdges(const std::string &personID, int nextStageIndex=0) const
std::vector< std::string > getInternalFoes(const std::string &laneID) const
int tlIndex
The tls index of the controlled link.
std::vector< std::string > getFoes(const std::string &laneID, const std::string &toLaneID) const
double getWidth(const std::string &typeID) const
double getMinGapLat(const std::string &typeID) const
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::vector< libsumo::TraCILogic > getCompleteRedYellowGreenDefinition(const std::string &tlsID) const
~TraCITestClient()
Destructor.
std::vector< std::string > getIDList() const
std::vector< std::string > getIDList() const
std::string getSchema(const std::string &viewID=DEFAULT_VIEW) const
void setApparentDecel(const std::string &typeID, double decel) const
VehicleTypeScope vehicletype
Scope for interaction with vehicle types.