Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
TraCIDefs.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-2026 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/****************************************************************************/
21// C++ TraCI client API implementation
22/****************************************************************************/
23#pragma once
24// we do not include config.h here, since we should be independent of a special sumo build
25// but we want to avoid certain warnings in MSVC see config.h.cmake for details
26#ifdef _MSC_VER
27#pragma warning(push)
28#pragma warning(disable: 4514 4820)
29#endif
30
32#include <vector>
33#include <limits>
34#include <map>
35#include <string>
36#include <stdexcept>
37#include <sstream>
38#include <memory>
39#include <cstring>
40
41
42// ===========================================================================
43// common declarations
44// ===========================================================================
45namespace libsumo {
46class VariableWrapper;
47}
48namespace tcpip {
49class Storage;
50}
51
52
53// ===========================================================================
54// global definitions
55// ===========================================================================
56#ifdef LIBTRACI
57#define LIBSUMO_NAMESPACE libtraci
58#else
59#define LIBSUMO_NAMESPACE libsumo
60#endif
61
62#define LIBSUMO_SUBSCRIPTION_API \
63static void subscribe(const std::string& objectID, const std::vector<int>& varIDs = std::vector<int>({-1}), \
64 double begin = libsumo::INVALID_DOUBLE_VALUE, double end = libsumo::INVALID_DOUBLE_VALUE, const libsumo::TraCIResults& parameters = libsumo::TraCIResults()); \
65static void unsubscribe(const std::string& objectID); \
66static void subscribeContext(const std::string& objectID, int domain, double dist, const std::vector<int>& varIDs = std::vector<int>({-1}), \
67 double begin = libsumo::INVALID_DOUBLE_VALUE, double end = libsumo::INVALID_DOUBLE_VALUE, const libsumo::TraCIResults& parameters = libsumo::TraCIResults()); \
68static void unsubscribeContext(const std::string& objectID, int domain, double dist); \
69static const libsumo::SubscriptionResults getAllSubscriptionResults(); \
70static const libsumo::TraCIResults getSubscriptionResults(const std::string& objectID); \
71static const libsumo::ContextSubscriptionResults getAllContextSubscriptionResults(); \
72static const libsumo::SubscriptionResults getContextSubscriptionResults(const std::string& objectID); \
73static void subscribeParameterWithKey(const std::string& objectID, const std::string& key, double beginTime = libsumo::INVALID_DOUBLE_VALUE, double endTime = libsumo::INVALID_DOUBLE_VALUE); \
74static const int DOMAIN_ID; \
75static int domainID() { return DOMAIN_ID; }
76
77#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM) \
78const int CLASS::DOMAIN_ID(libsumo::CMD_GET_##DOM##_VARIABLE); \
79void \
80CLASS::subscribe(const std::string& objectID, const std::vector<int>& varIDs, double begin, double end, const libsumo::TraCIResults& parameters) { \
81 libsumo::Helper::subscribe(libsumo::CMD_SUBSCRIBE_##DOM##_VARIABLE, objectID, varIDs, begin, end, parameters); \
82} \
83void \
84CLASS::unsubscribe(const std::string& objectID) { \
85 libsumo::Helper::subscribe(libsumo::CMD_SUBSCRIBE_##DOM##_VARIABLE, objectID, std::vector<int>(), libsumo::INVALID_DOUBLE_VALUE, libsumo::INVALID_DOUBLE_VALUE, libsumo::TraCIResults()); \
86} \
87void \
88CLASS::subscribeContext(const std::string& objectID, int domain, double dist, const std::vector<int>& varIDs, double begin, double end, const TraCIResults& parameters) { \
89 libsumo::Helper::subscribe(libsumo::CMD_SUBSCRIBE_##DOM##_CONTEXT, objectID, varIDs, begin, end, parameters, domain, dist); \
90} \
91void \
92CLASS::unsubscribeContext(const std::string& objectID, int domain, double dist) { \
93 libsumo::Helper::subscribe(libsumo::CMD_SUBSCRIBE_##DOM##_CONTEXT, objectID, std::vector<int>(), libsumo::INVALID_DOUBLE_VALUE, libsumo::INVALID_DOUBLE_VALUE, libsumo::TraCIResults(), domain, dist); \
94} \
95const libsumo::SubscriptionResults \
96CLASS::getAllSubscriptionResults() { \
97 return mySubscriptionResults; \
98} \
99const libsumo::TraCIResults \
100CLASS::getSubscriptionResults(const std::string& objectID) { \
101 return mySubscriptionResults[objectID]; \
102} \
103const libsumo::ContextSubscriptionResults \
104CLASS::getAllContextSubscriptionResults() { \
105 return myContextSubscriptionResults; \
106} \
107const libsumo::SubscriptionResults \
108CLASS::getContextSubscriptionResults(const std::string& objectID) { \
109 return myContextSubscriptionResults[objectID]; \
110} \
111void \
112CLASS::subscribeParameterWithKey(const std::string& objectID, const std::string& key, double beginTime, double endTime) { \
113 libsumo::Helper::subscribe(libsumo::CMD_SUBSCRIBE_##DOM##_VARIABLE, objectID, std::vector<int>({libsumo::VAR_PARAMETER_WITH_KEY}), beginTime, endTime, libsumo::TraCIResults {{libsumo::VAR_PARAMETER_WITH_KEY, std::make_shared<libsumo::TraCIString>(key)}}); \
114}
115
116
117#define LIBSUMO_ID_PARAMETER_API \
118static std::vector<std::string> getIDList(); \
119static int getIDCount(); \
120static std::string getParameter(const std::string& objectID, const std::string& key); \
121static const std::pair<std::string, std::string> getParameterWithKey(const std::string& objectID, const std::string& key); \
122static void setParameter(const std::string& objectID, const std::string& key, const std::string& value);
123
124#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS) \
125const std::pair<std::string, std::string> \
126CLASS::getParameterWithKey(const std::string& objectID, const std::string& key) { \
127 return std::make_pair(key, getParameter(objectID, key)); \
128}
129
130
131#define SWIGJAVA_CAST(CLASS) \
132static std::shared_ptr<CLASS> cast(std::shared_ptr<TraCIResult> res) { \
133 return std::dynamic_pointer_cast<CLASS>(res); \
134}
135
136
137// ===========================================================================
138// class and type definitions
139// ===========================================================================
140namespace libsumo {
145class TraCIException : public std::runtime_error {
146public:
148 TraCIException(std::string what)
149 : std::runtime_error(what) {}
150};
151
156class FatalTraCIError : public std::runtime_error {
157public:
159 FatalTraCIError(std::string what)
160 : std::runtime_error(what) {}
161};
162
165
168 virtual ~TraCIResult() {}
169#ifndef SWIG
170 TraCIResult(const TraCIResult&) = default;
172#endif
173 virtual std::string getString() const {
174 return "";
175 }
176 virtual int getType() const {
177 return -1;
178 }
179};
180
185 std::string getString() const override {
186 std::ostringstream os;
187 os << "TraCIPosition(" << x << "," << y;
188 if (z != INVALID_DOUBLE_VALUE) {
189 os << "," << z;
190 }
191 os << ")";
192 return os.str();
193 }
194 int getType() const override {
196 }
198#ifdef SWIGJAVA
200#endif
201};
202
207 TraCIRoadPosition(const std::string e = "", const double p = INVALID_DOUBLE_VALUE, const int li = INVALID_INT_VALUE) : edgeID(e), pos(p), laneIndex(li) {}
208 std::string getString() const override {
209 std::ostringstream os;
210 os << "TraCIRoadPosition(" << edgeID << "_" << laneIndex << "," << pos << ")";
211 return os.str();
212 }
213 int getType() const override {
214 return POSITION_ROADMAP;
215 }
216 std::string edgeID;
217 double pos;
219#ifdef SWIGJAVA
221#endif
222};
223
228 TraCIColor() : r(0), g(0), b(0), a(255) {}
229 TraCIColor(int r, int g, int b, int a = 255) : r(r), g(g), b(b), a(a) {}
230 std::string getString() const override {
231 std::ostringstream os;
232 os << "TraCIColor(" << r << "," << g << "," << b << "," << a << ")";
233 return os.str();
234 }
235 int r, g, b, a;
236#ifdef SWIGJAVA
238#endif
239};
240
241
246 std::string getString() const override {
247 std::ostringstream os;
248 os << "[";
249 for (const TraCIPosition& v : value) {
250 os << "(" << v.x << "," << v.y << "," << v.z << ")";
251 }
252 os << "]";
253 return os.str();
254 }
255 std::vector<TraCIPosition> value;
256#ifdef SWIGJAVA
258#endif
259};
260
261
263 TraCIInt(int v = 0, int t = libsumo::TYPE_INTEGER) : value(v), traciType(t) {}
264 std::string getString() const override {
265 std::ostringstream os;
266 os << value;
267 return os.str();
268 }
269 int getType() const override {
270 return traciType;
271 }
272 int value;
274#ifdef SWIGJAVA
276#endif
277};
278
279
281 TraCIDouble(double v = 0.) : value(v) {}
282 std::string getString() const override {
283 std::ostringstream os;
284 os << value;
285 return os.str();
286 }
287 int getType() const override {
289 }
290 double value;
291#ifdef SWIGJAVA
293#endif
294};
295
296
298 TraCIString(std::string v = "") : value(v) {}
299 std::string getString() const override {
300 return value;
301 }
302 int getType() const override {
304 }
305 std::string value;
306#ifdef SWIGJAVA
308#endif
309};
310
311
313 std::string getString() const override {
314 std::ostringstream os;
315 os << "[";
316 for (std::string v : value) {
317 os << v << ",";
318 }
319 os << "]";
320 return os.str();
321 }
322 std::vector<std::string> value;
323#ifdef SWIGJAVA
325#endif
326};
327
328
330 std::string getString() const override {
331 std::ostringstream os;
332 os << "[";
333 for (double v : value) {
334 os << v << ",";
335 }
336 os << "]";
337 return os.str();
338 }
339 std::vector<double> value;
340#ifdef SWIGJAVA
342#endif
343};
344
345
347 std::string getString() const override {
348 std::ostringstream os;
349 os << "[";
350 for (int v : value) {
351 os << v << ",";
352 }
353 os << "]";
354 return os.str();
355 }
356 std::vector<int> value;
357#ifdef SWIGJAVA
359#endif
360};
361
362
364 std::string getString() const override {
365 std::ostringstream os;
366 os << "[";
367 for (const auto& v : value) {
368 os << "(" << v.first << "," << v.second << "),";
369 }
370 os << "]";
371 return os.str();
372 }
373 std::vector<std::pair<std::string, double> > value;
374#ifdef SWIGJAVA
376#endif
377};
378
379
381typedef std::map<int, std::shared_ptr<libsumo::TraCIResult> > TraCIResults;
383typedef std::map<std::string, libsumo::TraCIResults> SubscriptionResults;
384typedef std::map<std::string, libsumo::SubscriptionResults> ContextSubscriptionResults;
385
386
389 TraCIPhase(const double _duration, const std::string& _state, const double _minDur = libsumo::INVALID_DOUBLE_VALUE,
390 const double _maxDur = libsumo::INVALID_DOUBLE_VALUE,
391 const std::vector<int>& _next = std::vector<int>(),
392 const std::string& _name = "",
393 const std::string& _earlyTarget = "") :
394 duration(_duration), state(_state), minDur(_minDur), maxDur(_maxDur), next(_next), name(_name), earlyTarget(_earlyTarget) {}
395
396 double duration;
397 std::string state;
398 double minDur, maxDur;
399 std::vector<int> next;
400 std::string name;
401 std::string earlyTarget;
402};
403}
404
405
406#ifdef SWIG
407%template(TraCIPhaseVector) std::vector<std::shared_ptr<libsumo::TraCIPhase> >; // *NOPAD*
408#endif
409
410
411namespace libsumo {
414 TraCILogic(const std::string& _programID, const int _type, const int _currentPhaseIndex,
415 const std::vector<std::shared_ptr<libsumo::TraCIPhase> >& _phases = std::vector<std::shared_ptr<libsumo::TraCIPhase> >())
416 : programID(_programID), type(_type), currentPhaseIndex(_currentPhaseIndex), phases(_phases) {}
417
418 std::string getString() const {
419 std::ostringstream os;
420 os << "TraCILink(" << programID << "," << type << "," << currentPhaseIndex << ")";
421 return os.str();
422 }
423
424 std::string programID;
425 int type;
427 std::vector<std::shared_ptr<libsumo::TraCIPhase> > phases;
428 std::map<std::string, std::string> subParameter;
429};
430
431
433 std::string getString() const override {
434 std::ostringstream os;
435 os << "TraCILogicVectorWrapped[";
436 for (const TraCILogic& v : value) {
437 os << v.getString() << ",";
438 }
439 os << "]";
440 return os.str();
441 }
442
443 std::vector<TraCILogic> value;
444};
445
446
447struct TraCILink {
449 TraCILink(const std::string& _from, const std::string& _via, const std::string& _to)
450 : fromLane(_from), viaLane(_via), toLane(_to) {}
451
452 std::string getString() const {
453 std::ostringstream os;
454 os << "TraCILink(" << fromLane << "," << viaLane << "," << toLane << ")";
455 return os.str();
456 }
457
458 std::string fromLane;
459 std::string viaLane;
460 std::string toLane;
461};
462
463
465 std::string getString() const override {
466 std::ostringstream os;
467 os << "TraCILinkVectorVectorWrapped[";
468 for (const std::vector<TraCILink>& v : value) {
469 os << "[";
470 for (const TraCILink& tl : v) {
471 os << tl.getString() << ",";
472 }
473 }
474 os << "]";
475 return os.str();
476 }
477
478 std::vector<std::vector<TraCILink> > value;
479};
480
481
483 TraCIConnection() {} // this is needed by SWIG when building a vector of this type, please don't use it
484 TraCIConnection(const std::string& _approachedLane, const bool _hasPrio, const bool _isOpen, const bool _hasFoe,
485 const std::string _approachedInternal, const std::string _state, const std::string _direction, const double _length)
486 : approachedLane(_approachedLane), hasPrio(_hasPrio), isOpen(_isOpen), hasFoe(_hasFoe),
487 approachedInternal(_approachedInternal), state(_state), direction(_direction), length(_length) {}
488
489 std::string getString() const {
490 std::ostringstream os;
491 os << "TraCIConnection(" << approachedLane << "," << hasPrio << "," << isOpen
492 << "," << hasFoe << "," << approachedInternal << "," << state << "," << direction << "," << length << ")";
493 return os.str();
494 }
495
496 std::string approachedLane;
498 bool isOpen;
499 bool hasFoe;
501 std::string state;
502 std::string direction;
503 double length;
504};
505
506
508 std::string getString() const override {
509 std::ostringstream os;
510 os << "TraCIConnectionVectorWrapped[";
511 for (const TraCIConnection& v : value) {
512 os << v.getString() << ",";
513 }
514 os << "]";
515 return os.str();
516 }
517
518 std::vector<TraCIConnection> value;
519};
520
521
524 std::string getString() const {
525 std::ostringstream os;
526 os << "TraCIVehicleData(" << id << "," << length << "," << entryTime
527 << "," << leaveTime << "," << typeID << ")";
528 return os.str();
529 }
530
532 std::string id;
534 double length;
536 double entryTime;
538 double leaveTime;
540 std::string typeID;
541};
542
543
545 std::string getString() const override {
546 std::ostringstream os;
547 os << "TraCIVehicleDataVectorWrapped[";
548 for (const TraCIVehicleData& v : value) {
549 os << v.getString() << ",";
550 }
551 os << "]";
552 return os.str();
553 }
554
555 std::vector<TraCIVehicleData> value;
556};
557
558
560 std::string getString() const {
561 std::ostringstream os;
562 os << "TraCINextTLSData(" << id << "," << tlIndex << "," << dist
563 << "," << state << ")";
564 return os.str();
565 }
566
568 std::string id;
572 double dist;
574 char state;
575};
576
577
579 std::string getString() const override {
580 std::ostringstream os;
581 os << "TraCINextTLSDataVectorWrapped[";
582 for (const TraCINextTLSData& v : value) {
583 os << v.getString() << ",";
584 }
585 os << "]";
586 return os.str();
587 }
588
589 std::vector<TraCINextTLSData> value;
590};
591
592
594
595 TraCINextStopData(const std::string& lane = "",
596 double startPos = INVALID_DOUBLE_VALUE,
597 double endPos = INVALID_DOUBLE_VALUE,
598 const std::string& stoppingPlaceID = "",
599 int stopFlags = 0,
600 double duration = INVALID_DOUBLE_VALUE,
601 double until = INVALID_DOUBLE_VALUE,
602 double intendedArrival = INVALID_DOUBLE_VALUE,
603 double arrival = INVALID_DOUBLE_VALUE,
604 double depart = INVALID_DOUBLE_VALUE,
605 const std::string& split = "",
606 const std::string& join = "",
607 const std::string& actType = "",
608 const std::string& tripId = "",
609 const std::string& line = "",
610 double speed = 0):
611 lane(lane),
612 startPos(startPos),
613 endPos(endPos),
614 stoppingPlaceID(stoppingPlaceID),
615 stopFlags(stopFlags),
616 duration(duration),
617 until(until),
618 intendedArrival(intendedArrival),
619 arrival(arrival),
620 depart(depart),
621 split(split),
622 join(join),
623 actType(actType),
624 tripId(tripId),
625 line(line),
626 speed(speed)
627 {}
628
629 std::string getString() const {
630 std::ostringstream os;
631 os << "TraCINextStopData(" << lane << "," << endPos << "," << stoppingPlaceID
632 << "," << stopFlags << "," << duration << "," << until
633 << "," << arrival << ")";
634 return os.str();
635 }
636
638 std::string lane;
640 double startPos;
642 double endPos;
644 std::string stoppingPlaceID;
648 double duration;
650 double until;
654 double arrival;
656 double depart;
658 std::string split;
660 std::string join;
662 std::string actType;
664 std::string tripId;
666 std::string line;
668 double speed;
669};
670
671
677 std::string getString() const override {
678 std::ostringstream os;
679 os << "TraCINextStopDataVectorWrapped[";
680 for (const TraCINextStopData& v : value) {
681 os << v.getString() << ",";
682 }
683 os << "]";
684 return os.str();
685 }
686
687 std::vector<TraCINextStopData> value;
688};
689
690
692 std::string getString() const {
693 std::ostringstream os;
694 os << "TraCIBestLanesData(" << laneID << "," << length << "," << occupation
695 << "," << bestLaneOffset << "," << allowsContinuation << ",[";
696 for (const std::string& s : continuationLanes) {
697 os << s << ",";
698 }
699 os << "])";
700 return os.str();
701 }
702
704 std::string laneID;
706 double length;
714 std::vector<std::string> continuationLanes;
715};
716
717
719 std::string getString() const override {
720 std::ostringstream os;
721 os << "TraCIBestLanesDataVectorWrapped[";
722 for (const TraCIBestLanesData& v : value) {
723 os << v.getString() << ",";
724 }
725 os << "]";
726 return os.str();
727 }
728
729 std::vector<TraCIBestLanesData> value;
730};
731
732
734public:
735 TraCIStage(int type = INVALID_INT_VALUE, const std::string& vType = "", const std::string& line = "", const std::string& destStop = "",
736 const std::vector<std::string>& edges = std::vector<std::string>(),
737 double travelTime = INVALID_DOUBLE_VALUE, double cost = INVALID_DOUBLE_VALUE, double length = INVALID_DOUBLE_VALUE,
738 const std::string& intended = "", double depart = INVALID_DOUBLE_VALUE, double departPos = INVALID_DOUBLE_VALUE,
739 double arrivalPos = INVALID_DOUBLE_VALUE, const std::string& description = "") :
740 type(type), vType(vType), line(line), destStop(destStop), edges(edges), travelTime(travelTime), cost(cost),
741 length(length), intended(intended), depart(depart), departPos(departPos), arrivalPos(arrivalPos), description(description) {}
743 int type;
745 std::string vType;
747 std::string line;
749 std::string destStop;
751 std::vector<std::string> edges;
755 double cost;
757 double length;
759 std::string intended;
761 double depart;
763 double departPos;
767 std::string description;
768};
769
770
771
774 TraCIReservation(const std::string& id,
775 const std::vector<std::string>& persons,
776 const std::string& group,
777 const std::string& fromEdge,
778 const std::string& toEdge,
779 double departPos,
780 double arrivalPos,
781 double depart,
782 double reservationTime,
783 int state) :
784 id(id), persons(persons), group(group), fromEdge(fromEdge), toEdge(toEdge), departPos(departPos), arrivalPos(arrivalPos),
785 depart(depart), reservationTime(reservationTime), state(state) {}
787 std::string id;
789 std::vector<std::string> persons;
791 std::string group;
793 std::string fromEdge;
795 std::string toEdge;
797 double departPos;
801 double depart;
805 int state;
806
807 std::string getString() const {
808 std::ostringstream os;
809 os << "TraCIReservation(id=" << id << ")";
810 return os.str();
811 }
812};
813
814
816 std::string getString() const override {
817 std::ostringstream os;
818 os << "TraCIReservationVectorWrapped[";
819 for (const TraCIReservation& v : value) {
820 os << v.getString() << ",";
821 }
822 os << "]";
823 return os.str();
824 }
825
826 std::vector<TraCIReservation> value;
827};
828
829
832 std::string collider;
833 std::string victim;
834 std::string colliderType;
835 std::string victimType;
839 std::string type;
841 std::string lane;
843 double pos;
844
845 std::string getString() const {
846 std::ostringstream os;
847 os << "TraCICollision(collider=" << collider << ", victim=" << victim << ")";
848 return os.str();
849 }
850};
851
852
854 std::string getString() const override {
855 std::ostringstream os;
856 os << "TraCICollisionVectorWrapped[";
857 for (const TraCICollision& v : value) {
858 os << v.getString() << ",";
859 }
860 os << "]";
861 return os.str();
862 }
863
864 std::vector<TraCICollision> value;
865};
866
867
870 std::string signalId;
872 std::string tripId;
874 std::string foeId;
876 std::string foeSignal;
878 int limit;
880 int type;
884 bool active;
886 std::map<std::string, std::string> param;
887
888 std::string getString() const {
889 std::ostringstream os;
890 os << "TraCISignalConstraint(signalId=" << signalId << ", tripid=" << tripId << ", foeSignal=" << foeSignal << ", foeId=" << foeId << ")";
891 return os.str();
892 }
893};
894
895
897 std::string getString() const override {
898 std::ostringstream os;
899 os << "TraCISignalConstraintVectorWrapped[";
900 for (const TraCISignalConstraint& v : value) {
901 os << v.getString() << ",";
902 }
903 os << "]";
904 return os.str();
905 }
906
907 std::vector<TraCISignalConstraint> value;
908};
909
910
913 std::string foeId;
914 double egoDist;
915 double foeDist;
918 std::string egoLane;
919 std::string foeLane;
922
923 std::string getString() const {
924 std::ostringstream os;
925 os << "TraCIJunctionFoe(foeId=" << foeId << ", egoDist=" << egoDist << ", foeDist=" << foeDist << ", foeDist=" << foeDist << ")";
926 return os.str();
927 }
928};
929
930
932 std::string getString() const override {
933 std::ostringstream os;
934 os << "TraCIJunctionFoeVectorWrapped[";
935 for (const TraCIJunctionFoe& v : value) {
936 os << v.getString() << ",";
937 }
938 os << "]";
939 return os.str();
940 }
941
942 std::vector<TraCIJunctionFoe> value;
943};
944
945
946}
947
948// pop MSVC warnings
949#ifdef _MSC_VER
950#pragma warning(pop)
951#endif
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
#define SWIGJAVA_CAST(CLASS)
Definition TraCIDefs.h:131
An error which is not recoverable.
Definition TraCIDefs.h:156
FatalTraCIError(std::string what)
Definition TraCIDefs.h:159
An error which allows to continue.
Definition TraCIDefs.h:145
TraCIException(std::string what)
Definition TraCIDefs.h:148
TRACI_CONST double INVALID_DOUBLE_VALUE
TRACI_CONST int POSITION_3D
TRACI_CONST int POSITION_ROADMAP
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
Definition TraCIDefs.h:384
TRACI_CONST int POSITION_2D
TRACI_CONST int TYPE_INTEGER
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition TraCIDefs.h:383
TRACI_CONST int INVALID_INT_VALUE
TRACI_CONST int TYPE_DOUBLE
std::map< int, std::shared_ptr< libsumo::TraCIResult > > TraCIResults
{variable->value}
Definition TraCIDefs.h:381
TRACI_CONST int TYPE_STRING
Definition json.hpp:4471
double length
The length than can be driven from that lane without lane change.
Definition TraCIDefs.h:706
std::string getString() const
Definition TraCIDefs.h:692
double occupation
The traffic density along length.
Definition TraCIDefs.h:708
bool allowsContinuation
Whether this lane allows continuing the route.
Definition TraCIDefs.h:712
int bestLaneOffset
The offset of this lane from the best lane.
Definition TraCIDefs.h:710
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
Definition TraCIDefs.h:714
std::string laneID
The id of the lane.
Definition TraCIDefs.h:704
std::string getString() const override
Definition TraCIDefs.h:719
std::vector< TraCIBestLanesData > value
Definition TraCIDefs.h:729
std::string lane
The lane where the collision happended.
Definition TraCIDefs.h:841
std::string type
The type of collision.
Definition TraCIDefs.h:839
std::string collider
The ids of the participating vehicles and persons.
Definition TraCIDefs.h:832
double pos
The position of the collision along the lane.
Definition TraCIDefs.h:843
std::string colliderType
Definition TraCIDefs.h:834
std::string getString() const
Definition TraCIDefs.h:845
std::vector< TraCICollision > value
Definition TraCIDefs.h:864
std::string getString() const override
Definition TraCIDefs.h:854
std::string getString() const override
Definition TraCIDefs.h:230
TraCIColor(int r, int g, int b, int a=255)
Definition TraCIDefs.h:229
std::string getString() const
Definition TraCIDefs.h:489
TraCIConnection(const std::string &_approachedLane, const bool _hasPrio, const bool _isOpen, const bool _hasFoe, const std::string _approachedInternal, const std::string _state, const std::string _direction, const double _length)
Definition TraCIDefs.h:484
std::string approachedLane
Definition TraCIDefs.h:496
std::string approachedInternal
Definition TraCIDefs.h:500
std::string getString() const override
Definition TraCIDefs.h:508
std::vector< TraCIConnection > value
Definition TraCIDefs.h:518
TraCIDouble(double v=0.)
Definition TraCIDefs.h:281
std::string getString() const override
Definition TraCIDefs.h:282
int getType() const override
Definition TraCIDefs.h:287
std::vector< double > value
Definition TraCIDefs.h:339
std::string getString() const override
Definition TraCIDefs.h:330
int getType() const override
Definition TraCIDefs.h:269
std::string getString() const override
Definition TraCIDefs.h:264
TraCIInt(int v=0, int t=libsumo::TYPE_INTEGER)
Definition TraCIDefs.h:263
std::string getString() const override
Definition TraCIDefs.h:347
std::vector< int > value
Definition TraCIDefs.h:356
std::string getString() const
Definition TraCIDefs.h:923
std::string foeId
the id of the vehicle with intersecting trajectory
Definition TraCIDefs.h:913
std::vector< TraCIJunctionFoe > value
Definition TraCIDefs.h:942
std::string getString() const override
Definition TraCIDefs.h:932
std::map< std::string, std::string > subParameter
Definition TraCIDefs.h:428
std::string programID
Definition TraCIDefs.h:424
std::vector< std::shared_ptr< libsumo::TraCIPhase > > phases
Definition TraCIDefs.h:427
TraCILogic(const std::string &_programID, const int _type, const int _currentPhaseIndex, const std::vector< std::shared_ptr< libsumo::TraCIPhase > > &_phases=std::vector< std::shared_ptr< libsumo::TraCIPhase > >())
Definition TraCIDefs.h:414
std::string getString() const
Definition TraCIDefs.h:418
std::vector< TraCILogic > value
Definition TraCIDefs.h:443
std::string getString() const override
Definition TraCIDefs.h:433
std::string stoppingPlaceID
Id assigned to the stop.
Definition TraCIDefs.h:644
std::string lane
The lane to stop at.
Definition TraCIDefs.h:638
int stopFlags
Stop flags.
Definition TraCIDefs.h:646
std::string actType
additional information for this stop
Definition TraCIDefs.h:662
std::string tripId
id of the trip within a cyclical public transport route
Definition TraCIDefs.h:664
std::string getString() const
Definition TraCIDefs.h:629
double startPos
The stopping position start.
Definition TraCIDefs.h:640
double arrival
The actual arrival time (only for past stops)
Definition TraCIDefs.h:654
TraCINextStopData(const std::string &lane="", double startPos=INVALID_DOUBLE_VALUE, double endPos=INVALID_DOUBLE_VALUE, const std::string &stoppingPlaceID="", int stopFlags=0, double duration=INVALID_DOUBLE_VALUE, double until=INVALID_DOUBLE_VALUE, double intendedArrival=INVALID_DOUBLE_VALUE, double arrival=INVALID_DOUBLE_VALUE, double depart=INVALID_DOUBLE_VALUE, const std::string &split="", const std::string &join="", const std::string &actType="", const std::string &tripId="", const std::string &line="", double speed=0)
Definition TraCIDefs.h:595
double depart
The time at which this stop was ended.
Definition TraCIDefs.h:656
std::string join
the id of the vehicle (train portion) to which this vehicle shall be joined
Definition TraCIDefs.h:660
double speed
the speed at which this stop counts as reached (waypoint mode)
Definition TraCIDefs.h:668
double intendedArrival
The intended arrival time.
Definition TraCIDefs.h:652
double endPos
The stopping position end.
Definition TraCIDefs.h:642
std::string split
the id of the vehicle (train portion) that splits of upon reaching this stop
Definition TraCIDefs.h:658
std::string line
the new line id of the trip within a cyclical public transport route
Definition TraCIDefs.h:666
double duration
The intended (minimum) stopping duration.
Definition TraCIDefs.h:648
double until
The time at which the vehicle may continue its journey.
Definition TraCIDefs.h:650
std::vector< TraCINextStopData > value
Definition TraCIDefs.h:687
std::string getString() const override
Definition TraCIDefs.h:677
std::string getString() const
Definition TraCIDefs.h:560
double dist
The distance to the tls.
Definition TraCIDefs.h:572
int tlIndex
The tls index of the controlled link.
Definition TraCIDefs.h:570
std::string id
The id of the next tls.
Definition TraCIDefs.h:568
char state
The current state of the tls.
Definition TraCIDefs.h:574
std::string getString() const override
Definition TraCIDefs.h:579
std::vector< TraCINextTLSData > value
Definition TraCIDefs.h:589
TraCIPhase(const double _duration, const std::string &_state, const double _minDur=libsumo::INVALID_DOUBLE_VALUE, const double _maxDur=libsumo::INVALID_DOUBLE_VALUE, const std::vector< int > &_next=std::vector< int >(), const std::string &_name="", const std::string &_earlyTarget="")
Definition TraCIDefs.h:389
std::vector< int > next
Definition TraCIDefs.h:399
std::string state
Definition TraCIDefs.h:397
std::string earlyTarget
Definition TraCIDefs.h:401
std::string name
Definition TraCIDefs.h:400
A 2D or 3D-position, for 2D positions z == INVALID_DOUBLE_VALUE.
Definition TraCIDefs.h:184
std::string getString() const override
Definition TraCIDefs.h:185
int getType() const override
Definition TraCIDefs.h:194
A list of positions.
Definition TraCIDefs.h:245
std::string getString() const override
Definition TraCIDefs.h:246
std::vector< TraCIPosition > value
Definition TraCIDefs.h:255
double depart
pickup-time
Definition TraCIDefs.h:801
double departPos
pickup position on the origin edge
Definition TraCIDefs.h:797
double reservationTime
time when the reservation was made
Definition TraCIDefs.h:803
double arrivalPos
drop-off position on the destination edge
Definition TraCIDefs.h:799
std::vector< std::string > persons
The persons ids that are part of this reservation.
Definition TraCIDefs.h:789
int state
the state of this reservation
Definition TraCIDefs.h:805
std::string fromEdge
The origin edge id.
Definition TraCIDefs.h:793
std::string group
The group id of this reservation.
Definition TraCIDefs.h:791
std::string id
The id of the taxi reservation (usable for traci.vehicle.dispatchTaxi)
Definition TraCIDefs.h:787
std::string toEdge
The destination edge id.
Definition TraCIDefs.h:795
TraCIReservation(const std::string &id, const std::vector< std::string > &persons, const std::string &group, const std::string &fromEdge, const std::string &toEdge, double departPos, double arrivalPos, double depart, double reservationTime, int state)
Definition TraCIDefs.h:774
std::string getString() const
Definition TraCIDefs.h:807
std::vector< TraCIReservation > value
Definition TraCIDefs.h:826
std::string getString() const override
Definition TraCIDefs.h:816
TraCIResult & operator=(const TraCIResult &)=default
TraCIResult(const TraCIResult &)=default
virtual ~TraCIResult()
Definition TraCIDefs.h:168
virtual std::string getString() const
Definition TraCIDefs.h:173
virtual int getType() const
Definition TraCIDefs.h:176
An edgeId, position and laneIndex.
Definition TraCIDefs.h:206
TraCIRoadPosition(const std::string e="", const double p=INVALID_DOUBLE_VALUE, const int li=INVALID_INT_VALUE)
Definition TraCIDefs.h:207
std::string getString() const override
Definition TraCIDefs.h:208
int getType() const override
Definition TraCIDefs.h:213
std::string foeId
the tripId or vehicle id of the train that must pass first
Definition TraCIDefs.h:874
std::string tripId
the tripId or vehicle id of the train that is constrained
Definition TraCIDefs.h:872
std::string foeSignal
the tlsID of the rail signla that the foe must pass first
Definition TraCIDefs.h:876
std::string signalId
the idea of the rail signal where this constraint is active
Definition TraCIDefs.h:870
std::map< std::string, std::string > param
additional parameters
Definition TraCIDefs.h:886
bool active
whether this constraint is active
Definition TraCIDefs.h:884
std::string getString() const
Definition TraCIDefs.h:888
int type
the type of constraint (predecessor:0, insertionPredecessor:1)
Definition TraCIDefs.h:880
bool mustWait
whether tripId must still wait for foeId to pass foeSignal
Definition TraCIDefs.h:882
int limit
the number of trains that must be recorded at the foeSignal
Definition TraCIDefs.h:878
std::vector< TraCISignalConstraint > value
Definition TraCIDefs.h:907
std::string getString() const override
Definition TraCIDefs.h:897
std::string intended
id of the intended vehicle for public transport ride
Definition TraCIDefs.h:759
int type
The type of stage (walking, driving, ...)
Definition TraCIDefs.h:743
std::string destStop
The id of the destination stop.
Definition TraCIDefs.h:749
double length
length in m
Definition TraCIDefs.h:757
double travelTime
duration of the stage in seconds
Definition TraCIDefs.h:753
double departPos
position on the lane when starting the stage
Definition TraCIDefs.h:763
std::string description
arbitrary description string
Definition TraCIDefs.h:767
std::string line
The line or the id of the vehicle type.
Definition TraCIDefs.h:747
double cost
effort needed
Definition TraCIDefs.h:755
TraCIStage(int type=INVALID_INT_VALUE, const std::string &vType="", const std::string &line="", const std::string &destStop="", const std::vector< std::string > &edges=std::vector< std::string >(), double travelTime=INVALID_DOUBLE_VALUE, double cost=INVALID_DOUBLE_VALUE, double length=INVALID_DOUBLE_VALUE, const std::string &intended="", double depart=INVALID_DOUBLE_VALUE, double departPos=INVALID_DOUBLE_VALUE, double arrivalPos=INVALID_DOUBLE_VALUE, const std::string &description="")
Definition TraCIDefs.h:735
double depart
intended depart time for public transport ride or INVALID_DOUBLE_VALUE
Definition TraCIDefs.h:761
std::vector< std::string > edges
The sequence of edges to travel.
Definition TraCIDefs.h:751
double arrivalPos
position on the lane when ending the stage
Definition TraCIDefs.h:765
std::string vType
The vehicle type when using a private car or bike.
Definition TraCIDefs.h:745
std::string getString() const override
Definition TraCIDefs.h:364
std::vector< std::pair< std::string, double > > value
Definition TraCIDefs.h:373
TraCIString(std::string v="")
Definition TraCIDefs.h:298
int getType() const override
Definition TraCIDefs.h:302
std::string getString() const override
Definition TraCIDefs.h:299
std::string value
Definition TraCIDefs.h:305
std::string getString() const override
Definition TraCIDefs.h:313
std::vector< std::string > value
Definition TraCIDefs.h:322
mirrors MSInductLoop::VehicleData
Definition TraCIDefs.h:523
std::string id
The id of the vehicle.
Definition TraCIDefs.h:532
double entryTime
Entry-time of the vehicle in [s].
Definition TraCIDefs.h:536
std::string typeID
Type of the vehicle in.
Definition TraCIDefs.h:540
double length
Length of the vehicle.
Definition TraCIDefs.h:534
std::string getString() const
Definition TraCIDefs.h:524
double leaveTime
Leave-time of the vehicle in [s].
Definition TraCIDefs.h:538
std::string getString() const override
Definition TraCIDefs.h:545
std::vector< TraCIVehicleData > value
Definition TraCIDefs.h:555