Hi Michael and Jakob,
I was able to find a/the solution for the problem.
In nearly every set-method, the command is transmitted,
but the packet returning is not checked
and therefore stays in the buffer.
Still the nextStep function call checks for incoming packets
and receives the false one from the buffer,
leading to the error mesage.
I attached a *.patch file containing a patch for all predefined methods
and extended the library for a few vehicle set/get methods.
You can ignore the hardcoded 'config.h' path.
I need it for a project where a 'config.h' file already exists.
regards,
Alexander
On 01/04/2016 09:28 AM, Jakob Erdmann wrote:
> Hi Alexander,
> this is the same type of error you already reported in November.
> Apparently it concerns many more commands.
> It is now being tracked at http://sumo.dlr.de/trac.wsgi/ticket/2007
> regards,
> Jakob
>
> 2015-12-21 18:11 GMT+01:00 Michael Behrisch
> <[email protected] <mailto:[email protected]>>:
>
> Hi Alexander,
> this error should not appear and since it seems rather severe, I assume,
> it has to do with our setup. Could you please give some more details
> concerning your platform (Windows/Linux, which python version etc.) and
> the sumo version you use?
> Maybe you can also send the whole scenario or at least the complete
> script?
>
> Best regards,
> Michael
>
> Am 21.12.2015 um 15:43 schrieb Alexander Weidinger:
> > Hi,
> >
> > try {
> > tracictrl->vehicle.setSpeed("veh0", car->_speed_x);
> > tracictrl->simulationStep(0);
> > } catch(tcpip::SocketException &e) {
> > debug("tcpip: %s\n", e.what());
> > }
> >
> > leads to:
> >
> > tcpip: #Error: received status response to command: 196 but expected: 2
> >
> > This also happens for methods, which were already implemented and not
> > extended by myself.
> > Seems like the order of packet handling isn't done correctly in traci
> >
> > Any ideas on how to fix this?
> >
> > Best regards,
> > Alexander
> >
> >
>
> ------------------------------------------------------------------------------
> > _______________________________________________
> > sumo-user mailing list
> > [email protected]
> <mailto:[email protected]>
> > https://lists.sourceforge.net/lists/listinfo/sumo-user
> >
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> sumo-user mailing list
> [email protected] <mailto:[email protected]>
> https://lists.sourceforge.net/lists/listinfo/sumo-user
>
>
--
Mit freundlichen Grüßen
Alexander Weidinger
Index: src/utils/traci/TraCIAPI.cpp
===================================================================
--- src/utils/traci/TraCIAPI.cpp (revision 19843)
+++ src/utils/traci/TraCIAPI.cpp (working copy)
@@ -28,7 +28,7 @@
#ifdef _MSC_VER
#include <windows_config.h>
#else
-#include <config.h>
+#include "../../config.h"
#endif
#include "TraCIAPI.h"
@@ -53,7 +53,7 @@
: edge(*this), gui(*this), inductionloop(*this),
junction(*this), lane(*this), multientryexit(*this), poi(*this),
polygon(*this), route(*this), simulation(*this), trafficlights(*this),
- vehicletype(*this),
+ vehicletype(*this), vehicle(*this),
mySocket(0) {}
#ifdef _MSC_VER
#pragma warning(default: 4355)
@@ -543,6 +543,8 @@
tcpip::Storage content;
content.writeDouble(time);
myParent.send_commandSetValue(CMD_SET_EDGE_VARIABLE, VAR_EDGE_TRAVELTIME,
edgeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_EDGE_VARIABLE);
}
void
@@ -550,6 +552,8 @@
tcpip::Storage content;
content.writeDouble(effort);
myParent.send_commandSetValue(CMD_SET_EDGE_VARIABLE, VAR_EDGE_EFFORT,
edgeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_EDGE_VARIABLE);
}
void
@@ -557,6 +561,8 @@
tcpip::Storage content;
content.writeDouble(speed);
myParent.send_commandSetValue(CMD_SET_EDGE_VARIABLE, VAR_MAXSPEED, edgeID,
content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_EDGE_VARIABLE);
}
@@ -596,6 +602,8 @@
tcpip::Storage content;
content.writeDouble(zoom);
myParent.send_commandSetValue(CMD_SET_GUI_VARIABLE, VAR_VIEW_ZOOM, viewID,
content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_GUI_VARIABLE);
}
void
@@ -605,6 +613,8 @@
content.writeDouble(x);
content.writeDouble(y);
myParent.send_commandSetValue(CMD_SET_GUI_VARIABLE, VAR_VIEW_OFFSET,
viewID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_GUI_VARIABLE);
}
void
@@ -626,6 +636,8 @@
content.writeDouble(xmax);
content.writeDouble(ymax);
myParent.send_commandSetValue(CMD_SET_GUI_VARIABLE, VAR_VIEW_BOUNDARY,
viewID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_GUI_VARIABLE);
}
void
@@ -633,6 +645,8 @@
tcpip::Storage content;
content.writeString(filename);
myParent.send_commandSetValue(CMD_SET_GUI_VARIABLE, VAR_SCREENSHOT,
viewID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_GUI_VARIABLE);
}
void
@@ -640,6 +654,8 @@
tcpip::Storage content;
content.writeString(vehID);
myParent.send_commandSetValue(CMD_SET_GUI_VARIABLE, VAR_TRACK_VEHICLE,
viewID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_GUI_VARIABLE);
}
@@ -845,6 +861,8 @@
content.writeString(allowedClasses[i]);
}
myParent.send_commandSetValue(CMD_SET_LANE_VARIABLE, LANE_ALLOWED, laneID,
content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_LANE_VARIABLE);
}
void
@@ -856,6 +874,8 @@
content.writeString(disallowedClasses[i]);
}
myParent.send_commandSetValue(CMD_SET_LANE_VARIABLE, LANE_DISALLOWED,
laneID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_LANE_VARIABLE);
}
void
@@ -864,6 +884,8 @@
content.writeUnsignedByte(TYPE_DOUBLE);
content.writeDouble(speed);
myParent.send_commandSetValue(CMD_SET_LANE_VARIABLE, VAR_MAXSPEED, laneID,
content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_LANE_VARIABLE);
}
void
@@ -872,6 +894,8 @@
content.writeUnsignedByte(TYPE_DOUBLE);
content.writeDouble(length);
myParent.send_commandSetValue(CMD_SET_LANE_VARIABLE, VAR_LENGTH, laneID,
content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_LANE_VARIABLE);
}
@@ -946,6 +970,8 @@
content.writeUnsignedByte(TYPE_STRING);
content.writeString(setType);
myParent.send_commandSetValue(CMD_SET_POI_VARIABLE, VAR_TYPE, poiID,
content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_POI_VARIABLE);
}
void
@@ -955,6 +981,8 @@
content.writeDouble(x);
content.writeDouble(y);
myParent.send_commandSetValue(CMD_SET_POI_VARIABLE, VAR_POSITION, poiID,
content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_POI_VARIABLE);
}
void
@@ -966,6 +994,8 @@
content.writeUnsignedByte(c.b);
content.writeUnsignedByte(c.a);
myParent.send_commandSetValue(CMD_SET_POI_VARIABLE, VAR_COLOR, poiID,
content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_POI_VARIABLE);
}
void
@@ -986,6 +1016,8 @@
content.writeDouble(x);
content.writeDouble(y);
myParent.send_commandSetValue(CMD_SET_POI_VARIABLE, ADD, poiID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_POI_VARIABLE);
}
void
@@ -994,6 +1026,8 @@
content.writeUnsignedByte(TYPE_INTEGER);
content.writeInt(layer);
myParent.send_commandSetValue(CMD_SET_POI_VARIABLE, REMOVE, poiID,
content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_POI_VARIABLE);
}
@@ -1028,6 +1062,8 @@
content.writeUnsignedByte(TYPE_STRING);
content.writeString(setType);
myParent.send_commandSetValue(CMD_SET_POLYGON_VARIABLE, VAR_TYPE,
polygonID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_POLYGON_VARIABLE);
}
void
@@ -1040,6 +1076,8 @@
content.writeDouble(shape[i].y);
}
myParent.send_commandSetValue(CMD_SET_POLYGON_VARIABLE, VAR_POSITION,
polygonID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_POLYGON_VARIABLE);
}
void
@@ -1051,6 +1089,8 @@
content.writeUnsignedByte(c.b);
content.writeUnsignedByte(c.a);
myParent.send_commandSetValue(CMD_SET_POLYGON_VARIABLE, VAR_COLOR,
polygonID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_POLYGON_VARIABLE);
}
void
@@ -1077,6 +1117,8 @@
content.writeDouble(shape[i].y);
}
myParent.send_commandSetValue(CMD_SET_POLYGON_VARIABLE, ADD, polygonID,
content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_POLYGON_VARIABLE);
}
void
@@ -1085,6 +1127,8 @@
content.writeUnsignedByte(TYPE_INTEGER);
content.writeInt(layer);
myParent.send_commandSetValue(CMD_SET_POLYGON_VARIABLE, REMOVE, polygonID,
content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_POLYGON_VARIABLE);
}
@@ -1109,6 +1153,8 @@
content.writeUnsignedByte(TYPE_STRINGLIST);
content.writeStringList(edges);
myParent.send_commandSetValue(CMD_SET_ROUTE_VARIABLE, VAR_POSITION,
routeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_ROUTE_VARIABLE);
}
@@ -1284,6 +1330,8 @@
content.writeUnsignedByte(TYPE_STRING);
content.writeString(state);
myParent.send_commandSetValue(CMD_SET_TL_VARIABLE,
TL_RED_YELLOW_GREEN_STATE, tlsID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_TL_VARIABLE);
}
void
@@ -1292,6 +1340,8 @@
content.writeUnsignedByte(TYPE_INTEGER);
content.writeInt(index);
myParent.send_commandSetValue(CMD_SET_TL_VARIABLE, TL_PHASE_INDEX, tlsID,
content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_TL_VARIABLE);
}
void
@@ -1300,6 +1350,8 @@
content.writeUnsignedByte(TYPE_STRING);
content.writeString(programID);
myParent.send_commandSetValue(CMD_SET_TL_VARIABLE, TL_PROGRAM, tlsID,
content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_TL_VARIABLE);
}
void
@@ -1308,6 +1360,8 @@
content.writeUnsignedByte(TYPE_INTEGER);
content.writeInt(int(1000 * phaseDuration));
myParent.send_commandSetValue(CMD_SET_TL_VARIABLE, TL_PHASE_DURATION,
tlsID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_TL_VARIABLE);
}
void
@@ -1336,6 +1390,8 @@
content.writeString(logic.phases[i].phase);
}
myParent.send_commandSetValue(CMD_SET_TL_VARIABLE,
TL_COMPLETE_PROGRAM_RYG, tlsID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_TL_VARIABLE);
}
@@ -1428,6 +1484,8 @@
content.writeUnsignedByte(TYPE_DOUBLE);
content.writeDouble(length);
myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE, VAR_LENGTH,
typeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE);
}
void
@@ -1436,6 +1494,8 @@
content.writeUnsignedByte(TYPE_DOUBLE);
content.writeDouble(speed);
myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE, VAR_MAXSPEED,
typeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE);
}
void
@@ -1444,6 +1504,8 @@
content.writeUnsignedByte(TYPE_STRING);
content.writeString(clazz);
myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE,
VAR_VEHICLECLASS, typeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE);
}
void
@@ -1452,6 +1514,8 @@
content.writeUnsignedByte(TYPE_DOUBLE);
content.writeDouble(factor);
myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE,
VAR_SPEED_FACTOR, typeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE);
}
void
@@ -1460,6 +1524,8 @@
content.writeUnsignedByte(TYPE_DOUBLE);
content.writeDouble(deviation);
myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE,
VAR_SPEED_DEVIATION, typeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE);
}
void
@@ -1468,6 +1534,8 @@
content.writeUnsignedByte(TYPE_STRING);
content.writeString(clazz);
myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE,
VAR_EMISSIONCLASS, typeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE);
}
void
@@ -1476,6 +1544,8 @@
content.writeUnsignedByte(TYPE_DOUBLE);
content.writeDouble(width);
myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE, VAR_WIDTH,
typeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE);
}
void
@@ -1484,6 +1554,8 @@
content.writeUnsignedByte(TYPE_DOUBLE);
content.writeDouble(minGap);
myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE, VAR_MINGAP,
typeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE);
}
void
@@ -1492,6 +1564,8 @@
content.writeUnsignedByte(TYPE_STRING);
content.writeString(clazz);
myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE,
VAR_SHAPECLASS, typeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE);
}
void
@@ -1500,6 +1574,8 @@
content.writeUnsignedByte(TYPE_DOUBLE);
content.writeDouble(accel);
myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE, VAR_ACCEL,
typeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE);
}
void
@@ -1508,6 +1584,8 @@
content.writeUnsignedByte(TYPE_DOUBLE);
content.writeDouble(decel);
myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE, VAR_DECEL,
typeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE);
}
void
@@ -1516,6 +1594,8 @@
content.writeUnsignedByte(TYPE_DOUBLE);
content.writeDouble(imperfection);
myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE,
VAR_IMPERFECTION, typeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE);
}
void
@@ -1524,6 +1604,8 @@
content.writeUnsignedByte(TYPE_DOUBLE);
content.writeDouble(tau);
myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE, VAR_TAU,
typeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE);
}
void
@@ -1535,9 +1617,129 @@
content.writeUnsignedByte(c.b);
content.writeUnsignedByte(c.a);
myParent.send_commandSetValue(CMD_SET_VEHICLETYPE_VARIABLE, VAR_COLOR,
typeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLETYPE_VARIABLE);
}
+
+
+// ---------------------------------------------------------------------------
+// TraCIAPI::VehicleScope-methods
+// ---------------------------------------------------------------------------
+std::vector<std::string>
+TraCIAPI::VehicleScope::getIDList() const {
+ return myParent.getStringVector(CMD_GET_VEHICLE_VARIABLE, ID_LIST, "");
+}
+
+unsigned int
+TraCIAPI::VehicleScope::getIDCount() const {
+ return myParent.getInt(CMD_GET_VEHICLE_VARIABLE, ID_COUNT, "");
+}
+
+SUMOReal
+TraCIAPI::VehicleScope::getSpeed(const std::string& typeID) const {
+ return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_SPEED, typeID);
+}
+
+TraCIAPI::TraCIPosition
+TraCIAPI::VehicleScope::getPosition(const std::string& typeID) const {
+ return myParent.getPosition(CMD_GET_VEHICLE_VARIABLE, VAR_POSITION,
typeID);
+}
+
+SUMOReal
+TraCIAPI::VehicleScope::getAngle(const std::string& typeID) const {
+ return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_ANGLE, typeID);
+}
+
+std::string
+TraCIAPI::VehicleScope::getRoadID(const std::string& typeID) const {
+ return myParent.getString(CMD_GET_VEHICLE_VARIABLE, VAR_ROAD_ID, typeID);
+}
+
+std::string
+TraCIAPI::VehicleScope::getLaneID(const std::string& typeID) const {
+ return myParent.getString(CMD_GET_VEHICLE_VARIABLE, VAR_LANE_ID, typeID);
+}
+
+unsigned int
+TraCIAPI::VehicleScope::getLaneIndex(const std::string& typeID) const {
+ return myParent.getInt(CMD_GET_VEHICLE_VARIABLE, VAR_LANE_INDEX, typeID);
+}
+
+std::string
+TraCIAPI::VehicleScope::getTypeID(const std::string& typeID) const {
+ return myParent.getString(CMD_GET_VEHICLE_VARIABLE, VAR_TYPE, typeID);
+}
+
+std::string
+TraCIAPI::VehicleScope::getRouteID(const std::string& typeID) const {
+ return myParent.getString(CMD_GET_VEHICLE_VARIABLE, VAR_ROAD_ID, typeID);
+}
+
+unsigned int
+TraCIAPI::VehicleScope::getRouteIndex(const std::string& typeID) const {
+ return myParent.getInt(CMD_GET_VEHICLE_VARIABLE, VAR_ROUTE_INDEX, typeID);
+}
+
+std::vector<std::string>
+TraCIAPI::VehicleScope::getEdges(const std::string& typeID) const {
+ return myParent.getStringVector(CMD_GET_VEHICLE_VARIABLE, VAR_EDGES,
typeID);
+}
+
+TraCIAPI::TraCIColor
+TraCIAPI::VehicleScope::getColor(const std::string& typeID) const {
+ return myParent.getColor(CMD_GET_VEHICLE_VARIABLE, VAR_COLOR, typeID);
+}
+
+SUMOReal
+TraCIAPI::VehicleScope::getLanePosition(const std::string& typeID) const {
+ return myParent.getDouble(CMD_GET_VEHICLE_VARIABLE, VAR_LANEPOSITION,
typeID);
+}
+
+
+
+
+void
+TraCIAPI::VehicleScope::moveTo(const std::string& typeID, const std::string&
laneID, SUMOReal position) const {
+ tcpip::Storage content;
+ content.writeUnsignedByte(TYPE_COMPOUND);
+ content.writeInt(2);
+ content.writeUnsignedByte(TYPE_STRING);
+ content.writeString(laneID);
+ content.writeUnsignedByte(TYPE_DOUBLE);
+ content.writeDouble(position);
+ myParent.send_commandSetValue(CMD_SET_VEHICLE_VARIABLE, VAR_MOVE_TO,
typeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLE_VARIABLE);
+}
+
+void
+TraCIAPI::VehicleScope::slowDown(const std::string& typeID, SUMOReal speed,
int duration) const {
+ tcpip::Storage content;
+ content.writeUnsignedByte(TYPE_COMPOUND);
+ content.writeInt(2);
+ content.writeUnsignedByte(TYPE_DOUBLE);
+ content.writeDouble(speed);
+ content.writeUnsignedByte(TYPE_INTEGER);
+ content.writeInt(duration);
+ myParent.send_commandSetValue(CMD_SET_VEHICLE_VARIABLE, CMD_SLOWDOWN,
typeID, content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLE_VARIABLE);
+}
+
+void
+TraCIAPI::VehicleScope::setSpeed(const std::string& typeID, SUMOReal speed)
const {
+ tcpip::Storage content;
+ content.writeUnsignedByte(TYPE_DOUBLE);
+ content.writeDouble(speed);
+ myParent.send_commandSetValue(CMD_SET_VEHICLE_VARIABLE, VAR_SPEED, typeID,
content);
+ tcpip::Storage inMsg;
+ myParent.check_resultState(inMsg, CMD_SET_VEHICLE_VARIABLE);
+}
+
+
+
/****************************************************************************/
Index: src/utils/traci/TraCIAPI.h
===================================================================
--- src/utils/traci/TraCIAPI.h (revision 19843)
+++ src/utils/traci/TraCIAPI.h (working copy)
@@ -29,7 +29,7 @@
#ifdef _MSC_VER
#include <windows_config.h>
#else
-#include <config.h>
+#include "../../config.h"
#endif
#include <vector>
@@ -643,6 +643,70 @@
};
+
+
+
+
+ /** @class VehicleScope
+ * @brief Scope for interaction with vehicles
+ */
+ class VehicleScope : public TraCIScopeWrapper {
+ public:
+ VehicleScope(TraCIAPI& parent) : TraCIScopeWrapper(parent) {}
+ virtual ~VehicleScope() {}
+
+ std::vector<std::string> getIDList() const;
+ unsigned int getIDCount() const;
+ SUMOReal getSpeed(const std::string& typeID) const;
+ TraCIPosition getPosition(const std::string& typeID) const;
+ SUMOReal getAngle(const std::string& typeID) const;
+ std::string getRoadID(const std::string& typeID) const;
+ std::string getLaneID(const std::string& typeID) const;
+ unsigned int getLaneIndex(const std::string& typeID) const;
+ std::string getTypeID(const std::string& typeID) const;
+ std::string getRouteID(const std::string& typeID) const;
+ unsigned int getRouteIndex(const std::string& typeID) const;
+ std::vector<std::string> getEdges(const std::string& typeID) const;
+ TraCIColor getColor(const std::string& typeID) const;
+ SUMOReal getLanePosition(const std::string& typeID) const;
+ unsigned int getSignalStates(const std::string& typeID) const;
+ SUMOReal getCO2Emissions(const std::string& typeID) const;
+ SUMOReal getCOEmissions(const std::string& typeID) const;
+ SUMOReal getHCEmissions(const std::string& typeID) const;
+ SUMOReal getPMxEmissions(const std::string& typeID) const;
+ SUMOReal getNOxEmissions(const std::string& typeID) const;
+ SUMOReal getFuelConsumption(const std::string& typeID) const;
+ SUMOReal getNoiseEmission(const std::string& typeID) const;
+ unsigned int getBestLanes(const std::string& typeID) const;
+ unsigned int getStopState(const std::string& typeID) const;
+ SUMOReal getLength(const std::string& typeID) const;
+ SUMOReal getMaxSpeed(const std::string& typeID) const;
+ SUMOReal getAccel(const std::string& typeID) const;
+ SUMOReal getDecel(const std::string& typeID) const;
+ SUMOReal getTau(const std::string& typeID) const;
+ SUMOReal getImperfection(const std::string& typeID) const;
+ SUMOReal getSpeedFactor(const std::string& typeID) const;
+ SUMOReal getSpeedDeviation(const std::string& typeID) const;
+ std::string getVClass(const std::string& typeID) const;
+ std::string getEmissionClass(const std::string& typeID) const;
+ std::string getShapeClass(const std::string& typeID) const;
+ SUMOReal getMinGap(const std::string& typeID) const;
+ SUMOReal getWidth(const std::string& typeID) const;
+ SUMOReal getWaitingTime(const std::string& typeID) const;
+
+ void moveTo(const std::string& typeID, const std::string& laneID,
SUMOReal position) const;
+ void slowDown(const std::string& typeID, SUMOReal speed, int duration)
const;
+ void setSpeed(const std::string& typeID, SUMOReal speed) const;
+
+ private:
+ /// @brief invalidated copy constructor
+ VehicleScope(const VehicleScope& src);
+
+ /// @brief invalidated assignment operator
+ VehicleScope& operator=(const VehicleScope& src);
+
+ };
+
public:
/// @brief Scope for interaction with edges
EdgeScope edge;
@@ -668,6 +732,8 @@
TrafficLightScope trafficlights;
/// @brief Scope for interaction with vehicle types
VehicleTypeScope vehicletype;
+ /// @brief Scope for interaction with vehicles
+ VehicleScope vehicle;
protected:
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
sumo-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sumo-user