Eclipse SUMO - Simulation of Urban MObility
TraCIAPI.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2012-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // C++ TraCI client API implementation
18 /****************************************************************************/
19 #ifndef TraCIAPI_h
20 #define TraCIAPI_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <vector>
27 #include <limits>
28 #include <string>
29 #include <sstream>
30 #include <iomanip>
31 #include <foreign/tcpip/socket.h>
32 #include <libsumo/TraCIConstants.h>
33 #include <libsumo/TraCIDefs.h>
34 
35 // ===========================================================================
36 // global definitions
37 // ===========================================================================
38 #define DEFAULT_VIEW "View #0"
39 #define PRECISION 2
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
50 class TraCIAPI {
51 public:
54  TraCIAPI();
55 
57  ~TraCIAPI();
58 
61 
67  void connect(const std::string& host, int port);
68 
70  void setOrder(int order);
71 
73  void close();
75 
77  void simulationStep(double time = 0);
78 
80  void load(const std::vector<std::string>& args);
81 
84  int getUnsignedByte(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
85  int getByte(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
86  int getInt(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
87  double getDouble(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
88  libsumo::TraCIPositionVector getPolygon(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
89  libsumo::TraCIPosition getPosition(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
90  libsumo::TraCIPosition getPosition3D(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
91  std::string getString(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
92  std::vector<std::string> getStringVector(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
93  libsumo::TraCIColor getColor(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
94  libsumo::TraCIStage getTraCIStage(int cmd, int var, const std::string& id, tcpip::Storage* add = 0);
96 
98  return myOutput;
99  }
100 
107  public:
111  TraCIScopeWrapper(TraCIAPI& parent, int cmdGetID, int cmdSetID, int subscribeID, int contextSubscribeID) :
112  myParent(parent),
113  myCmdGetID(cmdGetID),
114  myCmdSetID(cmdSetID),
115  mySubscribeID(subscribeID),
116  myContextSubscribeID(contextSubscribeID) {
117  }
118 
120  virtual ~TraCIScopeWrapper() {}
121 
123  std::string getParameter(const std::string& objectID, const std::string& key) const;
124 
126  void setParameter(const std::string& objectID, const std::string& key, const std::string& value) const;
127 
128  void subscribe(const std::string& objID, const std::vector<int>& vars, double beginTime, double endTime) const;
129  void subscribeContext(const std::string& objID, int domain, double range, const std::vector<int>& vars, double beginTime, double endTime) const;
130 
132  const libsumo::TraCIResults getSubscriptionResults(const std::string& objID) const;
133 
135  const libsumo::SubscriptionResults getContextSubscriptionResults(const std::string& objID) const;
136 
137  // the following are only for internal use
141 
142 
143  protected:
152 
153 
154  private:
157 
160 
161  };
162 
163 
164 
165 
166 
170  class EdgeScope : public TraCIScopeWrapper {
171  public:
173  virtual ~EdgeScope() {}
174 
175  std::vector<std::string> getIDList() const;
176  int getIDCount() const;
177  double getAdaptedTraveltime(const std::string& edgeID, double time) const;
178  double getEffort(const std::string& edgeID, double time) const;
179  double getCO2Emission(const std::string& edgeID) const;
180  double getCOEmission(const std::string& edgeID) const;
181  double getHCEmission(const std::string& edgeID) const;
182  double getPMxEmission(const std::string& edgeID) const;
183  double getNOxEmission(const std::string& edgeID) const;
184  double getFuelConsumption(const std::string& edgeID) const;
185  double getNoiseEmission(const std::string& edgeID) const;
186  double getElectricityConsumption(const std::string& edgeID) const;
187  double getLastStepMeanSpeed(const std::string& edgeID) const;
188  double getLastStepOccupancy(const std::string& edgeID) const;
189  double getLastStepLength(const std::string& edgeID) const;
190  double getTraveltime(const std::string& edgeID) const;
191  int getLastStepVehicleNumber(const std::string& edgeID) const;
192  double getLastStepHaltingNumber(const std::string& edgeID) const;
193  std::vector<std::string> getLastStepVehicleIDs(const std::string& edgeID) const;
194  int getLaneNumber(const std::string& edgeID) const;
195  std::string getStreetName(const std::string& id) const;
196 
197  void adaptTraveltime(const std::string& edgeID, double time, double beginSeconds = 0., double endSeconds = std::numeric_limits<double>::max()) const;
198  void setEffort(const std::string& edgeID, double effort, double beginSeconds = 0., double endSeconds = std::numeric_limits<double>::max()) const;
199  void setMaxSpeed(const std::string& edgeID, double speed) const;
200 
201  private:
203  EdgeScope(const EdgeScope& src);
204 
206  EdgeScope& operator=(const EdgeScope& src);
207 
208  };
209 
210 
211 
212 
213 
217  class GUIScope : public TraCIScopeWrapper {
218  public:
220  virtual ~GUIScope() {}
221 
222  std::vector<std::string> getIDList() const;
223  double getZoom(const std::string& viewID = DEFAULT_VIEW) const;
224  libsumo::TraCIPosition getOffset(const std::string& viewID = DEFAULT_VIEW) const;
225  std::string getSchema(const std::string& viewID = DEFAULT_VIEW) const;
226  libsumo::TraCIPositionVector getBoundary(const std::string& viewID = DEFAULT_VIEW) const;
227  void setZoom(const std::string& viewID, double zoom) const;
228  void setOffset(const std::string& viewID, double x, double y) const;
229  void setSchema(const std::string& viewID, const std::string& schemeName) const;
230  void setBoundary(const std::string& viewID, double xmin, double ymin, double xmax, double ymax) const;
231  void screenshot(const std::string& viewID, const std::string& filename, const int width = -1, const int height = -1) const;
232  void trackVehicle(const std::string& viewID, const std::string& vehID) const;
233 
234  private:
236  GUIScope(const GUIScope& src);
237 
239  GUIScope& operator=(const GUIScope& src);
240 
241  };
242 
243 
244 
245 
246 
251  public:
253  virtual ~InductionLoopScope() {}
254 
255  std::vector<std::string> getIDList() const;
256  double getPosition(const std::string& loopID) const;
257  std::string getLaneID(const std::string& loopID) const;
258  int getLastStepVehicleNumber(const std::string& loopID) const;
259  double getLastStepMeanSpeed(const std::string& loopID) const;
260  std::vector<std::string> getLastStepVehicleIDs(const std::string& loopID) const;
261  double getLastStepOccupancy(const std::string& loopID) const;
262  double getLastStepMeanLength(const std::string& loopID) const;
263  double getTimeSinceDetection(const std::string& loopID) const;
264  std::vector<libsumo::TraCIVehicleData> getVehicleData(const std::string& loopID) const;
265 
266 
267  private:
270 
273 
274  };
275 
276 
277 
278 
279 
284  public:
286  virtual ~JunctionScope() {}
287 
288  std::vector<std::string> getIDList() const;
289  int getIDCount() const;
290  libsumo::TraCIPosition getPosition(const std::string& junctionID) const;
291  libsumo::TraCIPositionVector getShape(const std::string& junctionID) const;
292 
293  private:
295  JunctionScope(const JunctionScope& src);
296 
299 
300  };
301 
302 
303 
304 
305 
309  class LaneScope : public TraCIScopeWrapper {
310  public:
312  virtual ~LaneScope() {}
313 
314  std::vector<std::string> getIDList() const;
315  int getIDCount() const;
316  double getLength(const std::string& laneID) const;
317  double getMaxSpeed(const std::string& laneID) const;
318  double getWidth(const std::string& laneID) const;
319  std::vector<std::string> getAllowed(const std::string& laneID) const;
320  std::vector<std::string> getDisallowed(const std::string& laneID) const;
321  int getLinkNumber(const std::string& laneID) const;
322  std::vector<libsumo::TraCIConnection> getLinks(const std::string& laneID) const;
323  libsumo::TraCIPositionVector getShape(const std::string& laneID) const;
324  std::string getEdgeID(const std::string& laneID) const;
325  double getCO2Emission(const std::string& laneID) const;
326  double getCOEmission(const std::string& laneID) const;
327  double getHCEmission(const std::string& laneID) const;
328  double getPMxEmission(const std::string& laneID) const;
329  double getNOxEmission(const std::string& laneID) const;
330  double getFuelConsumption(const std::string& laneID) const;
331  double getNoiseEmission(const std::string& laneID) const;
332  double getElectricityConsumption(const std::string& laneID) const;
333  double getLastStepMeanSpeed(const std::string& laneID) const;
334  double getLastStepOccupancy(const std::string& laneID) const;
335  double getLastStepLength(const std::string& laneID) const;
336  double getTraveltime(const std::string& laneID) const;
337  int getLastStepVehicleNumber(const std::string& laneID) const;
338  int getLastStepHaltingNumber(const std::string& laneID) const;
339  std::vector<std::string> getLastStepVehicleIDs(const std::string& laneID) const;
340  std::vector<std::string> getFoes(const std::string& laneID, const std::string& toLaneID) const;
341  std::vector<std::string> getInternalFoes(const std::string& laneID) const;
342 
343  void setAllowed(const std::string& laneID, const std::vector<std::string>& allowedClasses) const;
344  void setDisallowed(const std::string& laneID, const std::vector<std::string>& disallowedClasses) const;
345  void setMaxSpeed(const std::string& laneID, double speed) const;
346  void setLength(const std::string& laneID, double length) const;
347 
348  private:
350  LaneScope(const LaneScope& src);
351 
353  LaneScope& operator=(const LaneScope& src);
354 
355  };
356 
357 
362  public:
364  virtual ~LaneAreaScope() {}
365 
366  std::vector<std::string> getIDList() const;
367 
368  private:
370  LaneAreaScope(const LaneAreaScope& src);
371 
374 
375  };
376 
377 
381  class MeMeScope : public TraCIScopeWrapper {
382  public:
384  virtual ~MeMeScope() {}
385 
386  std::vector<std::string> getIDList() const;
387  int getLastStepVehicleNumber(const std::string& detID) const;
388  double getLastStepMeanSpeed(const std::string& detID) const;
389  std::vector<std::string> getLastStepVehicleIDs(const std::string& detID) const;
390  int getLastStepHaltingNumber(const std::string& detID) const;
391 
392  private:
394  MeMeScope(const MeMeScope& src);
395 
397  MeMeScope& operator=(const MeMeScope& src);
398 
399  };
400 
401 
402 
403 
404 
408  class POIScope : public TraCIScopeWrapper {
409  public:
411  virtual ~POIScope() {}
412 
413  std::vector<std::string> getIDList() const;
414  int getIDCount() const;
415  std::string getType(const std::string& poiID) const;
416  libsumo::TraCIPosition getPosition(const std::string& poiID) const;
417  libsumo::TraCIColor getColor(const std::string& poiID) const;
418  double getWidth(const std::string& poiID) const;
419  double getHeight(const std::string& poiID) const;
420  double getAngle(const std::string& poiID) const;
421  std::string getImageFile(const std::string& poiID) const;
422 
423  void setType(const std::string& poiID, const std::string& setType) const;
424  void setPosition(const std::string& poiID, double x, double y) const;
425  void setColor(const std::string& poiID, const libsumo::TraCIColor& c) const;
426  void setWidth(const std::string& poiID, double width) const;
427  void setHeight(const std::string& poiID, double height) const;
428  void setAngle(const std::string& poiID, double angle) const;
429  void setImageFile(const std::string& poiID, const std::string& imageFile) const;
430  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;
431  void remove(const std::string& poiID, int layer = 0) const;
432 
433  private:
435  POIScope(const POIScope& src);
436 
438  POIScope& operator=(const POIScope& src);
439 
440  };
441 
442 
443 
444 
445 
450  public:
452  virtual ~PolygonScope() {}
453 
454  std::vector<std::string> getIDList() const;
455  int getIDCount() const;
456  double getLineWidth(const std::string& polygonID) const;
457  std::string getType(const std::string& polygonID) const;
458  libsumo::TraCIPositionVector getShape(const std::string& polygonID) const;
459  libsumo::TraCIColor getColor(const std::string& polygonID) const;
460  void setType(const std::string& polygonID, const std::string& setType) const;
461  void setShape(const std::string& polygonID, const libsumo::TraCIPositionVector& shape) const;
462  void setColor(const std::string& polygonID, const libsumo::TraCIColor& c) const;
463  void setLineWidth(const std::string& polygonID, const double lineWidth) const;
464  void add(const std::string& polygonID, const libsumo::TraCIPositionVector& shape, const libsumo::TraCIColor& c, bool fill, const std::string& type, int layer) const;
465  void remove(const std::string& polygonID, int layer = 0) const;
466 
467  private:
469  PolygonScope(const PolygonScope& src);
470 
472  PolygonScope& operator=(const PolygonScope& src);
473 
474  };
475 
476 
477 
478 
479 
483  class RouteScope : public TraCIScopeWrapper {
484  public:
486  virtual ~RouteScope() {}
487 
488  std::vector<std::string> getIDList() const;
489  std::vector<std::string> getEdges(const std::string& routeID) const;
490 
491  void add(const std::string& routeID, const std::vector<std::string>& edges) const;
492 
493  private:
495  RouteScope(const RouteScope& src);
496 
498  RouteScope& operator=(const RouteScope& src);
499 
500  };
501 
502 
503 
508  public:
510  virtual ~SimulationScope() {}
511 
512  int getCurrentTime() const;
513  double getTime() const;
514  int getLoadedNumber() const;
515  std::vector<std::string> getLoadedIDList() const;
516  int getDepartedNumber() const;
517  std::vector<std::string> getDepartedIDList() const;
518  int getArrivedNumber() const;
519  std::vector<std::string> getArrivedIDList() const;
520  int getStartingTeleportNumber() const;
521  std::vector<std::string> getStartingTeleportIDList() const;
522  int getEndingTeleportNumber() const;
523  std::vector<std::string> getEndingTeleportIDList() const;
524  double getDeltaT() const;
525  libsumo::TraCIPositionVector getNetBoundary() const;
526  int getMinExpectedNumber() const;
527 
528  int getBusStopWaiting(const std::string& stopID) const;
529  std::vector<std::string> getBusStopWaitingIDList(const std::string& stopID) const;
530 
531  libsumo::TraCIPosition convert2D(const std::string& edgeID, double pos, int laneIndex = 0, bool toGeo = false) const;
532  libsumo::TraCIPosition convert3D(const std::string& edgeID, double pos, int laneIndex = 0, bool toGeo = false) const;
533  libsumo::TraCIRoadPosition convertRoad(double x, double y, bool isGeo = false, const std::string& vClass = "ignoring") const;
534  libsumo::TraCIPosition convertGeo(double x, double y, bool fromGeo = false) const;
535 
536  double getDistance2D(double x1, double y1, double x2, double y2, bool isGeo = false, bool isDriving = false);
537  double getDistanceRoad(const std::string& edgeID1, double pos1, const std::string& edgeID2, double pos2, bool isDriving = false);
538 
539 
540  private:
542  SimulationScope(const SimulationScope& src);
543 
546 
547  };
548 
549 
550 
551 
552 
557  public:
559  virtual ~TrafficLightScope() {}
560 
561  std::vector<std::string> getIDList() const;
562  int getIDCount() const;
563  std::string getRedYellowGreenState(const std::string& tlsID) const;
564  std::vector<libsumo::TraCILogic> getCompleteRedYellowGreenDefinition(const std::string& tlsID) const;
565  std::vector<std::string> getControlledLanes(const std::string& tlsID) const;
566  std::vector<std::vector<libsumo::TraCILink> > getControlledLinks(const std::string& tlsID) const;
567  std::string getProgram(const std::string& tlsID) const;
568  int getPhase(const std::string& tlsID) const;
569  double getPhaseDuration(const std::string& tlsID) const;
570  double getNextSwitch(const std::string& tlsID) const;
571  std::string getPhaseName(const std::string& tlsID) const;
572 
573  void setRedYellowGreenState(const std::string& tlsID, const std::string& state) const;
574  void setPhase(const std::string& tlsID, int index) const;
575  void setPhaseName(const std::string& tlsID, const std::string& name) const;
576  void setProgram(const std::string& tlsID, const std::string& programID) const;
577  void setPhaseDuration(const std::string& tlsID, double phaseDuration) const;
578  void setCompleteRedYellowGreenDefinition(const std::string& tlsID, const libsumo::TraCILogic& logic) const;
579 
580  private:
583 
586 
587  };
588 
589 
590 
591 
592 
597  public:
599  virtual ~VehicleTypeScope() {}
600 
601  std::vector<std::string> getIDList() const;
602  double getLength(const std::string& typeID) const;
603  double getMaxSpeed(const std::string& typeID) const;
604  double getSpeedFactor(const std::string& typeID) const;
605  double getSpeedDeviation(const std::string& typeID) const;
606  double getAccel(const std::string& typeID) const;
607  double getDecel(const std::string& typeID) const;
608  double getEmergencyDecel(const std::string& typeID) const;
609  double getApparentDecel(const std::string& typeID) const;
610  double getImperfection(const std::string& typeID) const;
611  double getTau(const std::string& typeID) const;
612  std::string getVehicleClass(const std::string& typeID) const;
613  std::string getEmissionClass(const std::string& typeID) const;
614  std::string getShapeClass(const std::string& typeID) const;
615  double getMinGap(const std::string& typeID) const;
616  double getWidth(const std::string& typeID) const;
617  double getHeight(const std::string& typeID) const;
618  libsumo::TraCIColor getColor(const std::string& typeID) const;
619  double getMinGapLat(const std::string& typeID) const;
620  double getMaxSpeedLat(const std::string& typeID) const;
621  std::string getLateralAlignment(const std::string& typeID) const;
622  int getPersonCapacity(const std::string& typeID) const;
623 
624  void setLength(const std::string& typeID, double length) const;
625  void setMaxSpeed(const std::string& typeID, double speed) const;
626  void setVehicleClass(const std::string& typeID, const std::string& clazz) const;
627  void setSpeedFactor(const std::string& typeID, double factor) const;
628  void setSpeedDeviation(const std::string& typeID, double deviation) const;
629  void setEmissionClass(const std::string& typeID, const std::string& clazz) const;
630  void setShapeClass(const std::string& typeID, const std::string& shapeClass) const;
631  void setWidth(const std::string& typeID, double width) const;
632  void setHeight(const std::string& typeID, double height) const;
633  void setMinGap(const std::string& typeID, double minGap) const;
634  void setAccel(const std::string& typeID, double accel) const;
635  void setDecel(const std::string& typeID, double decel) const;
636  void setEmergencyDecel(const std::string& typeID, double decel) const;
637  void setApparentDecel(const std::string& typeID, double decel) const;
638  void setImperfection(const std::string& typeID, double imperfection) const;
639  void setTau(const std::string& typeID, double tau) const;
640  void setColor(const std::string& typeID, const libsumo::TraCIColor& c) const;
641  void setMinGapLat(const std::string& typeID, double minGapLat) const;
642  void setMaxSpeedLat(const std::string& typeID, double speed) const;
643  void setLateralAlignment(const std::string& typeID, const std::string& latAlignment) const;
644  void copy(const std::string& origTypeID, const std::string& newTypeID) const;
645 
646  private:
649 
652 
653  };
654 
655 
656 
657 
658 
663  public:
665  virtual ~VehicleScope() {}
666 
668  SIGNAL_BLINKER_RIGHT = 1,
669  SIGNAL_BLINKER_LEFT = 2,
670  SIGNAL_BLINKER_EMERGENCY = 4,
671  SIGNAL_BRAKELIGHT = 8,
672  SIGNAL_FRONTLIGHT = 16,
673  SIGNAL_FOGLIGHT = 32,
674  SIGNAL_HIGHBEAM = 64,
675  SIGNAL_BACKDRIVE = 128,
676  SIGNAL_WIPER = 256,
677  SIGNAL_DOOR_OPEN_LEFT = 512,
678  SIGNAL_DOOR_OPEN_RIGHT = 1024,
679  SIGNAL_EMERGENCY_BLUE = 2048,
680  SIGNAL_EMERGENCY_RED = 4096,
681  SIGNAL_EMERGENCY_YELLOW = 8192,
682  SIGNAL_RESET = -1, /*< sending a negative signal resets all signals to their computed values immediately */
683  };
684 
687  std::vector<std::string> getIDList() const;
688  int getIDCount() const;
689  double getSpeed(const std::string& vehicleID) const;
690  double getLateralSpeed(const std::string& vehicleID) const;
691  double getAcceleration(const std::string& vehicleID) const;
692  libsumo::TraCIPosition getPosition(const std::string& vehicleID) const;
693  libsumo::TraCIPosition getPosition3D(const std::string& vehicleID) const;
694  double getAngle(const std::string& vehicleID) const;
695  std::string getRoadID(const std::string& vehicleID) const;
696  std::string getLaneID(const std::string& vehicleID) const;
697  int getLaneIndex(const std::string& vehicleID) const;
698  std::string getTypeID(const std::string& vehicleID) const;
699  std::string getRouteID(const std::string& vehicleID) const;
700  int getRouteIndex(const std::string& vehicleID) const;
701  std::vector<std::string> getRoute(const std::string& vehicleID) const;
702  libsumo::TraCIColor getColor(const std::string& vehicleID) const;
703  double getLanePosition(const std::string& vehicleID) const;
704  double getDistance(const std::string& vehicleID) const;
705  int getSignals(const std::string& vehicleID) const;
706  double getCO2Emission(const std::string& vehicleID) const;
707  double getCOEmission(const std::string& vehicleID) const;
708  double getHCEmission(const std::string& vehicleID) const;
709  double getPMxEmission(const std::string& vehicleID) const;
710  double getNOxEmission(const std::string& vehicleID) const;
711  double getFuelConsumption(const std::string& vehicleID) const;
712  double getNoiseEmission(const std::string& vehicleID) const;
713  double getElectricityConsumption(const std::string& vehicleID) const;
714  int getSpeedMode(const std::string& vehicleID) const;
715  int getStopState(const std::string& vehicleID) const;
716  double getWaitingTime(const std::string& vehicleID) const;
717  double getAccumulatedWaitingTime(const std::string& vehicleID) const;
718  double getSlope(const std::string& vehicleID) const;
719  double getAllowedSpeed(const std::string& vehicleID) const;
720  int getPersonNumber(const std::string& vehicleID) const;
721  std::vector<std::string> getPersonIDList(const std::string& vehicleID) const;
722  double getSpeedWithoutTraCI(const std::string& vehicleID) const;
723  bool isRouteValid(const std::string& vehicleID) const;
724  double getLateralLanePosition(const std::string& vehicleID) const;
725  double getSpeedFactor(const std::string& vehicleID) const;
726  std::string getLine(const std::string& vehicleID) const;
727  std::vector<std::string> getVia(const std::string& vehicleID) const;
728  std::vector<libsumo::TraCINextTLSData> getNextTLS(const std::string& vehID) const;
729  std::vector<libsumo::TraCIBestLanesData> getBestLanes(const std::string& vehicleID) const;
730  std::pair<std::string, double> getLeader(const std::string& vehicleID, double dist) const;
731  int getRoutingMode(const std::string& vehicleID) const;
732  std::pair<int, int> getLaneChangeState(const std::string& vehicleID, int direction) const;
734 
737  double getLength(const std::string& vehicleID) const;
738  double getMaxSpeed(const std::string& vehicleID) const;
739  double getAccel(const std::string& vehicleID) const;
740  double getDecel(const std::string& vehicleID) const;
741  double getEmergencyDecel(const std::string& vehicleID) const;
742  double getApparentDecel(const std::string& vehicleID) const;
743  double getTau(const std::string& vehicleID) const;
744  double getImperfection(const std::string& vehicleID) const;
745  double getSpeedDeviation(const std::string& vehicleID) const;
746  double getMinGap(const std::string& vehicleID) const;
747  double getWidth(const std::string& vehicleID) const;
748  double getHeight(const std::string& veihcleID) const;
749  double getMaxSpeedLat(const std::string& vehicleID) const;
750  double getMinGapLat(const std::string& vehicleID) const;
751  int getPersonCapacity(const std::string& vehicleID) const;
752  std::string getVehicleClass(const std::string& vehicleID) const;
753  std::string getEmissionClass(const std::string& vehicleID) const;
754  std::string getShapeClass(const std::string& vehicleID) const;
755  std::string getLateralAlignment(const std::string& vehicleID) const;
757 
760  void add(const std::string& vehicleID,
761  const std::string& routeID,
762  const std::string& typeID = "DEFAULT_VEHTYPE",
763  std::string depart = "-1",
764  const std::string& departLane = "first",
765  const std::string& departPos = "base",
766  const std::string& departSpeed = "0",
767  const std::string& arrivalLane = "current",
768  const std::string& arrivalPos = "max",
769  const std::string& arrivalSpeed = "current",
770  const std::string& fromTaz = "",
771  const std::string& toTaz = "",
772  const std::string& line = "",
773  int personCapacity = 0,
774  int personNumber = 0) const;
775 
776  void changeTarget(const std::string& vehicleID, const std::string& edgeID) const;
777  void changeLane(const std::string& vehicleID, int laneIndex, double duration) const;
778  void changeLaneRelative(const std::string& vehicleID, int laneChange, double duration) const;
779  void changeSublane(const std::string& vehicleID, double latDist) const;
780  void setRouteID(const std::string& vehicleID, const std::string& routeID) const;
781  void setRoute(const std::string& vehicleID, const std::vector<std::string>& edge) const;
782  void rerouteTraveltime(const std::string& vehicleID, bool currentTravelTimes = true) const;
783  void moveTo(const std::string& vehicleID, const std::string& laneID, double position) const;
784  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;
785  void slowDown(const std::string& vehicleID, double speed, double duration) const;
786  void openGap(const std::string& vehicleID, double newTau, double duration, double changeRate, double maxDecel) const;
787  void setSpeed(const std::string& vehicleID, double speed) const;
788  void setSpeedMode(const std::string& vehicleID, int mode) const;
789  void setStop(const std::string vehicleID, const std::string edgeID, const double endPos = 1.,
790  const int laneIndex = 0, const double duration = std::numeric_limits<double>::max(),
791  const int flags = 0, const double startPos = std::numeric_limits<int>::min(),
792  const double until = -1) const;
793  void setType(const std::string& vehicleID, const std::string& typeID) const;
794  void remove(const std::string& vehicleID, char reason = libsumo::REMOVE_VAPORIZED) const;
795  void setColor(const std::string& vehicleID, const libsumo::TraCIColor& c) const;
796  void setLine(const std::string& vehicleID, const std::string& line) const;
797  void setVia(const std::string& vehicleID, const std::vector<std::string>& via) const;
798  void setSignals(const std::string& vehicleID, int signals) const;
799  void setRoutingMode(const std::string& vehicleID, int routingMode) const;
801 
804  void setShapeClass(const std::string& vehicleID, const std::string& clazz) const;
805  void setEmissionClass(const std::string& vehicleID, const std::string& clazz) const;
806  void setSpeedFactor(const std::string& vehicleID, double factor) const;
807  void setMaxSpeed(const std::string& vehicleID, double speed) const;
809 
811  /* @brief Filters are added to the last modified vehicle context
812  * subscription (call these fucntions right after subscribing) */
814 
815  /* @brief Adds a lane-filter, lanes is a list of relative lane indices (-1 -> right neighboring lane of the ego, 0 -> ego lane, etc.)
816  * noOpposite specifies whether vehicles on opposite direction lanes shall be returned
817  * downstreamDist and upstreamDist specify the range of the search for surrounding vehicles along the road net. */
818  void addSubscriptionFilterLanes(const std::vector<int>& lanes,
819  bool noOpposite = false, double downstreamDist = -1, double upstreamDist = -1) const;
820 
821  /* @brief Omits vehicles on other edges than the ego's */
822  void addSubscriptionFilterNoOpposite() const;
823 
824  /* @brief Limits the downstream distance for resulting vehicles */
825  void addSubscriptionFilterDownstreamDistance(double dist) const;
826 
827  /* @brief Limits the updstream distance for resulting vehicles */
828  void addSubscriptionFilterUpstreamDistance(double dist) const;
829 
830  /* @brief Restricts vehicles returned by the last modified vehicle context subscription to leader and follower of the ego.
831  * downstreamDist and upstreamDist specify the range of the search for leader and follower along the road net. */
832  void addSubscriptionFilterCFManeuver(double downstreamDist = -1, double upstreamDist = -1) const;
833 
834  /* @brief Restricts returned vehicles to neighbor and ego-lane leader
835  * and follower of the ego in the given direction
836  * noOpposite specifies whether vehicles on opposite direction lanes shall be returned
837  * downstreamDist and upstreamDist specify the range of the search for leader and follower along the road net.
838  * Combine with: distance filters; vClass/vType filter. */
839  void addSubscriptionFilterLCManeuver(int direction, bool noOpposite = false, double downstreamDist = -1, double upstreamDist = -1) const;
840 
841  /* @brief Restricts returned vehicles to neighbor and ego-lane leader and follower of the ego.
842  * Combine with: lanes-filter to restrict to one direction; distance filters; vClass/vType filter. */
843  void addSubscriptionFilterLeadFollow(const std::vector<int>& lanes) const;
844 
845  /* @brief Restricts returned vehicles to foes on an upcoming junction */
846  void addSubscriptionFilterTurn(double downstreamDist = -1, double upstreamDist = -1) const;
847 
848  /* @brief Restricts returned vehicles to the given classes */
849  void addSubscriptionFilterVClass(const std::vector<std::string>& vClasses) const;
850 
851  /* @brief Restricts returned vehicles to the given types */
852  void addSubscriptionFilterVType(const std::vector<std::string>& vTypes) const;
853 
855 
856  private:
857  void addSubscriptionFilterEmpty(int filterType) const;
858  void addSubscriptionFilterFloat(int filterType, double val) const;
859  void addSubscriptionFilterStringList(int filterType, const std::vector<std::string>& vals) const;
860  void addSubscriptionFilterByteList(int filterType, const std::vector<int>& vals) const;
861 
863  VehicleScope(const VehicleScope& src);
864 
866  VehicleScope& operator=(const VehicleScope& src);
867 
868  };
869 
874  public:
876  virtual ~PersonScope() {}
877 
878  std::vector<std::string> getIDList() const;
879  int getIDCount() const;
880  double getSpeed(const std::string& personID) const;
881  libsumo::TraCIPosition getPosition(const std::string& personID) const;
882  libsumo::TraCIPosition getPosition3D(const std::string& personID) const;
883  std::string getRoadID(const std::string& personID) const;
884  std::string getTypeID(const std::string& personID) const;
885  double getWaitingTime(const std::string& personID) const;
886  std::string getNextEdge(const std::string& personID) const;
887  std::string getVehicle(const std::string& personID) const;
888  int getRemainingStages(const std::string& personID) const;
889  libsumo::TraCIStage getStage(const std::string& personID, int nextStageIndex = 0) const;
890  std::vector<std::string> getEdges(const std::string& personID, int nextStageIndex = 0) const;
891  double getAngle(const std::string& personID) const;
892  double getSlope(const std::string& personID) const;
893  double getLanePosition(const std::string& personID) const;
894  libsumo::TraCIColor getColor(const std::string& personID) const;
895 
898  double getLength(const std::string& personID) const;
900 
901 
902  void removeStages(const std::string& personID) const;
903  void add(const std::string& personID, const std::string& edgeID, double pos, double depart = libsumo::DEPARTFLAG_NOW, const std::string typeID = "DEFAULT_PEDTYPE");
904  void appendStage(const std::string& personID, const libsumo::TraCIStage& stage);
905  void appendWaitingStage(const std::string& personID, double duration, const std::string& description = "waiting", const std::string& stopID = "");
906  void appendWalkingStage(const std::string& personID, const std::vector<std::string>& edges, double arrivalPos, double duration = -1, double speed = -1, const std::string& stopID = "");
907  void appendDrivingStage(const std::string& personID, const std::string& toEdge, const std::string& lines, const std::string& stopID = "");
908  void removeStage(const std::string& personID, int nextStageIndex) const;
909  void rerouteTraveltime(const std::string& personID) const;
910  void setSpeed(const std::string& personID, double speed) const;
911  void setType(const std::string& personID, const std::string& typeID) const;
912  void setLength(const std::string& personID, double length) const;
913  void setWidth(const std::string& personID, double width) const;
914  void setHeight(const std::string& personID, double height) const;
915  void setMinGap(const std::string& personID, double minGap) const;
916  void setColor(const std::string& personID, const libsumo::TraCIColor& c) const;
917 
918  private:
920  PersonScope(const PersonScope& src);
921 
923  PersonScope& operator=(const PersonScope& src);
924  };
925 
926 
927 
928 public:
959 
960 
961 protected:
964 
967  void send_commandSimulationStep(double time) const;
968 
969 
972  void send_commandClose() const;
973 
974 
977  void send_commandSetOrder(int order) const;
978 
986  void createCommand(int cmdID, int varID, const std::string& objID, tcpip::Storage* add = nullptr) const;
987  void createFilterCommand(int cmdID, int varID, tcpip::Storage* add = nullptr) const;
988 
989 
997  void send_commandSubscribeObjectVariable(int domID, const std::string& objID, double beginTime, double endTime, const std::vector<int>& vars) const;
998 
999 
1009  void send_commandSubscribeObjectContext(int domID, const std::string& objID, double beginTime, double endTime,
1010  int domain, double range, const std::vector<int>& vars) const;
1012 
1013 
1016 
1023  void check_resultState(tcpip::Storage& inMsg, int command, bool ignoreCommandId = false, std::string* acknowledgement = 0) const;
1024 
1028  int check_commandGetResult(tcpip::Storage& inMsg, int command, int expectedType = -1, bool ignoreCommandId = false) const;
1029 
1030  bool processGet(int command, int expectedType, bool ignoreCommandId = false);
1031  bool processSet(int command);
1033 
1034  void readVariableSubscription(int cmdId, tcpip::Storage& inMsg);
1035  void readContextSubscription(int cmdId, tcpip::Storage& inMsg);
1036  void readVariables(tcpip::Storage& inMsg, const std::string& objectID, int variableCount, libsumo::SubscriptionResults& into);
1037 
1038  template <class T>
1039  static inline std::string toString(const T& t, std::streamsize accuracy = PRECISION) {
1040  std::ostringstream oss;
1041  oss.setf(std::ios::fixed, std::ios::floatfield);
1042  oss << std::setprecision(accuracy);
1043  oss << t;
1044  return oss.str();
1045  }
1046 
1048  void closeSocket();
1049 
1050 protected:
1051  std::map<int, TraCIScopeWrapper*> myDomains;
1058 };
1059 
1060 
1061 #endif
1062 
1063 /****************************************************************************/
EdgeScope edge
Scope for interaction with edges.
Definition: TraCIAPI.h:930
LaneScope(TraCIAPI &parent)
Definition: TraCIAPI.h:311
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:204
std::string getParameter(const std::string &objectID, const std::string &key) const
retrieve generic paramter
Definition: TraCIAPI.cpp:3590
TRACI_CONST int CMD_SET_POLYGON_VARIABLE
libsumo::SubscriptionResults & getModifiableSubscriptionResults()
Definition: TraCIAPI.cpp:3674
libsumo::SubscriptionResults & getModifiableContextSubscriptionResults(const std::string &objID)
Definition: TraCIAPI.cpp:3680
tcpip::Socket * mySocket
The socket.
Definition: TraCIAPI.h:1053
C++ TraCI client API implementation.
Definition: TraCIAPI.h:50
void close()
ends the simulation and closes the connection
Definition: TraCIAPI.cpp:103
Scope for interaction with edges.
Definition: TraCIAPI.h:170
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:267
TRACI_CONST int CMD_GET_TL_VARIABLE
void connect(const std::string &host, int port)
Connects to the specified SUMO server.
Definition: TraCIAPI.cpp:75
bool processSet(int command)
Definition: TraCIAPI.cpp:343
MeMeScope(TraCIAPI &parent)
Definition: TraCIAPI.h:383
TRACI_CONST int CMD_SUBSCRIBE_ROUTE_CONTEXT
void setOrder(int order)
set priority (execution order) for the client
Definition: TraCIAPI.cpp:88
An edgeId, position and laneIndex.
Definition: TraCIDefs.h:122
TRACI_CONST int CMD_GET_LANE_VARIABLE
TRACI_CONST int CMD_SUBSCRIBE_PERSON_VARIABLE
TRACI_CONST int CMD_SUBSCRIBE_VEHICLE_VARIABLE
virtual ~PolygonScope()
Definition: TraCIAPI.h:452
TRACI_CONST int CMD_GET_LANEAREA_VARIABLE
void setParameter(const std::string &objectID, const std::string &key, const std::string &value) const
set generic paramter
Definition: TraCIAPI.cpp:3599
GUIScope(TraCIAPI &parent)
Definition: TraCIAPI.h:219
libsumo::TraCIPositionVector getPolygon(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:396
TraCIScopeWrapper & operator=(const TraCIScopeWrapper &src)
invalidated assignment operator
TRACI_CONST int CMD_GET_ROUTE_VARIABLE
JunctionScope junction
Scope for interaction with junctions.
Definition: TraCIAPI.h:936
TRACI_CONST int CMD_GET_VEHICLETYPE_VARIABLE
PersonScope(TraCIAPI &parent)
Definition: TraCIAPI.h:875
libsumo::TraCIStage getTraCIStage(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:481
TRACI_CONST int CMD_SET_VEHICLE_VARIABLE
std::map< int, std::shared_ptr< TraCIResult > > TraCIResults
{variable->value}
Definition: TraCIDefs.h:202
LaneScope lane
Scope for interaction with lanes.
Definition: TraCIAPI.h:938
TRACI_CONST int CMD_GET_PERSON_VARIABLE
PersonScope person
Scope for interaction with persons.
Definition: TraCIAPI.h:944
#define DEFAULT_VIEW
Definition: TraCIAPI.h:38
TRACI_CONST int CMD_SET_JUNCTION_VARIABLE
void load(const std::vector< std::string > &args)
Let sumo load a simulation using the given command line like options.
Definition: TraCIAPI.cpp:643
TRACI_CONST int DEPARTFLAG_NOW
Scope for interaction with vehicles.
Definition: TraCIAPI.h:662
virtual ~RouteScope()
Definition: TraCIAPI.h:486
TraCIScopeWrapper(TraCIAPI &parent, int cmdGetID, int cmdSetID, int subscribeID, int contextSubscribeID)
Constructor.
Definition: TraCIAPI.h:111
void send_commandSetOrder(int order) const
Sends a SetOrder command.
Definition: TraCIAPI.cpp:148
Scope for interaction with traffic lights.
Definition: TraCIAPI.h:556
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:205
virtual ~LaneScope()
Definition: TraCIAPI.h:312
void closeSocket()
Closes the connection.
Definition: TraCIAPI.cpp:113
TRACI_CONST int CMD_SET_SIM_VARIABLE
Scope for interaction with lane area detectors.
Definition: TraCIAPI.h:361
libsumo::TraCIColor getColor(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:467
Scope for interaction with the gui.
Definition: TraCIAPI.h:217
void createFilterCommand(int cmdID, int varID, tcpip::Storage *add=nullptr) const
Definition: TraCIAPI.cpp:185
TrafficLightScope trafficlights
Scope for interaction with traffic lights.
Definition: TraCIAPI.h:954
TRACI_CONST int CMD_SET_POI_VARIABLE
const libsumo::SubscriptionResults getAllSubscriptionResults() const
Definition: TraCIAPI.cpp:3635
Scope for interaction with routes.
Definition: TraCIAPI.h:483
TRACI_CONST int CMD_SUBSCRIBE_LANEAREA_CONTEXT
TRACI_CONST int CMD_SUBSCRIBE_PERSON_CONTEXT
TRACI_CONST int REMOVE_VAPORIZED
InductionLoopScope inductionloop
Scope for interaction with inductive loops.
Definition: TraCIAPI.h:934
Scope for interaction with inductive loops.
Definition: TraCIAPI.h:250
POIScope(TraCIAPI &parent)
Definition: TraCIAPI.h:410
std::map< int, TraCIScopeWrapper * > myDomains
Definition: TraCIAPI.h:1051
const tcpip::Storage & getCommandStorage() const
Definition: TraCIAPI.h:97
TRACI_CONST int CMD_GET_POI_VARIABLE
TRACI_CONST int CMD_SET_TL_VARIABLE
virtual ~MeMeScope()
Definition: TraCIAPI.h:384
Scope for interaction with POIs.
Definition: TraCIAPI.h:408
libsumo::TraCIPosition getPosition3D(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:430
TRACI_CONST int CMD_GET_SIM_VARIABLE
TRACI_CONST int CMD_SUBSCRIBE_POLYGON_CONTEXT
TRACI_CONST int CMD_SUBSCRIBE_JUNCTION_VARIABLE
Scope for interaction with the simulation.
Definition: TraCIAPI.h:507
Scope for interaction with multi entry/-exit detectors.
Definition: TraCIAPI.h:381
const libsumo::SubscriptionResults getContextSubscriptionResults(const std::string &objID) const
Definition: TraCIAPI.cpp:3657
TRACI_CONST int CMD_SUBSCRIBE_SIM_CONTEXT
virtual ~EdgeScope()
Definition: TraCIAPI.h:173
TRACI_CONST int CMD_SUBSCRIBE_VEHICLE_CONTEXT
void readVariables(tcpip::Storage &inMsg, const std::string &objectID, int variableCount, libsumo::SubscriptionResults &into)
Definition: TraCIAPI.cpp:530
InductionLoopScope(TraCIAPI &parent)
Definition: TraCIAPI.h:252
MeMeScope multientryexit
Scope for interaction with multi-entry/-exit detectors.
Definition: TraCIAPI.h:942
TRACI_CONST int CMD_SUBSCRIBE_EDGE_VARIABLE
TRACI_CONST int CMD_SUBSCRIBE_POI_CONTEXT
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:161
TRACI_CONST int CMD_SUBSCRIBE_POLYGON_VARIABLE
TRACI_CONST int CMD_SET_PERSON_VARIABLE
TRACI_CONST int CMD_SUBSCRIBE_SIM_VARIABLE
TRACI_CONST int CMD_SUBSCRIBE_POI_VARIABLE
Scope for interaction with vehicle types.
Definition: TraCIAPI.h:596
PolygonScope(TraCIAPI &parent)
Definition: TraCIAPI.h:451
TRACI_CONST int CMD_GET_VEHICLE_VARIABLE
#define PRECISION
Definition: TraCIAPI.h:39
virtual ~JunctionScope()
Definition: TraCIAPI.h:286
TRACI_CONST int CMD_SUBSCRIBE_JUNCTION_CONTEXT
libsumo::ContextSubscriptionResults myContextSubscriptionResults
Definition: TraCIAPI.h:151
~TraCIAPI()
Destructor.
Definition: TraCIAPI.cpp:69
TRACI_CONST int CMD_SET_VEHICLETYPE_VARIABLE
RouteScope route
Scope for interaction with routes.
Definition: TraCIAPI.h:950
Scope for interaction with polygons.
Definition: TraCIAPI.h:449
void simulationStep(double time=0)
Advances by one step (or up to the given time)
Definition: TraCIAPI.cpp:621
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:208
TRACI_CONST int CMD_SUBSCRIBE_LANEAREA_VARIABLE
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:236
TRACI_CONST int CMD_GET_MULTIENTRYEXIT_VARIABLE
int getInt(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:376
TRACI_CONST int CMD_SUBSCRIBE_VEHICLETYPE_CONTEXT
TRACI_CONST int CMD_SET_LANE_VARIABLE
libsumo::SubscriptionResults mySubscriptionResults
Definition: TraCIAPI.h:150
void subscribe(const std::string &objID, const std::vector< int > &vars, double beginTime, double endTime) const
Definition: TraCIAPI.cpp:3613
int getByte(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:365
void subscribeContext(const std::string &objID, int domain, double range, const std::vector< int > &vars, double beginTime, double endTime) const
Definition: TraCIAPI.cpp:3625
static std::string toString(const T &t, std::streamsize accuracy=PRECISION)
Definition: TraCIAPI.h:1039
TRACI_CONST int CMD_SUBSCRIBE_TL_CONTEXT
int getUnsignedByte(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:355
double getDouble(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:386
TRACI_CONST int CMD_SUBSCRIBE_GUI_VARIABLE
Scope for interaction with vehicles.
Definition: TraCIAPI.h:873
Scope for interaction with junctions.
Definition: TraCIAPI.h:283
TrafficLightScope(TraCIAPI &parent)
Definition: TraCIAPI.h:558
virtual ~VehicleScope()
Definition: TraCIAPI.h:665
const libsumo::TraCIResults getSubscriptionResults(const std::string &objID) const
Definition: TraCIAPI.cpp:3641
Definition: Edge.cpp:30
virtual ~SimulationScope()
Definition: TraCIAPI.h:510
TRACI_CONST int CMD_SUBSCRIBE_MULTIENTRYEXIT_VARIABLE
std::vector< std::string > getStringVector(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:453
EdgeScope(TraCIAPI &parent)
Definition: TraCIAPI.h:172
TRACI_CONST int CMD_SUBSCRIBE_INDUCTIONLOOP_CONTEXT
POIScope poi
Scope for interaction with POIs.
Definition: TraCIAPI.h:946
TRACI_CONST int CMD_SUBSCRIBE_GUI_CONTEXT
virtual ~POIScope()
Definition: TraCIAPI.h:411
virtual ~PersonScope()
Definition: TraCIAPI.h:876
SimulationScope simulation
Scope for interaction with the simulation.
Definition: TraCIAPI.h:952
Scope for interaction with lanes.
Definition: TraCIAPI.h:309
RouteScope(TraCIAPI &parent)
Definition: TraCIAPI.h:485
VehicleScope vehicle
Scope for interaction with vehicles.
Definition: TraCIAPI.h:956
TRACI_CONST int CMD_SUBSCRIBE_LANE_CONTEXT
TRACI_CONST int CMD_GET_GUI_VARIABLE
std::vector< TraCIPosition > TraCIPositionVector
Definition: TraCIDefs.h:150
tcpip::Storage myOutput
The reusable output storage.
Definition: TraCIAPI.h:1055
TRACI_CONST int CMD_SUBSCRIBE_TL_VARIABLE
TRACI_CONST int CMD_SET_EDGE_VARIABLE
void readVariableSubscription(int cmdId, tcpip::Storage &inMsg)
Definition: TraCIAPI.cpp:598
PolygonScope polygon
Scope for interaction with polygons.
Definition: TraCIAPI.h:948
virtual ~TraCIScopeWrapper()
Destructor.
Definition: TraCIAPI.h:120
VehicleTypeScope(TraCIAPI &parent)
Definition: TraCIAPI.h:598
virtual ~GUIScope()
Definition: TraCIAPI.h:220
void send_commandSimulationStep(double time) const
Sends a SimulationStep command.
Definition: TraCIAPI.cpp:124
bool processGet(int command, int expectedType, bool ignoreCommandId=false)
Definition: TraCIAPI.cpp:330
void send_commandClose() const
Sends a Close command.
Definition: TraCIAPI.cpp:137
TraCIAPI & myParent
The parent TraCI client which offers the connection.
Definition: TraCIAPI.h:145
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:306
libsumo::TraCIPosition getPosition(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:417
TRACI_CONST int CMD_SUBSCRIBE_ROUTE_VARIABLE
TRACI_CONST int CMD_SUBSCRIBE_LANE_VARIABLE
GUIScope gui
Scope for interaction with the gui.
Definition: TraCIAPI.h:932
TRACI_CONST int CMD_GET_JUNCTION_VARIABLE
std::string getString(int cmd, int var, const std::string &id, tcpip::Storage *add=0)
Definition: TraCIAPI.cpp:443
VehicleScope(TraCIAPI &parent)
Definition: TraCIAPI.h:664
SimulationScope(TraCIAPI &parent)
Definition: TraCIAPI.h:509
An abstract interface for accessing type-dependent values.
Definition: TraCIAPI.h:106
TRACI_CONST int CMD_SUBSCRIBE_INDUCTIONLOOP_VARIABLE
TRACI_CONST int CMD_GET_INDUCTIONLOOP_VARIABLE
LaneAreaScope lanearea
Scope for interaction with lanes.
Definition: TraCIAPI.h:940
TraCIAPI()
Constructor.
Definition: TraCIAPI.cpp:42
virtual ~LaneAreaScope()
Definition: TraCIAPI.h:364
TRACI_CONST int CMD_SUBSCRIBE_MULTIENTRYEXIT_CONTEXT
TRACI_CONST int CMD_GET_EDGE_VARIABLE
A 3D-position.
Definition: TraCIDefs.h:110
const libsumo::ContextSubscriptionResults getAllContextSubscriptionResults() const
Definition: TraCIAPI.cpp:3651
LaneAreaScope(TraCIAPI &parent)
Definition: TraCIAPI.h:363
JunctionScope(TraCIAPI &parent)
Definition: TraCIAPI.h:285
TRACI_CONST int CMD_SUBSCRIBE_EDGE_CONTEXT
tcpip::Storage myInput
The reusable input storage.
Definition: TraCIAPI.h:1057
TRACI_CONST int CMD_SET_ROUTE_VARIABLE
TRACI_CONST int CMD_SUBSCRIBE_VEHICLETYPE_VARIABLE
void readContextSubscription(int cmdId, tcpip::Storage &inMsg)
Definition: TraCIAPI.cpp:606
TRACI_CONST int CMD_GET_POLYGON_VARIABLE
TRACI_CONST int CMD_SET_GUI_VARIABLE
VehicleTypeScope vehicletype
Scope for interaction with vehicle types.
Definition: TraCIAPI.h:958