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;
229 answerLog << std::endl <<
"-> Command sent: <GetVariable>:" << std::endl
230 <<
" domID=" << domID <<
" varID=" << varID
231 <<
" objID=" << objID << std::endl;
232 std::string acknowledgement;
234 answerLog << acknowledgement << std::endl;
244 answerLog <<
" CommandID=" << (domID + 0x10) <<
" VariableID=" << variableID <<
" ObjectID=" << objectID;
246 answerLog <<
" valueDataType=" << valueDataType;
249 std::stringstream msg;
250 msg <<
"Error while receiving command: " << e.what();
259 std::stringstream msg;
262 std::string msgS = msg.str();
268 answerLog << std::endl <<
"-> Command sent: <SetValue>:" << std::endl
269 <<
" domID=" << domID <<
" varID=" << varID
270 <<
" objID=" << objID << std::endl;
272 std::string acknowledgement;
274 answerLog << acknowledgement << std::endl;
283 std::vector<int> vars;
284 for (
int i = 0; i < varNo; ++i) {
291 answerLog << std::endl <<
"-> Command sent: <SubscribeVariable>:" << std::endl
292 <<
" domID=" << domID <<
" objID=" << objID <<
" with " << varNo <<
" variables" << std::endl;
295 std::string acknowledgement;
297 answerLog << acknowledgement << std::endl;
307 int domain,
double range,
int varNo, std::ifstream& defFile) {
308 std::vector<int> vars;
309 for (
int i = 0; i < varNo; ++i) {
316 answerLog << std::endl <<
"-> Command sent: <SubscribeContext>:" << std::endl
317 <<
" domID=" << domID <<
" objID=" << objID <<
" domain=" << domain <<
" range=" << range
318 <<
" with " << varNo <<
" variables" << std::endl;
321 std::string acknowledgement;
323 answerLog << acknowledgement << std::endl;
338 std::cerr <<
"Unable to write result file" << std::endl;
341 locTime = localtime(&seconds);
342 outFile <<
"TraCITestClient output file. Date: " << asctime(locTime) << std::endl;
350 std::cerr << msg.str() << std::endl;
351 answerLog <<
"----" << std::endl << msg.str() << std::endl;
362 int noSubscriptions = inMsg.
readInt();
363 for (
int s = 0; s < noSubscriptions; ++s) {
368 }
catch (std::invalid_argument& e) {
369 answerLog <<
"#Error while reading message:" << e.what() << std::endl;
388 answerLog <<
" #variables=" << varNo << std::endl;
389 for (
int i = 0; i < varNo; ++i) {
394 answerLog <<
" valueDataType=" << valueDataType;
402 answerLog <<
" #variables=" << varNo << std::endl;
404 answerLog <<
" #objects=" << objNo << std::endl;
405 for (
int j = 0; j < objNo; ++j) {
407 for (
int i = 0; i < varNo; ++i) {
412 answerLog <<
" valueDataType=" << valueDataType;
417 answerLog <<
"#Error: received response with command id: " << cmdId <<
" but expected a subscription response (0xe0-0xef / 0x90-0x9f)" << std::endl;
420 }
catch (std::invalid_argument& e) {
421 answerLog <<
"#Error while reading message:" << e.what() << std::endl;
436 std::string dataTypeS;
437 defFile >> dataTypeS;
438 if (dataTypeS ==
"<airDist>") {
441 }
else if (dataTypeS ==
"<drivingDist>") {
444 }
else if (dataTypeS ==
"<objSubscription>") {
445 int beginTime, endTime, numVars;
446 defFile >> beginTime >> endTime >> numVars;
450 for (
int i = 0; i < numVars; ++i) {
455 return 4 + 4 + 4 + numVars;
459 if (dataTypeS ==
"<int>") {
464 }
else if (dataTypeS ==
"<byte>") {
469 }
else if (dataTypeS ==
"<ubyte>") {
474 }
else if (dataTypeS ==
"<double>") {
479 }
else if (dataTypeS ==
"<string>") {
482 if (valueS ==
"\"\"") {
487 return 4 + 1 + (int) valueS.length();
488 }
else if (dataTypeS ==
"<string*>") {
489 std::vector<std::string> slValue;
492 for (
int i = 0; i < valI; ++i) {
495 slValue.push_back(tmp);
496 length += 4 + int(tmp.length());
501 }
else if (dataTypeS ==
"<compound>") {
506 for (
int i = 0; i < valI; ++i) {
510 }
else if (dataTypeS ==
"<color>") {
514 for (
int i = 0; i < 3; ++i) {
519 }
else if (dataTypeS ==
"<position2D>") {
526 }
else if (dataTypeS ==
"<position3D>") {
534 return 1 + 8 + 8 + 8;
535 }
else if (dataTypeS ==
"<positionRoadmap>") {
540 int length = 1 + 8 + (int) valueS.length();
545 return length + 4 + 1;
546 }
else if (dataTypeS ==
"<shape>") {
551 for (
int i = 0; i < valI; ++i) {
560 msg <<
"## Unknown data type: " << dataTypeS;
569 answerLog <<
" Unsigned Byte Value: " << ubyte << std::endl;
572 answerLog <<
" Byte value: " << byte << std::endl;
575 answerLog <<
" Int value: " << integer << std::endl;
578 answerLog <<
" Double value: " << doublev << std::endl;
585 for (
int i = 0; i < size; i++) {
588 answerLog <<
"(" << x <<
"," << y <<
") ";
595 answerLog <<
" Position3DValue: " << std::endl;
597 <<
" z: " << z << std::endl;
602 answerLog <<
" RoadMapPositionValue: roadId=" << roadId
604 <<
" laneId=" << laneId << std::endl;
607 answerLog <<
" string value: " << s << std::endl;
610 answerLog <<
" string list value: [ " << std::endl;
611 for (std::vector<std::string>::iterator i = s.begin(); i != s.end(); ++i) {
612 if (i != s.begin()) {
620 answerLog <<
" compound value with " << no <<
" members: [ " << std::endl;
621 for (
int i = 0; i < no; ++i) {
623 answerLog <<
" valueDataType=" << currentValueDataType;
630 answerLog <<
" position value: (" << xv <<
"," << yv <<
")" << std::endl;
636 answerLog <<
" color value: (" << r <<
"," << g <<
"," << b <<
"," << a <<
")" << std::endl;
638 answerLog <<
"#Error: unknown valueDataType!" << std::endl;
652 const std::string edgeID =
"e_m0";
665 const std::string laneID =
"e_m6_0";
667 std::vector<libsumo::TraCIConnection> connections =
lane.
getLinks(laneID);
669 for (
int i = 0; i < (int)connections.size(); ++i) {
676 <<
" state=" << c.
state 686 answerLog <<
" caught TraCIException(" << e.what() <<
")\n";
690 answerLog <<
" getInternalFoes (invalid): ";
693 answerLog <<
" caught TraCIException(" << e.what() <<
")\n";
707 std::string shapeStr;
708 for (
auto pos : shape) {
709 shapeStr += pos.getString() +
" ";
713 answerLog <<
" getShape: " << shapeStr <<
"\n";
717 std::string shapeStr2;
719 shapeStr2 += pos.getString() +
" ";
721 answerLog <<
" getShape after modification: " << shapeStr2 <<
"\n";
727 std::vector<libsumo::TraCIPosition> junctionShape =
junction.
getShape(
"n_m4");
728 std::string junctionShapeStr;
729 for (
auto pos : junctionShape) {
730 junctionShapeStr += pos.getString() +
" ";
732 answerLog <<
" getShape: " << junctionShapeStr <<
"\n";
737 std::vector<std::string> edges;
738 edges.push_back(
"e_u1");
739 edges.push_back(
"e_u0");
742 edges.push_back(
"e_m4");
764 answerLog <<
" copy type 't1' to 't1_copy' and set accel to 100.\n";
772 answerLog <<
" vehicle:\n";
774 std::vector<std::string> via;
775 via.push_back(
"e_shape1");
805 answerLog <<
" getColor: r=" << (int)col2.
r <<
" g=" << (
int)col2.
g <<
" b=" << (int)col2.
b <<
" a=" << (
int)col2.
a <<
"\n";
807 answerLog <<
" getSignals: " << signals <<
"\n";
811 answerLog <<
" getNextTLS:\n";
813 for (
int i = 0; i < (int)result.size(); ++i) {
815 answerLog <<
" tls=" << d.
id <<
" tlIndex=" << d.
tlIndex <<
" dist=" << d.
dist <<
" state=" << d.
state <<
"\n";
817 answerLog <<
" moveToXY, simStep:\n";
824 answerLog <<
" edges: " <<
joinToString(edges2,
" ") <<
"\n";
829 answerLog <<
" add:\n";
840 answerLog <<
" getLeader: " << leader.first <<
", " << leader.second <<
"\n";
842 answerLog <<
" getLaneChangeState (left): " << state.first <<
", " << state.second <<
"\n";
844 answerLog <<
" getLaneChangeState (right): " << state.first <<
", " << state.second <<
"\n";
847 answerLog <<
" remove:\n";
852 answerLog <<
" inductionloop:\n";
854 answerLog <<
" getVehicleData:\n";
856 for (
int i = 0; i < (int)result2.size(); ++i) {
862 answerLog <<
" simulation:\n";
872 answerLog <<
" getDistance2D_driving: " <<
simulation.
getDistance2D(2500, 500, 2000, 500,
false,
true) <<
"\n";
880 answerLog <<
" subscribe to road and pos of vehicle '1':\n";
881 std::vector<int> vars;
886 answerLog <<
" subscription results:\n";
890 answerLog <<
" subscribe to vehicles around edge 'e_u1':\n";
891 std::vector<int> vars2;
895 answerLog <<
" context subscription results:\n";
897 for (libsumo::SubscriptionResults::iterator it = result4.begin(); it != result4.end(); ++it) {
901 answerLog <<
" subscribe to vehicles around vehicle '1':\n";
902 std::vector<int> vars3;
917 answerLog <<
" context subscription results:\n";
919 for (
auto item : result5) {
920 answerLog <<
" vehicle=" << item.first <<
"\n";
924 answerLog <<
" person:\n";
953 std::vector<std::string> walkEdges;
954 walkEdges.push_back(
"e_u1");
955 walkEdges.push_back(
"e_shape1");
960 stage.
edges.push_back(
"e_vu2");
961 stage.
edges.push_back(
"e_vo2");
972 walkEdges.push_back(
"e_m5");
979 answerLog <<
" trafficlights:\n";
992 answerLog <<
" controlledLinks:\n";
993 for (
int i = 0; i < (int)links.size(); ++i) {
994 for (
int j = 0; j < (int)links[i].size(); ++j) {
995 answerLog <<
" index=" << i <<
" link=" << j <<
" fromLane=" << links[i][j].fromLane <<
" viaLane=" << links[i][j].viaLane <<
" toLane=" << links[i][j].toLane <<
"\n";
1005 answerLog <<
" completeDefinition:\n";
1006 for (
int i = 0; i < (int)logics.size(); ++i) {
1007 answerLog <<
" subID=" << logics[i].programID <<
" type=" << logics[i].type <<
" phase=" << logics[i].currentPhaseIndex <<
"\n";
1008 answerLog <<
" params=" <<
joinToString(logics[i].subParameter,
" ",
":") <<
"\n";
1009 for (
int j = 0; j < (int)logics[i].phases.size(); ++j) {
1010 answerLog <<
" phase=" << logics[i].phases[j].state
1011 <<
" dur=" << logics[i].phases[j].duration
1012 <<
" minDur=" << logics[i].phases[j].minDur
1013 <<
" maxDur=" << logics[i].phases[j].maxDur
1023 answerLog <<
" load:\n";
1024 std::vector<std::string> args;
1025 args.push_back(
"-n");
1026 args.push_back(
"net.net.xml");
1027 args.push_back(
"-r");
1028 args.push_back(
"input_routes.rou.xml");
1029 args.push_back(
"-a");
1030 args.push_back(
"input_additional.add.xml");
1031 args.push_back(
"--no-step-log");
1038 answerLog <<
" gui:\n";
1040 answerLog <<
" setScheme: \n";
1042 answerLog <<
" getScheme: " <<
gui.
getSchema(
"View #0") <<
"\n";
1044 answerLog <<
" getZoom: " <<
gui.
getZoom() <<
"\n";
1045 answerLog <<
" take screenshot: \n";
1048 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
int getPersonCapacity(const std::string &vehicleID) const
libsumo::TraCIPosition convertGeo(double x, double y, bool fromGeo=false) const
std::string getRouteID(const std::string &vehicleID) const
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
void setAccel(const std::string &typeID, double accel) const
void setRoute(const std::string &vehicleID, const std::vector< std::string > &edge) const
TRACI_CONST int TYPE_COLOR
std::vector< std::string > getIDList() const
int getStopState(const std::string &vehicleID) 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 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.
double getSlope(const std::string &personID) const
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="")
TRACI_CONST int POSITION_3D
tcpip::Socket * mySocket
The socket.
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
void commandSetOrder(int order)
Sends and validates a SetOrder command.
void setZoom(const std::string &viewID, double zoom) const
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()
libsumo::TraCIPositionVector getShape(const std::string &junctionID) const
mirrors MSInductLoop::VehicleData
std::vector< std::string > getBusStopWaitingIDList(const std::string &stopID) const
TRACI_CONST int RESPONSE_SUBSCRIBE_GUI_VARIABLE
void setRouteID(const std::string &vehicleID, const std::string &routeID) const
void testAPI()
call all API methods once
double arrivalPos
position on the lane when ending the stage
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.
TRACI_CONST int VAR_ROAD_ID
JunctionScope junction
Scope for interaction with junctions.
int getRoutingMode(const std::string &vehicleID) const
TRACI_CONST int CMD_CLOSE
double getWaitingTime(const std::string &vehicleID) const
void remove(const std::string &vehicleID, char reason=libsumo::REMOVE_VAPORIZED) const
std::string getTypeID(const std::string &vehicleID) const
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 setPhaseName(const std::string &tlsID, const std::string &name) 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
std::string getPhaseName(const std::string &tlsID) 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 setPhase(const std::string &tlsID, int index) 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
libsumo::TraCIPosition convert3D(const std::string &edgeID, double pos, int laneIndex=0, bool toGeo=false) const
std::string getLine(const std::string &vehicleID) const
std::string description
arbitrary description string
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
libsumo::TraCIPosition convert2D(const std::string &edgeID, double pos, int laneIndex=0, bool toGeo=false) const
TRACI_CONST int TYPE_INTEGER
TRACI_CONST int TYPE_BYTE
bool validateSimulationStep2(tcpip::Storage &inMsg)
Validates whether the given message is a valid answer to CMD_SIMSTEP.
int getPersonCapacity(const std::string &typeID) const
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 addSubscriptionFilterLCManeuver(int direction, bool noOpposite=false, double downstreamDist=-1, double upstreamDist=-1) 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
TRACI_CONST int RESPONSE_SUBSCRIBE_GUI_CONTEXT
std::string getTypeID(const std::string &personID) const
std::vector< std::string > getIDList() const
libsumo::TraCIColor getColor(const std::string &vehicleID) const
void createCommand(int cmdID, int varID, const std::string &objID, tcpip::Storage *add=nullptr) const
Sends a GetVariable / SetVariable request if mySocket is connected. Otherwise writes to myOutput only...
void setHeight(const std::string &personID, double height) const
std::vector< std::string > getVia(const std::string &vehicleID) const
TRACI_CONST int TYPE_POLYGON
void setType(const std::string &vehicleID, const std::string &typeID) const
std::string approachedInternal
void appendStage(const std::string &personID, const libsumo::TraCIStage &stage)
TRACI_CONST int CMD_GET_VEHICLE_VARIABLE
std::vector< std::string > edges
The sequence of edges to travel.
void writeResult()
Writes the results file.
double getAccumulatedWaitingTime(const std::string &vehicleID) const
virtual void writeByte(int)
RouteScope route
Scope for interaction with routes.
TRACI_CONST int CMD_SETORDER
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
TRACI_CONST int ROUTING_MODE_AGGREGATED
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.
TRACI_CONST int TYPE_DOUBLE
double getWaitingTime(const std::string &personID) const
TRACI_CONST int RESPONSE_SUBSCRIBE_INDUCTIONLOOP_CONTEXT
int getCurrentTime() const
std::string getRoadID(const std::string &personID) const
std::string id
The id of the vehicle.
TRACI_CONST int TYPE_STRINGLIST
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
TRACI_CONST int TYPE_STRING
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
TRACI_CONST int STAGE_WALKING
TRACI_CONST int REQUEST_AIRDIST
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.
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
TRACI_CONST int VAR_SPEED
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
libsumo::TraCIRoadPosition convertRoad(double x, double y, bool isGeo=false, const std::string &vClass="ignoring") 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
double getLateralSpeed(const std::string &vehicleID) const
VehicleScope vehicle
Scope for interaction with vehicles.
TRACI_CONST int POSITION_ROADMAP
TRACI_CONST int VAR_LANEPOSITION
double getHeight(const std::string &typeID) const
std::vector< std::string > getControlledLanes(const std::string &tlsID) const
tcpip::Storage myOutput
The reusable output storage.
int getLinkNumber(const std::string &laneID) const
void sendExact(const Storage &)
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
libsumo::TraCIStage getStage(const std::string &personID, int nextStageIndex=0) 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.
std::vector< std::string > getIDList() const
int getSpeedMode(const std::string &vehicleID) const
TRACI_CONST int REQUEST_DRIVINGDIST
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
TRACI_CONST int TYPE_UBYTE
virtual void writeDouble(double)
double getTraveltime(const std::string &edgeID) const
GUIScope gui
Scope for interaction with the gui.
void add(const std::string &personID, const std::string &edgeID, double pos, double depart=libsumo::DEPARTFLAG_NOW, const std::string typeID="DEFAULT_PEDTYPE")
void setMinGap(const std::string &personID, double minGap) const
std::string getLateralAlignment(const std::string &typeID) const
TRACI_CONST int CMD_SIMSTEP
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
TRACI_CONST int RESPONSE_SUBSCRIBE_INDUCTIONLOOP_VARIABLE
std::string getLaneID(const std::string &vehicleID) const
TRACI_CONST int POSITION_2D
int getBusStopWaiting(const std::string &stopID) 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
double getZoom(const std::string &viewID=DEFAULT_VIEW) 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
TRACI_CONST int TYPE_COMPOUND
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.