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-2025 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
167 virtual ~TraCIResult() {}
168 virtual std::string getString() const {
169 return "";
170 }
171 virtual int getType() const {
172 return -1;
173 }
174};
175
180 std::string getString() const {
181 std::ostringstream os;
182 os << "TraCIPosition(" << x << "," << y;
183 if (z != INVALID_DOUBLE_VALUE) {
184 os << "," << z;
185 }
186 os << ")";
187 return os.str();
188 }
189 int getType() const {
191 }
193#ifdef SWIGJAVA
195#endif
196};
197
202 TraCIRoadPosition(const std::string e = "", const double p = INVALID_DOUBLE_VALUE, const int li = INVALID_INT_VALUE) : edgeID(e), pos(p), laneIndex(li) {}
203 std::string getString() const {
204 std::ostringstream os;
205 os << "TraCIRoadPosition(" << edgeID << "_" << laneIndex << "," << pos << ")";
206 return os.str();
207 }
208 int getType() const {
209 return POSITION_ROADMAP;
210 }
211 std::string edgeID;
212 double pos;
214#ifdef SWIGJAVA
216#endif
217};
218
223 TraCIColor() : r(0), g(0), b(0), a(255) {}
224 TraCIColor(int r, int g, int b, int a = 255) : r(r), g(g), b(b), a(a) {}
225 std::string getString() const {
226 std::ostringstream os;
227 os << "TraCIColor(" << r << "," << g << "," << b << "," << a << ")";
228 return os.str();
229 }
230 int r, g, b, a;
231#ifdef SWIGJAVA
233#endif
234};
235
236
241 std::string getString() const {
242 std::ostringstream os;
243 os << "[";
244 for (const TraCIPosition& v : value) {
245 os << "(" << v.x << "," << v.y << "," << v.z << ")";
246 }
247 os << "]";
248 return os.str();
249 }
250 std::vector<TraCIPosition> value;
251#ifdef SWIGJAVA
253#endif
254};
255
256
258 TraCIInt(int v = 0, int t = libsumo::TYPE_INTEGER) : value(v), traciType(t) {}
259 std::string getString() const {
260 std::ostringstream os;
261 os << value;
262 return os.str();
263 }
264 int getType() const {
265 return traciType;
266 }
267 int value;
269#ifdef SWIGJAVA
271#endif
272};
273
274
276 TraCIDouble(double v = 0.) : value(v) {}
277 std::string getString() const {
278 std::ostringstream os;
279 os << value;
280 return os.str();
281 }
282 int getType() const {
284 }
285 double value;
286#ifdef SWIGJAVA
288#endif
289};
290
291
293 TraCIString(std::string v = "") : value(v) {}
294 std::string getString() const {
295 return value;
296 }
297 int getType() const {
299 }
300 std::string value;
301#ifdef SWIGJAVA
303#endif
304};
305
306
308 std::string getString() const {
309 std::ostringstream os;
310 os << "[";
311 for (std::string v : value) {
312 os << v << ",";
313 }
314 os << "]";
315 return os.str();
316 }
317 std::vector<std::string> value;
318#ifdef SWIGJAVA
320#endif
321};
322
323
325 std::string getString() const {
326 std::ostringstream os;
327 os << "[";
328 for (double v : value) {
329 os << v << ",";
330 }
331 os << "]";
332 return os.str();
333 }
334 std::vector<double> value;
335#ifdef SWIGJAVA
337#endif
338};
339
340
342 std::string getString() const {
343 std::ostringstream os;
344 os << "[";
345 for (int v : value) {
346 os << v << ",";
347 }
348 os << "]";
349 return os.str();
350 }
351 std::vector<int> value;
352#ifdef SWIGJAVA
354#endif
355};
356
357
359 std::string getString() const {
360 std::ostringstream os;
361 os << "[";
362 for (const auto& v : value) {
363 os << "(" << v.first << "," << v.second << "),";
364 }
365 os << "]";
366 return os.str();
367 }
368 std::vector<std::pair<std::string, double> > value;
369#ifdef SWIGJAVA
371#endif
372};
373
374
376typedef std::map<int, std::shared_ptr<libsumo::TraCIResult> > TraCIResults;
378typedef std::map<std::string, libsumo::TraCIResults> SubscriptionResults;
379typedef std::map<std::string, libsumo::SubscriptionResults> ContextSubscriptionResults;
380
381
384 TraCIPhase(const double _duration, const std::string& _state, const double _minDur = libsumo::INVALID_DOUBLE_VALUE,
385 const double _maxDur = libsumo::INVALID_DOUBLE_VALUE,
386 const std::vector<int>& _next = std::vector<int>(),
387 const std::string& _name = "",
388 const std::string& _earlyTarget = "") :
389 duration(_duration), state(_state), minDur(_minDur), maxDur(_maxDur), next(_next), name(_name), earlyTarget(_earlyTarget) {}
391
392 double duration;
393 std::string state;
394 double minDur, maxDur;
395 std::vector<int> next;
396 std::string name;
397 std::string earlyTarget;
398};
399}
400
401
402#ifdef SWIG
403%template(TraCIPhaseVector) std::vector<std::shared_ptr<libsumo::TraCIPhase> >; // *NOPAD*
404#endif
405
406
407namespace libsumo {
410 TraCILogic(const std::string& _programID, const int _type, const int _currentPhaseIndex,
411 const std::vector<std::shared_ptr<libsumo::TraCIPhase> >& _phases = std::vector<std::shared_ptr<libsumo::TraCIPhase> >())
412 : programID(_programID), type(_type), currentPhaseIndex(_currentPhaseIndex), phases(_phases) {}
414
415 std::string getString() const {
416 std::ostringstream os;
417 os << "TraCILink(" << programID << "," << type << "," << currentPhaseIndex << ")";
418 return os.str();
419 }
420
421 std::string programID;
422 int type;
424 std::vector<std::shared_ptr<libsumo::TraCIPhase> > phases;
425 std::map<std::string, std::string> subParameter;
426};
427
428
430 std::string getString() const {
431 std::ostringstream os;
432 os << "TraCILogicVectorWrapped[";
433 for (const TraCILogic& v : value) {
434 os << v.getString() << ",";
435 }
436 os << "]";
437 return os.str();
438 }
439
440 std::vector<TraCILogic> value;
441};
442
443
444struct TraCILink {
446 TraCILink(const std::string& _from, const std::string& _via, const std::string& _to)
447 : fromLane(_from), viaLane(_via), toLane(_to) {}
449
450 std::string getString() const {
451 std::ostringstream os;
452 os << "TraCILink(" << fromLane << "," << viaLane << "," << toLane << ")";
453 return os.str();
454 }
455
456 std::string fromLane;
457 std::string viaLane;
458 std::string toLane;
459};
460
461
463 std::string getString() const {
464 std::ostringstream os;
465 os << "TraCILinkVectorVectorWrapped[";
466 for (const std::vector<TraCILink>& v : value) {
467 os << "[";
468 for (const TraCILink& tl : v) {
469 os << tl.getString() << ",";
470 }
471 }
472 os << "]";
473 return os.str();
474 }
475
476 std::vector<std::vector<TraCILink> > value;
477};
478
479
481 TraCIConnection() {} // this is needed by SWIG when building a vector of this type, please don't use it
482 TraCIConnection(const std::string& _approachedLane, const bool _hasPrio, const bool _isOpen, const bool _hasFoe,
483 const std::string _approachedInternal, const std::string _state, const std::string _direction, const double _length)
484 : approachedLane(_approachedLane), hasPrio(_hasPrio), isOpen(_isOpen), hasFoe(_hasFoe),
485 approachedInternal(_approachedInternal), state(_state), direction(_direction), length(_length) {}
487
488 std::string getString() const {
489 std::ostringstream os;
490 os << "TraCIConnection(" << approachedLane << "," << hasPrio << "," << isOpen
491 << "," << hasFoe << "," << approachedInternal << "," << state << "," << direction << "," << length << ")";
492 return os.str();
493 }
494
495 std::string approachedLane;
497 bool isOpen;
498 bool hasFoe;
500 std::string state;
501 std::string direction;
502 double length;
503};
504
505
507 std::string getString() const {
508 std::ostringstream os;
509 os << "TraCIConnectionVectorWrapped[";
510 for (const TraCIConnection& v : value) {
511 os << v.getString() << ",";
512 }
513 os << "]";
514 return os.str();
515 }
516
517 std::vector<TraCIConnection> value;
518};
519
520
523 std::string getString() const {
524 std::ostringstream os;
525 os << "TraCIVehicleData(" << id << "," << length << "," << entryTime
526 << "," << leaveTime << "," << typeID << ")";
527 return os.str();
528 }
529
531 std::string id;
533 double length;
535 double entryTime;
537 double leaveTime;
539 std::string typeID;
540};
541
542
544 std::string getString() const {
545 std::ostringstream os;
546 os << "TraCIVehicleDataVectorWrapped[";
547 for (const TraCIVehicleData& v : value) {
548 os << v.getString() << ",";
549 }
550 os << "]";
551 return os.str();
552 }
553
554 std::vector<TraCIVehicleData> value;
555};
556
557
559 std::string getString() const {
560 std::ostringstream os;
561 os << "TraCINextTLSData(" << id << "," << tlIndex << "," << dist
562 << "," << state << ")";
563 return os.str();
564 }
565
567 std::string id;
571 double dist;
573 char state;
574};
575
576
578 std::string getString() const {
579 std::ostringstream os;
580 os << "TraCINextTLSDataVectorWrapped[";
581 for (const TraCINextTLSData& v : value) {
582 os << v.getString() << ",";
583 }
584 os << "]";
585 return os.str();
586 }
587
588 std::vector<TraCINextTLSData> value;
589};
590
591
593
594 TraCINextStopData(const std::string& lane = "",
595 double startPos = INVALID_DOUBLE_VALUE,
596 double endPos = INVALID_DOUBLE_VALUE,
597 const std::string& stoppingPlaceID = "",
598 int stopFlags = 0,
599 double duration = INVALID_DOUBLE_VALUE,
600 double until = INVALID_DOUBLE_VALUE,
601 double intendedArrival = INVALID_DOUBLE_VALUE,
602 double arrival = INVALID_DOUBLE_VALUE,
603 double depart = INVALID_DOUBLE_VALUE,
604 const std::string& split = "",
605 const std::string& join = "",
606 const std::string& actType = "",
607 const std::string& tripId = "",
608 const std::string& line = "",
609 double speed = 0):
610 lane(lane),
611 startPos(startPos),
612 endPos(endPos),
613 stoppingPlaceID(stoppingPlaceID),
614 stopFlags(stopFlags),
615 duration(duration),
616 until(until),
617 intendedArrival(intendedArrival),
618 arrival(arrival),
619 depart(depart),
620 split(split),
621 join(join),
622 actType(actType),
623 tripId(tripId),
624 line(line),
625 speed(speed)
626 {}
627
628 std::string getString() const {
629 std::ostringstream os;
630 os << "TraCINextStopData(" << lane << "," << endPos << "," << stoppingPlaceID
631 << "," << stopFlags << "," << duration << "," << until
632 << "," << arrival << ")";
633 return os.str();
634 }
635
637 std::string lane;
639 double startPos;
641 double endPos;
643 std::string stoppingPlaceID;
647 double duration;
649 double until;
653 double arrival;
655 double depart;
657 std::string split;
659 std::string join;
661 std::string actType;
663 std::string tripId;
665 std::string line;
667 double speed;
668};
669
670
676 std::string getString() const {
677 std::ostringstream os;
678 os << "TraCINextStopDataVectorWrapped[";
679 for (const TraCINextStopData& v : value) {
680 os << v.getString() << ",";
681 }
682 os << "]";
683 return os.str();
684 }
685
686 std::vector<TraCINextStopData> value;
687};
688
689
691 std::string getString() const {
692 std::ostringstream os;
693 os << "TraCIBestLanesData(" << laneID << "," << length << "," << occupation
694 << "," << bestLaneOffset << "," << allowsContinuation << ",[";
695 for (const std::string& s : continuationLanes) {
696 os << s << ",";
697 }
698 os << "])";
699 return os.str();
700 }
701
703 std::string laneID;
705 double length;
713 std::vector<std::string> continuationLanes;
714};
715
716
718 std::string getString() const {
719 std::ostringstream os;
720 os << "TraCIBestLanesDataVectorWrapped[";
721 for (const TraCIBestLanesData& v : value) {
722 os << v.getString() << ",";
723 }
724 os << "]";
725 return os.str();
726 }
727
728 std::vector<TraCIBestLanesData> value;
729};
730
731
733public:
734 TraCIStage(int type = INVALID_INT_VALUE, const std::string& vType = "", const std::string& line = "", const std::string& destStop = "",
735 const std::vector<std::string>& edges = std::vector<std::string>(),
736 double travelTime = INVALID_DOUBLE_VALUE, double cost = INVALID_DOUBLE_VALUE, double length = INVALID_DOUBLE_VALUE,
737 const std::string& intended = "", double depart = INVALID_DOUBLE_VALUE, double departPos = INVALID_DOUBLE_VALUE,
738 double arrivalPos = INVALID_DOUBLE_VALUE, const std::string& description = "") :
739 type(type), vType(vType), line(line), destStop(destStop), edges(edges), travelTime(travelTime), cost(cost),
740 length(length), intended(intended), depart(depart), departPos(departPos), arrivalPos(arrivalPos), description(description) {}
742 int type;
744 std::string vType;
746 std::string line;
748 std::string destStop;
750 std::vector<std::string> edges;
754 double cost;
756 double length;
758 std::string intended;
760 double depart;
762 double departPos;
766 std::string description;
767};
768
769
770
773 TraCIReservation(const std::string& id,
774 const std::vector<std::string>& persons,
775 const std::string& group,
776 const std::string& fromEdge,
777 const std::string& toEdge,
778 double departPos,
779 double arrivalPos,
780 double depart,
781 double reservationTime,
782 int state) :
783 id(id), persons(persons), group(group), fromEdge(fromEdge), toEdge(toEdge), departPos(departPos), arrivalPos(arrivalPos),
784 depart(depart), reservationTime(reservationTime), state(state) {}
786 std::string id;
788 std::vector<std::string> persons;
790 std::string group;
792 std::string fromEdge;
794 std::string toEdge;
796 double departPos;
800 double depart;
804 int state;
805
806 std::string getString() const {
807 std::ostringstream os;
808 os << "TraCIReservation(id=" << id << ")";
809 return os.str();
810 }
811};
812
813
815 std::string getString() const {
816 std::ostringstream os;
817 os << "TraCIReservationVectorWrapped[";
818 for (const TraCIReservation& v : value) {
819 os << v.getString() << ",";
820 }
821 os << "]";
822 return os.str();
823 }
824
825 std::vector<TraCIReservation> value;
826};
827
828
831 std::string collider;
832 std::string victim;
833 std::string colliderType;
834 std::string victimType;
838 std::string type;
840 std::string lane;
842 double pos;
843
844 std::string getString() const {
845 std::ostringstream os;
846 os << "TraCICollision(collider=" << collider << ", victim=" << victim << ")";
847 return os.str();
848 }
849};
850
851
853 std::string getString() const {
854 std::ostringstream os;
855 os << "TraCICollisionVectorWrapped[";
856 for (const TraCICollision& v : value) {
857 os << v.getString() << ",";
858 }
859 os << "]";
860 return os.str();
861 }
862
863 std::vector<TraCICollision> value;
864};
865
866
869 std::string signalId;
871 std::string tripId;
873 std::string foeId;
875 std::string foeSignal;
877 int limit;
879 int type;
883 bool active;
885 std::map<std::string, std::string> param;
886
887 std::string getString() const {
888 std::ostringstream os;
889 os << "TraCISignalConstraint(signalId=" << signalId << ", tripid=" << tripId << ", foeSignal=" << foeSignal << ", foeId=" << foeId << ")";
890 return os.str();
891 }
892};
893
894
896 std::string getString() const {
897 std::ostringstream os;
898 os << "TraCISignalConstraintVectorWrapped[";
899 for (const TraCISignalConstraint& v : value) {
900 os << v.getString() << ",";
901 }
902 os << "]";
903 return os.str();
904 }
905
906 std::vector<TraCISignalConstraint> value;
907};
908
909
912 std::string foeId;
913 double egoDist;
914 double foeDist;
917 std::string egoLane;
918 std::string foeLane;
921
922 std::string getString() const {
923 std::ostringstream os;
924 os << "TraCIJunctionFoe(foeId=" << foeId << ", egoDist=" << egoDist << ", foeDist=" << foeDist << ", foeDist=" << foeDist << ")";
925 return os.str();
926 }
927};
928
929
931 std::string getString() const {
932 std::ostringstream os;
933 os << "TraCIJunctionFoeVectorWrapped[";
934 for (const TraCIJunctionFoe& v : value) {
935 os << v.getString() << ",";
936 }
937 os << "]";
938 return os.str();
939 }
940
941 std::vector<TraCIJunctionFoe> value;
942};
943
944
945}
946
947// pop MSVC warnings
948#ifdef _MSC_VER
949#pragma warning(pop)
950#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:379
TRACI_CONST int POSITION_2D
TRACI_CONST int TYPE_INTEGER
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition TraCIDefs.h:378
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:376
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:705
std::string getString() const
Definition TraCIDefs.h:691
double occupation
The traffic density along length.
Definition TraCIDefs.h:707
bool allowsContinuation
Whether this lane allows continuing the route.
Definition TraCIDefs.h:711
int bestLaneOffset
The offset of this lane from the best lane.
Definition TraCIDefs.h:709
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
Definition TraCIDefs.h:713
std::string laneID
The id of the lane.
Definition TraCIDefs.h:703
std::vector< TraCIBestLanesData > value
Definition TraCIDefs.h:728
std::string lane
The lane where the collision happended.
Definition TraCIDefs.h:840
std::string type
The type of collision.
Definition TraCIDefs.h:838
std::string collider
The ids of the participating vehicles and persons.
Definition TraCIDefs.h:831
double pos
The position of the collision along the lane.
Definition TraCIDefs.h:842
std::string colliderType
Definition TraCIDefs.h:833
std::string getString() const
Definition TraCIDefs.h:844
std::vector< TraCICollision > value
Definition TraCIDefs.h:863
std::string getString() const
Definition TraCIDefs.h:225
TraCIColor(int r, int g, int b, int a=255)
Definition TraCIDefs.h:224
std::string getString() const
Definition TraCIDefs.h:488
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:482
std::string approachedLane
Definition TraCIDefs.h:495
std::string approachedInternal
Definition TraCIDefs.h:499
std::vector< TraCIConnection > value
Definition TraCIDefs.h:517
TraCIDouble(double v=0.)
Definition TraCIDefs.h:276
int getType() const
Definition TraCIDefs.h:282
std::string getString() const
Definition TraCIDefs.h:277
std::vector< double > value
Definition TraCIDefs.h:334
std::string getString() const
Definition TraCIDefs.h:325
TraCIInt(int v=0, int t=libsumo::TYPE_INTEGER)
Definition TraCIDefs.h:258
int getType() const
Definition TraCIDefs.h:264
std::string getString() const
Definition TraCIDefs.h:259
std::string getString() const
Definition TraCIDefs.h:342
std::vector< int > value
Definition TraCIDefs.h:351
std::string getString() const
Definition TraCIDefs.h:922
std::string foeId
the id of the vehicle with intersecting trajectory
Definition TraCIDefs.h:912
std::vector< TraCIJunctionFoe > value
Definition TraCIDefs.h:941
std::map< std::string, std::string > subParameter
Definition TraCIDefs.h:425
std::string programID
Definition TraCIDefs.h:421
std::vector< std::shared_ptr< libsumo::TraCIPhase > > phases
Definition TraCIDefs.h:424
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:410
std::string getString() const
Definition TraCIDefs.h:415
std::vector< TraCILogic > value
Definition TraCIDefs.h:440
std::string getString() const
Definition TraCIDefs.h:430
std::string stoppingPlaceID
Id assigned to the stop.
Definition TraCIDefs.h:643
std::string lane
The lane to stop at.
Definition TraCIDefs.h:637
int stopFlags
Stop flags.
Definition TraCIDefs.h:645
std::string actType
additional information for this stop
Definition TraCIDefs.h:661
std::string tripId
id of the trip within a cyclical public transport route
Definition TraCIDefs.h:663
std::string getString() const
Definition TraCIDefs.h:628
double startPos
The stopping position start.
Definition TraCIDefs.h:639
double arrival
The actual arrival time (only for past stops)
Definition TraCIDefs.h:653
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:594
double depart
The time at which this stop was ended.
Definition TraCIDefs.h:655
std::string join
the id of the vehicle (train portion) to which this vehicle shall be joined
Definition TraCIDefs.h:659
double speed
the speed at which this stop counts as reached (waypoint mode)
Definition TraCIDefs.h:667
double intendedArrival
The intended arrival time.
Definition TraCIDefs.h:651
double endPos
The stopping position end.
Definition TraCIDefs.h:641
std::string split
the id of the vehicle (train portion) that splits of upon reaching this stop
Definition TraCIDefs.h:657
std::string line
the new line id of the trip within a cyclical public transport route
Definition TraCIDefs.h:665
double duration
The intended (minimum) stopping duration.
Definition TraCIDefs.h:647
double until
The time at which the vehicle may continue its journey.
Definition TraCIDefs.h:649
std::vector< TraCINextStopData > value
Definition TraCIDefs.h:686
std::string getString() const
Definition TraCIDefs.h:559
double dist
The distance to the tls.
Definition TraCIDefs.h:571
int tlIndex
The tls index of the controlled link.
Definition TraCIDefs.h:569
std::string id
The id of the next tls.
Definition TraCIDefs.h:567
char state
The current state of the tls.
Definition TraCIDefs.h:573
std::vector< TraCINextTLSData > value
Definition TraCIDefs.h:588
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:384
std::vector< int > next
Definition TraCIDefs.h:395
std::string state
Definition TraCIDefs.h:393
std::string earlyTarget
Definition TraCIDefs.h:397
std::string name
Definition TraCIDefs.h:396
A 2D or 3D-position, for 2D positions z == INVALID_DOUBLE_VALUE.
Definition TraCIDefs.h:179
std::string getString() const
Definition TraCIDefs.h:180
A list of positions.
Definition TraCIDefs.h:240
std::string getString() const
Definition TraCIDefs.h:241
std::vector< TraCIPosition > value
Definition TraCIDefs.h:250
double depart
pickup-time
Definition TraCIDefs.h:800
double departPos
pickup position on the origin edge
Definition TraCIDefs.h:796
double reservationTime
time when the reservation was made
Definition TraCIDefs.h:802
double arrivalPos
drop-off position on the destination edge
Definition TraCIDefs.h:798
std::vector< std::string > persons
The persons ids that are part of this reservation.
Definition TraCIDefs.h:788
int state
the state of this reservation
Definition TraCIDefs.h:804
std::string fromEdge
The origin edge id.
Definition TraCIDefs.h:792
std::string group
The group id of this reservation.
Definition TraCIDefs.h:790
std::string id
The id of the taxi reservation (usable for traci.vehicle.dispatchTaxi)
Definition TraCIDefs.h:786
std::string toEdge
The destination edge id.
Definition TraCIDefs.h:794
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:773
std::string getString() const
Definition TraCIDefs.h:806
std::vector< TraCIReservation > value
Definition TraCIDefs.h:825
virtual ~TraCIResult()
Definition TraCIDefs.h:167
virtual std::string getString() const
Definition TraCIDefs.h:168
virtual int getType() const
Definition TraCIDefs.h:171
An edgeId, position and laneIndex.
Definition TraCIDefs.h:201
std::string getString() const
Definition TraCIDefs.h:203
TraCIRoadPosition(const std::string e="", const double p=INVALID_DOUBLE_VALUE, const int li=INVALID_INT_VALUE)
Definition TraCIDefs.h:202
std::string foeId
the tripId or vehicle id of the train that must pass first
Definition TraCIDefs.h:873
std::string tripId
the tripId or vehicle id of the train that is constrained
Definition TraCIDefs.h:871
std::string foeSignal
the tlsID of the rail signla that the foe must pass first
Definition TraCIDefs.h:875
std::string signalId
the idea of the rail signal where this constraint is active
Definition TraCIDefs.h:869
std::map< std::string, std::string > param
additional parameters
Definition TraCIDefs.h:885
bool active
whether this constraint is active
Definition TraCIDefs.h:883
std::string getString() const
Definition TraCIDefs.h:887
int type
the type of constraint (predecessor:0, insertionPredecessor:1)
Definition TraCIDefs.h:879
bool mustWait
whether tripId must still wait for foeId to pass foeSignal
Definition TraCIDefs.h:881
int limit
the number of trains that must be recorded at the foeSignal
Definition TraCIDefs.h:877
std::vector< TraCISignalConstraint > value
Definition TraCIDefs.h:906
std::string intended
id of the intended vehicle for public transport ride
Definition TraCIDefs.h:758
int type
The type of stage (walking, driving, ...)
Definition TraCIDefs.h:742
std::string destStop
The id of the destination stop.
Definition TraCIDefs.h:748
double length
length in m
Definition TraCIDefs.h:756
double travelTime
duration of the stage in seconds
Definition TraCIDefs.h:752
double departPos
position on the lane when starting the stage
Definition TraCIDefs.h:762
std::string description
arbitrary description string
Definition TraCIDefs.h:766
std::string line
The line or the id of the vehicle type.
Definition TraCIDefs.h:746
double cost
effort needed
Definition TraCIDefs.h:754
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:734
double depart
intended depart time for public transport ride or INVALID_DOUBLE_VALUE
Definition TraCIDefs.h:760
std::vector< std::string > edges
The sequence of edges to travel.
Definition TraCIDefs.h:750
double arrivalPos
position on the lane when ending the stage
Definition TraCIDefs.h:764
std::string vType
The vehicle type when using a private car or bike.
Definition TraCIDefs.h:744
std::string getString() const
Definition TraCIDefs.h:359
std::vector< std::pair< std::string, double > > value
Definition TraCIDefs.h:368
TraCIString(std::string v="")
Definition TraCIDefs.h:293
std::string value
Definition TraCIDefs.h:300
int getType() const
Definition TraCIDefs.h:297
std::string getString() const
Definition TraCIDefs.h:294
std::vector< std::string > value
Definition TraCIDefs.h:317
std::string getString() const
Definition TraCIDefs.h:308
mirrors MSInductLoop::VehicleData
Definition TraCIDefs.h:522
std::string id
The id of the vehicle.
Definition TraCIDefs.h:531
double entryTime
Entry-time of the vehicle in [s].
Definition TraCIDefs.h:535
std::string typeID
Type of the vehicle in.
Definition TraCIDefs.h:539
double length
Length of the vehicle.
Definition TraCIDefs.h:533
std::string getString() const
Definition TraCIDefs.h:523
double leaveTime
Leave-time of the vehicle in [s].
Definition TraCIDefs.h:537
std::vector< TraCIVehicleData > value
Definition TraCIDefs.h:554