Eclipse SUMO - Simulation of Urban MObility
libtraci/Vehicle.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2017-2022 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/****************************************************************************/
19// C++ TraCI client API implementation
20/****************************************************************************/
21#include <config.h>
22#include <sstream>
23
24#define LIBTRACI 1
26#include <libsumo/Vehicle.h>
27#include "Domain.h"
28
29namespace libtraci {
30
31typedef Domain<libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::CMD_SET_VEHICLE_VARIABLE> Dom;
32
33
34// ===========================================================================
35// static member definitions
36// ===========================================================================
37std::vector<std::string>
38Vehicle::getIDList() {
40}
41
42
43int
44Vehicle::getIDCount() {
46}
47
48
51
52double
53Vehicle::getSpeed(const std::string& vehID) {
55}
56
57double
58Vehicle::getLateralSpeed(const std::string& vehID) {
60}
61
62double
63Vehicle::getAcceleration(const std::string& vehID) {
65}
66
67
68double
69Vehicle::getSpeedWithoutTraCI(const std::string& vehID) {
71}
72
73
75Vehicle::getPosition(const std::string& vehID, const bool includeZ) {
76 return includeZ ? getPosition3D(vehID) : Dom::getPos(libsumo::VAR_POSITION, vehID);
77}
78
79
81Vehicle::getPosition3D(const std::string& vehID) {
83}
84
85
86double
87Vehicle::getAngle(const std::string& vehID) {
89}
90
91
92double
93Vehicle::getSlope(const std::string& vehID) {
95}
96
97
98std::string
99Vehicle::getRoadID(const std::string& vehID) {
101}
102
103
104std::string
105Vehicle::getLaneID(const std::string& vehID) {
107}
108
109
110int
111Vehicle::getLaneIndex(const std::string& vehID) {
113}
114
115
116std::string
117Vehicle::getTypeID(const std::string& vehID) {
118 return Dom::getString(libsumo::VAR_TYPE, vehID);
119}
120
121
122std::string
123Vehicle::getRouteID(const std::string& vehID) {
125}
126
127
128int
129Vehicle::getRouteIndex(const std::string& vehID) {
131}
132
133
135Vehicle::getColor(const std::string& vehID) {
136 return Dom::getCol(libsumo::VAR_COLOR, vehID);
137}
138
139double
140Vehicle::getLanePosition(const std::string& vehID) {
142}
143
144double
145Vehicle::getLateralLanePosition(const std::string& vehID) {
147}
148
149double
150Vehicle::getCO2Emission(const std::string& vehID) {
152}
153
154double
155Vehicle::getCOEmission(const std::string& vehID) {
157}
158
159double
160Vehicle::getHCEmission(const std::string& vehID) {
162}
163
164double
165Vehicle::getPMxEmission(const std::string& vehID) {
167}
168
169double
170Vehicle::getNOxEmission(const std::string& vehID) {
172}
173
174double
175Vehicle::getFuelConsumption(const std::string& vehID) {
177}
178
179double
180Vehicle::getNoiseEmission(const std::string& vehID) {
182}
183
184double
185Vehicle::getElectricityConsumption(const std::string& vehID) {
187}
188
189int
190Vehicle::getPersonNumber(const std::string& vehID) {
192}
193
194int
195Vehicle::getPersonCapacity(const std::string& vehID) {
197}
198
199std::vector<std::string>
200Vehicle::getPersonIDList(const std::string& vehID) {
202}
203
204std::pair<std::string, double>
205Vehicle::getLeader(const std::string& vehID, double dist) {
206 tcpip::Storage content;
207 StoHelp::writeTypedDouble(content, dist);
208 tcpip::Storage& ret = Dom::get(libsumo::VAR_LEADER, vehID, &content);
209 ret.readInt(); // components
210 ret.readUnsignedByte();
211 const std::string leaderID = ret.readString();
212 ret.readUnsignedByte();
213 const double gap = ret.readDouble();
214 return std::make_pair(leaderID, gap);
215}
216
217
218std::pair<std::string, double>
219Vehicle::getFollower(const std::string& vehID, double dist) {
220 tcpip::Storage content;
221 StoHelp::writeTypedDouble(content, dist);
222 tcpip::Storage& ret = Dom::get(libsumo::VAR_FOLLOWER, vehID, &content);
223 ret.readInt(); // components
224 ret.readUnsignedByte();
225 const std::string leaderID = ret.readString();
226 ret.readUnsignedByte();
227 const double gap = ret.readDouble();
228 return std::make_pair(leaderID, gap);
229}
230
231
232double
233Vehicle::getWaitingTime(const std::string& vehID) {
235}
236
237
238double
239Vehicle::getAccumulatedWaitingTime(const std::string& vehID) {
241}
242
243
244double
245Vehicle::getAdaptedTraveltime(const std::string& vehID, double time, const std::string& edgeID) {
246 tcpip::Storage content;
247 StoHelp::writeCompound(content, 2);
248 StoHelp::writeTypedDouble(content, time);
249 StoHelp::writeTypedString(content, edgeID);
250 return Dom::getDouble(libsumo::VAR_EDGE_TRAVELTIME, vehID, &content);
251}
252
253
254double
255Vehicle::getEffort(const std::string& vehID, double time, const std::string& edgeID) {
256 tcpip::Storage content;
257 StoHelp::writeCompound(content, 2);
258 StoHelp::writeTypedDouble(content, time);
259 StoHelp::writeTypedString(content, edgeID);
260 return Dom::getDouble(libsumo::VAR_EDGE_EFFORT, vehID, &content);
261}
262
263
264bool
265Vehicle::isRouteValid(const std::string& vehID) {
266 return Dom::getInt(libsumo::VAR_ROUTE_VALID, vehID) != 0;
267}
268
269
270std::vector<std::string>
271Vehicle::getRoute(const std::string& vehID) {
273}
274
275
276int
277Vehicle::getSignals(const std::string& vehID) {
278 return Dom::getInt(libsumo::VAR_SIGNALS, vehID);
279}
280
281
282std::vector<libsumo::TraCIBestLanesData>
283Vehicle::getBestLanes(const std::string& vehID) {
284 std::vector<libsumo::TraCIBestLanesData> result;
286 ret.readInt();
287 ret.readUnsignedByte();
288
289 const int n = ret.readInt(); // number of following edge information
290 for (int i = 0; i < n; ++i) {
292 ret.readUnsignedByte();
293 info.laneID = ret.readString();
294
295 ret.readUnsignedByte();
296 info.length = ret.readDouble();
297
298 ret.readUnsignedByte();
299 info.occupation = ret.readDouble();
300
301 ret.readUnsignedByte();
302 info.bestLaneOffset = ret.readByte();
303
304 ret.readUnsignedByte();
305 info.allowsContinuation = (ret.readUnsignedByte() == 1);
306
307 ret.readUnsignedByte();
308 int m = ret.readInt();
309 while (m-- > 0) {
310 info.continuationLanes.push_back(ret.readString());
311 }
312 result.push_back(info);
313 }
314 return result;
315}
316
317
318std::vector<libsumo::TraCINextTLSData>
319Vehicle::getNextTLS(const std::string& vehID) {
320 std::vector<libsumo::TraCINextTLSData> result;
322 ret.readInt(); // components
323 // number of items
324 ret.readUnsignedByte();
325 const int n = ret.readInt();
326 for (int i = 0; i < n; ++i) {
328 ret.readUnsignedByte();
329 d.id = ret.readString();
330
331 ret.readUnsignedByte();
332 d.tlIndex = ret.readInt();
333
334 ret.readUnsignedByte();
335 d.dist = ret.readDouble();
336
337 ret.readUnsignedByte();
338 d.state = (char)ret.readByte();
339
340 result.push_back(d);
341 }
342 return result;
343}
344
345std::vector<libsumo::TraCINextStopData>
346Vehicle::getNextStops(const std::string& vehID) {
347 return getStops(vehID, 0);
348}
349
350std::vector<libsumo::TraCINextStopData>
351Vehicle::getStops(const std::string& vehID, int limit) {
352 std::vector<libsumo::TraCINextStopData> result;
353 tcpip::Storage content;
354 StoHelp::writeTypedInt(content, limit);
355 tcpip::Storage& ret = Dom::get(libsumo::VAR_NEXT_STOPS2, vehID, &content);
356 ret.readInt(); // components
357 // number of items
358 const int n = StoHelp::readCompound(ret);
359 for (int i = 0; i < n; ++i) {
377 result.emplace_back(s);
378 }
379 return result;
380}
381
382std::string
383Vehicle::getStopParameter(const std::string& vehID, int nextStopIndex, const std::string& param) {
384 tcpip::Storage content;
385 StoHelp::writeCompound(content, 2);
386 StoHelp::writeTypedInt(content, nextStopIndex);
387 StoHelp::writeTypedString(content, param);
388 return Dom::getString(libsumo::VAR_STOP_PARAMETER, vehID, &content);
389}
390
391int
392Vehicle::getStopState(const std::string& vehID) {
393 return Dom::getInt(libsumo::VAR_STOPSTATE, vehID);
394}
395
396
397double
398Vehicle::getDistance(const std::string& vehID) {
400}
401
402
403double
404Vehicle::getDrivingDistance(const std::string& vehID, const std::string& edgeID, double position, int laneIndex) {
405 tcpip::Storage content;
406 StoHelp::writeCompound(content, 2);
408 content.writeString(edgeID);
409 content.writeDouble(position);
410 content.writeUnsignedByte(laneIndex);
412 return Dom::getDouble(libsumo::DISTANCE_REQUEST, vehID, &content);
413}
414
415
416double
417Vehicle::getDrivingDistance2D(const std::string& vehID, double x, double y) {
418 tcpip::Storage content;
419 StoHelp::writeCompound(content, 2);
421 content.writeDouble(x);
422 content.writeDouble(y);
424 return Dom::getDouble(libsumo::DISTANCE_REQUEST, vehID, &content);
425}
426
427
428double
429Vehicle::getAllowedSpeed(const std::string& vehID) {
431}
432
433
434double
435Vehicle::getSpeedFactor(const std::string& vehID) {
437}
438
439
440int
441Vehicle::getSpeedMode(const std::string& vehID) {
443}
444
445
446int
447Vehicle::getLaneChangeMode(const std::string& vehID) {
449}
450
451
452int
453Vehicle::getRoutingMode(const std::string& vehID) {
455}
456
457
458std::string
459Vehicle::getLine(const std::string& vehID) {
460 return Dom::getString(libsumo::VAR_LINE, vehID);
461}
462
463
464
465std::vector<std::string>
466Vehicle::getVia(const std::string& vehID) {
468}
469
470
471std::pair<int, int>
472Vehicle::getLaneChangeState(const std::string& vehID, int direction) {
473 tcpip::Storage content;
474 StoHelp::writeTypedInt(content, direction);
475 tcpip::Storage& ret = Dom::get(libsumo::CMD_CHANGELANE, vehID, &content);
476 ret.readInt(); // components
477 ret.readUnsignedByte();
478 const int stateWithoutTraCI = ret.readInt();
479 ret.readUnsignedByte();
480 const int state = ret.readInt();
481 return std::make_pair(stateWithoutTraCI, state);
482}
483
484
485std::vector<std::pair<std::string, double> >
486Vehicle::getNeighbors(const std::string& vehID, const int mode) {
487 std::vector<std::pair<std::string, double> > neighs;
488 tcpip::Storage content;
490 content.writeUnsignedByte(mode);
491 tcpip::Storage& ret = Dom::get(libsumo::VAR_NEIGHBORS, vehID, &content);
492 const int items = ret.readInt(); // components
493 for (int i = 0; i < items; i++) {
494 const std::string neighID = ret.readString();
495 neighs.emplace_back(neighID, ret.readDouble());
496 }
497 return neighs;
498}
499
500
501double
502Vehicle::getFollowSpeed(const std::string& vehID, double speed, double gap, double leaderSpeed, double leaderMaxDecel, const std::string& leaderID) {
503 tcpip::Storage content;
504 StoHelp::writeCompound(content, 5);
505 StoHelp::writeTypedDouble(content, speed);
506 StoHelp::writeTypedDouble(content, gap);
507 StoHelp::writeTypedDouble(content, leaderSpeed);
508 StoHelp::writeTypedDouble(content, leaderMaxDecel);
509 StoHelp::writeTypedString(content, leaderID);
510 return Dom::getDouble(libsumo::VAR_FOLLOW_SPEED, vehID, &content);
511}
512
513
514double
515Vehicle::getSecureGap(const std::string& vehID, double speed, double leaderSpeed, double leaderMaxDecel, const std::string& leaderID) {
516 tcpip::Storage content;
517 StoHelp::writeCompound(content, 4);
518 StoHelp::writeTypedDouble(content, speed);
519 StoHelp::writeTypedDouble(content, leaderSpeed);
520 StoHelp::writeTypedDouble(content, leaderMaxDecel);
521 StoHelp::writeTypedString(content, leaderID);
522 return Dom::getDouble(libsumo::VAR_SECURE_GAP, vehID, &content);
523}
524
525
526double
527Vehicle::getStopSpeed(const std::string& vehID, const double speed, double gap) {
528 tcpip::Storage content;
529 StoHelp::writeCompound(content, 2);
530 StoHelp::writeTypedDouble(content, speed);
531 StoHelp::writeTypedDouble(content, gap);
532 return Dom::getDouble(libsumo::VAR_STOP_SPEED, vehID, &content);
533}
534
535double
536Vehicle::getStopDelay(const std::string& vehID) {
538}
539
540double
541Vehicle::getStopArrivalDelay(const std::string& vehID) {
543}
544
545double
546Vehicle::getTimeLoss(const std::string& vehID) {
548}
549
550std::vector<std::string>
551Vehicle::getTaxiFleet(int taxiState) {
552 tcpip::Storage content;
553 StoHelp::writeTypedInt(content, taxiState);
554 return Dom::getStringVector(libsumo::VAR_TAXI_FLEET, "", &content);
555}
556
557std::string
558Vehicle::getEmissionClass(const std::string& vehID) {
560}
561
562std::string
563Vehicle::getShapeClass(const std::string& vehID) {
565}
566
567
568double
569Vehicle::getLength(const std::string& vehID) {
570 return Dom::getDouble(libsumo::VAR_LENGTH, vehID);
571}
572
573
574double
575Vehicle::getAccel(const std::string& vehID) {
576 return Dom::getDouble(libsumo::VAR_ACCEL, vehID);
577}
578
579
580double
581Vehicle::getDecel(const std::string& vehID) {
582 return Dom::getDouble(libsumo::VAR_DECEL, vehID);
583}
584
585
586double Vehicle::getEmergencyDecel(const std::string& vehID) {
588}
589
590
591double Vehicle::getApparentDecel(const std::string& vehID) {
593}
594
595
596double Vehicle::getActionStepLength(const std::string& vehID) {
598}
599
600
601double Vehicle::getLastActionTime(const std::string& vehID) {
603}
604
605
606double
607Vehicle::getTau(const std::string& vehID) {
608 return Dom::getDouble(libsumo::VAR_TAU, vehID);
609}
610
611
612double
613Vehicle::getImperfection(const std::string& vehID) {
615}
616
617
618double
619Vehicle::getSpeedDeviation(const std::string& vehID) {
621}
622
623
624std::string
625Vehicle::getVehicleClass(const std::string& vehID) {
627}
628
629
630double
631Vehicle::getMinGap(const std::string& vehID) {
632 return Dom::getDouble(libsumo::VAR_MINGAP, vehID);
633}
634
635
636double
637Vehicle::getMinGapLat(const std::string& vehID) {
639}
640
641
642double
643Vehicle::getMaxSpeed(const std::string& vehID) {
645}
646
647
648double
649Vehicle::getMaxSpeedLat(const std::string& vehID) {
651}
652
653
654std::string
655Vehicle::getLateralAlignment(const std::string& vehID) {
657}
658
659
660double
661Vehicle::getWidth(const std::string& vehID) {
662 return Dom::getDouble(libsumo::VAR_WIDTH, vehID);
663}
664
665
666double
667Vehicle::getHeight(const std::string& vehID) {
668 return Dom::getDouble(libsumo::VAR_HEIGHT, vehID);
669}
670
671
672void
673Vehicle::setStop(const std::string& vehID,
674 const std::string& edgeID,
675 double pos,
676 int laneIndex,
677 double duration,
678 int flags,
679 double startPos,
680 double until) {
681 tcpip::Storage content;
682 StoHelp::writeCompound(content, 7);
683 StoHelp::writeTypedString(content, edgeID);
684 StoHelp::writeTypedDouble(content, pos);
685 StoHelp::writeTypedByte(content, laneIndex);
686 StoHelp::writeTypedDouble(content, duration);
687 StoHelp::writeTypedByte(content, flags);
688 StoHelp::writeTypedDouble(content, startPos);
689 StoHelp::writeTypedDouble(content, until);
690 Dom::set(libsumo::CMD_STOP, vehID, &content);
691}
692
693
694void
695Vehicle::replaceStop(const std::string& vehID,
696 int nextStopIndex,
697 const std::string& edgeID,
698 double pos,
699 int laneIndex,
700 double duration,
701 int flags,
702 double startPos,
703 double until,
704 int teleport) {
705 tcpip::Storage content;
706 StoHelp::writeCompound(content, 9);
707 StoHelp::writeTypedString(content, edgeID);
708 StoHelp::writeTypedDouble(content, pos);
709 StoHelp::writeTypedByte(content, laneIndex);
710 StoHelp::writeTypedDouble(content, duration);
711 StoHelp::writeTypedInt(content, flags);
712 StoHelp::writeTypedDouble(content, startPos);
713 StoHelp::writeTypedDouble(content, until);
714 StoHelp::writeTypedInt(content, nextStopIndex);
715 StoHelp::writeTypedByte(content, teleport);
716 Dom::set(libsumo::CMD_REPLACE_STOP, vehID, &content);
717}
718
719
720void
721Vehicle::insertStop(const std::string& vehID,
722 int nextStopIndex,
723 const std::string& edgeID,
724 double pos,
725 int laneIndex,
726 double duration,
727 int flags,
728 double startPos,
729 double until,
730 int teleport) {
731 tcpip::Storage content;
732 StoHelp::writeCompound(content, 9);
733 StoHelp::writeTypedString(content, edgeID);
734 StoHelp::writeTypedDouble(content, pos);
735 StoHelp::writeTypedByte(content, laneIndex);
736 StoHelp::writeTypedDouble(content, duration);
737 StoHelp::writeTypedInt(content, flags);
738 StoHelp::writeTypedDouble(content, startPos);
739 StoHelp::writeTypedDouble(content, until);
740 StoHelp::writeTypedInt(content, nextStopIndex);
741 StoHelp::writeTypedByte(content, teleport);
742 Dom::set(libsumo::CMD_INSERT_STOP, vehID, &content);
743}
744
745
746void
747Vehicle::setStopParameter(const std::string& vehID, int nextStopIndex,
748 const std::string& param, const std::string& value) {
749 tcpip::Storage content;
750 StoHelp::writeCompound(content, 3);
751 StoHelp::writeTypedInt(content, nextStopIndex);
752 StoHelp::writeTypedString(content, param);
753 StoHelp::writeTypedString(content, value);
754 Dom::set(libsumo::VAR_STOP_PARAMETER, vehID, &content);
755}
756
757
758void
759Vehicle::rerouteParkingArea(const std::string& vehID, const std::string& parkingAreaID) {
760 tcpip::Storage content;
761 StoHelp::writeCompound(content, 1);
762 StoHelp::writeTypedString(content, parkingAreaID);
764}
765
766
767void
768Vehicle::resume(const std::string& vehID) {
769 tcpip::Storage content;
770 StoHelp::writeCompound(content, 0);
771 Dom::set(libsumo::CMD_RESUME, vehID, &content);
772}
773
774
775void
776Vehicle::changeTarget(const std::string& vehID, const std::string& edgeID) {
778}
779
780
781void
782Vehicle::changeLane(const std::string& vehID, int laneIndex, double duration) {
783 tcpip::Storage content;
784 StoHelp::writeCompound(content, 2);
785 StoHelp::writeTypedByte(content, laneIndex);
786 StoHelp::writeTypedDouble(content, duration);
787 Dom::set(libsumo::CMD_CHANGELANE, vehID, &content);
788}
789
790void
791Vehicle::changeLaneRelative(const std::string& vehID, int indexOffset, double duration) {
792 tcpip::Storage content;
793 StoHelp::writeCompound(content, 3);
794 StoHelp::writeTypedByte(content, indexOffset);
795 StoHelp::writeTypedDouble(content, duration);
796 StoHelp::writeTypedByte(content, 1);
797 Dom::set(libsumo::CMD_CHANGELANE, vehID, &content);
798}
799
800
801void
802Vehicle::changeSublane(const std::string& vehID, double latDist) {
804}
805
806
807void
808Vehicle::add(const std::string& vehID,
809 const std::string& routeID,
810 const std::string& typeID,
811 const std::string& depart,
812 const std::string& departLane,
813 const std::string& departPos,
814 const std::string& departSpeed,
815 const std::string& arrivalLane,
816 const std::string& arrivalPos,
817 const std::string& arrivalSpeed,
818 const std::string& fromTaz,
819 const std::string& toTaz,
820 const std::string& line,
821 int personCapacity,
822 int personNumber) {
823 tcpip::Storage content;
824 StoHelp::writeCompound(content, 14);
825 StoHelp::writeTypedString(content, routeID);
826 StoHelp::writeTypedString(content, typeID);
827 StoHelp::writeTypedString(content, depart);
828 StoHelp::writeTypedString(content, departLane);
829 StoHelp::writeTypedString(content, departPos);
830 StoHelp::writeTypedString(content, departSpeed);
831
832 StoHelp::writeTypedString(content, arrivalLane);
833 StoHelp::writeTypedString(content, arrivalPos);
834 StoHelp::writeTypedString(content, arrivalSpeed);
835
836 StoHelp::writeTypedString(content, fromTaz);
837 StoHelp::writeTypedString(content, toTaz);
838 StoHelp::writeTypedString(content, line);
839
840 StoHelp::writeTypedInt(content, personCapacity);
841 StoHelp::writeTypedInt(content, personNumber);
842
843 Dom::set(libsumo::ADD_FULL, vehID, &content);
844}
845
846
847void
848Vehicle::moveToXY(const std::string& vehID, const std::string& edgeID, const int laneIndex,
849 const double x, const double y, double angle, const int keepRoute, double matchThreshold) {
850 tcpip::Storage content;
851 StoHelp::writeCompound(content, 7);
852 StoHelp::writeTypedString(content, edgeID);
853 StoHelp::writeTypedInt(content, laneIndex);
854 StoHelp::writeTypedDouble(content, x);
855 StoHelp::writeTypedDouble(content, y);
856 StoHelp::writeTypedDouble(content, angle);
857 StoHelp::writeTypedByte(content, keepRoute);
858 StoHelp::writeTypedDouble(content, matchThreshold);
859 Dom::set(libsumo::MOVE_TO_XY, vehID, &content);
860}
861
862void
863Vehicle::slowDown(const std::string& vehID, double speed, double duration) {
864 tcpip::Storage content;
865 StoHelp::writeCompound(content, 2);
866 StoHelp::writeTypedDouble(content, speed);
867 StoHelp::writeTypedDouble(content, duration);
868 Dom::set(libsumo::CMD_SLOWDOWN, vehID, &content);
869}
870
871void
872Vehicle::openGap(const std::string& vehID, double newTimeHeadway, double newSpaceHeadway, double duration, double changeRate, double maxDecel, const std::string& referenceVehID) {
873 tcpip::Storage content;
874 StoHelp::writeCompound(content, referenceVehID != "" ? 6 : 5);
875 StoHelp::writeTypedDouble(content, newTimeHeadway);
876 StoHelp::writeTypedDouble(content, newSpaceHeadway);
877 StoHelp::writeTypedDouble(content, duration);
878 StoHelp::writeTypedDouble(content, changeRate);
879 StoHelp::writeTypedDouble(content, maxDecel);
880 if (referenceVehID != "") {
881 StoHelp::writeTypedString(content, referenceVehID);
882 }
883 Dom::set(libsumo::CMD_OPENGAP, vehID, &content);
884}
885
886void
887Vehicle::deactivateGapControl(const std::string& vehID) {
888 openGap(vehID, -1, -1, -1, -1);
889}
890
891void
892Vehicle::requestToC(const std::string& vehID, double leadTime) {
893 std::ostringstream oss;
894 oss.setf(std::ios::fixed, std::ios::floatfield);
895 oss << std::setprecision(2);
896 oss << leadTime;
897 setParameter(vehID, "device.toc.requestToC", oss.str());
898}
899
900void
901Vehicle::setSpeed(const std::string& vehID, double speed) {
902 Dom::setDouble(libsumo::VAR_SPEED, vehID, speed);
903}
904
905void
906Vehicle::setAcceleration(const std::string& vehID, double accel, double duration) {
907 tcpip::Storage content;
908 StoHelp::writeCompound(content, 2);
909 StoHelp::writeTypedDouble(content, accel);
910 StoHelp::writeTypedDouble(content, duration);
911 Dom::set(libsumo::VAR_ACCELERATION, vehID, &content);
912}
913
914void
915Vehicle::setPreviousSpeed(const std::string& vehID, double prevSpeed, double prevAcceleration) {
916 tcpip::Storage content;
917 StoHelp::writeCompound(content, 2);
918 StoHelp::writeTypedDouble(content, prevSpeed);
919 StoHelp::writeTypedDouble(content, prevAcceleration);
920 Dom::set(libsumo::VAR_PREV_SPEED, vehID, &content);
921}
922
923void
924Vehicle::setSpeedMode(const std::string& vehID, int speedMode) {
925 Dom::setInt(libsumo::VAR_SPEEDSETMODE, vehID, speedMode);
926}
927
928void
929Vehicle::setLaneChangeMode(const std::string& vehID, int laneChangeMode) {
930 Dom::setInt(libsumo::VAR_LANECHANGE_MODE, vehID, laneChangeMode);
931}
932
933void
934Vehicle::setRoutingMode(const std::string& vehID, int routingMode) {
935 Dom::setInt(libsumo::VAR_ROUTING_MODE, vehID, routingMode);
936}
937
938void
939Vehicle::setType(const std::string& vehID, const std::string& typeID) {
940 Dom::setString(libsumo::VAR_TYPE, vehID, typeID);
941}
942
943void
944Vehicle::setRouteID(const std::string& vehID, const std::string& routeID) {
945 Dom::setString(libsumo::VAR_ROUTE_ID, vehID, routeID);
946}
947
948void
949Vehicle::setRoute(const std::string& vehID, const std::string& edgeID) {
950 setRoute(vehID, std::vector<std::string>({edgeID}));
951}
952
953void
954Vehicle::setRoute(const std::string& vehID, const std::vector<std::string>& edgeIDs) {
956}
957
958void
959Vehicle::updateBestLanes(const std::string& vehID) {
960 tcpip::Storage content;
961 Dom::set(libsumo::VAR_UPDATE_BESTLANES, vehID, &content);
962}
963
964
965void
966Vehicle::setAdaptedTraveltime(const std::string& vehID, const std::string& edgeID,
967 double time, double begSeconds, double endSeconds) {
968 tcpip::Storage content;
969 if (time == libsumo::INVALID_DOUBLE_VALUE) {
970 // reset
971 StoHelp::writeCompound(content, 1);
972 StoHelp::writeTypedString(content, edgeID);
973 } else if (begSeconds == libsumo::INVALID_DOUBLE_VALUE) {
974 // set value for the whole simulation
975 StoHelp::writeCompound(content, 2);
976 StoHelp::writeTypedString(content, edgeID);
977 StoHelp::writeTypedDouble(content, time);
978 } else {
979 StoHelp::writeCompound(content, 4);
980 StoHelp::writeTypedDouble(content, begSeconds);
981 StoHelp::writeTypedDouble(content, endSeconds);
982 StoHelp::writeTypedString(content, edgeID);
983 StoHelp::writeTypedDouble(content, time);
984 }
985 Dom::set(libsumo::VAR_EDGE_TRAVELTIME, vehID, &content);
986}
987
988
989void
990Vehicle::setEffort(const std::string& vehID, const std::string& edgeID,
991 double effort, double begSeconds, double endSeconds) {
992 tcpip::Storage content;
993 if (effort == libsumo::INVALID_DOUBLE_VALUE) {
994 // reset
995 StoHelp::writeCompound(content, 1);
996 StoHelp::writeTypedString(content, edgeID);
997 } else if (begSeconds == libsumo::INVALID_DOUBLE_VALUE) {
998 // set value for the whole simulation
999 StoHelp::writeCompound(content, 2);
1000 StoHelp::writeTypedString(content, edgeID);
1001 StoHelp::writeTypedDouble(content, effort);
1002 } else {
1003 StoHelp::writeCompound(content, 4);
1004 StoHelp::writeTypedDouble(content, begSeconds);
1005 StoHelp::writeTypedDouble(content, endSeconds);
1006 StoHelp::writeTypedString(content, edgeID);
1007 StoHelp::writeTypedDouble(content, effort);
1008 }
1009 Dom::set(libsumo::VAR_EDGE_EFFORT, vehID, &content);
1010}
1011
1012
1013void
1014Vehicle::rerouteTraveltime(const std::string& vehID, const bool /* currentTravelTimes */) {
1015 tcpip::Storage content;
1016 StoHelp::writeCompound(content, 0);
1017 Dom::set(libsumo::CMD_REROUTE_TRAVELTIME, vehID, &content);
1018}
1019
1020
1021void
1022Vehicle::rerouteEffort(const std::string& vehID) {
1023 tcpip::Storage content;
1024 StoHelp::writeCompound(content, 0);
1025 Dom::set(libsumo::CMD_REROUTE_EFFORT, vehID, &content);
1026}
1027
1028
1029void
1030Vehicle::setSignals(const std::string& vehID, int signals) {
1031 Dom::setInt(libsumo::VAR_SIGNALS, vehID, signals);
1032}
1033
1034
1035void
1036Vehicle::moveTo(const std::string& vehID, const std::string& laneID, double position, int reason) {
1037 tcpip::Storage content;
1038 StoHelp::writeCompound(content, 3);
1039 StoHelp::writeTypedString(content, laneID);
1040 StoHelp::writeTypedDouble(content, position);
1041 StoHelp::writeTypedInt(content, reason);
1042 Dom::set(libsumo::VAR_MOVE_TO, vehID, &content);
1043}
1044
1045
1046void
1047Vehicle::setActionStepLength(const std::string& vehID, double actionStepLength, bool resetActionOffset) {
1048 //if (actionStepLength < 0) {
1049 // raise TraCIException("Invalid value for actionStepLength. Given value must be non-negative.")
1050 //{
1051 // Use negative value to indicate resetActionOffset == False
1052 if (!resetActionOffset) {
1053 actionStepLength *= -1;
1054 }
1055 Dom::setDouble(libsumo::VAR_ACTIONSTEPLENGTH, vehID, actionStepLength);
1056}
1057
1058
1059void
1060Vehicle::remove(const std::string& vehID, char reason) {
1061 tcpip::Storage content;
1063 content.writeUnsignedByte(reason);
1064 Dom::set(libsumo::REMOVE, vehID, &content);
1065}
1066
1067
1068void
1069Vehicle::setColor(const std::string& vehID, const libsumo::TraCIColor& color) {
1070 Dom::setCol(libsumo::VAR_COLOR, vehID, color);
1071}
1072
1073
1074void
1075Vehicle::setSpeedFactor(const std::string& vehID, double factor) {
1077}
1078
1079
1080void
1081Vehicle::setLine(const std::string& vehID, const std::string& line) {
1082 Dom::setString(libsumo::VAR_LINE, vehID, line);
1083}
1084
1085
1086void
1087Vehicle::setVia(const std::string& vehID, const std::vector<std::string>& via) {
1089}
1090
1091
1092void
1093Vehicle::setLength(const std::string& vehID, double length) {
1094 Dom::setDouble(libsumo::VAR_LENGTH, vehID, length);
1095}
1096
1097
1098void
1099Vehicle::setMaxSpeed(const std::string& vehID, double speed) {
1101}
1102
1103
1104void
1105Vehicle::setVehicleClass(const std::string& vehID, const std::string& clazz) {
1107}
1108
1109
1110void
1111Vehicle::setShapeClass(const std::string& vehID, const std::string& clazz) {
1113}
1114
1115
1116void
1117Vehicle::setEmissionClass(const std::string& vehID, const std::string& clazz) {
1119}
1120
1121
1122void
1123Vehicle::setWidth(const std::string& vehID, double width) {
1124 Dom::setDouble(libsumo::VAR_WIDTH, vehID, width);
1125}
1126
1127
1128void
1129Vehicle::setHeight(const std::string& vehID, double height) {
1130 Dom::setDouble(libsumo::VAR_HEIGHT, vehID, height);
1131}
1132
1133
1134void
1135Vehicle::setMinGap(const std::string& vehID, double minGap) {
1136 Dom::setDouble(libsumo::VAR_MINGAP, vehID, minGap);
1137}
1138
1139
1140void
1141Vehicle::setAccel(const std::string& vehID, double accel) {
1142 Dom::setDouble(libsumo::VAR_ACCEL, vehID, accel);
1143}
1144
1145
1146void
1147Vehicle::setDecel(const std::string& vehID, double decel) {
1148 Dom::setDouble(libsumo::VAR_DECEL, vehID, decel);
1149}
1150
1151
1152void
1153Vehicle::setEmergencyDecel(const std::string& vehID, double decel) {
1155}
1156
1157
1158void
1159Vehicle::setApparentDecel(const std::string& vehID, double decel) {
1161}
1162
1163
1164void
1165Vehicle::setImperfection(const std::string& vehID, double imperfection) {
1166 Dom::setDouble(libsumo::VAR_IMPERFECTION, vehID, imperfection);
1167}
1168
1169
1170void
1171Vehicle::setTau(const std::string& vehID, double tau) {
1172 Dom::setDouble(libsumo::VAR_TAU, vehID, tau);
1173}
1174
1175
1176void
1177Vehicle::setMinGapLat(const std::string& vehID, double minGapLat) {
1178 Dom::setDouble(libsumo::VAR_MINGAP_LAT, vehID, minGapLat);
1179}
1180
1181
1182void
1183Vehicle::setMaxSpeedLat(const std::string& vehID, double speed) {
1185}
1186
1187
1188void
1189Vehicle::setLateralAlignment(const std::string& vehID, const std::string& latAlignment) {
1190 Dom::setString(libsumo::VAR_LATALIGNMENT, vehID, latAlignment);
1191}
1192
1193
1194void
1195Vehicle::highlight(const std::string& vehID, const libsumo::TraCIColor& col, double size, const int alphaMax, const double duration, const int type) {
1196 tcpip::Storage content;
1197 StoHelp::writeCompound(content, alphaMax > 0 ? 5 : 2);
1199 content.writeUnsignedByte(col.r);
1200 content.writeUnsignedByte(col.g);
1201 content.writeUnsignedByte(col.b);
1202 content.writeUnsignedByte(col.a);
1203 StoHelp::writeTypedDouble(content, size);
1204 if (alphaMax > 0) {
1206 content.writeUnsignedByte(alphaMax);
1207 StoHelp::writeTypedDouble(content, duration);
1209 content.writeUnsignedByte(type);
1210 }
1211 Dom::set(libsumo::VAR_HIGHLIGHT, vehID, &content);
1212}
1213
1214void
1215Vehicle::dispatchTaxi(const std::string& vehID, const std::vector<std::string>& reservations) {
1217}
1218
1219
1220void
1221Vehicle::subscribeLeader(const std::string& vehID, double dist, double begin, double end) {
1222 subscribe(vehID, std::vector<int>({ libsumo::VAR_LEADER }), begin, end,
1223 libsumo::TraCIResults({ {libsumo::VAR_LEADER, std::make_shared<libsumo::TraCIDouble>(dist)} }));
1224}
1225
1226
1227void
1228Vehicle::addSubscriptionFilterLanes(const std::vector<int>& lanes, bool noOpposite, double downstreamDist, double upstreamDist) {
1229 tcpip::Storage content;
1230 content.writeUnsignedByte((int)lanes.size());
1231 for (int lane : lanes) {
1232 content.writeUnsignedByte(lane < 0 ? lane + 256 : lane);
1233 }
1235 if (noOpposite) {
1236 addSubscriptionFilterNoOpposite();
1237 }
1238 if (downstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1239 addSubscriptionFilterDownstreamDistance(downstreamDist);
1240 }
1241 if (upstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1242 addSubscriptionFilterUpstreamDistance(upstreamDist);
1243 }
1244}
1245
1246
1247void
1248Vehicle::addSubscriptionFilterNoOpposite() {
1250}
1251
1252
1253void
1254Vehicle::addSubscriptionFilterDownstreamDistance(double dist) {
1255 tcpip::Storage content;
1256 StoHelp::writeTypedDouble(content, dist);
1258}
1259
1260
1261void
1262Vehicle::addSubscriptionFilterUpstreamDistance(double dist) {
1263 tcpip::Storage content;
1264 StoHelp::writeTypedDouble(content, dist);
1266}
1267
1268
1269void
1270Vehicle::addSubscriptionFilterCFManeuver(double downstreamDist, double upstreamDist) {
1271 addSubscriptionFilterLeadFollow(std::vector<int>(1));
1272 if (downstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1273 addSubscriptionFilterDownstreamDistance(downstreamDist);
1274 }
1275 if (upstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1276 addSubscriptionFilterUpstreamDistance(upstreamDist);
1277 }
1278}
1279
1280
1281void
1282Vehicle::addSubscriptionFilterLCManeuver(int direction, bool noOpposite, double downstreamDist, double upstreamDist) {
1283 if (direction == libsumo::INVALID_INT_VALUE) {
1284 addSubscriptionFilterLeadFollow({ -1, 0, 1 });
1285 } else if (direction != -1 && direction != 1) {
1286 // warnings.warn("Ignoring lane change subscription filter with non-neighboring lane offset direction=%s." % direction)
1287 return;
1288 } else {
1289 addSubscriptionFilterLeadFollow({ 0, direction });
1290 }
1291 if (noOpposite) {
1292 addSubscriptionFilterNoOpposite();
1293 }
1294 if (downstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1295 addSubscriptionFilterDownstreamDistance(downstreamDist);
1296 }
1297 if (upstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1298 addSubscriptionFilterUpstreamDistance(upstreamDist);
1299 }
1300}
1301
1302
1303void
1304Vehicle::addSubscriptionFilterLeadFollow(const std::vector<int>& lanes) {
1306 addSubscriptionFilterLanes(lanes);
1307}
1308
1309
1310void
1311Vehicle::addSubscriptionFilterTurn(double downstreamDist, double foeDistToJunction) {
1312 tcpip::Storage content;
1313 StoHelp::writeTypedDouble(content, foeDistToJunction);
1315 if (downstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1316 addSubscriptionFilterDownstreamDistance(downstreamDist);
1317 }
1318}
1319
1320
1321void
1322Vehicle::addSubscriptionFilterVClass(const std::vector<std::string>& vClasses) {
1323 tcpip::Storage content;
1324 StoHelp::writeTypedStringList(content, vClasses);
1326}
1327
1328
1329void
1330Vehicle::addSubscriptionFilterVType(const std::vector<std::string>& vTypes) {
1331 tcpip::Storage content;
1332 StoHelp::writeTypedStringList(content, vTypes);
1334}
1335
1336
1337void
1338Vehicle::addSubscriptionFilterFieldOfVision(double openingAngle) {
1339 tcpip::Storage content;
1340 StoHelp::writeTypedDouble(content, openingAngle);
1342}
1343
1344
1345void
1346Vehicle::addSubscriptionFilterLateralDistance(double lateralDist, double downstreamDist, double upstreamDist) {
1347 tcpip::Storage content;
1348 StoHelp::writeTypedDouble(content, lateralDist);
1350 if (downstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1351 addSubscriptionFilterDownstreamDistance(downstreamDist);
1352 }
1353 if (upstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1354 addSubscriptionFilterUpstreamDistance(upstreamDist);
1355 }
1356}
1357
1358
1359}
1360
1361
1362/****************************************************************************/
#define LIBTRACI_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
Definition: Domain.h:38
#define LIBTRACI_PARAMETER_IMPLEMENTATION(CLASS, DOMAIN)
Definition: Domain.h:77
C++ TraCI client API implementation.
static void writeTypedDouble(tcpip::Storage &content, double value)
static int readCompound(tcpip::Storage &ret, int expectedSize=-1, const std::string &error="")
Definition: StorageHelper.h:85
static int readTypedInt(tcpip::Storage &ret, const std::string &error="")
Definition: StorageHelper.h:50
static void writeCompound(tcpip::Storage &content, int size)
static std::string readTypedString(tcpip::Storage &ret, const std::string &error="")
Definition: StorageHelper.h:71
static void writeTypedInt(tcpip::Storage &content, int value)
static void writeTypedStringList(tcpip::Storage &content, const std::vector< std::string > &value)
static void writeTypedByte(tcpip::Storage &content, int value)
static void writeTypedString(tcpip::Storage &content, const std::string &value)
static double readTypedDouble(tcpip::Storage &ret, const std::string &error="")
Definition: StorageHelper.h:64
static Connection & getActive()
Definition: Connection.h:55
void addFilter(int var, tcpip::Storage *add=nullptr)
Definition: Connection.cpp:338
static void setDouble(int var, const std::string &id, double value)
Definition: Domain.h:220
static libsumo::TraCIPosition getPos(int var, const std::string &id, tcpip::Storage *add=nullptr, const bool isGeo=false)
Definition: Domain.h:150
static void setCol(int var, const std::string &id, const libsumo::TraCIColor value)
Definition: Domain.h:241
static std::vector< std::string > getStringVector(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition: Domain.h:171
static void setStringVector(int var, const std::string &id, const std::vector< std::string > &value)
Definition: Domain.h:234
static libsumo::TraCIColor getCol(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition: Domain.h:179
static std::string getString(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition: Domain.h:167
static int getInt(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition: Domain.h:125
static void set(int var, const std::string &id, tcpip::Storage *add)
Definition: Domain.h:209
static libsumo::TraCIPosition getPos3D(int var, const std::string &id, tcpip::Storage *add=nullptr, const bool isGeo=false)
Definition: Domain.h:158
static double getDouble(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition: Domain.h:129
static void setInt(int var, const std::string &id, int value)
Definition: Domain.h:213
static void setString(int var, const std::string &id, const std::string &value)
Definition: Domain.h:227
static tcpip::Storage & get(int var, const std::string &id, tcpip::Storage *add=nullptr, int expectedType=libsumo::TYPE_COMPOUND)
Definition: Domain.h:111
virtual std::string readString()
Definition: storage.cpp:180
virtual void writeString(const std::string &s)
Definition: storage.cpp:197
virtual void writeDouble(double)
Definition: storage.cpp:354
virtual int readUnsignedByte()
Definition: storage.cpp:155
virtual void writeUnsignedByte(int)
Definition: storage.cpp:165
virtual int readByte()
Definition: storage.cpp:128
virtual double readDouble()
Definition: storage.cpp:362
virtual int readInt()
Definition: storage.cpp:311
TRACI_CONST double INVALID_DOUBLE_VALUE
TRACI_CONST int VAR_LASTACTIONTIME
TRACI_CONST int TYPE_COLOR
TRACI_CONST int FILTER_TYPE_DOWNSTREAM_DIST
TRACI_CONST int VAR_EDGES
TRACI_CONST int POSITION_ROADMAP
TRACI_CONST int VAR_NOXEMISSION
TRACI_CONST int VAR_LANECHANGE_MODE
TRACI_CONST int LAST_STEP_PERSON_ID_LIST
TRACI_CONST int FILTER_TYPE_NOOPPOSITE
TRACI_CONST int VAR_VEHICLECLASS
TRACI_CONST int TRACI_ID_LIST
TRACI_CONST int VAR_LATALIGNMENT
TRACI_CONST int VAR_TYPE
TRACI_CONST int CMD_CHANGESUBLANE
TRACI_CONST int VAR_ROUTING_MODE
TRACI_CONST int VAR_MINGAP
TRACI_CONST int CMD_TAXI_DISPATCH
TRACI_CONST int VAR_SECURE_GAP
TRACI_CONST int VAR_SHAPECLASS
TRACI_CONST int VAR_WAITING_TIME
TRACI_CONST int CMD_STOP
TRACI_CONST int VAR_LINE
TRACI_CONST int VAR_EDGE_TRAVELTIME
TRACI_CONST int VAR_ROAD_ID
TRACI_CONST int VAR_TIMELOSS
TRACI_CONST int CMD_RESUME
TRACI_CONST int VAR_ACTIONSTEPLENGTH
TRACI_CONST int VAR_SPEED_FACTOR
TRACI_CONST int MOVE_TO_XY
TRACI_CONST int VAR_FOLLOW_SPEED
TRACI_CONST int VAR_STOP_ARRIVALDELAY
TRACI_CONST int VAR_SPEED_LAT
TRACI_CONST int FILTER_TYPE_FIELD_OF_VISION
TRACI_CONST int VAR_ANGLE
TRACI_CONST int VAR_TAU
TRACI_CONST int VAR_NEXT_TLS
TRACI_CONST int VAR_EDGE_EFFORT
TRACI_CONST int VAR_ROUTE
TRACI_CONST int VAR_BEST_LANES
TRACI_CONST int VAR_ALLOWED_SPEED
TRACI_CONST int VAR_LANE_INDEX
TRACI_CONST int VAR_PMXEMISSION
TRACI_CONST int VAR_SPEED_WITHOUT_TRACI
TRACI_CONST int VAR_HIGHLIGHT
TRACI_CONST int TYPE_UBYTE
TRACI_CONST int VAR_MOVE_TO
TRACI_CONST int VAR_PERSON_NUMBER
TRACI_CONST int VAR_COEMISSION
TRACI_CONST int VAR_UPDATE_BESTLANES
TRACI_CONST int VAR_COLOR
TRACI_CONST int VAR_POSITION
TRACI_CONST int VAR_WIDTH
TRACI_CONST int VAR_PERSON_CAPACITY
TRACI_CONST int VAR_STOP_PARAMETER
TRACI_CONST int POSITION_2D
TRACI_CONST int VAR_MAXSPEED
TRACI_CONST int VAR_LEADER
TRACI_CONST int CMD_CHANGETARGET
TRACI_CONST int ADD_FULL
TRACI_CONST int VAR_CO2EMISSION
TRACI_CONST int CMD_REROUTE_TO_PARKING
TRACI_CONST int FILTER_TYPE_VTYPE
TRACI_CONST int CMD_REROUTE_TRAVELTIME
TRACI_CONST int VAR_TAXI_FLEET
TRACI_CONST int VAR_PREV_SPEED
TRACI_CONST int VAR_ROUTE_VALID
TRACI_CONST int VAR_SPEEDSETMODE
TRACI_CONST int CMD_REPLACE_STOP
TRACI_CONST int VAR_FUELCONSUMPTION
TRACI_CONST int VAR_SLOPE
TRACI_CONST int VAR_LENGTH
TRACI_CONST int VAR_MAXSPEED_LAT
TRACI_CONST int CMD_REROUTE_EFFORT
TRACI_CONST int VAR_HCEMISSION
TRACI_CONST int ID_COUNT
TRACI_CONST int VAR_LANEPOSITION
TRACI_CONST int REMOVE
TRACI_CONST int VAR_LANE_ID
TRACI_CONST int CMD_INSERT_STOP
TRACI_CONST int VAR_STOP_SPEED
TRACI_CONST int VAR_IMPERFECTION
TRACI_CONST int VAR_HEIGHT
TRACI_CONST int VAR_APPARENT_DECEL
TRACI_CONST int VAR_NOISEEMISSION
TRACI_CONST int FILTER_TYPE_LEAD_FOLLOW
TRACI_CONST int REQUEST_DRIVINGDIST
TRACI_CONST int VAR_POSITION3D
TRACI_CONST int VAR_SPEED
TRACI_CONST int VAR_DECEL
TRACI_CONST int VAR_SIGNALS
TRACI_CONST int FILTER_TYPE_UPSTREAM_DIST
TRACI_CONST int VAR_ACCUMULATED_WAITING_TIME
TRACI_CONST int VAR_MINGAP_LAT
TRACI_CONST int INVALID_INT_VALUE
TRACI_CONST int VAR_ROUTE_INDEX
TRACI_CONST int VAR_NEXT_STOPS2
TRACI_CONST int CMD_SLOWDOWN
TRACI_CONST int FILTER_TYPE_TURN
TRACI_CONST int VAR_ACCELERATION
TRACI_CONST int VAR_ROUTE_ID
TRACI_CONST int DISTANCE_REQUEST
TRACI_CONST int TYPE_BYTE
TRACI_CONST int CMD_OPENGAP
TRACI_CONST int VAR_LANEPOSITION_LAT
TRACI_CONST int FILTER_TYPE_VCLASS
TRACI_CONST int CMD_CHANGELANE
TRACI_CONST int VAR_STOP_DELAY
TRACI_CONST int VAR_NEIGHBORS
TRACI_CONST int VAR_EMERGENCY_DECEL
TRACI_CONST int VAR_STOPSTATE
TRACI_CONST int VAR_FOLLOWER
TRACI_CONST int VAR_EMISSIONCLASS
TRACI_CONST int FILTER_TYPE_LANES
TRACI_CONST int VAR_ACCEL
std::map< int, std::shared_ptr< libsumo::TraCIResult > > TraCIResults
{variable->value}
Definition: TraCIDefs.h:298
TRACI_CONST int VAR_DISTANCE
TRACI_CONST int FILTER_TYPE_LATERAL_DIST
TRACI_CONST int VAR_ELECTRICITYCONSUMPTION
TRACI_CONST int VAR_SPEED_DEVIATION
TRACI_CONST int VAR_VIA
Domain< libsumo::CMD_GET_BUSSTOP_VARIABLE, libsumo::CMD_SET_BUSSTOP_VARIABLE > Dom
double length
The length than can be driven from that lane without lane change.
Definition: TraCIDefs.h:507
double occupation
The traffic density along length.
Definition: TraCIDefs.h:509
bool allowsContinuation
Whether this lane allows continuing the route.
Definition: TraCIDefs.h:513
int bestLaneOffset
The offset of this lane from the best lane.
Definition: TraCIDefs.h:511
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
Definition: TraCIDefs.h:515
std::string laneID
The id of the lane.
Definition: TraCIDefs.h:505
std::string stoppingPlaceID
Id assigned to the stop.
Definition: TraCIDefs.h:456
std::string lane
The lane to stop at.
Definition: TraCIDefs.h:450
int stopFlags
Stop flags.
Definition: TraCIDefs.h:458
std::string actType
additional information for this stop
Definition: TraCIDefs.h:474
std::string tripId
id of the trip within a cyclical public transport route
Definition: TraCIDefs.h:476
double startPos
The stopping position start.
Definition: TraCIDefs.h:452
double arrival
The actual arrival time (only for past stops)
Definition: TraCIDefs.h:466
double depart
The time at which this stop was ended.
Definition: TraCIDefs.h:468
std::string join
the id of the vehicle (train portion) to which this vehicle shall be joined
Definition: TraCIDefs.h:472
double speed
the speed at which this stop counts as reached (waypoint mode)
Definition: TraCIDefs.h:480
double intendedArrival
The intended arrival time.
Definition: TraCIDefs.h:464
double endPos
The stopping position end.
Definition: TraCIDefs.h:454
std::string split
the id of the vehicle (train portion) that splits of upon reaching this stop
Definition: TraCIDefs.h:470
std::string line
the new line id of the trip within a cyclical public transport route
Definition: TraCIDefs.h:478
double duration
The intended (minimum) stopping duration.
Definition: TraCIDefs.h:460
double until
The time at which the vehicle may continue its journey.
Definition: TraCIDefs.h:462
double dist
The distance to the tls.
Definition: TraCIDefs.h:399
int tlIndex
The tls index of the controlled link.
Definition: TraCIDefs.h:397
std::string id
The id of the next tls.
Definition: TraCIDefs.h:395
char state
The current state of the tls.
Definition: TraCIDefs.h:401
A 3D-position.
Definition: TraCIDefs.h:172