Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
TraCIAPI.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2012-2024 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
20// C++ TraCI client API implementation
21/****************************************************************************/
22#pragma once
23#include <config.h>
24#include <vector>
25#include <limits>
26#include <string>
27#include <sstream>
28#include <iomanip>
31#include <libsumo/TraCIDefs.h>
32
33// ===========================================================================
34// global definitions
35// ===========================================================================
36#define DEFAULT_VIEW "View #0"
37#define PRECISION 2
38
39// ===========================================================================
40// class definitions
41// ===========================================================================
48class TraCIAPI {
49public:
52 TraCIAPI();
53
55 ~TraCIAPI();
56
59
65 void connect(const std::string& host, int port);
66
68 void setOrder(int order);
69
71 void close();
73
75 void simulationStep(double time = 0);
76
78 void load(const std::vector<std::string>& args);
79
81 std::pair<int, std::string> getVersion();
82
89 public:
93 TraCIScopeWrapper(TraCIAPI& parent, int cmdGetID, int cmdSetID, int subscribeID, int contextSubscribeID) :
94 myParent(parent),
95 myCmdGetID(cmdGetID),
96 myCmdSetID(cmdSetID),
97 mySubscribeID(subscribeID),
98 myContextSubscribeID(contextSubscribeID) {
99 }
100
103
104 std::vector<std::string> getIDList() const;
105 int getIDCount() const;
106
108 std::string getParameter(const std::string& objectID, const std::string& key) const;
109
111 std::pair<std::string, std::string> getParameterWithKey(const std::string& objectID, const std::string& key) const;
112
114 void setParameter(const std::string& objectID, const std::string& key, const std::string& value) const;
115
116 void subscribe(const std::string& objID, const std::vector<int>& vars, double beginTime, double endTime) const;
117 void subscribeContext(const std::string& objID, int domain, double range, const std::vector<int>& vars, double beginTime, double endTime) const;
118
120 const libsumo::TraCIResults getSubscriptionResults(const std::string& objID) const;
121
123 const libsumo::SubscriptionResults getContextSubscriptionResults(const std::string& objID) const;
124
125 // the following are only for internal use
129
130 protected:
131 int getUnsignedByte(int var, const std::string& id, tcpip::Storage* add = 0) const;
132 int getByte(int var, const std::string& id, tcpip::Storage* add = 0) const;
133 int getInt(int var, const std::string& id, tcpip::Storage* add = 0) const;
134 double getDouble(int var, const std::string& id, tcpip::Storage* add = 0) const;
135 libsumo::TraCIPositionVector getPolygon(int var, const std::string& id, tcpip::Storage* add = 0) const;
136 libsumo::TraCIPosition getPos(int var, const std::string& id, tcpip::Storage* add = 0) const;
137 libsumo::TraCIPosition getPos3D(int var, const std::string& id, tcpip::Storage* add = 0) const;
138 std::string getString(int var, const std::string& id, tcpip::Storage* add = 0) const;
139 std::vector<std::string> getStringVector(int var, const std::string& id, tcpip::Storage* add = 0) const;
140 std::vector<double> getDoubleVector(int var, const std::string& id, tcpip::Storage* add = 0) const;
141 libsumo::TraCIColor getCol(int var, const std::string& id, tcpip::Storage* add = 0) const;
142 libsumo::TraCIStage getTraCIStage(int var, const std::string& id, tcpip::Storage* add = 0) const;
143
144 void setInt(int var, const std::string& id, int value) const;
145 void setDouble(int var, const std::string& id, double value) const;
146 void setString(int var, const std::string& id, const std::string& value) const;
147 void setStringVector(int var, const std::string& id, const std::vector<std::string>& value) const;
148
149 protected:
152
153 private:
160
161
162 private:
165 };
166
167
172 public:
173 EdgeScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_EDGE_VARIABLE, libsumo::CMD_SET_EDGE_VARIABLE, libsumo::CMD_SUBSCRIBE_EDGE_VARIABLE, libsumo::CMD_SUBSCRIBE_EDGE_CONTEXT) {}
174 virtual ~EdgeScope() {}
175
176 double getAdaptedTraveltime(const std::string& edgeID, double time) const;
177 double getEffort(const std::string& edgeID, double time) const;
178 double getCO2Emission(const std::string& edgeID) const;
179 double getCOEmission(const std::string& edgeID) const;
180 double getHCEmission(const std::string& edgeID) const;
181 double getPMxEmission(const std::string& edgeID) const;
182 double getNOxEmission(const std::string& edgeID) const;
183 double getFuelConsumption(const std::string& edgeID) const;
184 double getNoiseEmission(const std::string& edgeID) const;
185 double getElectricityConsumption(const std::string& edgeID) const;
186 double getLastStepMeanSpeed(const std::string& edgeID) const;
187 double getLastStepOccupancy(const std::string& edgeID) const;
188 double getLastStepLength(const std::string& edgeID) const;
189 double getTraveltime(const std::string& edgeID) const;
190 int getLastStepVehicleNumber(const std::string& edgeID) const;
191 double getLastStepHaltingNumber(const std::string& edgeID) const;
192 std::vector<std::string> getLastStepVehicleIDs(const std::string& edgeID) const;
193 int getLaneNumber(const std::string& edgeID) const;
194 std::string getStreetName(const std::string& id) const;
195
196 void adaptTraveltime(const std::string& edgeID, double time, double beginSeconds = 0., double endSeconds = std::numeric_limits<double>::max()) const;
197 void setEffort(const std::string& edgeID, double effort, double beginSeconds = 0., double endSeconds = std::numeric_limits<double>::max()) const;
198 void setMaxSpeed(const std::string& edgeID, double speed) const;
199 };
200
201
206 public:
207 GUIScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_GUI_VARIABLE, libsumo::CMD_SET_GUI_VARIABLE, libsumo::CMD_SUBSCRIBE_GUI_VARIABLE, libsumo::CMD_SUBSCRIBE_GUI_CONTEXT) {}
208 virtual ~GUIScope() {}
209
210 double getZoom(const std::string& viewID = DEFAULT_VIEW) const;
211 libsumo::TraCIPosition getOffset(const std::string& viewID = DEFAULT_VIEW) const;
212 std::string getSchema(const std::string& viewID = DEFAULT_VIEW) const;
213 libsumo::TraCIPositionVector getBoundary(const std::string& viewID = DEFAULT_VIEW) const;
214 void setZoom(const std::string& viewID, double zoom) const;
215 void setOffset(const std::string& viewID, double x, double y) const;
216 void setSchema(const std::string& viewID, const std::string& schemeName) const;
217 void setBoundary(const std::string& viewID, double xmin, double ymin, double xmax, double ymax) const;
218 void screenshot(const std::string& viewID, const std::string& filename, const int width = -1, const int height = -1) const;
219 void trackVehicle(const std::string& viewID, const std::string& vehID) const;
220 };
221
222
227 public:
228 InductionLoopScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_INDUCTIONLOOP_VARIABLE, -1, libsumo::CMD_SUBSCRIBE_INDUCTIONLOOP_VARIABLE, libsumo::CMD_SUBSCRIBE_INDUCTIONLOOP_CONTEXT) {}
230
235 int getIntervalVehicleNumber(const std::string& loopID) const;
236 double getPosition(const std::string& loopID) const;
237 std::string getLaneID(const std::string& loopID) const;
238 int getLastStepVehicleNumber(const std::string& loopID) const;
239 double getLastStepMeanSpeed(const std::string& loopID) const;
240 std::vector<std::string> getLastStepVehicleIDs(const std::string& loopID) const;
241 double getLastStepOccupancy(const std::string& loopID) const;
242 double getLastStepMeanLength(const std::string& loopID) const;
243 double getTimeSinceDetection(const std::string& loopID) const;
244 std::vector<libsumo::TraCIVehicleData> getVehicleData(const std::string& loopID) const;
245 };
246
247
252 public:
253 JunctionScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_JUNCTION_VARIABLE, libsumo::CMD_SET_JUNCTION_VARIABLE, libsumo::CMD_SUBSCRIBE_JUNCTION_VARIABLE, libsumo::CMD_SUBSCRIBE_JUNCTION_CONTEXT) {}
254 virtual ~JunctionScope() {}
255
256 libsumo::TraCIPosition getPosition(const std::string& junctionID) const;
257 libsumo::TraCIPositionVector getShape(const std::string& junctionID) const;
258 };
259
260
265 public:
266 LaneScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_LANE_VARIABLE, libsumo::CMD_SET_LANE_VARIABLE, libsumo::CMD_SUBSCRIBE_LANE_VARIABLE, libsumo::CMD_SUBSCRIBE_LANE_CONTEXT) {}
267 virtual ~LaneScope() {}
268
269 double getLength(const std::string& laneID) const;
270 double getMaxSpeed(const std::string& laneID) const;
271 double getWidth(const std::string& laneID) const;
272 std::vector<std::string> getAllowed(const std::string& laneID) const;
273 std::vector<std::string> getDisallowed(const std::string& laneID) const;
274 int getLinkNumber(const std::string& laneID) const;
275 std::vector<libsumo::TraCIConnection> getLinks(const std::string& laneID) const;
276 libsumo::TraCIPositionVector getShape(const std::string& laneID) const;
277 std::string getEdgeID(const std::string& laneID) const;
278 double getCO2Emission(const std::string& laneID) const;
279 double getCOEmission(const std::string& laneID) const;
280 double getHCEmission(const std::string& laneID) const;
281 double getPMxEmission(const std::string& laneID) const;
282 double getNOxEmission(const std::string& laneID) const;
283 double getFuelConsumption(const std::string& laneID) const;
284 double getNoiseEmission(const std::string& laneID) const;
285 double getElectricityConsumption(const std::string& laneID) const;
286 double getLastStepMeanSpeed(const std::string& laneID) const;
287 double getLastStepOccupancy(const std::string& laneID) const;
288 double getLastStepLength(const std::string& laneID) const;
289 double getTraveltime(const std::string& laneID) const;
290 int getLastStepVehicleNumber(const std::string& laneID) const;
291 int getLastStepHaltingNumber(const std::string& laneID) const;
292 std::vector<std::string> getLastStepVehicleIDs(const std::string& laneID) const;
293 std::vector<std::string> getFoes(const std::string& laneID, const std::string& toLaneID) const;
294 std::vector<std::string> getInternalFoes(const std::string& laneID) const;
295
296 void setAllowed(const std::string& laneID, const std::vector<std::string>& allowedClasses) const;
297 void setDisallowed(const std::string& laneID, const std::vector<std::string>& disallowedClasses) const;
298 void setMaxSpeed(const std::string& laneID, double speed) const;
299 void setLength(const std::string& laneID, double length) const;
300 };
301
302
307 public:
308 LaneAreaScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_LANEAREA_VARIABLE, -1, libsumo::CMD_SUBSCRIBE_LANEAREA_VARIABLE, libsumo::CMD_SUBSCRIBE_LANEAREA_CONTEXT) {}
309 virtual ~LaneAreaScope() {}
310 };
311
312
317 public:
318 MeMeScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_MULTIENTRYEXIT_VARIABLE, -1, libsumo::CMD_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE, libsumo::CMD_SUBSCRIBE_MULTIENTRYEXIT_CONTEXT) {}
319 virtual ~MeMeScope() {}
320
321 int getLastStepVehicleNumber(const std::string& detID) const;
322 double getLastStepMeanSpeed(const std::string& detID) const;
323 std::vector<std::string> getLastStepVehicleIDs(const std::string& detID) const;
324 int getLastStepHaltingNumber(const std::string& detID) const;
325 std::vector<std::string> getEntryLanes(const std::string& detID) const;
326 std::vector<std::string> getExitLanes(const std::string& detID) const;
327 std::vector<double> getEntryPositions(const std::string& detID) const;
328 std::vector<double> getExitPositions(const std::string& detID) const;
329 };
330
331
336 public:
337 POIScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_POI_VARIABLE, libsumo::CMD_SET_POI_VARIABLE, libsumo::CMD_SUBSCRIBE_POI_VARIABLE, libsumo::CMD_SUBSCRIBE_POI_CONTEXT) {}
338 virtual ~POIScope() {}
339
340 std::string getType(const std::string& poiID) const;
341 libsumo::TraCIPosition getPosition(const std::string& poiID) const;
342 libsumo::TraCIColor getColor(const std::string& poiID) const;
343 double getWidth(const std::string& poiID) const;
344 double getHeight(const std::string& poiID) const;
345 double getAngle(const std::string& poiID) const;
346 std::string getImageFile(const std::string& poiID) const;
347
348 void setType(const std::string& poiID, const std::string& setType) const;
349 void setPosition(const std::string& poiID, double x, double y) const;
350 void setColor(const std::string& poiID, const libsumo::TraCIColor& c) const;
351 void setWidth(const std::string& poiID, double width) const;
352 void setHeight(const std::string& poiID, double height) const;
353 void setAngle(const std::string& poiID, double angle) const;
354 void setImageFile(const std::string& poiID, const std::string& imageFile) const;
355 void add(const std::string& poiID, double x, double y, const libsumo::TraCIColor& c, const std::string& type, int layer, const std::string& imgFile, double width, double height, double angle) const;
356 void remove(const std::string& poiID, int layer = 0) const;
357 };
358
359
364 public:
365 PolygonScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_POLYGON_VARIABLE, libsumo::CMD_SET_POLYGON_VARIABLE, libsumo::CMD_SUBSCRIBE_POLYGON_VARIABLE, libsumo::CMD_SUBSCRIBE_POLYGON_CONTEXT) {}
366 virtual ~PolygonScope() {}
367
368 double getLineWidth(const std::string& polygonID) const;
369 bool getFilled(const std::string& polygonID) const;
370 std::string getType(const std::string& polygonID) const;
371 libsumo::TraCIPositionVector getShape(const std::string& polygonID) const;
372 libsumo::TraCIColor getColor(const std::string& polygonID) const;
373 void setType(const std::string& polygonID, const std::string& setType) const;
374 void setShape(const std::string& polygonID, const libsumo::TraCIPositionVector& shape) const;
375 void setColor(const std::string& polygonID, const libsumo::TraCIColor& c) const;
376 void setLineWidth(const std::string& polygonID, const double lineWidth) const;
377 void add(const std::string& polygonID, const libsumo::TraCIPositionVector& shape, const libsumo::TraCIColor& c, bool fill, const std::string& type, int layer) const;
378 void remove(const std::string& polygonID, int layer = 0) const;
379 };
380
381
386 public:
387 RerouterScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_REROUTER_VARIABLE, libsumo::CMD_SET_REROUTER_VARIABLE, libsumo::CMD_SUBSCRIBE_REROUTER_VARIABLE, libsumo::CMD_SUBSCRIBE_REROUTER_CONTEXT) {}
388 virtual ~RerouterScope() {}
389 };
390
391
396 public:
397 RouteScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_ROUTE_VARIABLE, libsumo::CMD_SET_ROUTE_VARIABLE, libsumo::CMD_SUBSCRIBE_ROUTE_VARIABLE, libsumo::CMD_SUBSCRIBE_ROUTE_CONTEXT) {}
398 virtual ~RouteScope() {}
399
400 std::vector<std::string> getEdges(const std::string& routeID) const;
401
402 void add(const std::string& routeID, const std::vector<std::string>& edges) const;
403 };
404
405
410 public:
411 RouteProbeScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_ROUTEPROBE_VARIABLE, libsumo::CMD_SET_ROUTEPROBE_VARIABLE, libsumo::CMD_SUBSCRIBE_ROUTEPROBE_VARIABLE, libsumo::CMD_SUBSCRIBE_ROUTEPROBE_CONTEXT) {}
412 virtual ~RouteProbeScope() {}
413 };
414
415
420 public:
421 SimulationScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_SIM_VARIABLE, libsumo::CMD_SET_SIM_VARIABLE, libsumo::CMD_SUBSCRIBE_SIM_VARIABLE, libsumo::CMD_SUBSCRIBE_SIM_CONTEXT) {}
422 virtual ~SimulationScope() {}
423
424 int getCurrentTime() const;
425 double getTime() const;
426 int getLoadedNumber() const;
427 std::vector<std::string> getLoadedIDList() const;
428 int getDepartedNumber() const;
429 std::vector<std::string> getDepartedIDList() const;
430 int getArrivedNumber() const;
431 std::vector<std::string> getArrivedIDList() const;
432 int getStartingTeleportNumber() const;
433 std::vector<std::string> getStartingTeleportIDList() const;
434 int getEndingTeleportNumber() const;
435 std::vector<std::string> getEndingTeleportIDList() const;
436 double getDeltaT() const;
438 int getMinExpectedNumber() const;
439 std::string getOption(const std::string& option) const;
440
441 int getDepartedPersonNumber() const;
442 std::vector<std::string> getDepartedPersonIDList() const;
443 int getArrivedPersonNumber() const;
444 std::vector<std::string> getArrivedPersonIDList() const;
445
446 int getBusStopWaiting(const std::string& stopID) const;
447 std::vector<std::string> getBusStopWaitingIDList(const std::string& stopID) const;
448
449 libsumo::TraCIPosition convert2D(const std::string& edgeID, double pos, int laneIndex = 0, bool toGeo = false) const;
450 libsumo::TraCIPosition convert3D(const std::string& edgeID, double pos, int laneIndex = 0, bool toGeo = false) const;
451 libsumo::TraCIRoadPosition convertRoad(double x, double y, bool isGeo = false, const std::string& vClass = "ignoring") const;
452 libsumo::TraCIPosition convertGeo(double x, double y, bool fromGeo = false) const;
453
454 double getDistance2D(double x1, double y1, double x2, double y2, bool isGeo = false, bool isDriving = false);
455 double getDistanceRoad(const std::string& edgeID1, double pos1, const std::string& edgeID2, double pos2, bool isDriving = false);
456 libsumo::TraCIStage findRoute(const std::string& fromEdge, const std::string& toEdge, const std::string& vType = "", double pos = -1., int routingMode = 0) const;
457 void loadState(const std::string& path) const;
458 void saveState(const std::string& destination) const;
459 void writeMessage(const std::string msg);
460 };
461
462
467 public:
468 TrafficLightScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_TL_VARIABLE, libsumo::CMD_SET_TL_VARIABLE, libsumo::CMD_SUBSCRIBE_TL_VARIABLE, libsumo::CMD_SUBSCRIBE_TL_CONTEXT) {}
470
471 std::string getRedYellowGreenState(const std::string& tlsID) const;
472 std::vector<libsumo::TraCILogic> getAllProgramLogics(const std::string& tlsID) const;
473 std::vector<std::string> getControlledLanes(const std::string& tlsID) const;
474 std::vector<std::vector<libsumo::TraCILink> > getControlledLinks(const std::string& tlsID) const;
475 std::string getProgram(const std::string& tlsID) const;
476 int getPhase(const std::string& tlsID) const;
477 double getPhaseDuration(const std::string& tlsID) const;
478 double getNextSwitch(const std::string& tlsID) const;
479 int getServedPersonCount(const std::string& tlsID, int index) const;
480 std::string getPhaseName(const std::string& tlsID) const;
481
482 void setRedYellowGreenState(const std::string& tlsID, const std::string& state) const;
483 void setPhase(const std::string& tlsID, int index) const;
484 void setPhaseName(const std::string& tlsID, const std::string& name) const;
485 void setProgram(const std::string& tlsID, const std::string& programID) const;
486 void setPhaseDuration(const std::string& tlsID, double phaseDuration) const;
487 void setProgramLogic(const std::string& tlsID, const libsumo::TraCILogic& logic) const;
488
489 // aliases for backward compatibility
490 inline std::vector<libsumo::TraCILogic> getCompleteRedYellowGreenDefinition(const std::string& tlsID) const {
491 return getAllProgramLogics(tlsID);
492 }
493 void setCompleteRedYellowGreenDefinition(const std::string& tlsID, const libsumo::TraCILogic& logic) const {
494 setProgramLogic(tlsID, logic);
495 }
496 };
497
498
503 public:
504 VehicleTypeScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_VEHICLETYPE_VARIABLE, libsumo::CMD_SET_VEHICLETYPE_VARIABLE, libsumo::CMD_SUBSCRIBE_VEHICLETYPE_VARIABLE, libsumo::CMD_SUBSCRIBE_VEHICLETYPE_CONTEXT) {}
505 virtual ~VehicleTypeScope() {}
506
507 double getLength(const std::string& typeID) const;
508 double getMaxSpeed(const std::string& typeID) const;
509 double getSpeedFactor(const std::string& typeID) const;
510 double getSpeedDeviation(const std::string& typeID) const;
511 double getAccel(const std::string& typeID) const;
512 double getDecel(const std::string& typeID) const;
513 double getEmergencyDecel(const std::string& typeID) const;
514 double getApparentDecel(const std::string& typeID) const;
515 double getImperfection(const std::string& typeID) const;
516 double getTau(const std::string& typeID) const;
517 std::string getVehicleClass(const std::string& typeID) const;
518 std::string getEmissionClass(const std::string& typeID) const;
519 std::string getShapeClass(const std::string& typeID) const;
520 double getMinGap(const std::string& typeID) const;
521 double getWidth(const std::string& typeID) const;
522 double getHeight(const std::string& typeID) const;
523 libsumo::TraCIColor getColor(const std::string& typeID) const;
524 double getMinGapLat(const std::string& typeID) const;
525 double getMaxSpeedLat(const std::string& typeID) const;
526 std::string getLateralAlignment(const std::string& typeID) const;
527 int getPersonCapacity(const std::string& typeID) const;
528
529 void setLength(const std::string& typeID, double length) const;
530 void setMaxSpeed(const std::string& typeID, double speed) const;
531 void setVehicleClass(const std::string& typeID, const std::string& clazz) const;
532 void setSpeedFactor(const std::string& typeID, double factor) const;
533 void setSpeedDeviation(const std::string& typeID, double deviation) const;
534 void setEmissionClass(const std::string& typeID, const std::string& clazz) const;
535 void setShapeClass(const std::string& typeID, const std::string& shapeClass) const;
536 void setWidth(const std::string& typeID, double width) const;
537 void setHeight(const std::string& typeID, double height) const;
538 void setMinGap(const std::string& typeID, double minGap) const;
539 void setAccel(const std::string& typeID, double accel) const;
540 void setDecel(const std::string& typeID, double decel) const;
541 void setEmergencyDecel(const std::string& typeID, double decel) const;
542 void setApparentDecel(const std::string& typeID, double decel) const;
543 void setImperfection(const std::string& typeID, double imperfection) const;
544 void setTau(const std::string& typeID, double tau) const;
545 void setColor(const std::string& typeID, const libsumo::TraCIColor& c) const;
546 void setMinGapLat(const std::string& typeID, double minGapLat) const;
547 void setMaxSpeedLat(const std::string& typeID, double speed) const;
548 void setLateralAlignment(const std::string& typeID, const std::string& latAlignment) const;
549 void copy(const std::string& origTypeID, const std::string& newTypeID) const;
550 };
551
552
557 public:
558 VehicleScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::CMD_SET_VEHICLE_VARIABLE, libsumo::CMD_SUBSCRIBE_VEHICLE_VARIABLE, libsumo::CMD_SUBSCRIBE_VEHICLE_CONTEXT) {}
559 virtual ~VehicleScope() {}
560
578
581 double getSpeed(const std::string& vehicleID) const;
582 double getLateralSpeed(const std::string& vehicleID) const;
583 double getAcceleration(const std::string& vehicleID) const;
584 double getFollowSpeed(const std::string& vehicleID, double speed, double gap, double leaderSpeed, double leaderMaxDecel, const std::string& leaderID = "") const;
585 double getSecureGap(const std::string& vehicleID, double speed, double leaderSpeed, double leaderMaxDecel, const std::string& leaderID = "") const;
586 double getStopSpeed(const std::string& vehicleID, double speed, double gap) const;
587 libsumo::TraCIPosition getPosition(const std::string& vehicleID) const;
588 libsumo::TraCIPosition getPosition3D(const std::string& vehicleID) const;
589 double getAngle(const std::string& vehicleID) const;
590 std::string getRoadID(const std::string& vehicleID) const;
591 std::string getLaneID(const std::string& vehicleID) const;
592 int getLaneIndex(const std::string& vehicleID) const;
593 std::string getTypeID(const std::string& vehicleID) const;
594 std::string getRouteID(const std::string& vehicleID) const;
595 int getRouteIndex(const std::string& vehicleID) const;
596 std::vector<std::string> getRoute(const std::string& vehicleID) const;
597 libsumo::TraCIColor getColor(const std::string& vehicleID) const;
598 double getLanePosition(const std::string& vehicleID) const;
599 double getDistance(const std::string& vehicleID) const;
600 int getSignals(const std::string& vehicleID) const;
601 double getCO2Emission(const std::string& vehicleID) const;
602 double getCOEmission(const std::string& vehicleID) const;
603 double getHCEmission(const std::string& vehicleID) const;
604 double getPMxEmission(const std::string& vehicleID) const;
605 double getNOxEmission(const std::string& vehicleID) const;
606 double getFuelConsumption(const std::string& vehicleID) const;
607 double getNoiseEmission(const std::string& vehicleID) const;
608 double getElectricityConsumption(const std::string& vehicleID) const;
609 int getStopState(const std::string& vehicleID) const;
610 double getWaitingTime(const std::string& vehicleID) const;
611 double getAccumulatedWaitingTime(const std::string& vehicleID) const;
612 int getLaneChangeMode(const std::string& vehicleID) const;
613 int getSpeedMode(const std::string& vehicleID) const;
614 double getSlope(const std::string& vehicleID) const;
615 double getAllowedSpeed(const std::string& vehicleID) const;
616 int getPersonNumber(const std::string& vehicleID) const;
617 std::vector<std::string> getPersonIDList(const std::string& vehicleID) const;
618 double getSpeedWithoutTraCI(const std::string& vehicleID) const;
619 bool isRouteValid(const std::string& vehicleID) const;
620 double getLateralLanePosition(const std::string& vehicleID) const;
621 double getSpeedFactor(const std::string& vehicleID) const;
622 std::string getLine(const std::string& vehicleID) const;
623 std::vector<std::string> getVia(const std::string& vehicleID) const;
624 std::vector<libsumo::TraCINextTLSData> getNextTLS(const std::string& vehID) const;
625 std::vector<libsumo::TraCIBestLanesData> getBestLanes(const std::string& vehicleID) const;
626 std::pair<std::string, double> getLeader(const std::string& vehicleID, double dist) const;
627 std::pair<std::string, double> getFollower(const std::string& vehicleID, double dist) const;
628 int getRoutingMode(const std::string& vehicleID) const;
629 double getStopDelay(const std::string& vehicleID) const;
630 double getStopArrivalDelay(const std::string& vehicleID) const;
631 std::pair<int, int> getLaneChangeState(const std::string& vehicleID, int direction) const;
633
636 double getLength(const std::string& vehicleID) const;
637 double getMaxSpeed(const std::string& vehicleID) const;
638 double getAccel(const std::string& vehicleID) const;
639 double getDecel(const std::string& vehicleID) const;
640 double getEmergencyDecel(const std::string& vehicleID) const;
641 double getApparentDecel(const std::string& vehicleID) const;
642 double getTau(const std::string& vehicleID) const;
643 double getImperfection(const std::string& vehicleID) const;
644 double getSpeedDeviation(const std::string& vehicleID) const;
645 double getMinGap(const std::string& vehicleID) const;
646 double getWidth(const std::string& vehicleID) const;
647 double getHeight(const std::string& veihcleID) const;
648 double getMaxSpeedLat(const std::string& vehicleID) const;
649 double getMinGapLat(const std::string& vehicleID) const;
650 int getPersonCapacity(const std::string& vehicleID) const;
651 std::string getVehicleClass(const std::string& vehicleID) const;
652 std::string getEmissionClass(const std::string& vehicleID) const;
653 std::string getShapeClass(const std::string& vehicleID) const;
654 std::string getLateralAlignment(const std::string& vehicleID) const;
656
659 void add(const std::string& vehicleID,
660 const std::string& routeID,
661 const std::string& typeID = "DEFAULT_VEHTYPE",
662 std::string depart = "-1",
663 const std::string& departLane = "first",
664 const std::string& departPos = "base",
665 const std::string& departSpeed = "0",
666 const std::string& arrivalLane = "current",
667 const std::string& arrivalPos = "max",
668 const std::string& arrivalSpeed = "current",
669 const std::string& fromTaz = "",
670 const std::string& toTaz = "",
671 const std::string& line = "",
672 int personCapacity = 0,
673 int personNumber = 0) const;
674
675 void changeTarget(const std::string& vehicleID, const std::string& edgeID) const;
676 void changeLane(const std::string& vehicleID, int laneIndex, double duration) const;
677 void changeLaneRelative(const std::string& vehicleID, int laneChange, double duration) const;
678 void changeSublane(const std::string& vehicleID, double latDist) const;
679 void setRouteID(const std::string& vehicleID, const std::string& routeID) const;
680 void setRoute(const std::string& vehicleID, const std::vector<std::string>& edge) const;
681 void rerouteTraveltime(const std::string& vehicleID, bool currentTravelTimes = true) const;
682 void moveTo(const std::string& vehicleID, const std::string& laneID, double position, int reason = libsumo::MOVE_TELEPORT) const;
683 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;
684 void slowDown(const std::string& vehicleID, double speed, double duration) const;
685 void openGap(const std::string& vehicleID, double newTau, double duration, double changeRate, double maxDecel) const;
686 void setSpeed(const std::string& vehicleID, double speed) const;
687 void setAcceleration(const std::string& vehicleID, double accel, double duration) const;
688 void setPreviousSpeed(const std::string& vehicleID, double prevSpeed, double prevAcceleration = std::numeric_limits<int>::min()) const;
689 void setLaneChangeMode(const std::string& vehicleID, int mode) const;
690 void setSpeedMode(const std::string& vehicleID, int mode) const;
691 void setStop(const std::string vehicleID, const std::string edgeID, const double endPos = 1.,
692 const int laneIndex = 0, const double duration = std::numeric_limits<double>::max(),
693 const int flags = 0, const double startPos = std::numeric_limits<int>::min(),
694 const double until = -1) const;
695 void setType(const std::string& vehicleID, const std::string& typeID) const;
696 void remove(const std::string& vehicleID, char reason = libsumo::REMOVE_VAPORIZED) const;
697 void setColor(const std::string& vehicleID, const libsumo::TraCIColor& c) const;
698 void setLine(const std::string& vehicleID, const std::string& line) const;
699 void setVia(const std::string& vehicleID, const std::vector<std::string>& via) const;
700 void setSignals(const std::string& vehicleID, int signals) const;
701 void setRoutingMode(const std::string& vehicleID, int routingMode) const;
703
706 void setShapeClass(const std::string& vehicleID, const std::string& clazz) const;
707 void setEmissionClass(const std::string& vehicleID, const std::string& clazz) const;
708 void setSpeedFactor(const std::string& vehicleID, double factor) const;
709 void setMinGap(const std::string& vehicleID, double minGap) const;
710 void setMaxSpeed(const std::string& vehicleID, double speed) const;
712
714 /* @brief Filters are added to the last modified vehicle context
715 * subscription (call these fucntions right after subscribing) */
717
718 /* @brief Adds a lane-filter, lanes is a list of relative lane indices (-1 -> right neighboring lane of the ego, 0 -> ego lane, etc.)
719 * noOpposite specifies whether vehicles on opposite direction lanes shall be returned
720 * downstreamDist and upstreamDist specify the range of the search for surrounding vehicles along the road net. */
721 void addSubscriptionFilterLanes(const std::vector<int>& lanes,
722 bool noOpposite = false, double downstreamDist = -1, double upstreamDist = -1) const;
723
724 /* @brief Omits vehicles on other edges than the ego's */
726
727 /* @brief Limits the downstream distance for resulting vehicles */
728 void addSubscriptionFilterDownstreamDistance(double dist) const;
729
730 /* @brief Limits the updstream distance for resulting vehicles */
731 void addSubscriptionFilterUpstreamDistance(double dist) const;
732
733 /* @brief Restricts vehicles returned by the last modified vehicle context subscription to leader and follower of the ego.
734 * downstreamDist and upstreamDist specify the range of the search for leader and follower along the road net. */
735 void addSubscriptionFilterCFManeuver(double downstreamDist = -1, double upstreamDist = -1) const;
736
737 /* @brief Restricts returned vehicles to neighbor and ego-lane leader
738 * and follower of the ego in the given direction
739 * noOpposite specifies whether vehicles on opposite direction lanes shall be returned
740 * downstreamDist and upstreamDist specify the range of the search for leader and follower along the road net.
741 * Combine with: distance filters; vClass/vType filter. */
742 void addSubscriptionFilterLCManeuver(int direction, bool noOpposite = false, double downstreamDist = -1, double upstreamDist = -1) const;
743
744 /* @brief Restricts returned vehicles to neighbor and ego-lane leader and follower of the ego.
745 * Combine with: lanes-filter to restrict to one direction; distance filters; vClass/vType filter. */
746 void addSubscriptionFilterLeadFollow(const std::vector<int>& lanes) const;
747
748 /* @brief Restricts returned vehicles to foes on an upcoming junction */
749 void addSubscriptionFilterTurn(double downstreamDist = -1, double upstreamDist = -1) const;
750
751 /* @brief Restricts returned vehicles to the given classes */
752 void addSubscriptionFilterVClass(const std::vector<std::string>& vClasses) const;
753
754 /* @brief Restricts returned vehicles to the given types */
755 void addSubscriptionFilterVType(const std::vector<std::string>& vTypes) const;
756
757 /* @brief Restricts returned vehicles to the given FOV-angle */
758 void addSubscriptionFilterFieldOfVision(double angle) const;
759
760 /* @brief Restricts returned vehicles to the given lateral distance */
761 void addSubscriptionFilterLateralDistance(double lateralDist, double downstreamDist = -1, double foeDistToJunction = -1) const;
762
764
765 private:
766 void addSubscriptionFilterEmpty(int filterType) const;
767 void addSubscriptionFilterFloat(int filterType, double val) const;
768 void addSubscriptionFilterStringList(int filterType, const std::vector<std::string>& vals) const;
769 void addSubscriptionFilterByteList(int filterType, const std::vector<int>& vals) const;
770 };
771
772
777 public:
778 PersonScope(TraCIAPI& parent) : TraCIScopeWrapper(parent, libsumo::CMD_GET_PERSON_VARIABLE, libsumo::CMD_SET_PERSON_VARIABLE, libsumo::CMD_SUBSCRIBE_PERSON_VARIABLE, libsumo::CMD_SUBSCRIBE_PERSON_CONTEXT) {}
779 virtual ~PersonScope() {}
780
781 double getSpeed(const std::string& personID) const;
782 libsumo::TraCIPosition getPosition(const std::string& personID) const;
783 libsumo::TraCIPosition getPosition3D(const std::string& personID) const;
784 std::string getRoadID(const std::string& personID) const;
785 std::string getLaneID(const std::string& personID) const;
786 std::string getTypeID(const std::string& personID) const;
787 double getSpeedFactor(const std::string& personID) const;
788 double getWaitingTime(const std::string& personID) const;
789 std::string getNextEdge(const std::string& personID) const;
790 std::string getVehicle(const std::string& personID) const;
791 int getRemainingStages(const std::string& personID) const;
792 libsumo::TraCIStage getStage(const std::string& personID, int nextStageIndex = 0) const;
793 std::vector<std::string> getEdges(const std::string& personID, int nextStageIndex = 0) const;
794 double getAngle(const std::string& personID) const;
795 double getSlope(const std::string& personID) const;
796 double getLanePosition(const std::string& personID) const;
797 libsumo::TraCIColor getColor(const std::string& personID) const;
798
801 double getLength(const std::string& personID) const;
803
804
805 void removeStages(const std::string& personID) const;
806 void add(const std::string& personID, const std::string& edgeID, double pos, double depart = libsumo::DEPARTFLAG_NOW, const std::string typeID = "DEFAULT_PEDTYPE");
807 void appendStage(const std::string& personID, const libsumo::TraCIStage& stage);
808 void appendWaitingStage(const std::string& personID, double duration, const std::string& description = "waiting", const std::string& stopID = "");
809 void appendWalkingStage(const std::string& personID, const std::vector<std::string>& edges, double arrivalPos, double duration = -1, double speed = -1, const std::string& stopID = "");
810 void appendDrivingStage(const std::string& personID, const std::string& toEdge, const std::string& lines, const std::string& stopID = "");
811 void removeStage(const std::string& personID, int nextStageIndex) const;
812 void rerouteTraveltime(const std::string& personID) const;
813 void moveTo(const std::string& personID, const std::string& edgeID, double position) const;
814 void moveToXY(const std::string& personID, const std::string& edgeID, const double x, const double y, double angle, const int keepRoute) const;
815 void setSpeed(const std::string& personID, double speed) const;
816 void setType(const std::string& personID, const std::string& typeID) const;
817 void setSpeedFactor(const std::string& personID, double factor) const;
818 void setLength(const std::string& personID, double length) const;
819 void setWidth(const std::string& personID, double width) const;
820 void setHeight(const std::string& personID, double height) const;
821 void setMinGap(const std::string& personID, double minGap) const;
822 void setColor(const std::string& personID, const libsumo::TraCIColor& c) const;
823 };
824
825
826
827public:
862
863
864protected:
867
870 void send_commandSimulationStep(double time) const;
871
872
875 void send_commandClose() const;
876
877
880 void send_commandSetOrder(int order) const;
881
889 void createCommand(int cmdID, int varID, const std::string& objID, tcpip::Storage* add = nullptr) const;
890 void createFilterCommand(int cmdID, int varID, tcpip::Storage* add = nullptr) const;
891
892
900 void send_commandSubscribeObjectVariable(int domID, const std::string& objID, double beginTime, double endTime, const std::vector<int>& vars) const;
901
902
912 void send_commandSubscribeObjectContext(int domID, const std::string& objID, double beginTime, double endTime,
913 int domain, double range, const std::vector<int>& vars) const;
915
916
919
926 void check_resultState(tcpip::Storage& inMsg, int command, bool ignoreCommandId = false, std::string* acknowledgement = 0) const;
927
931 int check_commandGetResult(tcpip::Storage& inMsg, int command, int expectedType = -1, bool ignoreCommandId = false) const;
932
933 bool processGet(int command, int expectedType, bool ignoreCommandId = false);
934 bool processSet(int command);
936
937 void readVariableSubscription(int cmdId, tcpip::Storage& inMsg);
938 void readContextSubscription(int cmdId, tcpip::Storage& inMsg);
939 void readVariables(tcpip::Storage& inMsg, const std::string& objectID, int variableCount, libsumo::SubscriptionResults& into);
940
941 template <class T>
942 static inline std::string toString(const T& t, std::streamsize accuracy = PRECISION) {
943 std::ostringstream oss;
944 oss.setf(std::ios::fixed, std::ios::floatfield);
945 oss << std::setprecision(accuracy);
946 oss << t;
947 return oss.str();
948 }
949
951 void closeSocket();
952
953protected:
954 std::map<int, TraCIScopeWrapper*> myDomains;
961};
#define DEFAULT_VIEW
Definition TraCIAPI.h:36
#define PRECISION
Definition TraCIAPI.h:37
Scope for interaction with edges.
Definition TraCIAPI.h:171
double getElectricityConsumption(const std::string &edgeID) const
Definition TraCIAPI.cpp:549
double getLastStepHaltingNumber(const std::string &edgeID) const
Definition TraCIAPI.cpp:579
double getHCEmission(const std::string &edgeID) const
Definition TraCIAPI.cpp:524
void adaptTraveltime(const std::string &edgeID, double time, double beginSeconds=0., double endSeconds=std::numeric_limits< double >::max()) const
Definition TraCIAPI.cpp:602
double getLastStepOccupancy(const std::string &edgeID) const
Definition TraCIAPI.cpp:559
double getLastStepLength(const std::string &edgeID) const
Definition TraCIAPI.cpp:564
std::vector< std::string > getLastStepVehicleIDs(const std::string &edgeID) const
Definition TraCIAPI.cpp:584
double getNOxEmission(const std::string &edgeID) const
Definition TraCIAPI.cpp:534
void setMaxSpeed(const std::string &edgeID, double speed) const
Definition TraCIAPI.cpp:641
virtual ~EdgeScope()
Definition TraCIAPI.h:174
double getCO2Emission(const std::string &edgeID) const
Definition TraCIAPI.cpp:513
double getCOEmission(const std::string &edgeID) const
Definition TraCIAPI.cpp:519
int getLaneNumber(const std::string &edgeID) const
Definition TraCIAPI.cpp:590
void setEffort(const std::string &edgeID, double effort, double beginSeconds=0., double endSeconds=std::numeric_limits< double >::max()) const
Definition TraCIAPI.cpp:622
double getNoiseEmission(const std::string &edgeID) const
Definition TraCIAPI.cpp:544
double getFuelConsumption(const std::string &edgeID) const
Definition TraCIAPI.cpp:539
double getTraveltime(const std::string &edgeID) const
Definition TraCIAPI.cpp:569
EdgeScope(TraCIAPI &parent)
Definition TraCIAPI.h:173
int getLastStepVehicleNumber(const std::string &edgeID) const
Definition TraCIAPI.cpp:574
std::string getStreetName(const std::string &id) const
Definition TraCIAPI.cpp:596
double getLastStepMeanSpeed(const std::string &edgeID) const
Definition TraCIAPI.cpp:554
double getPMxEmission(const std::string &edgeID) const
Definition TraCIAPI.cpp:529
double getAdaptedTraveltime(const std::string &edgeID, double time) const
Definition TraCIAPI.cpp:497
double getEffort(const std::string &edgeID, double time) const
Definition TraCIAPI.cpp:505
Scope for interaction with the gui.
Definition TraCIAPI.h:205
void setOffset(const std::string &viewID, double x, double y) const
Definition TraCIAPI.cpp:676
libsumo::TraCIPositionVector getBoundary(const std::string &viewID=DEFAULT_VIEW) const
Definition TraCIAPI.cpp:665
std::string getSchema(const std::string &viewID=DEFAULT_VIEW) const
Definition TraCIAPI.cpp:660
void setBoundary(const std::string &viewID, double xmin, double ymin, double xmax, double ymax) const
Definition TraCIAPI.cpp:691
void setZoom(const std::string &viewID, double zoom) const
Definition TraCIAPI.cpp:671
virtual ~GUIScope()
Definition TraCIAPI.h:208
void trackVehicle(const std::string &viewID, const std::string &vehID) const
Definition TraCIAPI.cpp:719
void setSchema(const std::string &viewID, const std::string &schemeName) const
Definition TraCIAPI.cpp:686
libsumo::TraCIPosition getOffset(const std::string &viewID=DEFAULT_VIEW) const
Definition TraCIAPI.cpp:655
GUIScope(TraCIAPI &parent)
Definition TraCIAPI.h:207
double getZoom(const std::string &viewID=DEFAULT_VIEW) const
Definition TraCIAPI.cpp:650
void screenshot(const std::string &viewID, const std::string &filename, const int width=-1, const int height=-1) const
Definition TraCIAPI.cpp:704
Scope for interaction with inductive loops.
Definition TraCIAPI.h:226
std::vector< libsumo::TraCIVehicleData > getVehicleData(const std::string &loopID) const
Definition TraCIAPI.cpp:774
int getIntervalVehicleNumber(const std::string &loopID) const
Definition TraCIAPI.cpp:728
double getPosition(const std::string &loopID) const
Definition TraCIAPI.cpp:733
double getLastStepMeanSpeed(const std::string &loopID) const
Definition TraCIAPI.cpp:748
double getTimeSinceDetection(const std::string &loopID) const
Definition TraCIAPI.cpp:768
double getLastStepMeanLength(const std::string &loopID) const
Definition TraCIAPI.cpp:763
std::vector< std::string > getLastStepVehicleIDs(const std::string &loopID) const
Definition TraCIAPI.cpp:753
double getLastStepOccupancy(const std::string &loopID) const
Definition TraCIAPI.cpp:758
InductionLoopScope(TraCIAPI &parent)
Definition TraCIAPI.h:228
int getLastStepVehicleNumber(const std::string &loopID) const
Definition TraCIAPI.cpp:743
std::string getLaneID(const std::string &loopID) const
Definition TraCIAPI.cpp:738
Scope for interaction with junctions.
Definition TraCIAPI.h:251
JunctionScope(TraCIAPI &parent)
Definition TraCIAPI.h:253
libsumo::TraCIPosition getPosition(const std::string &junctionID) const
Definition TraCIAPI.cpp:811
libsumo::TraCIPositionVector getShape(const std::string &junctionID) const
Definition TraCIAPI.cpp:816
Scope for interaction with lane area detectors.
Definition TraCIAPI.h:306
LaneAreaScope(TraCIAPI &parent)
Definition TraCIAPI.h:308
Scope for interaction with lanes.
Definition TraCIAPI.h:264
int getLastStepVehicleNumber(const std::string &laneID) const
Definition TraCIAPI.cpp:975
double getPMxEmission(const std::string &laneID) const
Definition TraCIAPI.cpp:930
int getLastStepHaltingNumber(const std::string &laneID) const
Definition TraCIAPI.cpp:980
std::string getEdgeID(const std::string &laneID) const
Definition TraCIAPI.cpp:910
void setDisallowed(const std::string &laneID, const std::vector< std::string > &disallowedClasses) const
libsumo::TraCIPositionVector getShape(const std::string &laneID) const
Definition TraCIAPI.cpp:905
double getLastStepLength(const std::string &laneID) const
Definition TraCIAPI.cpp:965
void setLength(const std::string &laneID, double length) const
double getLength(const std::string &laneID) const
Definition TraCIAPI.cpp:825
int getLinkNumber(const std::string &laneID) const
Definition TraCIAPI.cpp:850
double getTraveltime(const std::string &laneID) const
Definition TraCIAPI.cpp:970
double getCOEmission(const std::string &laneID) const
Definition TraCIAPI.cpp:920
void setMaxSpeed(const std::string &laneID, double speed) const
LaneScope(TraCIAPI &parent)
Definition TraCIAPI.h:266
std::vector< std::string > getInternalFoes(const std::string &laneID) const
void setAllowed(const std::string &laneID, const std::vector< std::string > &allowedClasses) const
std::vector< std::string > getDisallowed(const std::string &laneID) const
Definition TraCIAPI.cpp:845
double getNoiseEmission(const std::string &laneID) const
Definition TraCIAPI.cpp:945
std::vector< std::string > getAllowed(const std::string &laneID) const
Definition TraCIAPI.cpp:840
double getFuelConsumption(const std::string &laneID) const
Definition TraCIAPI.cpp:940
double getWidth(const std::string &laneID) const
Definition TraCIAPI.cpp:835
double getCO2Emission(const std::string &laneID) const
Definition TraCIAPI.cpp:915
double getHCEmission(const std::string &laneID) const
Definition TraCIAPI.cpp:925
std::vector< libsumo::TraCIConnection > getLinks(const std::string &laneID) const
Definition TraCIAPI.cpp:855
double getMaxSpeed(const std::string &laneID) const
Definition TraCIAPI.cpp:830
std::vector< std::string > getLastStepVehicleIDs(const std::string &laneID) const
Definition TraCIAPI.cpp:985
double getElectricityConsumption(const std::string &laneID) const
Definition TraCIAPI.cpp:950
std::vector< std::string > getFoes(const std::string &laneID, const std::string &toLaneID) const
Definition TraCIAPI.cpp:991
double getLastStepMeanSpeed(const std::string &laneID) const
Definition TraCIAPI.cpp:955
double getNOxEmission(const std::string &laneID) const
Definition TraCIAPI.cpp:935
virtual ~LaneScope()
Definition TraCIAPI.h:267
double getLastStepOccupancy(const std::string &laneID) const
Definition TraCIAPI.cpp:960
Scope for interaction with multi entry/-exit detectors.
Definition TraCIAPI.h:316
std::vector< std::string > getLastStepVehicleIDs(const std::string &detID) const
virtual ~MeMeScope()
Definition TraCIAPI.h:319
int getLastStepVehicleNumber(const std::string &detID) const
std::vector< std::string > getExitLanes(const std::string &detID) const
std::vector< double > getExitPositions(const std::string &detID) const
double getLastStepMeanSpeed(const std::string &detID) const
MeMeScope(TraCIAPI &parent)
Definition TraCIAPI.h:318
int getLastStepHaltingNumber(const std::string &detID) const
std::vector< std::string > getEntryLanes(const std::string &detID) const
std::vector< double > getEntryPositions(const std::string &detID) const
Scope for interaction with POIs.
Definition TraCIAPI.h:335
libsumo::TraCIColor getColor(const std::string &poiID) const
void add(const std::string &poiID, double x, double y, const libsumo::TraCIColor &c, const std::string &type, int layer, const std::string &imgFile, double width, double height, double angle) const
std::string getImageFile(const std::string &poiID) const
void setWidth(const std::string &poiID, double width) const
libsumo::TraCIPosition getPosition(const std::string &poiID) const
void setImageFile(const std::string &poiID, const std::string &imageFile) const
void setHeight(const std::string &poiID, double height) const
void setAngle(const std::string &poiID, double angle) const
double getHeight(const std::string &poiID) const
double getAngle(const std::string &poiID) const
void remove(const std::string &poiID, int layer=0) const
void setColor(const std::string &poiID, const libsumo::TraCIColor &c) const
void setPosition(const std::string &poiID, double x, double y) const
POIScope(TraCIAPI &parent)
Definition TraCIAPI.h:337
double getWidth(const std::string &poiID) const
void setType(const std::string &poiID, const std::string &setType) const
std::string getType(const std::string &poiID) const
virtual ~POIScope()
Definition TraCIAPI.h:338
Scope for interaction with vehicles.
Definition TraCIAPI.h:776
std::string getNextEdge(const std::string &personID) const
void setLength(const std::string &personID, double length) const
libsumo::TraCIColor getColor(const std::string &personID) const
double getSlope(const std::string &personID) const
int getRemainingStages(const std::string &personID) const
double getWaitingTime(const std::string &personID) const
virtual ~PersonScope()
Definition TraCIAPI.h:779
void setSpeedFactor(const std::string &personID, double factor) const
libsumo::TraCIStage getStage(const std::string &personID, int nextStageIndex=0) const
void removeStage(const std::string &personID, int nextStageIndex) const
void add(const std::string &personID, const std::string &edgeID, double pos, double depart=libsumo::DEPARTFLAG_NOW, const std::string typeID="DEFAULT_PEDTYPE")
PersonScope(TraCIAPI &parent)
Definition TraCIAPI.h:778
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 setSpeed(const std::string &personID, double speed) const
double getLength(const std::string &personID) const
void moveToXY(const std::string &personID, const std::string &edgeID, const double x, const double y, double angle, const int keepRoute) const
void setHeight(const std::string &personID, double height) const
void setType(const std::string &personID, const std::string &typeID) const
void setMinGap(const std::string &personID, double minGap) const
void moveTo(const std::string &personID, const std::string &edgeID, double position) const
libsumo::TraCIPosition getPosition(const std::string &personID) const
double getSpeedFactor(const std::string &personID) const
void removeStages(const std::string &personID) const
void setColor(const std::string &personID, const libsumo::TraCIColor &c) const
std::string getRoadID(const std::string &personID) const
double getSpeed(const std::string &personID) const
std::string getVehicle(const std::string &personID) const
void appendDrivingStage(const std::string &personID, const std::string &toEdge, const std::string &lines, const std::string &stopID="")
std::string getTypeID(const std::string &personID) const
void appendStage(const std::string &personID, const libsumo::TraCIStage &stage)
double getAngle(const std::string &personID) const
std::string getLaneID(const std::string &personID) const
libsumo::TraCIPosition getPosition3D(const std::string &personID) const
std::vector< std::string > getEdges(const std::string &personID, int nextStageIndex=0) const
void appendWaitingStage(const std::string &personID, double duration, const std::string &description="waiting", const std::string &stopID="")
double getLanePosition(const std::string &personID) const
void setWidth(const std::string &personID, double width) const
void rerouteTraveltime(const std::string &personID) const
Scope for interaction with polygons.
Definition TraCIAPI.h:363
libsumo::TraCIColor getColor(const std::string &polygonID) const
void setType(const std::string &polygonID, const std::string &setType) const
bool getFilled(const std::string &polygonID) const
void add(const std::string &polygonID, const libsumo::TraCIPositionVector &shape, const libsumo::TraCIColor &c, bool fill, const std::string &type, int layer) const
libsumo::TraCIPositionVector getShape(const std::string &polygonID) const
std::string getType(const std::string &polygonID) const
void remove(const std::string &polygonID, int layer=0) const
double getLineWidth(const std::string &polygonID) const
PolygonScope(TraCIAPI &parent)
Definition TraCIAPI.h:365
void setColor(const std::string &polygonID, const libsumo::TraCIColor &c) const
void setLineWidth(const std::string &polygonID, const double lineWidth) const
virtual ~PolygonScope()
Definition TraCIAPI.h:366
void setShape(const std::string &polygonID, const libsumo::TraCIPositionVector &shape) const
Scope for interaction with rerouters.
Definition TraCIAPI.h:385
RerouterScope(TraCIAPI &parent)
Definition TraCIAPI.h:387
Scope for interaction with route probes.
Definition TraCIAPI.h:409
RouteProbeScope(TraCIAPI &parent)
Definition TraCIAPI.h:411
Scope for interaction with routes.
Definition TraCIAPI.h:395
RouteScope(TraCIAPI &parent)
Definition TraCIAPI.h:397
virtual ~RouteScope()
Definition TraCIAPI.h:398
std::vector< std::string > getEdges(const std::string &routeID) const
void add(const std::string &routeID, const std::vector< std::string > &edges) const
Scope for interaction with the simulation.
Definition TraCIAPI.h:419
SimulationScope(TraCIAPI &parent)
Definition TraCIAPI.h:421
double getDistance2D(double x1, double y1, double x2, double y2, bool isGeo=false, bool isDriving=false)
libsumo::TraCIPosition convert2D(const std::string &edgeID, double pos, int laneIndex=0, bool toGeo=false) const
std::vector< std::string > getStartingTeleportIDList() const
int getStartingTeleportNumber() const
int getEndingTeleportNumber() const
int getBusStopWaiting(const std::string &stopID) const
libsumo::TraCIStage findRoute(const std::string &fromEdge, const std::string &toEdge, const std::string &vType="", double pos=-1., int routingMode=0) const
libsumo::TraCIRoadPosition convertRoad(double x, double y, bool isGeo=false, const std::string &vClass="ignoring") const
void loadState(const std::string &path) const
std::vector< std::string > getBusStopWaitingIDList(const std::string &stopID) const
int getDepartedPersonNumber() const
double getDistanceRoad(const std::string &edgeID1, double pos1, const std::string &edgeID2, double pos2, bool isDriving=false)
std::vector< std::string > getArrivedPersonIDList() const
void saveState(const std::string &destination) const
std::vector< std::string > getEndingTeleportIDList() const
int getMinExpectedNumber() const
std::vector< std::string > getDepartedPersonIDList() const
std::vector< std::string > getDepartedIDList() const
int getArrivedPersonNumber() const
std::vector< std::string > getLoadedIDList() const
std::vector< std::string > getArrivedIDList() const
std::string getOption(const std::string &option) const
libsumo::TraCIPositionVector getNetBoundary() const
void writeMessage(const std::string msg)
libsumo::TraCIPosition convertGeo(double x, double y, bool fromGeo=false) const
libsumo::TraCIPosition convert3D(const std::string &edgeID, double pos, int laneIndex=0, bool toGeo=false) const
An abstract interface for accessing type-dependent values.
Definition TraCIAPI.h:88
int getUnsignedByte(int var, const std::string &id, tcpip::Storage *add=0) const
libsumo::ContextSubscriptionResults myContextSubscriptionResults
Definition TraCIAPI.h:159
const libsumo::SubscriptionResults getContextSubscriptionResults(const std::string &objID) const
virtual ~TraCIScopeWrapper()
Destructor.
Definition TraCIAPI.h:102
int getInt(int var, const std::string &id, tcpip::Storage *add=0) const
std::vector< std::string > getStringVector(int var, const std::string &id, tcpip::Storage *add=0) const
double getDouble(int var, const std::string &id, tcpip::Storage *add=0) const
libsumo::TraCIPosition getPos3D(int var, const std::string &id, tcpip::Storage *add=0) const
std::pair< std::string, std::string > getParameterWithKey(const std::string &objectID, const std::string &key) const
retrieve generic parameter and return (key, value) tuple
libsumo::TraCIColor getCol(int var, const std::string &id, tcpip::Storage *add=0) const
const libsumo::SubscriptionResults getAllSubscriptionResults() const
libsumo::SubscriptionResults mySubscriptionResults
Definition TraCIAPI.h:158
void setStringVector(int var, const std::string &id, const std::vector< std::string > &value) const
std::vector< std::string > getIDList() const
libsumo::TraCIPositionVector getPolygon(int var, const std::string &id, tcpip::Storage *add=0) const
TraCIScopeWrapper(TraCIAPI &parent, int cmdGetID, int cmdSetID, int subscribeID, int contextSubscribeID)
Constructor.
Definition TraCIAPI.h:93
libsumo::SubscriptionResults & getModifiableSubscriptionResults()
const libsumo::TraCIResults getSubscriptionResults(const std::string &objID) const
void setString(int var, const std::string &id, const std::string &value) const
void subscribeContext(const std::string &objID, int domain, double range, const std::vector< int > &vars, double beginTime, double endTime) const
void setParameter(const std::string &objectID, const std::string &key, const std::string &value) const
set generic paramter
TraCIAPI & myParent
The parent TraCI client which offers the connection.
Definition TraCIAPI.h:151
std::string getParameter(const std::string &objectID, const std::string &key) const
retrieve generic parameter
std::vector< double > getDoubleVector(int var, const std::string &id, tcpip::Storage *add=0) const
void setInt(int var, const std::string &id, int value) const
int getByte(int var, const std::string &id, tcpip::Storage *add=0) const
libsumo::TraCIStage getTraCIStage(int var, const std::string &id, tcpip::Storage *add=0) const
void subscribe(const std::string &objID, const std::vector< int > &vars, double beginTime, double endTime) const
std::string getString(int var, const std::string &id, tcpip::Storage *add=0) const
TraCIScopeWrapper & operator=(const TraCIScopeWrapper &src)=delete
invalidated assignment operator
libsumo::TraCIPosition getPos(int var, const std::string &id, tcpip::Storage *add=0) const
const libsumo::ContextSubscriptionResults getAllContextSubscriptionResults() const
libsumo::SubscriptionResults & getModifiableContextSubscriptionResults(const std::string &objID)
void setDouble(int var, const std::string &id, double value) const
Scope for interaction with traffic lights.
Definition TraCIAPI.h:466
void setCompleteRedYellowGreenDefinition(const std::string &tlsID, const libsumo::TraCILogic &logic) const
Definition TraCIAPI.h:493
int getServedPersonCount(const std::string &tlsID, int index) const
std::string getRedYellowGreenState(const std::string &tlsID) const
TrafficLightScope(TraCIAPI &parent)
Definition TraCIAPI.h:468
int getPhase(const std::string &tlsID) const
std::string getPhaseName(const std::string &tlsID) const
void setRedYellowGreenState(const std::string &tlsID, const std::string &state) const
std::string getProgram(const std::string &tlsID) const
void setPhase(const std::string &tlsID, int index) const
void setPhaseName(const std::string &tlsID, const std::string &name) const
double getNextSwitch(const std::string &tlsID) const
std::vector< std::vector< libsumo::TraCILink > > getControlledLinks(const std::string &tlsID) const
double getPhaseDuration(const std::string &tlsID) const
std::vector< std::string > getControlledLanes(const std::string &tlsID) const
std::vector< libsumo::TraCILogic > getAllProgramLogics(const std::string &tlsID) const
void setPhaseDuration(const std::string &tlsID, double phaseDuration) const
void setProgramLogic(const std::string &tlsID, const libsumo::TraCILogic &logic) const
std::vector< libsumo::TraCILogic > getCompleteRedYellowGreenDefinition(const std::string &tlsID) const
Definition TraCIAPI.h:490
void setProgram(const std::string &tlsID, const std::string &programID) const
Scope for interaction with vehicles.
Definition TraCIAPI.h:556
VehicleScope(TraCIAPI &parent)
Definition TraCIAPI.h:558
std::vector< libsumo::TraCINextTLSData > getNextTLS(const std::string &vehID) const
void changeLane(const std::string &vehicleID, int laneIndex, double duration) const
void setMinGap(const std::string &vehicleID, double minGap) const
double getLateralSpeed(const std::string &vehicleID) const
void setMaxSpeed(const std::string &vehicleID, double speed) const
virtual ~VehicleScope()
Definition TraCIAPI.h:559
void setPreviousSpeed(const std::string &vehicleID, double prevSpeed, double prevAcceleration=std::numeric_limits< int >::min()) const
double getSpeed(const std::string &vehicleID) const
int getStopState(const std::string &vehicleID) const
double getWaitingTime(const std::string &vehicleID) const
void addSubscriptionFilterCFManeuver(double downstreamDist=-1, double upstreamDist=-1) const
double getCOEmission(const std::string &vehicleID) const
void addSubscriptionFilterStringList(int filterType, const std::vector< std::string > &vals) const
void changeTarget(const std::string &vehicleID, const std::string &edgeID) const
libsumo::TraCIPosition getPosition(const std::string &vehicleID) const
bool isRouteValid(const std::string &vehicleID) const
void addSubscriptionFilterByteList(int filterType, const std::vector< int > &vals) const
double getSecureGap(const std::string &vehicleID, double speed, double leaderSpeed, double leaderMaxDecel, const std::string &leaderID="") const
void setSpeedFactor(const std::string &vehicleID, double factor) const
void setShapeClass(const std::string &vehicleID, const std::string &clazz) const
void addSubscriptionFilterLateralDistance(double lateralDist, double downstreamDist=-1, double foeDistToJunction=-1) const
void setVia(const std::string &vehicleID, const std::vector< std::string > &via) const
void setEmissionClass(const std::string &vehicleID, const std::string &clazz) const
double getTau(const std::string &vehicleID) const
double getDistance(const std::string &vehicleID) const
void remove(const std::string &vehicleID, char reason=libsumo::REMOVE_VAPORIZED) const
void openGap(const std::string &vehicleID, double newTau, double duration, double changeRate, double maxDecel) const
void moveTo(const std::string &vehicleID, const std::string &laneID, double position, int reason=libsumo::MOVE_TELEPORT) const
void setSpeed(const std::string &vehicleID, double speed) const
double getEmergencyDecel(const std::string &vehicleID) const
std::string getEmissionClass(const std::string &vehicleID) const
void setStop(const std::string vehicleID, const std::string edgeID, const double endPos=1., const int laneIndex=0, const double duration=std::numeric_limits< double >::max(), const int flags=0, const double startPos=std::numeric_limits< int >::min(), const double until=-1) const
void setRouteID(const std::string &vehicleID, const std::string &routeID) const
std::pair< int, int > getLaneChangeState(const std::string &vehicleID, int direction) const
double getNoiseEmission(const std::string &vehicleID) const
std::string getShapeClass(const std::string &vehicleID) const
void addSubscriptionFilterLeadFollow(const std::vector< int > &lanes) const
std::string getLine(const std::string &vehicleID) const
double getElectricityConsumption(const std::string &vehicleID) const
double getSpeedFactor(const std::string &vehicleID) const
double getNOxEmission(const std::string &vehicleID) const
void setRoute(const std::string &vehicleID, const std::vector< std::string > &edge) const
int getSignals(const std::string &vehicleID) const
libsumo::TraCIColor getColor(const std::string &vehicleID) const
int getPersonCapacity(const std::string &vehicleID) const
void setSignals(const std::string &vehicleID, int signals) const
std::string getRoadID(const std::string &vehicleID) const
void addSubscriptionFilterVType(const std::vector< std::string > &vTypes) const
void addSubscriptionFilterUpstreamDistance(double dist) const
void addSubscriptionFilterFloat(int filterType, double val) const
double getAllowedSpeed(const std::string &vehicleID) const
void addSubscriptionFilterLanes(const std::vector< int > &lanes, bool noOpposite=false, double downstreamDist=-1, double upstreamDist=-1) const
double getCO2Emission(const std::string &vehicleID) const
double getFuelConsumption(const std::string &vehicleID) const
double getHCEmission(const std::string &vehicleID) const
void addSubscriptionFilterNoOpposite() const
void addSubscriptionFilterLCManeuver(int direction, bool noOpposite=false, double downstreamDist=-1, double upstreamDist=-1) const
std::pair< std::string, double > getLeader(const std::string &vehicleID, double dist) const
double getAcceleration(const std::string &vehicleID) const
std::vector< std::string > getVia(const std::string &vehicleID) const
void addSubscriptionFilterVClass(const std::vector< std::string > &vClasses) const
double getImperfection(const std::string &vehicleID) const
std::string getLaneID(const std::string &vehicleID) const
double getAngle(const std::string &vehicleID) const
void addSubscriptionFilterDownstreamDistance(double dist) const
double getMinGap(const std::string &vehicleID) const
void addSubscriptionFilterEmpty(int filterType) const
double getStopArrivalDelay(const std::string &vehicleID) const
void setAcceleration(const std::string &vehicleID, double accel, double duration) const
std::vector< std::string > getPersonIDList(const std::string &vehicleID) const
double getStopDelay(const std::string &vehicleID) const
double getMinGapLat(const std::string &vehicleID) const
void setLine(const std::string &vehicleID, const std::string &line) const
double getSlope(const std::string &vehicleID) const
void setColor(const std::string &vehicleID, const libsumo::TraCIColor &c) 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
libsumo::TraCIPosition getPosition3D(const std::string &vehicleID) const
void setLaneChangeMode(const std::string &vehicleID, int mode) const
void setRoutingMode(const std::string &vehicleID, int routingMode) const
void addSubscriptionFilterTurn(double downstreamDist=-1, double upstreamDist=-1) const
double getDecel(const std::string &vehicleID) const
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 getHeight(const std::string &veihcleID) const
int getRouteIndex(const std::string &vehicleID) const
double getMaxSpeedLat(const std::string &vehicleID) const
void changeSublane(const std::string &vehicleID, double latDist) const
std::string getLateralAlignment(const std::string &vehicleID) const
std::string getRouteID(const std::string &vehicleID) const
double getLanePosition(const std::string &vehicleID) const
int getLaneChangeMode(const std::string &vehicleID) const
int getSpeedMode(const std::string &vehicleID) const
std::vector< std::string > getRoute(const std::string &vehicleID) const
double getApparentDecel(const std::string &vehicleID) const
double getLateralLanePosition(const std::string &vehicleID) const
std::pair< std::string, double > getFollower(const std::string &vehicleID, double dist) const
double getPMxEmission(const std::string &vehicleID) const
double getLength(const std::string &vehicleID) const
double getMaxSpeed(const std::string &vehicleID) const
std::string getVehicleClass(const std::string &vehicleID) const
double getSpeedWithoutTraCI(const std::string &vehicleID) const
int getRoutingMode(const std::string &vehicleID) const
double getWidth(const std::string &vehicleID) const
double getSpeedDeviation(const std::string &vehicleID) const
int getPersonNumber(const std::string &vehicleID) const
double getFollowSpeed(const std::string &vehicleID, double speed, double gap, double leaderSpeed, double leaderMaxDecel, const std::string &leaderID="") const
void setType(const std::string &vehicleID, const std::string &typeID) const
void addSubscriptionFilterFieldOfVision(double angle) const
std::vector< libsumo::TraCIBestLanesData > getBestLanes(const std::string &vehicleID) const
double getAccel(const std::string &vehicleID) const
void setSpeedMode(const std::string &vehicleID, int mode) const
void slowDown(const std::string &vehicleID, double speed, double duration) const
std::string getTypeID(const std::string &vehicleID) const
double getAccumulatedWaitingTime(const std::string &vehicleID) const
void changeLaneRelative(const std::string &vehicleID, int laneChange, double duration) const
void rerouteTraveltime(const std::string &vehicleID, bool currentTravelTimes=true) const
double getStopSpeed(const std::string &vehicleID, double speed, double gap) const
int getLaneIndex(const std::string &vehicleID) const
Scope for interaction with vehicle types.
Definition TraCIAPI.h:502
double getSpeedDeviation(const std::string &typeID) const
double getSpeedFactor(const std::string &typeID) const
void setImperfection(const std::string &typeID, double imperfection) const
void setApparentDecel(const std::string &typeID, double decel) const
void setHeight(const std::string &typeID, double height) const
std::string getShapeClass(const std::string &typeID) const
double getMinGapLat(const std::string &typeID) const
void copy(const std::string &origTypeID, const std::string &newTypeID) const
int getPersonCapacity(const std::string &typeID) const
VehicleTypeScope(TraCIAPI &parent)
Definition TraCIAPI.h:504
void setVehicleClass(const std::string &typeID, const std::string &clazz) const
void setColor(const std::string &typeID, const libsumo::TraCIColor &c) const
void setDecel(const std::string &typeID, double decel) const
void setWidth(const std::string &typeID, double width) const
double getApparentDecel(const std::string &typeID) const
double getDecel(const std::string &typeID) const
void setLateralAlignment(const std::string &typeID, const std::string &latAlignment) const
void setMaxSpeed(const std::string &typeID, double speed) const
double getMinGap(const std::string &typeID) const
std::string getVehicleClass(const std::string &typeID) const
void setShapeClass(const std::string &typeID, const std::string &shapeClass) const
double getMaxSpeedLat(const std::string &typeID) const
double getEmergencyDecel(const std::string &typeID) const
double getWidth(const std::string &typeID) const
libsumo::TraCIColor getColor(const std::string &typeID) const
double getTau(const std::string &typeID) const
double getMaxSpeed(const std::string &typeID) const
double getLength(const std::string &typeID) const
std::string getEmissionClass(const std::string &typeID) const
double getImperfection(const std::string &typeID) const
void setEmissionClass(const std::string &typeID, const std::string &clazz) const
void setAccel(const std::string &typeID, double accel) const
void setMinGap(const std::string &typeID, double minGap) const
double getAccel(const std::string &typeID) const
void setSpeedFactor(const std::string &typeID, double factor) const
double getHeight(const std::string &typeID) const
void setEmergencyDecel(const std::string &typeID, double decel) const
void setSpeedDeviation(const std::string &typeID, double deviation) const
void setMaxSpeedLat(const std::string &typeID, double speed) const
std::string getLateralAlignment(const std::string &typeID) const
void setMinGapLat(const std::string &typeID, double minGapLat) const
void setLength(const std::string &typeID, double length) const
void setTau(const std::string &typeID, double tau) const
C++ TraCI client API implementation.
Definition TraCIAPI.h:48
RouteScope route
Scope for interaction with routes.
Definition TraCIAPI.h:851
std::pair< int, std::string > getVersion()
return TraCI API and SUMO version
Definition TraCIAPI.cpp:479
void setOrder(int order)
set priority (execution order) for the client
Definition TraCIAPI.cpp:81
void readVariableSubscription(int cmdId, tcpip::Storage &inMsg)
Definition TraCIAPI.cpp:416
tcpip::Storage myInput
The reusable input storage.
Definition TraCIAPI.h:960
MeMeScope multientryexit
Scope for interaction with multi-entry/-exit detectors.
Definition TraCIAPI.h:841
VehicleTypeScope vehicletype
Scope for interaction with vehicle types.
Definition TraCIAPI.h:861
void send_commandSubscribeObjectVariable(int domID, const std::string &objID, double beginTime, double endTime, const std::vector< int > &vars) const
Sends a SubscribeVariable request.
Definition TraCIAPI.cpp:201
void send_commandSimulationStep(double time) const
Sends a SimulationStep command.
Definition TraCIAPI.cpp:117
GUIScope gui
Scope for interaction with the gui.
Definition TraCIAPI.h:831
void check_resultState(tcpip::Storage &inMsg, int command, bool ignoreCommandId=false, std::string *acknowledgement=0) const
Validates the result state of a command.
Definition TraCIAPI.cpp:260
PolygonScope polygon
Scope for interaction with polygons.
Definition TraCIAPI.h:847
static std::string toString(const T &t, std::streamsize accuracy=PRECISION)
Definition TraCIAPI.h:942
TraCIAPI()
Constructor.
Definition TraCIAPI.cpp:34
void connect(const std::string &host, int port)
Connects to the specified SUMO server.
Definition TraCIAPI.cpp:68
tcpip::Socket * mySocket
The socket.
Definition TraCIAPI.h:956
void load(const std::vector< std::string > &args)
Let sumo load a simulation using the given command line like options.
Definition TraCIAPI.cpp:461
LaneAreaScope lanearea
Scope for interaction with lanes.
Definition TraCIAPI.h:839
void simulationStep(double time=0)
Advances by one step (or up to the given time)
Definition TraCIAPI.cpp:439
void createFilterCommand(int cmdID, int varID, tcpip::Storage *add=nullptr) const
Definition TraCIAPI.cpp:178
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...
Definition TraCIAPI.cpp:154
void close()
ends the simulation and closes the connection
Definition TraCIAPI.cpp:96
LaneScope lane
Scope for interaction with lanes.
Definition TraCIAPI.h:837
std::map< int, TraCIScopeWrapper * > myDomains
Definition TraCIAPI.h:954
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.
Definition TraCIAPI.cpp:229
bool processSet(int command)
Definition TraCIAPI.cpp:336
TrafficLightScope trafficlights
Scope for interaction with traffic lights.
Definition TraCIAPI.h:857
InductionLoopScope inductionloop
Scope for interaction with inductive loops.
Definition TraCIAPI.h:833
tcpip::Storage myOutput
The reusable output storage.
Definition TraCIAPI.h:958
POIScope poi
Scope for interaction with POIs.
Definition TraCIAPI.h:845
void closeSocket()
Closes the connection.
Definition TraCIAPI.cpp:106
int check_commandGetResult(tcpip::Storage &inMsg, int command, int expectedType=-1, bool ignoreCommandId=false) const
Validates the result state of a command.
Definition TraCIAPI.cpp:299
VehicleScope vehicle
Scope for interaction with vehicles.
Definition TraCIAPI.h:859
JunctionScope junction
Scope for interaction with junctions.
Definition TraCIAPI.h:835
void send_commandClose() const
Sends a Close command.
Definition TraCIAPI.cpp:130
void send_commandSetOrder(int order) const
Sends a SetOrder command.
Definition TraCIAPI.cpp:141
~TraCIAPI()
Destructor.
Definition TraCIAPI.cpp:62
RouteProbeScope routeprobe
Scope for interaction with route probes.
Definition TraCIAPI.h:853
EdgeScope edge
Scope for interaction with edges.
Definition TraCIAPI.h:829
bool processGet(int command, int expectedType, bool ignoreCommandId=false)
Definition TraCIAPI.cpp:323
SimulationScope simulation
Scope for interaction with the simulation.
Definition TraCIAPI.h:855
void readContextSubscription(int cmdId, tcpip::Storage &inMsg)
Definition TraCIAPI.cpp:424
void readVariables(tcpip::Storage &inMsg, const std::string &objectID, int variableCount, libsumo::SubscriptionResults &into)
Definition TraCIAPI.cpp:348
PersonScope person
Scope for interaction with persons.
Definition TraCIAPI.h:843
RerouterScope rerouter
Scope for interaction with rerouters.
Definition TraCIAPI.h:849
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
Definition TraCIDefs.h:338
TRACI_CONST int MOVE_TELEPORT
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition TraCIDefs.h:337
TRACI_CONST int DEPARTFLAG_NOW
TRACI_CONST int REMOVE_VAPORIZED
std::map< int, std::shared_ptr< libsumo::TraCIResult > > TraCIResults
{variable->value}
Definition TraCIDefs.h:335
A 2D or 3D-position, for 2D positions z == INVALID_DOUBLE_VALUE.
Definition TraCIDefs.h:178
A list of positions.
Definition TraCIDefs.h:234
An edgeId, position and laneIndex.
Definition TraCIDefs.h:197