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.dev/sumo
3// Copyright (C) 2017-2023 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/****************************************************************************/
20// C++ TraCI client API implementation
21/****************************************************************************/
22#include <config.h>
23#include <sstream>
24
25#define LIBTRACI 1
27#include <libsumo/Vehicle.h>
28#include "Domain.h"
29
30namespace libtraci {
31
32typedef Domain<libsumo::CMD_GET_VEHICLE_VARIABLE, libsumo::CMD_SET_VEHICLE_VARIABLE> Dom;
33
34
35// ===========================================================================
36// static member definitions
37// ===========================================================================
38std::vector<std::string>
39Vehicle::getIDList() {
41}
42
43
44int
45Vehicle::getIDCount() {
47}
48
49
52
53double
54Vehicle::getSpeed(const std::string& vehID) {
56}
57
58double
59Vehicle::getLateralSpeed(const std::string& vehID) {
61}
62
63double
64Vehicle::getAcceleration(const std::string& vehID) {
66}
67
68
69double
70Vehicle::getSpeedWithoutTraCI(const std::string& vehID) {
72}
73
74
76Vehicle::getPosition(const std::string& vehID, const bool includeZ) {
77 return includeZ ? getPosition3D(vehID) : Dom::getPos(libsumo::VAR_POSITION, vehID);
78}
79
80
82Vehicle::getPosition3D(const std::string& vehID) {
84}
85
86
87double
88Vehicle::getAngle(const std::string& vehID) {
90}
91
92
93double
94Vehicle::getSlope(const std::string& vehID) {
96}
97
98
99std::string
100Vehicle::getRoadID(const std::string& vehID) {
102}
103
104
105double
106Vehicle::getDeparture(const std::string& vehID) {
108}
109
110
111double
112Vehicle::getDepartDelay(const std::string& vehID) {
114}
115
116
117std::string
118Vehicle::getLaneID(const std::string& vehID) {
120}
121
122
123int
124Vehicle::getLaneIndex(const std::string& vehID) {
126}
127
128
129std::string
130Vehicle::getTypeID(const std::string& vehID) {
131 return Dom::getString(libsumo::VAR_TYPE, vehID);
132}
133
134
135std::string
136Vehicle::getRouteID(const std::string& vehID) {
138}
139
140
141int
142Vehicle::getRouteIndex(const std::string& vehID) {
144}
145
146
148Vehicle::getColor(const std::string& vehID) {
149 return Dom::getCol(libsumo::VAR_COLOR, vehID);
150}
151
152double
153Vehicle::getLanePosition(const std::string& vehID) {
155}
156
157double
158Vehicle::getLateralLanePosition(const std::string& vehID) {
160}
161
162double
163Vehicle::getCO2Emission(const std::string& vehID) {
165}
166
167double
168Vehicle::getCOEmission(const std::string& vehID) {
170}
171
172double
173Vehicle::getHCEmission(const std::string& vehID) {
175}
176
177double
178Vehicle::getPMxEmission(const std::string& vehID) {
180}
181
182double
183Vehicle::getNOxEmission(const std::string& vehID) {
185}
186
187double
188Vehicle::getFuelConsumption(const std::string& vehID) {
190}
191
192double
193Vehicle::getNoiseEmission(const std::string& vehID) {
195}
196
197double
198Vehicle::getElectricityConsumption(const std::string& vehID) {
200}
201
202int
203Vehicle::getPersonNumber(const std::string& vehID) {
205}
206
207int
208Vehicle::getPersonCapacity(const std::string& vehID) {
210}
211
212
213double
214Vehicle::getBoardingDuration(const std::string& vehID) {
216}
217
218
219double
220Vehicle::getImpatience(const std::string& vehID) {
222}
223
224
225std::vector<std::string>
226Vehicle::getPersonIDList(const std::string& vehID) {
228}
229
230std::pair<std::string, double>
231Vehicle::getLeader(const std::string& vehID, double dist) {
232 tcpip::Storage content;
233 StoHelp::writeTypedDouble(content, dist);
234 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
235 tcpip::Storage& ret = Dom::get(libsumo::VAR_LEADER, vehID, &content);
236 ret.readInt(); // components
237 ret.readUnsignedByte();
238 const std::string leaderID = ret.readString();
239 ret.readUnsignedByte();
240 const double gap = ret.readDouble();
241 return std::make_pair(leaderID, gap);
242}
243
244
245std::pair<std::string, double>
246Vehicle::getFollower(const std::string& vehID, double dist) {
247 tcpip::Storage content;
248 StoHelp::writeTypedDouble(content, dist);
249 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
250 tcpip::Storage& ret = Dom::get(libsumo::VAR_FOLLOWER, vehID, &content);
251 ret.readInt(); // components
252 const std::string leaderID = StoHelp::readTypedString(ret);
253 return std::make_pair(leaderID, StoHelp::readTypedDouble(ret));
254}
255
256
257std::vector<libsumo::TraCIJunctionFoe>
258Vehicle::getJunctionFoes(const std::string& vehID, double dist) {
259 std::vector<libsumo::TraCIJunctionFoe> result;
260 tcpip::Storage content;
261 StoHelp::writeTypedDouble(content, dist);
262 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
263 tcpip::Storage& ret = Dom::get(libsumo::VAR_FOES, vehID, &content);
264 ret.readInt(); // compound size
265 const int n = StoHelp::readTypedInt(ret); // number of foe informations
266 for (int i = 0; i < n; ++i) {
275 info.egoResponse = StoHelp::readBool(ret);
276 info.foeResponse = StoHelp::readBool(ret);
277 result.emplace_back(info);
278 }
279 return result;
280}
281
282
283double
284Vehicle::getWaitingTime(const std::string& vehID) {
286}
287
288
289double
290Vehicle::getAccumulatedWaitingTime(const std::string& vehID) {
292}
293
294
295double
296Vehicle::getAdaptedTraveltime(const std::string& vehID, double time, const std::string& edgeID) {
297 tcpip::Storage content;
298 StoHelp::writeCompound(content, 2);
299 StoHelp::writeTypedDouble(content, time);
300 StoHelp::writeTypedString(content, edgeID);
301 return Dom::getDouble(libsumo::VAR_EDGE_TRAVELTIME, vehID, &content);
302}
303
304
305double
306Vehicle::getEffort(const std::string& vehID, double time, const std::string& edgeID) {
307 tcpip::Storage content;
308 StoHelp::writeCompound(content, 2);
309 StoHelp::writeTypedDouble(content, time);
310 StoHelp::writeTypedString(content, edgeID);
311 return Dom::getDouble(libsumo::VAR_EDGE_EFFORT, vehID, &content);
312}
313
314
315bool
316Vehicle::isRouteValid(const std::string& vehID) {
317 return Dom::getInt(libsumo::VAR_ROUTE_VALID, vehID) != 0;
318}
319
320
321std::vector<std::string>
322Vehicle::getRoute(const std::string& vehID) {
324}
325
326
327int
328Vehicle::getSignals(const std::string& vehID) {
329 return Dom::getInt(libsumo::VAR_SIGNALS, vehID);
330}
331
332
333std::vector<libsumo::TraCIBestLanesData>
334Vehicle::getBestLanes(const std::string& vehID) {
335 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
336 std::vector<libsumo::TraCIBestLanesData> result;
338 ret.readInt();
339 ret.readUnsignedByte();
340
341 const int n = ret.readInt(); // number of following edge information
342 for (int i = 0; i < n; ++i) {
344 ret.readUnsignedByte();
345 info.laneID = ret.readString();
346
347 ret.readUnsignedByte();
348 info.length = ret.readDouble();
349
350 ret.readUnsignedByte();
351 info.occupation = ret.readDouble();
352
353 ret.readUnsignedByte();
354 info.bestLaneOffset = ret.readByte();
355
356 ret.readUnsignedByte();
357 info.allowsContinuation = (ret.readUnsignedByte() == 1);
358
359 ret.readUnsignedByte();
360 int m = ret.readInt();
361 while (m-- > 0) {
362 info.continuationLanes.push_back(ret.readString());
363 }
364 result.push_back(info);
365 }
366 return result;
367}
368
369
370std::vector<libsumo::TraCINextTLSData>
371Vehicle::getNextTLS(const std::string& vehID) {
372 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
373 std::vector<libsumo::TraCINextTLSData> result;
375 ret.readInt(); // components
376 // number of items
377 ret.readUnsignedByte();
378 const int n = ret.readInt();
379 for (int i = 0; i < n; ++i) {
381 ret.readUnsignedByte();
382 d.id = ret.readString();
383
384 ret.readUnsignedByte();
385 d.tlIndex = ret.readInt();
386
387 ret.readUnsignedByte();
388 d.dist = ret.readDouble();
389
390 ret.readUnsignedByte();
391 d.state = (char)ret.readByte();
392
393 result.push_back(d);
394 }
395 return result;
396}
397
398std::vector<libsumo::TraCINextStopData>
399Vehicle::getNextStops(const std::string& vehID) {
400 return getStops(vehID, 0);
401}
402
403std::vector<libsumo::TraCIConnection>
404Vehicle::getNextLinks(const std::string& vehID) {
405 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
406 std::vector<libsumo::TraCIConnection> result;
408 ret.readInt(); // components
409 // number of items
410 ret.readUnsignedByte();
411 ret.readInt();
412
413 const int linkNo = ret.readInt();
414 for (int i = 0; i < linkNo; ++i) {
418 con.hasPrio = StoHelp::readBool(ret);
419 con.isOpen = StoHelp::readBool(ret);
420 con.hasFoe = StoHelp::readBool(ret);
424 result.emplace_back(con);
425 }
426 return result;
427}
428
429std::vector<libsumo::TraCINextStopData>
430Vehicle::getStops(const std::string& vehID, int limit) {
431 std::vector<libsumo::TraCINextStopData> result;
432 tcpip::Storage content;
433 StoHelp::writeTypedInt(content, limit);
434 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
435 tcpip::Storage& ret = Dom::get(libsumo::VAR_NEXT_STOPS2, vehID, &content);
436 ret.readInt(); // components
437 // number of items
438 const int n = StoHelp::readCompound(ret);
439 for (int i = 0; i < n; ++i) {
457 result.emplace_back(s);
458 }
459 return result;
460}
461
462std::string
463Vehicle::getStopParameter(const std::string& vehID, int nextStopIndex, const std::string& param, bool customParam) {
464 tcpip::Storage content;
465 StoHelp::writeCompound(content, 3);
466 StoHelp::writeTypedInt(content, nextStopIndex);
467 StoHelp::writeTypedString(content, param);
468 StoHelp::writeTypedByte(content, customParam);
469 return Dom::getString(libsumo::VAR_STOP_PARAMETER, vehID, &content);
470}
471
472int
473Vehicle::getStopState(const std::string& vehID) {
474 return Dom::getInt(libsumo::VAR_STOPSTATE, vehID);
475}
476
477
478double
479Vehicle::getDistance(const std::string& vehID) {
481}
482
483
484double
485Vehicle::getDrivingDistance(const std::string& vehID, const std::string& edgeID, double position, int laneIndex) {
486 tcpip::Storage content;
487 StoHelp::writeCompound(content, 2);
489 content.writeString(edgeID);
490 content.writeDouble(position);
491 content.writeUnsignedByte(laneIndex);
493 return Dom::getDouble(libsumo::DISTANCE_REQUEST, vehID, &content);
494}
495
496
497double
498Vehicle::getDrivingDistance2D(const std::string& vehID, double x, double y) {
499 tcpip::Storage content;
500 StoHelp::writeCompound(content, 2);
502 content.writeDouble(x);
503 content.writeDouble(y);
505 return Dom::getDouble(libsumo::DISTANCE_REQUEST, vehID, &content);
506}
507
508
509double
510Vehicle::getAllowedSpeed(const std::string& vehID) {
512}
513
514
515double
516Vehicle::getSpeedFactor(const std::string& vehID) {
518}
519
520
521int
522Vehicle::getSpeedMode(const std::string& vehID) {
524}
525
526
527int
528Vehicle::getLaneChangeMode(const std::string& vehID) {
530}
531
532
533int
534Vehicle::getRoutingMode(const std::string& vehID) {
536}
537
538
539std::string
540Vehicle::getLine(const std::string& vehID) {
541 return Dom::getString(libsumo::VAR_LINE, vehID);
542}
543
544
545
546std::vector<std::string>
547Vehicle::getVia(const std::string& vehID) {
549}
550
551
552std::pair<int, int>
553Vehicle::getLaneChangeState(const std::string& vehID, int direction) {
554 tcpip::Storage content;
555 StoHelp::writeTypedInt(content, direction);
556 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
557 tcpip::Storage& ret = Dom::get(libsumo::CMD_CHANGELANE, vehID, &content);
558 ret.readInt(); // components
559 ret.readUnsignedByte();
560 const int stateWithoutTraCI = ret.readInt();
561 ret.readUnsignedByte();
562 const int state = ret.readInt();
563 return std::make_pair(stateWithoutTraCI, state);
564}
565
566
567std::vector<std::pair<std::string, double> >
568Vehicle::getNeighbors(const std::string& vehID, const int mode) {
569 std::vector<std::pair<std::string, double> > neighs;
570 tcpip::Storage content;
572 content.writeUnsignedByte(mode);
573 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
574 tcpip::Storage& ret = Dom::get(libsumo::VAR_NEIGHBORS, vehID, &content);
575 const int items = ret.readInt(); // components
576 for (int i = 0; i < items; i++) {
577 const std::string neighID = ret.readString();
578 neighs.emplace_back(neighID, ret.readDouble());
579 }
580 return neighs;
581}
582
583
584double
585Vehicle::getFollowSpeed(const std::string& vehID, double speed, double gap, double leaderSpeed, double leaderMaxDecel, const std::string& leaderID) {
586 tcpip::Storage content;
587 StoHelp::writeCompound(content, 5);
588 StoHelp::writeTypedDouble(content, speed);
589 StoHelp::writeTypedDouble(content, gap);
590 StoHelp::writeTypedDouble(content, leaderSpeed);
591 StoHelp::writeTypedDouble(content, leaderMaxDecel);
592 StoHelp::writeTypedString(content, leaderID);
593 return Dom::getDouble(libsumo::VAR_FOLLOW_SPEED, vehID, &content);
594}
595
596
597double
598Vehicle::getSecureGap(const std::string& vehID, double speed, double leaderSpeed, double leaderMaxDecel, const std::string& leaderID) {
599 tcpip::Storage content;
600 StoHelp::writeCompound(content, 4);
601 StoHelp::writeTypedDouble(content, speed);
602 StoHelp::writeTypedDouble(content, leaderSpeed);
603 StoHelp::writeTypedDouble(content, leaderMaxDecel);
604 StoHelp::writeTypedString(content, leaderID);
605 return Dom::getDouble(libsumo::VAR_SECURE_GAP, vehID, &content);
606}
607
608
609double
610Vehicle::getStopSpeed(const std::string& vehID, const double speed, double gap) {
611 tcpip::Storage content;
612 StoHelp::writeCompound(content, 2);
613 StoHelp::writeTypedDouble(content, speed);
614 StoHelp::writeTypedDouble(content, gap);
615 return Dom::getDouble(libsumo::VAR_STOP_SPEED, vehID, &content);
616}
617
618double
619Vehicle::getStopDelay(const std::string& vehID) {
621}
622
623double
624Vehicle::getStopArrivalDelay(const std::string& vehID) {
626}
627
628double
629Vehicle::getTimeLoss(const std::string& vehID) {
631}
632
633std::vector<std::string>
634Vehicle::getTaxiFleet(int taxiState) {
635 tcpip::Storage content;
636 StoHelp::writeTypedInt(content, taxiState);
637 return Dom::getStringVector(libsumo::VAR_TAXI_FLEET, "", &content);
638}
639
640std::vector<std::string>
641Vehicle::getLoadedIDList() {
643}
644
645std::vector<std::string>
646Vehicle::getTeleportingIDList() {
648}
649
650std::string
651Vehicle::getEmissionClass(const std::string& vehID) {
653}
654
655std::string
656Vehicle::getShapeClass(const std::string& vehID) {
658}
659
660
661double
662Vehicle::getLength(const std::string& vehID) {
663 return Dom::getDouble(libsumo::VAR_LENGTH, vehID);
664}
665
666
667double
668Vehicle::getAccel(const std::string& vehID) {
669 return Dom::getDouble(libsumo::VAR_ACCEL, vehID);
670}
671
672
673double
674Vehicle::getDecel(const std::string& vehID) {
675 return Dom::getDouble(libsumo::VAR_DECEL, vehID);
676}
677
678
679double Vehicle::getEmergencyDecel(const std::string& vehID) {
681}
682
683
684double Vehicle::getApparentDecel(const std::string& vehID) {
686}
687
688
689double Vehicle::getActionStepLength(const std::string& vehID) {
691}
692
693
694double Vehicle::getLastActionTime(const std::string& vehID) {
696}
697
698
699double
700Vehicle::getTau(const std::string& vehID) {
701 return Dom::getDouble(libsumo::VAR_TAU, vehID);
702}
703
704
705double
706Vehicle::getImperfection(const std::string& vehID) {
708}
709
710
711double
712Vehicle::getSpeedDeviation(const std::string& vehID) {
714}
715
716
717std::string
718Vehicle::getVehicleClass(const std::string& vehID) {
720}
721
722
723double
724Vehicle::getMinGap(const std::string& vehID) {
725 return Dom::getDouble(libsumo::VAR_MINGAP, vehID);
726}
727
728
729double
730Vehicle::getMinGapLat(const std::string& vehID) {
732}
733
734
735double
736Vehicle::getMaxSpeed(const std::string& vehID) {
738}
739
740
741double
742Vehicle::getMaxSpeedLat(const std::string& vehID) {
744}
745
746
747std::string
748Vehicle::getLateralAlignment(const std::string& vehID) {
750}
751
752
753double
754Vehicle::getWidth(const std::string& vehID) {
755 return Dom::getDouble(libsumo::VAR_WIDTH, vehID);
756}
757
758
759double
760Vehicle::getHeight(const std::string& vehID) {
761 return Dom::getDouble(libsumo::VAR_HEIGHT, vehID);
762}
763
764
765void
766Vehicle::setStop(const std::string& vehID,
767 const std::string& edgeID,
768 double pos,
769 int laneIndex,
770 double duration,
771 int flags,
772 double startPos,
773 double until) {
774 tcpip::Storage content;
775 StoHelp::writeCompound(content, 7);
776 StoHelp::writeTypedString(content, edgeID);
777 StoHelp::writeTypedDouble(content, pos);
778 StoHelp::writeTypedByte(content, laneIndex);
779 StoHelp::writeTypedDouble(content, duration);
780 StoHelp::writeTypedByte(content, flags);
781 StoHelp::writeTypedDouble(content, startPos);
782 StoHelp::writeTypedDouble(content, until);
783 Dom::set(libsumo::CMD_STOP, vehID, &content);
784}
785
786
787void
788Vehicle::replaceStop(const std::string& vehID,
789 int nextStopIndex,
790 const std::string& edgeID,
791 double pos,
792 int laneIndex,
793 double duration,
794 int flags,
795 double startPos,
796 double until,
797 int teleport) {
798 tcpip::Storage content;
799 StoHelp::writeCompound(content, 9);
800 StoHelp::writeTypedString(content, edgeID);
801 StoHelp::writeTypedDouble(content, pos);
802 StoHelp::writeTypedByte(content, laneIndex);
803 StoHelp::writeTypedDouble(content, duration);
804 StoHelp::writeTypedInt(content, flags);
805 StoHelp::writeTypedDouble(content, startPos);
806 StoHelp::writeTypedDouble(content, until);
807 StoHelp::writeTypedInt(content, nextStopIndex);
808 StoHelp::writeTypedByte(content, teleport);
809 Dom::set(libsumo::CMD_REPLACE_STOP, vehID, &content);
810}
811
812
813void
814Vehicle::insertStop(const std::string& vehID,
815 int nextStopIndex,
816 const std::string& edgeID,
817 double pos,
818 int laneIndex,
819 double duration,
820 int flags,
821 double startPos,
822 double until,
823 int teleport) {
824 tcpip::Storage content;
825 StoHelp::writeCompound(content, 9);
826 StoHelp::writeTypedString(content, edgeID);
827 StoHelp::writeTypedDouble(content, pos);
828 StoHelp::writeTypedByte(content, laneIndex);
829 StoHelp::writeTypedDouble(content, duration);
830 StoHelp::writeTypedInt(content, flags);
831 StoHelp::writeTypedDouble(content, startPos);
832 StoHelp::writeTypedDouble(content, until);
833 StoHelp::writeTypedInt(content, nextStopIndex);
834 StoHelp::writeTypedByte(content, teleport);
835 Dom::set(libsumo::CMD_INSERT_STOP, vehID, &content);
836}
837
838
839void
840Vehicle::setStopParameter(const std::string& vehID, int nextStopIndex,
841 const std::string& param, const std::string& value,
842 bool customParam) {
843 tcpip::Storage content;
844 StoHelp::writeCompound(content, 4);
845 StoHelp::writeTypedInt(content, nextStopIndex);
846 StoHelp::writeTypedString(content, param);
847 StoHelp::writeTypedString(content, value);
848 StoHelp::writeTypedByte(content, customParam);
849 Dom::set(libsumo::VAR_STOP_PARAMETER, vehID, &content);
850}
851
852
853void
854Vehicle::rerouteParkingArea(const std::string& vehID, const std::string& parkingAreaID) {
855 tcpip::Storage content;
856 StoHelp::writeCompound(content, 1);
857 StoHelp::writeTypedString(content, parkingAreaID);
859}
860
861
862void
863Vehicle::resume(const std::string& vehID) {
864 tcpip::Storage content;
865 StoHelp::writeCompound(content, 0);
866 Dom::set(libsumo::CMD_RESUME, vehID, &content);
867}
868
869
870void
871Vehicle::changeTarget(const std::string& vehID, const std::string& edgeID) {
873}
874
875
876void
877Vehicle::changeLane(const std::string& vehID, int laneIndex, double duration) {
878 tcpip::Storage content;
879 StoHelp::writeCompound(content, 2);
880 StoHelp::writeTypedByte(content, laneIndex);
881 StoHelp::writeTypedDouble(content, duration);
882 Dom::set(libsumo::CMD_CHANGELANE, vehID, &content);
883}
884
885void
886Vehicle::changeLaneRelative(const std::string& vehID, int indexOffset, double duration) {
887 tcpip::Storage content;
888 StoHelp::writeCompound(content, 3);
889 StoHelp::writeTypedByte(content, indexOffset);
890 StoHelp::writeTypedDouble(content, duration);
891 StoHelp::writeTypedByte(content, 1);
892 Dom::set(libsumo::CMD_CHANGELANE, vehID, &content);
893}
894
895
896void
897Vehicle::changeSublane(const std::string& vehID, double latDist) {
899}
900
901
902void
903Vehicle::add(const std::string& vehID,
904 const std::string& routeID,
905 const std::string& typeID,
906 const std::string& depart,
907 const std::string& departLane,
908 const std::string& departPos,
909 const std::string& departSpeed,
910 const std::string& arrivalLane,
911 const std::string& arrivalPos,
912 const std::string& arrivalSpeed,
913 const std::string& fromTaz,
914 const std::string& toTaz,
915 const std::string& line,
916 int personCapacity,
917 int personNumber) {
918 tcpip::Storage content;
919 StoHelp::writeCompound(content, 14);
920 StoHelp::writeTypedString(content, routeID);
921 StoHelp::writeTypedString(content, typeID);
922 StoHelp::writeTypedString(content, depart);
923 StoHelp::writeTypedString(content, departLane);
924 StoHelp::writeTypedString(content, departPos);
925 StoHelp::writeTypedString(content, departSpeed);
926
927 StoHelp::writeTypedString(content, arrivalLane);
928 StoHelp::writeTypedString(content, arrivalPos);
929 StoHelp::writeTypedString(content, arrivalSpeed);
930
931 StoHelp::writeTypedString(content, fromTaz);
932 StoHelp::writeTypedString(content, toTaz);
933 StoHelp::writeTypedString(content, line);
934
935 StoHelp::writeTypedInt(content, personCapacity);
936 StoHelp::writeTypedInt(content, personNumber);
937
938 Dom::set(libsumo::ADD_FULL, vehID, &content);
939}
940
941
942void
943Vehicle::moveToXY(const std::string& vehID, const std::string& edgeID, const int laneIndex,
944 const double x, const double y, double angle, const int keepRoute, double matchThreshold) {
945 tcpip::Storage content;
946 StoHelp::writeCompound(content, 7);
947 StoHelp::writeTypedString(content, edgeID);
948 StoHelp::writeTypedInt(content, laneIndex);
949 StoHelp::writeTypedDouble(content, x);
950 StoHelp::writeTypedDouble(content, y);
951 StoHelp::writeTypedDouble(content, angle);
952 StoHelp::writeTypedByte(content, keepRoute);
953 StoHelp::writeTypedDouble(content, matchThreshold);
954 Dom::set(libsumo::MOVE_TO_XY, vehID, &content);
955}
956
957void
958Vehicle::slowDown(const std::string& vehID, double speed, double duration) {
959 tcpip::Storage content;
960 StoHelp::writeCompound(content, 2);
961 StoHelp::writeTypedDouble(content, speed);
962 StoHelp::writeTypedDouble(content, duration);
963 Dom::set(libsumo::CMD_SLOWDOWN, vehID, &content);
964}
965
966void
967Vehicle::openGap(const std::string& vehID, double newTimeHeadway, double newSpaceHeadway, double duration, double changeRate, double maxDecel, const std::string& referenceVehID) {
968 tcpip::Storage content;
969 StoHelp::writeCompound(content, referenceVehID != "" ? 6 : 5);
970 StoHelp::writeTypedDouble(content, newTimeHeadway);
971 StoHelp::writeTypedDouble(content, newSpaceHeadway);
972 StoHelp::writeTypedDouble(content, duration);
973 StoHelp::writeTypedDouble(content, changeRate);
974 StoHelp::writeTypedDouble(content, maxDecel);
975 if (referenceVehID != "") {
976 StoHelp::writeTypedString(content, referenceVehID);
977 }
978 Dom::set(libsumo::CMD_OPENGAP, vehID, &content);
979}
980
981void
982Vehicle::deactivateGapControl(const std::string& vehID) {
983 openGap(vehID, -1, -1, -1, -1);
984}
985
986void
987Vehicle::requestToC(const std::string& vehID, double leadTime) {
988 std::ostringstream oss;
989 oss.setf(std::ios::fixed, std::ios::floatfield);
990 oss << std::setprecision(2);
991 oss << leadTime;
992 setParameter(vehID, "device.toc.requestToC", oss.str());
993}
994
995void
996Vehicle::setSpeed(const std::string& vehID, double speed) {
997 Dom::setDouble(libsumo::VAR_SPEED, vehID, speed);
998}
999
1000void
1001Vehicle::setAcceleration(const std::string& vehID, double accel, double duration) {
1002 tcpip::Storage content;
1003 StoHelp::writeCompound(content, 2);
1004 StoHelp::writeTypedDouble(content, accel);
1005 StoHelp::writeTypedDouble(content, duration);
1006 Dom::set(libsumo::VAR_ACCELERATION, vehID, &content);
1007}
1008
1009void
1010Vehicle::setPreviousSpeed(const std::string& vehID, double prevSpeed, double prevAcceleration) {
1011 tcpip::Storage content;
1012 StoHelp::writeCompound(content, 2);
1013 StoHelp::writeTypedDouble(content, prevSpeed);
1014 StoHelp::writeTypedDouble(content, prevAcceleration);
1015 Dom::set(libsumo::VAR_PREV_SPEED, vehID, &content);
1016}
1017
1018void
1019Vehicle::setSpeedMode(const std::string& vehID, int speedMode) {
1020 Dom::setInt(libsumo::VAR_SPEEDSETMODE, vehID, speedMode);
1021}
1022
1023void
1024Vehicle::setLaneChangeMode(const std::string& vehID, int laneChangeMode) {
1025 Dom::setInt(libsumo::VAR_LANECHANGE_MODE, vehID, laneChangeMode);
1026}
1027
1028void
1029Vehicle::setRoutingMode(const std::string& vehID, int routingMode) {
1030 Dom::setInt(libsumo::VAR_ROUTING_MODE, vehID, routingMode);
1031}
1032
1033void
1034Vehicle::setType(const std::string& vehID, const std::string& typeID) {
1035 Dom::setString(libsumo::VAR_TYPE, vehID, typeID);
1036}
1037
1038void
1039Vehicle::setRouteID(const std::string& vehID, const std::string& routeID) {
1040 Dom::setString(libsumo::VAR_ROUTE_ID, vehID, routeID);
1041}
1042
1043void
1044Vehicle::setRoute(const std::string& vehID, const std::string& edgeID) {
1045 setRoute(vehID, std::vector<std::string>({edgeID}));
1046}
1047
1048void
1049Vehicle::setRoute(const std::string& vehID, const std::vector<std::string>& edgeIDs) {
1051}
1052
1053void
1054Vehicle::setLateralLanePosition(const std::string& vehID, double posLat) {
1056}
1057
1058void
1059Vehicle::updateBestLanes(const std::string& vehID) {
1060 tcpip::Storage content;
1061 Dom::set(libsumo::VAR_UPDATE_BESTLANES, vehID, &content);
1062}
1063
1064
1065void
1066Vehicle::setAdaptedTraveltime(const std::string& vehID, const std::string& edgeID,
1067 double time, double begSeconds, double endSeconds) {
1068 tcpip::Storage content;
1069 if (time == libsumo::INVALID_DOUBLE_VALUE) {
1070 // reset
1071 StoHelp::writeCompound(content, 1);
1072 StoHelp::writeTypedString(content, edgeID);
1073 } else if (begSeconds == libsumo::INVALID_DOUBLE_VALUE) {
1074 // set value for the whole simulation
1075 StoHelp::writeCompound(content, 2);
1076 StoHelp::writeTypedString(content, edgeID);
1077 StoHelp::writeTypedDouble(content, time);
1078 } else {
1079 StoHelp::writeCompound(content, 4);
1080 StoHelp::writeTypedDouble(content, begSeconds);
1081 StoHelp::writeTypedDouble(content, endSeconds);
1082 StoHelp::writeTypedString(content, edgeID);
1083 StoHelp::writeTypedDouble(content, time);
1084 }
1085 Dom::set(libsumo::VAR_EDGE_TRAVELTIME, vehID, &content);
1086}
1087
1088
1089void
1090Vehicle::setEffort(const std::string& vehID, const std::string& edgeID,
1091 double effort, double begSeconds, double endSeconds) {
1092 tcpip::Storage content;
1093 if (effort == libsumo::INVALID_DOUBLE_VALUE) {
1094 // reset
1095 StoHelp::writeCompound(content, 1);
1096 StoHelp::writeTypedString(content, edgeID);
1097 } else if (begSeconds == libsumo::INVALID_DOUBLE_VALUE) {
1098 // set value for the whole simulation
1099 StoHelp::writeCompound(content, 2);
1100 StoHelp::writeTypedString(content, edgeID);
1101 StoHelp::writeTypedDouble(content, effort);
1102 } else {
1103 StoHelp::writeCompound(content, 4);
1104 StoHelp::writeTypedDouble(content, begSeconds);
1105 StoHelp::writeTypedDouble(content, endSeconds);
1106 StoHelp::writeTypedString(content, edgeID);
1107 StoHelp::writeTypedDouble(content, effort);
1108 }
1109 Dom::set(libsumo::VAR_EDGE_EFFORT, vehID, &content);
1110}
1111
1112
1113void
1114Vehicle::rerouteTraveltime(const std::string& vehID, const bool /* currentTravelTimes */) {
1115 tcpip::Storage content;
1116 StoHelp::writeCompound(content, 0);
1117 Dom::set(libsumo::CMD_REROUTE_TRAVELTIME, vehID, &content);
1118}
1119
1120
1121void
1122Vehicle::rerouteEffort(const std::string& vehID) {
1123 tcpip::Storage content;
1124 StoHelp::writeCompound(content, 0);
1125 Dom::set(libsumo::CMD_REROUTE_EFFORT, vehID, &content);
1126}
1127
1128
1129void
1130Vehicle::setSignals(const std::string& vehID, int signals) {
1131 Dom::setInt(libsumo::VAR_SIGNALS, vehID, signals);
1132}
1133
1134
1135void
1136Vehicle::moveTo(const std::string& vehID, const std::string& laneID, double position, int reason) {
1137 tcpip::Storage content;
1138 StoHelp::writeCompound(content, 3);
1139 StoHelp::writeTypedString(content, laneID);
1140 StoHelp::writeTypedDouble(content, position);
1141 StoHelp::writeTypedInt(content, reason);
1142 Dom::set(libsumo::VAR_MOVE_TO, vehID, &content);
1143}
1144
1145
1146void
1147Vehicle::setActionStepLength(const std::string& vehID, double actionStepLength, bool resetActionOffset) {
1148 //if (actionStepLength < 0) {
1149 // raise TraCIException("Invalid value for actionStepLength. Given value must be non-negative.")
1150 //{
1151 // Use negative value to indicate resetActionOffset == False
1152 if (!resetActionOffset) {
1153 actionStepLength *= -1;
1154 }
1155 Dom::setDouble(libsumo::VAR_ACTIONSTEPLENGTH, vehID, actionStepLength);
1156}
1157
1158
1159void
1160Vehicle::remove(const std::string& vehID, char reason) {
1161 tcpip::Storage content;
1163 content.writeUnsignedByte(reason);
1164 Dom::set(libsumo::REMOVE, vehID, &content);
1165}
1166
1167
1168void
1169Vehicle::setColor(const std::string& vehID, const libsumo::TraCIColor& color) {
1170 Dom::setCol(libsumo::VAR_COLOR, vehID, color);
1171}
1172
1173
1174void
1175Vehicle::setSpeedFactor(const std::string& vehID, double factor) {
1177}
1178
1179
1180void
1181Vehicle::setLine(const std::string& vehID, const std::string& line) {
1182 Dom::setString(libsumo::VAR_LINE, vehID, line);
1183}
1184
1185
1186void
1187Vehicle::setVia(const std::string& vehID, const std::vector<std::string>& via) {
1189}
1190
1191
1192void
1193Vehicle::setLength(const std::string& vehID, double length) {
1194 Dom::setDouble(libsumo::VAR_LENGTH, vehID, length);
1195}
1196
1197
1198void
1199Vehicle::setMaxSpeed(const std::string& vehID, double speed) {
1201}
1202
1203
1204void
1205Vehicle::setVehicleClass(const std::string& vehID, const std::string& clazz) {
1207}
1208
1209
1210void
1211Vehicle::setShapeClass(const std::string& vehID, const std::string& clazz) {
1213}
1214
1215
1216void
1217Vehicle::setEmissionClass(const std::string& vehID, const std::string& clazz) {
1219}
1220
1221
1222void
1223Vehicle::setWidth(const std::string& vehID, double width) {
1224 Dom::setDouble(libsumo::VAR_WIDTH, vehID, width);
1225}
1226
1227
1228void
1229Vehicle::setHeight(const std::string& vehID, double height) {
1230 Dom::setDouble(libsumo::VAR_HEIGHT, vehID, height);
1231}
1232
1233
1234void
1235Vehicle::setMinGap(const std::string& vehID, double minGap) {
1236 Dom::setDouble(libsumo::VAR_MINGAP, vehID, minGap);
1237}
1238
1239
1240void
1241Vehicle::setAccel(const std::string& vehID, double accel) {
1242 Dom::setDouble(libsumo::VAR_ACCEL, vehID, accel);
1243}
1244
1245
1246void
1247Vehicle::setDecel(const std::string& vehID, double decel) {
1248 Dom::setDouble(libsumo::VAR_DECEL, vehID, decel);
1249}
1250
1251
1252void
1253Vehicle::setEmergencyDecel(const std::string& vehID, double decel) {
1255}
1256
1257
1258void
1259Vehicle::setApparentDecel(const std::string& vehID, double decel) {
1261}
1262
1263
1264void
1265Vehicle::setImperfection(const std::string& vehID, double imperfection) {
1266 Dom::setDouble(libsumo::VAR_IMPERFECTION, vehID, imperfection);
1267}
1268
1269
1270void
1271Vehicle::setTau(const std::string& vehID, double tau) {
1272 Dom::setDouble(libsumo::VAR_TAU, vehID, tau);
1273}
1274
1275
1276void
1277Vehicle::setMinGapLat(const std::string& vehID, double minGapLat) {
1278 Dom::setDouble(libsumo::VAR_MINGAP_LAT, vehID, minGapLat);
1279}
1280
1281
1282void
1283Vehicle::setMaxSpeedLat(const std::string& vehID, double speed) {
1285}
1286
1287
1288void
1289Vehicle::setLateralAlignment(const std::string& vehID, const std::string& latAlignment) {
1290 Dom::setString(libsumo::VAR_LATALIGNMENT, vehID, latAlignment);
1291}
1292
1293
1294void
1295Vehicle::setImpatience(const std::string& vehID, double impatience) {
1296 Dom::setDouble(libsumo::VAR_IMPATIENCE, vehID, impatience);
1297}
1298
1299void
1300Vehicle::setBoardingDuration(const std::string& vehID, double boardingDuration) {
1301 Dom::setDouble(libsumo::VAR_BOARDING_DURATION, vehID, boardingDuration);
1302}
1303
1304
1305void
1306Vehicle::highlight(const std::string& vehID, const libsumo::TraCIColor& col, double size, const int alphaMax, const double duration, const int type) {
1307 tcpip::Storage content;
1308 StoHelp::writeCompound(content, alphaMax > 0 ? 5 : 2);
1310 content.writeUnsignedByte(col.r);
1311 content.writeUnsignedByte(col.g);
1312 content.writeUnsignedByte(col.b);
1313 content.writeUnsignedByte(col.a);
1314 StoHelp::writeTypedDouble(content, size);
1315 if (alphaMax > 0) {
1317 content.writeUnsignedByte(alphaMax);
1318 StoHelp::writeTypedDouble(content, duration);
1320 content.writeUnsignedByte(type);
1321 }
1322 Dom::set(libsumo::VAR_HIGHLIGHT, vehID, &content);
1323}
1324
1325void
1326Vehicle::dispatchTaxi(const std::string& vehID, const std::vector<std::string>& reservations) {
1328}
1329
1330
1331void
1332Vehicle::subscribeLeader(const std::string& vehID, double dist, double begin, double end) {
1333 subscribe(vehID, std::vector<int>({ libsumo::VAR_LEADER }), begin, end,
1334 libsumo::TraCIResults({ {libsumo::VAR_LEADER, std::make_shared<libsumo::TraCIDouble>(dist)} }));
1335}
1336
1337
1338void
1339Vehicle::addSubscriptionFilterLanes(const std::vector<int>& lanes, bool noOpposite, double downstreamDist, double upstreamDist) {
1340 tcpip::Storage content;
1341 content.writeUnsignedByte((int)lanes.size());
1342 for (int lane : lanes) {
1343 content.writeUnsignedByte(lane < 0 ? lane + 256 : lane);
1344 }
1346 if (noOpposite) {
1347 addSubscriptionFilterNoOpposite();
1348 }
1349 if (downstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1350 addSubscriptionFilterDownstreamDistance(downstreamDist);
1351 }
1352 if (upstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1353 addSubscriptionFilterUpstreamDistance(upstreamDist);
1354 }
1355}
1356
1357
1358void
1359Vehicle::addSubscriptionFilterNoOpposite() {
1361}
1362
1363
1364void
1365Vehicle::addSubscriptionFilterDownstreamDistance(double dist) {
1366 tcpip::Storage content;
1367 StoHelp::writeTypedDouble(content, dist);
1369}
1370
1371
1372void
1373Vehicle::addSubscriptionFilterUpstreamDistance(double dist) {
1374 tcpip::Storage content;
1375 StoHelp::writeTypedDouble(content, dist);
1377}
1378
1379
1380void
1381Vehicle::addSubscriptionFilterCFManeuver(double downstreamDist, double upstreamDist) {
1382 addSubscriptionFilterLeadFollow(std::vector<int>(1));
1383 if (downstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1384 addSubscriptionFilterDownstreamDistance(downstreamDist);
1385 }
1386 if (upstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1387 addSubscriptionFilterUpstreamDistance(upstreamDist);
1388 }
1389}
1390
1391
1392void
1393Vehicle::addSubscriptionFilterLCManeuver(int direction, bool noOpposite, double downstreamDist, double upstreamDist) {
1394 if (direction == libsumo::INVALID_INT_VALUE) {
1395 addSubscriptionFilterLeadFollow({ -1, 0, 1 });
1396 } else if (direction != -1 && direction != 1) {
1397 // warnings.warn("Ignoring lane change subscription filter with non-neighboring lane offset direction=%s." % direction)
1398 return;
1399 } else {
1400 addSubscriptionFilterLeadFollow({ 0, direction });
1401 }
1402 if (noOpposite) {
1403 addSubscriptionFilterNoOpposite();
1404 }
1405 if (downstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1406 addSubscriptionFilterDownstreamDistance(downstreamDist);
1407 }
1408 if (upstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1409 addSubscriptionFilterUpstreamDistance(upstreamDist);
1410 }
1411}
1412
1413
1414void
1415Vehicle::addSubscriptionFilterLeadFollow(const std::vector<int>& lanes) {
1417 addSubscriptionFilterLanes(lanes);
1418}
1419
1420
1421void
1422Vehicle::addSubscriptionFilterTurn(double downstreamDist, double foeDistToJunction) {
1423 tcpip::Storage content;
1424 StoHelp::writeTypedDouble(content, foeDistToJunction);
1426 if (downstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1427 addSubscriptionFilterDownstreamDistance(downstreamDist);
1428 }
1429}
1430
1431
1432void
1433Vehicle::addSubscriptionFilterVClass(const std::vector<std::string>& vClasses) {
1434 tcpip::Storage content;
1435 StoHelp::writeTypedStringList(content, vClasses);
1437}
1438
1439
1440void
1441Vehicle::addSubscriptionFilterVType(const std::vector<std::string>& vTypes) {
1442 tcpip::Storage content;
1443 StoHelp::writeTypedStringList(content, vTypes);
1445}
1446
1447
1448void
1449Vehicle::addSubscriptionFilterFieldOfVision(double openingAngle) {
1450 tcpip::Storage content;
1451 StoHelp::writeTypedDouble(content, openingAngle);
1453}
1454
1455
1456void
1457Vehicle::addSubscriptionFilterLateralDistance(double lateralDist, double downstreamDist, double upstreamDist) {
1458 tcpip::Storage content;
1459 StoHelp::writeTypedDouble(content, lateralDist);
1461 if (downstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1462 addSubscriptionFilterDownstreamDistance(downstreamDist);
1463 }
1464 if (upstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1465 addSubscriptionFilterUpstreamDistance(upstreamDist);
1466 }
1467}
1468
1469
1470}
1471
1472
1473/****************************************************************************/
#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 bool readBool(tcpip::Storage &ret, const std::string &error="")
Definition: StorageHelper.h:96
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
std::string approachedLane
Definition: TraCIDefs.h:404
std::string approachedInternal
Definition: TraCIDefs.h:408
static Connection & getActive()
Definition: Connection.h:57
void addFilter(int var, tcpip::Storage *add=nullptr)
Definition: Connection.cpp:342
std::mutex & getMutex() const
Definition: Connection.h:76
static void setDouble(int var, const std::string &id, double value)
Definition: Domain.h:231
static libsumo::TraCIPosition getPos(int var, const std::string &id, tcpip::Storage *add=nullptr, const bool isGeo=false)
Definition: Domain.h:153
static void setCol(int var, const std::string &id, const libsumo::TraCIColor value)
Definition: Domain.h:252
static std::vector< std::string > getStringVector(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition: Domain.h:177
static void setStringVector(int var, const std::string &id, const std::vector< std::string > &value)
Definition: Domain.h:245
static libsumo::TraCIColor getCol(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition: Domain.h:187
static std::string getString(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition: Domain.h:172
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:219
static libsumo::TraCIPosition getPos3D(int var, const std::string &id, tcpip::Storage *add=nullptr, const bool isGeo=false)
Definition: Domain.h:162
static double getDouble(int var, const std::string &id, tcpip::Storage *add=nullptr)
Definition: Domain.h:130
static void setInt(int var, const std::string &id, int value)
Definition: Domain.h:224
static void setString(int var, const std::string &id, const std::string &value)
Definition: Domain.h:238
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_IMPATIENCE
TRACI_CONST int VAR_LATALIGNMENT
TRACI_CONST int VAR_TYPE
TRACI_CONST int CMD_CHANGESUBLANE
TRACI_CONST int VAR_DEPARTURE
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 VAR_BOARDING_DURATION
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 VAR_TELEPORTING_LIST
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_NEXT_LINKS
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 VAR_LOADED_LIST
TRACI_CONST int FILTER_TYPE_LANES
TRACI_CONST int VAR_ACCEL
TRACI_CONST int VAR_DEPART_DELAY
std::map< int, std::shared_ptr< libsumo::TraCIResult > > TraCIResults
{variable->value}
Definition: TraCIDefs.h:335
TRACI_CONST int VAR_FOES
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:544
double occupation
The traffic density along length.
Definition: TraCIDefs.h:546
bool allowsContinuation
Whether this lane allows continuing the route.
Definition: TraCIDefs.h:550
int bestLaneOffset
The offset of this lane from the best lane.
Definition: TraCIDefs.h:548
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
Definition: TraCIDefs.h:552
std::string laneID
The id of the lane.
Definition: TraCIDefs.h:542
std::string foeId
the id of the vehicle with intersecting trajectory
Definition: TraCIDefs.h:679
std::string stoppingPlaceID
Id assigned to the stop.
Definition: TraCIDefs.h:493
std::string lane
The lane to stop at.
Definition: TraCIDefs.h:487
int stopFlags
Stop flags.
Definition: TraCIDefs.h:495
std::string actType
additional information for this stop
Definition: TraCIDefs.h:511
std::string tripId
id of the trip within a cyclical public transport route
Definition: TraCIDefs.h:513
double startPos
The stopping position start.
Definition: TraCIDefs.h:489
double arrival
The actual arrival time (only for past stops)
Definition: TraCIDefs.h:503
double depart
The time at which this stop was ended.
Definition: TraCIDefs.h:505
std::string join
the id of the vehicle (train portion) to which this vehicle shall be joined
Definition: TraCIDefs.h:509
double speed
the speed at which this stop counts as reached (waypoint mode)
Definition: TraCIDefs.h:517
double intendedArrival
The intended arrival time.
Definition: TraCIDefs.h:501
double endPos
The stopping position end.
Definition: TraCIDefs.h:491
std::string split
the id of the vehicle (train portion) that splits of upon reaching this stop
Definition: TraCIDefs.h:507
std::string line
the new line id of the trip within a cyclical public transport route
Definition: TraCIDefs.h:515
double duration
The intended (minimum) stopping duration.
Definition: TraCIDefs.h:497
double until
The time at which the vehicle may continue its journey.
Definition: TraCIDefs.h:499
double dist
The distance to the tls.
Definition: TraCIDefs.h:436
int tlIndex
The tls index of the controlled link.
Definition: TraCIDefs.h:434
std::string id
The id of the next tls.
Definition: TraCIDefs.h:432
char state
The current state of the tls.
Definition: TraCIDefs.h:438
A 2D or 3D-position, for 2D positions z == INVALID_DOUBLE_VALUE.
Definition: TraCIDefs.h:178