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 const double _offset = 0.)
417 : programID(_programID), type(_type), currentPhaseIndex(_currentPhaseIndex), phases(_phases), offset(_offset) {}
418
419 std::string getString() const {
420 std::ostringstream os;
421 os << "TraCILink(" << programID << "," << type << "," << currentPhaseIndex << ")";
422 return os.str();
423 }
424
425 std::string programID;
426 int type;
428 std::vector<std::shared_ptr<libsumo::TraCIPhase> > phases;
429 std::map<std::string, std::string> subParameter;
430 double offset = 0.;
431};
432
433
435 std::string getString() const override {
436 std::ostringstream os;
437 os << "TraCILogicVectorWrapped[";
438 for (const TraCILogic& v : value) {
439 os << v.getString() << ",";
440 }
441 os << "]";
442 return os.str();
443 }
444
445 std::vector<TraCILogic> value;
446};
447
448
449struct TraCILink {
451 TraCILink(const std::string& _from, const std::string& _via, const std::string& _to)
452 : fromLane(_from), viaLane(_via), toLane(_to) {}
453
454 std::string getString() const {
455 std::ostringstream os;
456 os << "TraCILink(" << fromLane << "," << viaLane << "," << toLane << ")";
457 return os.str();
458 }
459
460 std::string fromLane;
461 std::string viaLane;
462 std::string toLane;
463};
464
465
467 std::string getString() const override {
468 std::ostringstream os;
469 os << "TraCILinkVectorVectorWrapped[";
470 for (const std::vector<TraCILink>& v : value) {
471 os << "[";
472 for (const TraCILink& tl : v) {
473 os << tl.getString() << ",";
474 }
475 }
476 os << "]";
477 return os.str();
478 }
479
480 std::vector<std::vector<TraCILink> > value;
481};
482
483
485 TraCIConnection() {} // this is needed by SWIG when building a vector of this type, please don't use it
486 TraCIConnection(const std::string& _approachedLane, const bool _hasPrio, const bool _isOpen, const bool _hasFoe,
487 const std::string _approachedInternal, const std::string _state, const std::string _direction, const double _length)
488 : approachedLane(_approachedLane), hasPrio(_hasPrio), isOpen(_isOpen), hasFoe(_hasFoe),
489 approachedInternal(_approachedInternal), state(_state), direction(_direction), length(_length) {}
490
491 std::string getString() const {
492 std::ostringstream os;
493 os << "TraCIConnection(" << approachedLane << "," << hasPrio << "," << isOpen
494 << "," << hasFoe << "," << approachedInternal << "," << state << "," << direction << "," << length << ")";
495 return os.str();
496 }
497
498 std::string approachedLane;
500 bool isOpen;
501 bool hasFoe;
503 std::string state;
504 std::string direction;
505 double length;
506};
507
508
510 std::string getString() const override {
511 std::ostringstream os;
512 os << "TraCIConnectionVectorWrapped[";
513 for (const TraCIConnection& v : value) {
514 os << v.getString() << ",";
515 }
516 os << "]";
517 return os.str();
518 }
519
520 std::vector<TraCIConnection> value;
521};
522
523
526 std::string getString() const {
527 std::ostringstream os;
528 os << "TraCIVehicleData(" << id << "," << length << "," << entryTime
529 << "," << leaveTime << "," << typeID << ")";
530 return os.str();
531 }
532
534 std::string id;
536 double length;
538 double entryTime;
540 double leaveTime;
542 std::string typeID;
543};
544
545
547 std::string getString() const override {
548 std::ostringstream os;
549 os << "TraCIVehicleDataVectorWrapped[";
550 for (const TraCIVehicleData& v : value) {
551 os << v.getString() << ",";
552 }
553 os << "]";
554 return os.str();
555 }
556
557 std::vector<TraCIVehicleData> value;
558};
559
560
562 std::string getString() const {
563 std::ostringstream os;
564 os << "TraCINextTLSData(" << id << "," << tlIndex << "," << dist
565 << "," << state << ")";
566 return os.str();
567 }
568
570 std::string id;
574 double dist;
576 char state;
577};
578
579
581 std::string getString() const override {
582 std::ostringstream os;
583 os << "TraCINextTLSDataVectorWrapped[";
584 for (const TraCINextTLSData& v : value) {
585 os << v.getString() << ",";
586 }
587 os << "]";
588 return os.str();
589 }
590
591 std::vector<TraCINextTLSData> value;
592};
593
594
596
597 TraCINextStopData(const std::string& lane = "",
598 double startPos = INVALID_DOUBLE_VALUE,
599 double endPos = INVALID_DOUBLE_VALUE,
600 const std::string& stoppingPlaceID = "",
601 int stopFlags = 0,
602 double duration = INVALID_DOUBLE_VALUE,
603 double until = INVALID_DOUBLE_VALUE,
604 double intendedArrival = INVALID_DOUBLE_VALUE,
605 double arrival = INVALID_DOUBLE_VALUE,
606 double depart = INVALID_DOUBLE_VALUE,
607 const std::string& split = "",
608 const std::string& join = "",
609 const std::string& actType = "",
610 const std::string& tripId = "",
611 const std::string& line = "",
612 double speed = 0):
613 lane(lane),
614 startPos(startPos),
615 endPos(endPos),
616 stoppingPlaceID(stoppingPlaceID),
617 stopFlags(stopFlags),
618 duration(duration),
619 until(until),
620 intendedArrival(intendedArrival),
621 arrival(arrival),
622 depart(depart),
623 split(split),
624 join(join),
625 actType(actType),
626 tripId(tripId),
627 line(line),
628 speed(speed)
629 {}
630
631 std::string getString() const {
632 std::ostringstream os;
633 os << "TraCINextStopData(" << lane << "," << endPos << "," << stoppingPlaceID
634 << "," << stopFlags << "," << duration << "," << until
635 << "," << arrival << ")";
636 return os.str();
637 }
638
640 std::string lane;
642 double startPos;
644 double endPos;
646 std::string stoppingPlaceID;
650 double duration;
652 double until;
656 double arrival;
658 double depart;
660 std::string split;
662 std::string join;
664 std::string actType;
666 std::string tripId;
668 std::string line;
670 double speed;
671};
672
673
679 std::string getString() const override {
680 std::ostringstream os;
681 os << "TraCINextStopDataVectorWrapped[";
682 for (const TraCINextStopData& v : value) {
683 os << v.getString() << ",";
684 }
685 os << "]";
686 return os.str();
687 }
688
689 std::vector<TraCINextStopData> value;
690};
691
692
694 std::string getString() const {
695 std::ostringstream os;
696 os << "TraCIBestLanesData(" << laneID << "," << length << "," << occupation
697 << "," << bestLaneOffset << "," << allowsContinuation << ",[";
698 for (const std::string& s : continuationLanes) {
699 os << s << ",";
700 }
701 os << "])";
702 return os.str();
703 }
704
706 std::string laneID;
708 double length;
716 std::vector<std::string> continuationLanes;
717};
718
719
721 std::string getString() const override {
722 std::ostringstream os;
723 os << "TraCIBestLanesDataVectorWrapped[";
724 for (const TraCIBestLanesData& v : value) {
725 os << v.getString() << ",";
726 }
727 os << "]";
728 return os.str();
729 }
730
731 std::vector<TraCIBestLanesData> value;
732};
733
734
736public:
737 TraCIStage(int type = INVALID_INT_VALUE, const std::string& vType = "", const std::string& line = "", const std::string& destStop = "",
738 const std::vector<std::string>& edges = std::vector<std::string>(),
739 double travelTime = INVALID_DOUBLE_VALUE, double cost = INVALID_DOUBLE_VALUE, double length = INVALID_DOUBLE_VALUE,
740 const std::string& intended = "", double depart = INVALID_DOUBLE_VALUE, double departPos = INVALID_DOUBLE_VALUE,
741 double arrivalPos = INVALID_DOUBLE_VALUE, const std::string& description = "") :
742 type(type), vType(vType), line(line), destStop(destStop), edges(edges), travelTime(travelTime), cost(cost),
743 length(length), intended(intended), depart(depart), departPos(departPos), arrivalPos(arrivalPos), description(description) {}
745 int type;
747 std::string vType;
749 std::string line;
751 std::string destStop;
753 std::vector<std::string> edges;
757 double cost;
759 double length;
761 std::string intended;
763 double depart;
765 double departPos;
769 std::string description;
770};
771
772
773
776 TraCIReservation(const std::string& id,
777 const std::vector<std::string>& persons,
778 const std::string& group,
779 const std::string& fromEdge,
780 const std::string& toEdge,
781 double departPos,
782 double arrivalPos,
783 double depart,
784 double reservationTime,
785 int state) :
786 id(id), persons(persons), group(group), fromEdge(fromEdge), toEdge(toEdge), departPos(departPos), arrivalPos(arrivalPos),
787 depart(depart), reservationTime(reservationTime), state(state) {}
789 std::string id;
791 std::vector<std::string> persons;
793 std::string group;
795 std::string fromEdge;
797 std::string toEdge;
799 double departPos;
803 double depart;
807 int state;
808
809 std::string getString() const {
810 std::ostringstream os;
811 os << "TraCIReservation(id=" << id << ")";
812 return os.str();
813 }
814};
815
816
818 std::string getString() const override {
819 std::ostringstream os;
820 os << "TraCIReservationVectorWrapped[";
821 for (const TraCIReservation& v : value) {
822 os << v.getString() << ",";
823 }
824 os << "]";
825 return os.str();
826 }
827
828 std::vector<TraCIReservation> value;
829};
830
831
834 std::string collider;
835 std::string victim;
836 std::string colliderType;
837 std::string victimType;
841 std::string type;
843 std::string lane;
845 double pos;
846
847 std::string getString() const {
848 std::ostringstream os;
849 os << "TraCICollision(collider=" << collider << ", victim=" << victim << ")";
850 return os.str();
851 }
852};
853
854
856 std::string getString() const override {
857 std::ostringstream os;
858 os << "TraCICollisionVectorWrapped[";
859 for (const TraCICollision& v : value) {
860 os << v.getString() << ",";
861 }
862 os << "]";
863 return os.str();
864 }
865
866 std::vector<TraCICollision> value;
867};
868
869
872 std::string signalId;
874 std::string tripId;
876 std::string foeId;
878 std::string foeSignal;
880 int limit;
882 int type;
886 bool active;
888 std::map<std::string, std::string> param;
889
890 std::string getString() const {
891 std::ostringstream os;
892 os << "TraCISignalConstraint(signalId=" << signalId << ", tripid=" << tripId << ", foeSignal=" << foeSignal << ", foeId=" << foeId << ")";
893 return os.str();
894 }
895};
896
897
899 std::string getString() const override {
900 std::ostringstream os;
901 os << "TraCISignalConstraintVectorWrapped[";
902 for (const TraCISignalConstraint& v : value) {
903 os << v.getString() << ",";
904 }
905 os << "]";
906 return os.str();
907 }
908
909 std::vector<TraCISignalConstraint> value;
910};
911
912
915 std::string foeId;
916 double egoDist;
917 double foeDist;
920 std::string egoLane;
921 std::string foeLane;
924
925 std::string getString() const {
926 std::ostringstream os;
927 os << "TraCIJunctionFoe(foeId=" << foeId << ", egoDist=" << egoDist << ", foeDist=" << foeDist << ", foeDist=" << foeDist << ")";
928 return os.str();
929 }
930};
931
932
934 std::string getString() const override {
935 std::ostringstream os;
936 os << "TraCIJunctionFoeVectorWrapped[";
937 for (const TraCIJunctionFoe& v : value) {
938 os << v.getString() << ",";
939 }
940 os << "]";
941 return os.str();
942 }
943
944 std::vector<TraCIJunctionFoe> value;
945};
946
947
948}
949
950// pop MSVC warnings
951#ifdef _MSC_VER
952#pragma warning(pop)
953#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:5639
double length
The length than can be driven from that lane without lane change.
Definition TraCIDefs.h:708
std::string getString() const
Definition TraCIDefs.h:694
double occupation
The traffic density along length.
Definition TraCIDefs.h:710
bool allowsContinuation
Whether this lane allows continuing the route.
Definition TraCIDefs.h:714
int bestLaneOffset
The offset of this lane from the best lane.
Definition TraCIDefs.h:712
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
Definition TraCIDefs.h:716
std::string laneID
The id of the lane.
Definition TraCIDefs.h:706
std::string getString() const override
Definition TraCIDefs.h:721
std::vector< TraCIBestLanesData > value
Definition TraCIDefs.h:731
std::string lane
The lane where the collision happended.
Definition TraCIDefs.h:843
std::string type
The type of collision.
Definition TraCIDefs.h:841
std::string collider
The ids of the participating vehicles and persons.
Definition TraCIDefs.h:834
double pos
The position of the collision along the lane.
Definition TraCIDefs.h:845
std::string colliderType
Definition TraCIDefs.h:836
std::string getString() const
Definition TraCIDefs.h:847
std::vector< TraCICollision > value
Definition TraCIDefs.h:866
std::string getString() const override
Definition TraCIDefs.h:856
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:491
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:486
std::string approachedLane
Definition TraCIDefs.h:498
std::string approachedInternal
Definition TraCIDefs.h:502
std::string getString() const override
Definition TraCIDefs.h:510
std::vector< TraCIConnection > value
Definition TraCIDefs.h:520
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:925
std::string foeId
the id of the vehicle with intersecting trajectory
Definition TraCIDefs.h:915
std::vector< TraCIJunctionFoe > value
Definition TraCIDefs.h:944
std::string getString() const override
Definition TraCIDefs.h:934
std::map< std::string, std::string > subParameter
Definition TraCIDefs.h:429
std::string programID
Definition TraCIDefs.h:425
std::vector< std::shared_ptr< libsumo::TraCIPhase > > phases
Definition TraCIDefs.h:428
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 > >(), const double _offset=0.)
Definition TraCIDefs.h:414
std::string getString() const
Definition TraCIDefs.h:419
std::vector< TraCILogic > value
Definition TraCIDefs.h:445
std::string getString() const override
Definition TraCIDefs.h:435
std::string stoppingPlaceID
Id assigned to the stop.
Definition TraCIDefs.h:646
std::string lane
The lane to stop at.
Definition TraCIDefs.h:640
int stopFlags
Stop flags.
Definition TraCIDefs.h:648
std::string actType
additional information for this stop
Definition TraCIDefs.h:664
std::string tripId
id of the trip within a cyclical public transport route
Definition TraCIDefs.h:666
std::string getString() const
Definition TraCIDefs.h:631
double startPos
The stopping position start.
Definition TraCIDefs.h:642
double arrival
The actual arrival time (only for past stops)
Definition TraCIDefs.h:656
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:597
double depart
The time at which this stop was ended.
Definition TraCIDefs.h:658
std::string join
the id of the vehicle (train portion) to which this vehicle shall be joined
Definition TraCIDefs.h:662
double speed
the speed at which this stop counts as reached (waypoint mode)
Definition TraCIDefs.h:670
double intendedArrival
The intended arrival time.
Definition TraCIDefs.h:654
double endPos
The stopping position end.
Definition TraCIDefs.h:644
std::string split
the id of the vehicle (train portion) that splits of upon reaching this stop
Definition TraCIDefs.h:660
std::string line
the new line id of the trip within a cyclical public transport route
Definition TraCIDefs.h:668
double duration
The intended (minimum) stopping duration.
Definition TraCIDefs.h:650
double until
The time at which the vehicle may continue its journey.
Definition TraCIDefs.h:652
std::vector< TraCINextStopData > value
Definition TraCIDefs.h:689
std::string getString() const override
Definition TraCIDefs.h:679
std::string getString() const
Definition TraCIDefs.h:562
double dist
The distance to the tls.
Definition TraCIDefs.h:574
int tlIndex
The tls index of the controlled link.
Definition TraCIDefs.h:572
std::string id
The id of the next tls.
Definition TraCIDefs.h:570
char state
The current state of the tls.
Definition TraCIDefs.h:576
std::string getString() const override
Definition TraCIDefs.h:581
std::vector< TraCINextTLSData > value
Definition TraCIDefs.h:591
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:803
double departPos
pickup position on the origin edge
Definition TraCIDefs.h:799
double reservationTime
time when the reservation was made
Definition TraCIDefs.h:805
double arrivalPos
drop-off position on the destination edge
Definition TraCIDefs.h:801
std::vector< std::string > persons
The persons ids that are part of this reservation.
Definition TraCIDefs.h:791
int state
the state of this reservation
Definition TraCIDefs.h:807
std::string fromEdge
The origin edge id.
Definition TraCIDefs.h:795
std::string group
The group id of this reservation.
Definition TraCIDefs.h:793
std::string id
The id of the taxi reservation (usable for traci.vehicle.dispatchTaxi)
Definition TraCIDefs.h:789
std::string toEdge
The destination edge id.
Definition TraCIDefs.h:797
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:776
std::string getString() const
Definition TraCIDefs.h:809
std::vector< TraCIReservation > value
Definition TraCIDefs.h:828
std::string getString() const override
Definition TraCIDefs.h:818
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:876
std::string tripId
the tripId or vehicle id of the train that is constrained
Definition TraCIDefs.h:874
std::string foeSignal
the tlsID of the rail signla that the foe must pass first
Definition TraCIDefs.h:878
std::string signalId
the idea of the rail signal where this constraint is active
Definition TraCIDefs.h:872
std::map< std::string, std::string > param
additional parameters
Definition TraCIDefs.h:888
bool active
whether this constraint is active
Definition TraCIDefs.h:886
std::string getString() const
Definition TraCIDefs.h:890
int type
the type of constraint (predecessor:0, insertionPredecessor:1)
Definition TraCIDefs.h:882
bool mustWait
whether tripId must still wait for foeId to pass foeSignal
Definition TraCIDefs.h:884
int limit
the number of trains that must be recorded at the foeSignal
Definition TraCIDefs.h:880
std::vector< TraCISignalConstraint > value
Definition TraCIDefs.h:909
std::string getString() const override
Definition TraCIDefs.h:899
std::string intended
id of the intended vehicle for public transport ride
Definition TraCIDefs.h:761
int type
The type of stage (walking, driving, ...)
Definition TraCIDefs.h:745
std::string destStop
The id of the destination stop.
Definition TraCIDefs.h:751
double length
length in m
Definition TraCIDefs.h:759
double travelTime
duration of the stage in seconds
Definition TraCIDefs.h:755
double departPos
position on the lane when starting the stage
Definition TraCIDefs.h:765
std::string description
arbitrary description string
Definition TraCIDefs.h:769
std::string line
The line or the id of the vehicle type.
Definition TraCIDefs.h:749
double cost
effort needed
Definition TraCIDefs.h:757
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:737
double depart
intended depart time for public transport ride or INVALID_DOUBLE_VALUE
Definition TraCIDefs.h:763
std::vector< std::string > edges
The sequence of edges to travel.
Definition TraCIDefs.h:753
double arrivalPos
position on the lane when ending the stage
Definition TraCIDefs.h:767
std::string vType
The vehicle type when using a private car or bike.
Definition TraCIDefs.h:747
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:525
std::string id
The id of the vehicle.
Definition TraCIDefs.h:534
double entryTime
Entry-time of the vehicle in [s].
Definition TraCIDefs.h:538
std::string typeID
Type of the vehicle in.
Definition TraCIDefs.h:542
double length
Length of the vehicle.
Definition TraCIDefs.h:536
std::string getString() const
Definition TraCIDefs.h:526
double leaveTime
Leave-time of the vehicle in [s].
Definition TraCIDefs.h:540
std::string getString() const override
Definition TraCIDefs.h:547
std::vector< TraCIVehicleData > value
Definition TraCIDefs.h:557