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-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
219std::vector<std::string>
220Vehicle::getPersonIDList(const std::string& vehID) {
222}
223
224std::pair<std::string, double>
225Vehicle::getLeader(const std::string& vehID, double dist) {
226 tcpip::Storage content;
227 StoHelp::writeTypedDouble(content, dist);
228 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
229 tcpip::Storage& ret = Dom::get(libsumo::VAR_LEADER, vehID, &content);
230 ret.readInt(); // components
231 ret.readUnsignedByte();
232 const std::string leaderID = ret.readString();
233 ret.readUnsignedByte();
234 const double gap = ret.readDouble();
235 return std::make_pair(leaderID, gap);
236}
237
238
239std::pair<std::string, double>
240Vehicle::getFollower(const std::string& vehID, double dist) {
241 tcpip::Storage content;
242 StoHelp::writeTypedDouble(content, dist);
243 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
244 tcpip::Storage& ret = Dom::get(libsumo::VAR_FOLLOWER, vehID, &content);
245 ret.readInt(); // components
246 ret.readUnsignedByte();
247 const std::string leaderID = ret.readString();
248 ret.readUnsignedByte();
249 const double gap = ret.readDouble();
250 return std::make_pair(leaderID, gap);
251}
252
253
254std::vector<libsumo::TraCIJunctionFoe>
255Vehicle::getJunctionFoes(const std::string& vehID, double dist) {
256 std::vector<libsumo::TraCIJunctionFoe> result;
257 tcpip::Storage content;
258 StoHelp::writeTypedDouble(content, dist);
259 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
260 tcpip::Storage& ret = Dom::get(libsumo::VAR_FOES, vehID, &content);
261 const int n = ret.readInt(); // number of foe informations
262 for (int i = 0; i < n; ++i) {
264 // TODO implement server side and result retrieval
265 result.push_back(info);
266 }
267 return result;
268}
269
270
271double
272Vehicle::getWaitingTime(const std::string& vehID) {
274}
275
276
277double
278Vehicle::getAccumulatedWaitingTime(const std::string& vehID) {
280}
281
282
283double
284Vehicle::getAdaptedTraveltime(const std::string& vehID, double time, const std::string& edgeID) {
285 tcpip::Storage content;
286 StoHelp::writeCompound(content, 2);
287 StoHelp::writeTypedDouble(content, time);
288 StoHelp::writeTypedString(content, edgeID);
289 return Dom::getDouble(libsumo::VAR_EDGE_TRAVELTIME, vehID, &content);
290}
291
292
293double
294Vehicle::getEffort(const std::string& vehID, double time, const std::string& edgeID) {
295 tcpip::Storage content;
296 StoHelp::writeCompound(content, 2);
297 StoHelp::writeTypedDouble(content, time);
298 StoHelp::writeTypedString(content, edgeID);
299 return Dom::getDouble(libsumo::VAR_EDGE_EFFORT, vehID, &content);
300}
301
302
303bool
304Vehicle::isRouteValid(const std::string& vehID) {
305 return Dom::getInt(libsumo::VAR_ROUTE_VALID, vehID) != 0;
306}
307
308
309std::vector<std::string>
310Vehicle::getRoute(const std::string& vehID) {
312}
313
314
315int
316Vehicle::getSignals(const std::string& vehID) {
317 return Dom::getInt(libsumo::VAR_SIGNALS, vehID);
318}
319
320
321std::vector<libsumo::TraCIBestLanesData>
322Vehicle::getBestLanes(const std::string& vehID) {
323 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
324 std::vector<libsumo::TraCIBestLanesData> result;
326 ret.readInt();
327 ret.readUnsignedByte();
328
329 const int n = ret.readInt(); // number of following edge information
330 for (int i = 0; i < n; ++i) {
332 ret.readUnsignedByte();
333 info.laneID = ret.readString();
334
335 ret.readUnsignedByte();
336 info.length = ret.readDouble();
337
338 ret.readUnsignedByte();
339 info.occupation = ret.readDouble();
340
341 ret.readUnsignedByte();
342 info.bestLaneOffset = ret.readByte();
343
344 ret.readUnsignedByte();
345 info.allowsContinuation = (ret.readUnsignedByte() == 1);
346
347 ret.readUnsignedByte();
348 int m = ret.readInt();
349 while (m-- > 0) {
350 info.continuationLanes.push_back(ret.readString());
351 }
352 result.push_back(info);
353 }
354 return result;
355}
356
357
358std::vector<libsumo::TraCINextTLSData>
359Vehicle::getNextTLS(const std::string& vehID) {
360 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
361 std::vector<libsumo::TraCINextTLSData> result;
363 ret.readInt(); // components
364 // number of items
365 ret.readUnsignedByte();
366 const int n = ret.readInt();
367 for (int i = 0; i < n; ++i) {
369 ret.readUnsignedByte();
370 d.id = ret.readString();
371
372 ret.readUnsignedByte();
373 d.tlIndex = ret.readInt();
374
375 ret.readUnsignedByte();
376 d.dist = ret.readDouble();
377
378 ret.readUnsignedByte();
379 d.state = (char)ret.readByte();
380
381 result.push_back(d);
382 }
383 return result;
384}
385
386std::vector<libsumo::TraCINextStopData>
387Vehicle::getNextStops(const std::string& vehID) {
388 return getStops(vehID, 0);
389}
390
391std::vector<libsumo::TraCIConnection>
392Vehicle::getNextLinks(const std::string& vehID) {
393 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
394 std::vector<libsumo::TraCIConnection> result;
396 ret.readInt(); // components
397 // number of items
398 ret.readUnsignedByte();
399 ret.readInt();
400
401 int linkNo = ret.readInt();
402 for (int i = 0; i < linkNo; ++i) {
403
404 ret.readUnsignedByte();
405 std::string approachedLane = ret.readString();
406
407 ret.readUnsignedByte();
408 std::string approachedLaneInternal = ret.readString();
409
410 ret.readUnsignedByte();
411 bool hasPrio = ret.readUnsignedByte() != 0;
412
413 ret.readUnsignedByte();
414 bool isOpen = ret.readUnsignedByte() != 0;
415
416 ret.readUnsignedByte();
417 bool hasFoe = ret.readUnsignedByte() != 0;
418
419 ret.readUnsignedByte();
420 std::string state = ret.readString();
421
422 ret.readUnsignedByte();
423 std::string direction = ret.readString();
424
425 ret.readUnsignedByte();
426 double length = ret.readDouble();
427
428 result.push_back(libsumo::TraCIConnection(approachedLane,
429 hasPrio,
430 isOpen,
431 hasFoe,
432 approachedLaneInternal,
433 state,
434 direction,
435 length));
436 }
437 return result;
438}
439
440std::vector<libsumo::TraCINextStopData>
441Vehicle::getStops(const std::string& vehID, int limit) {
442 std::vector<libsumo::TraCINextStopData> result;
443 tcpip::Storage content;
444 StoHelp::writeTypedInt(content, limit);
445 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
446 tcpip::Storage& ret = Dom::get(libsumo::VAR_NEXT_STOPS2, vehID, &content);
447 ret.readInt(); // components
448 // number of items
449 const int n = StoHelp::readCompound(ret);
450 for (int i = 0; i < n; ++i) {
468 result.emplace_back(s);
469 }
470 return result;
471}
472
473std::string
474Vehicle::getStopParameter(const std::string& vehID, int nextStopIndex, const std::string& param) {
475 tcpip::Storage content;
476 StoHelp::writeCompound(content, 2);
477 StoHelp::writeTypedInt(content, nextStopIndex);
478 StoHelp::writeTypedString(content, param);
479 return Dom::getString(libsumo::VAR_STOP_PARAMETER, vehID, &content);
480}
481
482int
483Vehicle::getStopState(const std::string& vehID) {
484 return Dom::getInt(libsumo::VAR_STOPSTATE, vehID);
485}
486
487
488double
489Vehicle::getDistance(const std::string& vehID) {
491}
492
493
494double
495Vehicle::getDrivingDistance(const std::string& vehID, const std::string& edgeID, double position, int laneIndex) {
496 tcpip::Storage content;
497 StoHelp::writeCompound(content, 2);
499 content.writeString(edgeID);
500 content.writeDouble(position);
501 content.writeUnsignedByte(laneIndex);
503 return Dom::getDouble(libsumo::DISTANCE_REQUEST, vehID, &content);
504}
505
506
507double
508Vehicle::getDrivingDistance2D(const std::string& vehID, double x, double y) {
509 tcpip::Storage content;
510 StoHelp::writeCompound(content, 2);
512 content.writeDouble(x);
513 content.writeDouble(y);
515 return Dom::getDouble(libsumo::DISTANCE_REQUEST, vehID, &content);
516}
517
518
519double
520Vehicle::getAllowedSpeed(const std::string& vehID) {
522}
523
524
525double
526Vehicle::getSpeedFactor(const std::string& vehID) {
528}
529
530
531int
532Vehicle::getSpeedMode(const std::string& vehID) {
534}
535
536
537int
538Vehicle::getLaneChangeMode(const std::string& vehID) {
540}
541
542
543int
544Vehicle::getRoutingMode(const std::string& vehID) {
546}
547
548
549std::string
550Vehicle::getLine(const std::string& vehID) {
551 return Dom::getString(libsumo::VAR_LINE, vehID);
552}
553
554
555
556std::vector<std::string>
557Vehicle::getVia(const std::string& vehID) {
559}
560
561
562std::pair<int, int>
563Vehicle::getLaneChangeState(const std::string& vehID, int direction) {
564 tcpip::Storage content;
565 StoHelp::writeTypedInt(content, direction);
566 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
567 tcpip::Storage& ret = Dom::get(libsumo::CMD_CHANGELANE, vehID, &content);
568 ret.readInt(); // components
569 ret.readUnsignedByte();
570 const int stateWithoutTraCI = ret.readInt();
571 ret.readUnsignedByte();
572 const int state = ret.readInt();
573 return std::make_pair(stateWithoutTraCI, state);
574}
575
576
577std::vector<std::pair<std::string, double> >
578Vehicle::getNeighbors(const std::string& vehID, const int mode) {
579 std::vector<std::pair<std::string, double> > neighs;
580 tcpip::Storage content;
582 content.writeUnsignedByte(mode);
583 std::unique_lock<std::mutex> lock{ libtraci::Connection::getActive().getMutex() };
584 tcpip::Storage& ret = Dom::get(libsumo::VAR_NEIGHBORS, vehID, &content);
585 const int items = ret.readInt(); // components
586 for (int i = 0; i < items; i++) {
587 const std::string neighID = ret.readString();
588 neighs.emplace_back(neighID, ret.readDouble());
589 }
590 return neighs;
591}
592
593
594double
595Vehicle::getFollowSpeed(const std::string& vehID, double speed, double gap, double leaderSpeed, double leaderMaxDecel, const std::string& leaderID) {
596 tcpip::Storage content;
597 StoHelp::writeCompound(content, 5);
598 StoHelp::writeTypedDouble(content, speed);
599 StoHelp::writeTypedDouble(content, gap);
600 StoHelp::writeTypedDouble(content, leaderSpeed);
601 StoHelp::writeTypedDouble(content, leaderMaxDecel);
602 StoHelp::writeTypedString(content, leaderID);
603 return Dom::getDouble(libsumo::VAR_FOLLOW_SPEED, vehID, &content);
604}
605
606
607double
608Vehicle::getSecureGap(const std::string& vehID, double speed, double leaderSpeed, double leaderMaxDecel, const std::string& leaderID) {
609 tcpip::Storage content;
610 StoHelp::writeCompound(content, 4);
611 StoHelp::writeTypedDouble(content, speed);
612 StoHelp::writeTypedDouble(content, leaderSpeed);
613 StoHelp::writeTypedDouble(content, leaderMaxDecel);
614 StoHelp::writeTypedString(content, leaderID);
615 return Dom::getDouble(libsumo::VAR_SECURE_GAP, vehID, &content);
616}
617
618
619double
620Vehicle::getStopSpeed(const std::string& vehID, const double speed, double gap) {
621 tcpip::Storage content;
622 StoHelp::writeCompound(content, 2);
623 StoHelp::writeTypedDouble(content, speed);
624 StoHelp::writeTypedDouble(content, gap);
625 return Dom::getDouble(libsumo::VAR_STOP_SPEED, vehID, &content);
626}
627
628double
629Vehicle::getStopDelay(const std::string& vehID) {
631}
632
633double
634Vehicle::getStopArrivalDelay(const std::string& vehID) {
636}
637
638double
639Vehicle::getTimeLoss(const std::string& vehID) {
641}
642
643std::vector<std::string>
644Vehicle::getTaxiFleet(int taxiState) {
645 tcpip::Storage content;
646 StoHelp::writeTypedInt(content, taxiState);
647 return Dom::getStringVector(libsumo::VAR_TAXI_FLEET, "", &content);
648}
649
650std::vector<std::string>
651Vehicle::getLoadedIDList() {
653}
654
655std::vector<std::string>
656Vehicle::getTeleportingIDList() {
658}
659
660std::string
661Vehicle::getEmissionClass(const std::string& vehID) {
663}
664
665std::string
666Vehicle::getShapeClass(const std::string& vehID) {
668}
669
670
671double
672Vehicle::getLength(const std::string& vehID) {
673 return Dom::getDouble(libsumo::VAR_LENGTH, vehID);
674}
675
676
677double
678Vehicle::getAccel(const std::string& vehID) {
679 return Dom::getDouble(libsumo::VAR_ACCEL, vehID);
680}
681
682
683double
684Vehicle::getDecel(const std::string& vehID) {
685 return Dom::getDouble(libsumo::VAR_DECEL, vehID);
686}
687
688
689double Vehicle::getEmergencyDecel(const std::string& vehID) {
691}
692
693
694double Vehicle::getApparentDecel(const std::string& vehID) {
696}
697
698
699double Vehicle::getActionStepLength(const std::string& vehID) {
701}
702
703
704double Vehicle::getLastActionTime(const std::string& vehID) {
706}
707
708
709double
710Vehicle::getTau(const std::string& vehID) {
711 return Dom::getDouble(libsumo::VAR_TAU, vehID);
712}
713
714
715double
716Vehicle::getImperfection(const std::string& vehID) {
718}
719
720
721double
722Vehicle::getSpeedDeviation(const std::string& vehID) {
724}
725
726
727std::string
728Vehicle::getVehicleClass(const std::string& vehID) {
730}
731
732
733double
734Vehicle::getMinGap(const std::string& vehID) {
735 return Dom::getDouble(libsumo::VAR_MINGAP, vehID);
736}
737
738
739double
740Vehicle::getMinGapLat(const std::string& vehID) {
742}
743
744
745double
746Vehicle::getMaxSpeed(const std::string& vehID) {
748}
749
750
751double
752Vehicle::getMaxSpeedLat(const std::string& vehID) {
754}
755
756
757std::string
758Vehicle::getLateralAlignment(const std::string& vehID) {
760}
761
762
763double
764Vehicle::getWidth(const std::string& vehID) {
765 return Dom::getDouble(libsumo::VAR_WIDTH, vehID);
766}
767
768
769double
770Vehicle::getHeight(const std::string& vehID) {
771 return Dom::getDouble(libsumo::VAR_HEIGHT, vehID);
772}
773
774
775void
776Vehicle::setStop(const std::string& vehID,
777 const std::string& edgeID,
778 double pos,
779 int laneIndex,
780 double duration,
781 int flags,
782 double startPos,
783 double until) {
784 tcpip::Storage content;
785 StoHelp::writeCompound(content, 7);
786 StoHelp::writeTypedString(content, edgeID);
787 StoHelp::writeTypedDouble(content, pos);
788 StoHelp::writeTypedByte(content, laneIndex);
789 StoHelp::writeTypedDouble(content, duration);
790 StoHelp::writeTypedByte(content, flags);
791 StoHelp::writeTypedDouble(content, startPos);
792 StoHelp::writeTypedDouble(content, until);
793 Dom::set(libsumo::CMD_STOP, vehID, &content);
794}
795
796
797void
798Vehicle::replaceStop(const std::string& vehID,
799 int nextStopIndex,
800 const std::string& edgeID,
801 double pos,
802 int laneIndex,
803 double duration,
804 int flags,
805 double startPos,
806 double until,
807 int teleport) {
808 tcpip::Storage content;
809 StoHelp::writeCompound(content, 9);
810 StoHelp::writeTypedString(content, edgeID);
811 StoHelp::writeTypedDouble(content, pos);
812 StoHelp::writeTypedByte(content, laneIndex);
813 StoHelp::writeTypedDouble(content, duration);
814 StoHelp::writeTypedInt(content, flags);
815 StoHelp::writeTypedDouble(content, startPos);
816 StoHelp::writeTypedDouble(content, until);
817 StoHelp::writeTypedInt(content, nextStopIndex);
818 StoHelp::writeTypedByte(content, teleport);
819 Dom::set(libsumo::CMD_REPLACE_STOP, vehID, &content);
820}
821
822
823void
824Vehicle::insertStop(const std::string& vehID,
825 int nextStopIndex,
826 const std::string& edgeID,
827 double pos,
828 int laneIndex,
829 double duration,
830 int flags,
831 double startPos,
832 double until,
833 int teleport) {
834 tcpip::Storage content;
835 StoHelp::writeCompound(content, 9);
836 StoHelp::writeTypedString(content, edgeID);
837 StoHelp::writeTypedDouble(content, pos);
838 StoHelp::writeTypedByte(content, laneIndex);
839 StoHelp::writeTypedDouble(content, duration);
840 StoHelp::writeTypedInt(content, flags);
841 StoHelp::writeTypedDouble(content, startPos);
842 StoHelp::writeTypedDouble(content, until);
843 StoHelp::writeTypedInt(content, nextStopIndex);
844 StoHelp::writeTypedByte(content, teleport);
845 Dom::set(libsumo::CMD_INSERT_STOP, vehID, &content);
846}
847
848
849void
850Vehicle::setStopParameter(const std::string& vehID, int nextStopIndex,
851 const std::string& param, const std::string& value) {
852 tcpip::Storage content;
853 StoHelp::writeCompound(content, 3);
854 StoHelp::writeTypedInt(content, nextStopIndex);
855 StoHelp::writeTypedString(content, param);
856 StoHelp::writeTypedString(content, value);
857 Dom::set(libsumo::VAR_STOP_PARAMETER, vehID, &content);
858}
859
860
861void
862Vehicle::rerouteParkingArea(const std::string& vehID, const std::string& parkingAreaID) {
863 tcpip::Storage content;
864 StoHelp::writeCompound(content, 1);
865 StoHelp::writeTypedString(content, parkingAreaID);
867}
868
869
870void
871Vehicle::resume(const std::string& vehID) {
872 tcpip::Storage content;
873 StoHelp::writeCompound(content, 0);
874 Dom::set(libsumo::CMD_RESUME, vehID, &content);
875}
876
877
878void
879Vehicle::changeTarget(const std::string& vehID, const std::string& edgeID) {
881}
882
883
884void
885Vehicle::changeLane(const std::string& vehID, int laneIndex, double duration) {
886 tcpip::Storage content;
887 StoHelp::writeCompound(content, 2);
888 StoHelp::writeTypedByte(content, laneIndex);
889 StoHelp::writeTypedDouble(content, duration);
890 Dom::set(libsumo::CMD_CHANGELANE, vehID, &content);
891}
892
893void
894Vehicle::changeLaneRelative(const std::string& vehID, int indexOffset, double duration) {
895 tcpip::Storage content;
896 StoHelp::writeCompound(content, 3);
897 StoHelp::writeTypedByte(content, indexOffset);
898 StoHelp::writeTypedDouble(content, duration);
899 StoHelp::writeTypedByte(content, 1);
900 Dom::set(libsumo::CMD_CHANGELANE, vehID, &content);
901}
902
903
904void
905Vehicle::changeSublane(const std::string& vehID, double latDist) {
907}
908
909
910void
911Vehicle::add(const std::string& vehID,
912 const std::string& routeID,
913 const std::string& typeID,
914 const std::string& depart,
915 const std::string& departLane,
916 const std::string& departPos,
917 const std::string& departSpeed,
918 const std::string& arrivalLane,
919 const std::string& arrivalPos,
920 const std::string& arrivalSpeed,
921 const std::string& fromTaz,
922 const std::string& toTaz,
923 const std::string& line,
924 int personCapacity,
925 int personNumber) {
926 tcpip::Storage content;
927 StoHelp::writeCompound(content, 14);
928 StoHelp::writeTypedString(content, routeID);
929 StoHelp::writeTypedString(content, typeID);
930 StoHelp::writeTypedString(content, depart);
931 StoHelp::writeTypedString(content, departLane);
932 StoHelp::writeTypedString(content, departPos);
933 StoHelp::writeTypedString(content, departSpeed);
934
935 StoHelp::writeTypedString(content, arrivalLane);
936 StoHelp::writeTypedString(content, arrivalPos);
937 StoHelp::writeTypedString(content, arrivalSpeed);
938
939 StoHelp::writeTypedString(content, fromTaz);
940 StoHelp::writeTypedString(content, toTaz);
941 StoHelp::writeTypedString(content, line);
942
943 StoHelp::writeTypedInt(content, personCapacity);
944 StoHelp::writeTypedInt(content, personNumber);
945
946 Dom::set(libsumo::ADD_FULL, vehID, &content);
947}
948
949
950void
951Vehicle::moveToXY(const std::string& vehID, const std::string& edgeID, const int laneIndex,
952 const double x, const double y, double angle, const int keepRoute, double matchThreshold) {
953 tcpip::Storage content;
954 StoHelp::writeCompound(content, 7);
955 StoHelp::writeTypedString(content, edgeID);
956 StoHelp::writeTypedInt(content, laneIndex);
957 StoHelp::writeTypedDouble(content, x);
958 StoHelp::writeTypedDouble(content, y);
959 StoHelp::writeTypedDouble(content, angle);
960 StoHelp::writeTypedByte(content, keepRoute);
961 StoHelp::writeTypedDouble(content, matchThreshold);
962 Dom::set(libsumo::MOVE_TO_XY, vehID, &content);
963}
964
965void
966Vehicle::slowDown(const std::string& vehID, double speed, double duration) {
967 tcpip::Storage content;
968 StoHelp::writeCompound(content, 2);
969 StoHelp::writeTypedDouble(content, speed);
970 StoHelp::writeTypedDouble(content, duration);
971 Dom::set(libsumo::CMD_SLOWDOWN, vehID, &content);
972}
973
974void
975Vehicle::openGap(const std::string& vehID, double newTimeHeadway, double newSpaceHeadway, double duration, double changeRate, double maxDecel, const std::string& referenceVehID) {
976 tcpip::Storage content;
977 StoHelp::writeCompound(content, referenceVehID != "" ? 6 : 5);
978 StoHelp::writeTypedDouble(content, newTimeHeadway);
979 StoHelp::writeTypedDouble(content, newSpaceHeadway);
980 StoHelp::writeTypedDouble(content, duration);
981 StoHelp::writeTypedDouble(content, changeRate);
982 StoHelp::writeTypedDouble(content, maxDecel);
983 if (referenceVehID != "") {
984 StoHelp::writeTypedString(content, referenceVehID);
985 }
986 Dom::set(libsumo::CMD_OPENGAP, vehID, &content);
987}
988
989void
990Vehicle::deactivateGapControl(const std::string& vehID) {
991 openGap(vehID, -1, -1, -1, -1);
992}
993
994void
995Vehicle::requestToC(const std::string& vehID, double leadTime) {
996 std::ostringstream oss;
997 oss.setf(std::ios::fixed, std::ios::floatfield);
998 oss << std::setprecision(2);
999 oss << leadTime;
1000 setParameter(vehID, "device.toc.requestToC", oss.str());
1001}
1002
1003void
1004Vehicle::setSpeed(const std::string& vehID, double speed) {
1005 Dom::setDouble(libsumo::VAR_SPEED, vehID, speed);
1006}
1007
1008void
1009Vehicle::setAcceleration(const std::string& vehID, double accel, double duration) {
1010 tcpip::Storage content;
1011 StoHelp::writeCompound(content, 2);
1012 StoHelp::writeTypedDouble(content, accel);
1013 StoHelp::writeTypedDouble(content, duration);
1014 Dom::set(libsumo::VAR_ACCELERATION, vehID, &content);
1015}
1016
1017void
1018Vehicle::setPreviousSpeed(const std::string& vehID, double prevSpeed, double prevAcceleration) {
1019 tcpip::Storage content;
1020 StoHelp::writeCompound(content, 2);
1021 StoHelp::writeTypedDouble(content, prevSpeed);
1022 StoHelp::writeTypedDouble(content, prevAcceleration);
1023 Dom::set(libsumo::VAR_PREV_SPEED, vehID, &content);
1024}
1025
1026void
1027Vehicle::setSpeedMode(const std::string& vehID, int speedMode) {
1028 Dom::setInt(libsumo::VAR_SPEEDSETMODE, vehID, speedMode);
1029}
1030
1031void
1032Vehicle::setLaneChangeMode(const std::string& vehID, int laneChangeMode) {
1033 Dom::setInt(libsumo::VAR_LANECHANGE_MODE, vehID, laneChangeMode);
1034}
1035
1036void
1037Vehicle::setRoutingMode(const std::string& vehID, int routingMode) {
1038 Dom::setInt(libsumo::VAR_ROUTING_MODE, vehID, routingMode);
1039}
1040
1041void
1042Vehicle::setType(const std::string& vehID, const std::string& typeID) {
1043 Dom::setString(libsumo::VAR_TYPE, vehID, typeID);
1044}
1045
1046void
1047Vehicle::setRouteID(const std::string& vehID, const std::string& routeID) {
1048 Dom::setString(libsumo::VAR_ROUTE_ID, vehID, routeID);
1049}
1050
1051void
1052Vehicle::setRoute(const std::string& vehID, const std::string& edgeID) {
1053 setRoute(vehID, std::vector<std::string>({edgeID}));
1054}
1055
1056void
1057Vehicle::setRoute(const std::string& vehID, const std::vector<std::string>& edgeIDs) {
1059}
1060
1061void
1062Vehicle::setLateralLanePosition(const std::string& vehID, double posLat) {
1064}
1065
1066void
1067Vehicle::updateBestLanes(const std::string& vehID) {
1068 tcpip::Storage content;
1069 Dom::set(libsumo::VAR_UPDATE_BESTLANES, vehID, &content);
1070}
1071
1072
1073void
1074Vehicle::setAdaptedTraveltime(const std::string& vehID, const std::string& edgeID,
1075 double time, double begSeconds, double endSeconds) {
1076 tcpip::Storage content;
1077 if (time == libsumo::INVALID_DOUBLE_VALUE) {
1078 // reset
1079 StoHelp::writeCompound(content, 1);
1080 StoHelp::writeTypedString(content, edgeID);
1081 } else if (begSeconds == libsumo::INVALID_DOUBLE_VALUE) {
1082 // set value for the whole simulation
1083 StoHelp::writeCompound(content, 2);
1084 StoHelp::writeTypedString(content, edgeID);
1085 StoHelp::writeTypedDouble(content, time);
1086 } else {
1087 StoHelp::writeCompound(content, 4);
1088 StoHelp::writeTypedDouble(content, begSeconds);
1089 StoHelp::writeTypedDouble(content, endSeconds);
1090 StoHelp::writeTypedString(content, edgeID);
1091 StoHelp::writeTypedDouble(content, time);
1092 }
1093 Dom::set(libsumo::VAR_EDGE_TRAVELTIME, vehID, &content);
1094}
1095
1096
1097void
1098Vehicle::setEffort(const std::string& vehID, const std::string& edgeID,
1099 double effort, double begSeconds, double endSeconds) {
1100 tcpip::Storage content;
1101 if (effort == libsumo::INVALID_DOUBLE_VALUE) {
1102 // reset
1103 StoHelp::writeCompound(content, 1);
1104 StoHelp::writeTypedString(content, edgeID);
1105 } else if (begSeconds == libsumo::INVALID_DOUBLE_VALUE) {
1106 // set value for the whole simulation
1107 StoHelp::writeCompound(content, 2);
1108 StoHelp::writeTypedString(content, edgeID);
1109 StoHelp::writeTypedDouble(content, effort);
1110 } else {
1111 StoHelp::writeCompound(content, 4);
1112 StoHelp::writeTypedDouble(content, begSeconds);
1113 StoHelp::writeTypedDouble(content, endSeconds);
1114 StoHelp::writeTypedString(content, edgeID);
1115 StoHelp::writeTypedDouble(content, effort);
1116 }
1117 Dom::set(libsumo::VAR_EDGE_EFFORT, vehID, &content);
1118}
1119
1120
1121void
1122Vehicle::rerouteTraveltime(const std::string& vehID, const bool /* currentTravelTimes */) {
1123 tcpip::Storage content;
1124 StoHelp::writeCompound(content, 0);
1125 Dom::set(libsumo::CMD_REROUTE_TRAVELTIME, vehID, &content);
1126}
1127
1128
1129void
1130Vehicle::rerouteEffort(const std::string& vehID) {
1131 tcpip::Storage content;
1132 StoHelp::writeCompound(content, 0);
1133 Dom::set(libsumo::CMD_REROUTE_EFFORT, vehID, &content);
1134}
1135
1136
1137void
1138Vehicle::setSignals(const std::string& vehID, int signals) {
1139 Dom::setInt(libsumo::VAR_SIGNALS, vehID, signals);
1140}
1141
1142
1143void
1144Vehicle::moveTo(const std::string& vehID, const std::string& laneID, double position, int reason) {
1145 tcpip::Storage content;
1146 StoHelp::writeCompound(content, 3);
1147 StoHelp::writeTypedString(content, laneID);
1148 StoHelp::writeTypedDouble(content, position);
1149 StoHelp::writeTypedInt(content, reason);
1150 Dom::set(libsumo::VAR_MOVE_TO, vehID, &content);
1151}
1152
1153
1154void
1155Vehicle::setActionStepLength(const std::string& vehID, double actionStepLength, bool resetActionOffset) {
1156 //if (actionStepLength < 0) {
1157 // raise TraCIException("Invalid value for actionStepLength. Given value must be non-negative.")
1158 //{
1159 // Use negative value to indicate resetActionOffset == False
1160 if (!resetActionOffset) {
1161 actionStepLength *= -1;
1162 }
1163 Dom::setDouble(libsumo::VAR_ACTIONSTEPLENGTH, vehID, actionStepLength);
1164}
1165
1166
1167void
1168Vehicle::remove(const std::string& vehID, char reason) {
1169 tcpip::Storage content;
1171 content.writeUnsignedByte(reason);
1172 Dom::set(libsumo::REMOVE, vehID, &content);
1173}
1174
1175
1176void
1177Vehicle::setColor(const std::string& vehID, const libsumo::TraCIColor& color) {
1178 Dom::setCol(libsumo::VAR_COLOR, vehID, color);
1179}
1180
1181
1182void
1183Vehicle::setSpeedFactor(const std::string& vehID, double factor) {
1185}
1186
1187
1188void
1189Vehicle::setLine(const std::string& vehID, const std::string& line) {
1190 Dom::setString(libsumo::VAR_LINE, vehID, line);
1191}
1192
1193
1194void
1195Vehicle::setVia(const std::string& vehID, const std::vector<std::string>& via) {
1197}
1198
1199
1200void
1201Vehicle::setLength(const std::string& vehID, double length) {
1202 Dom::setDouble(libsumo::VAR_LENGTH, vehID, length);
1203}
1204
1205
1206void
1207Vehicle::setMaxSpeed(const std::string& vehID, double speed) {
1209}
1210
1211
1212void
1213Vehicle::setVehicleClass(const std::string& vehID, const std::string& clazz) {
1215}
1216
1217
1218void
1219Vehicle::setShapeClass(const std::string& vehID, const std::string& clazz) {
1221}
1222
1223
1224void
1225Vehicle::setEmissionClass(const std::string& vehID, const std::string& clazz) {
1227}
1228
1229
1230void
1231Vehicle::setWidth(const std::string& vehID, double width) {
1232 Dom::setDouble(libsumo::VAR_WIDTH, vehID, width);
1233}
1234
1235
1236void
1237Vehicle::setHeight(const std::string& vehID, double height) {
1238 Dom::setDouble(libsumo::VAR_HEIGHT, vehID, height);
1239}
1240
1241
1242void
1243Vehicle::setMinGap(const std::string& vehID, double minGap) {
1244 Dom::setDouble(libsumo::VAR_MINGAP, vehID, minGap);
1245}
1246
1247
1248void
1249Vehicle::setAccel(const std::string& vehID, double accel) {
1250 Dom::setDouble(libsumo::VAR_ACCEL, vehID, accel);
1251}
1252
1253
1254void
1255Vehicle::setDecel(const std::string& vehID, double decel) {
1256 Dom::setDouble(libsumo::VAR_DECEL, vehID, decel);
1257}
1258
1259
1260void
1261Vehicle::setEmergencyDecel(const std::string& vehID, double decel) {
1263}
1264
1265
1266void
1267Vehicle::setApparentDecel(const std::string& vehID, double decel) {
1269}
1270
1271
1272void
1273Vehicle::setImperfection(const std::string& vehID, double imperfection) {
1274 Dom::setDouble(libsumo::VAR_IMPERFECTION, vehID, imperfection);
1275}
1276
1277
1278void
1279Vehicle::setTau(const std::string& vehID, double tau) {
1280 Dom::setDouble(libsumo::VAR_TAU, vehID, tau);
1281}
1282
1283
1284void
1285Vehicle::setMinGapLat(const std::string& vehID, double minGapLat) {
1286 Dom::setDouble(libsumo::VAR_MINGAP_LAT, vehID, minGapLat);
1287}
1288
1289
1290void
1291Vehicle::setMaxSpeedLat(const std::string& vehID, double speed) {
1293}
1294
1295
1296void
1297Vehicle::setLateralAlignment(const std::string& vehID, const std::string& latAlignment) {
1298 Dom::setString(libsumo::VAR_LATALIGNMENT, vehID, latAlignment);
1299}
1300
1301
1302void
1303Vehicle::highlight(const std::string& vehID, const libsumo::TraCIColor& col, double size, const int alphaMax, const double duration, const int type) {
1304 tcpip::Storage content;
1305 StoHelp::writeCompound(content, alphaMax > 0 ? 5 : 2);
1307 content.writeUnsignedByte(col.r);
1308 content.writeUnsignedByte(col.g);
1309 content.writeUnsignedByte(col.b);
1310 content.writeUnsignedByte(col.a);
1311 StoHelp::writeTypedDouble(content, size);
1312 if (alphaMax > 0) {
1314 content.writeUnsignedByte(alphaMax);
1315 StoHelp::writeTypedDouble(content, duration);
1317 content.writeUnsignedByte(type);
1318 }
1319 Dom::set(libsumo::VAR_HIGHLIGHT, vehID, &content);
1320}
1321
1322void
1323Vehicle::dispatchTaxi(const std::string& vehID, const std::vector<std::string>& reservations) {
1325}
1326
1327
1328void
1329Vehicle::subscribeLeader(const std::string& vehID, double dist, double begin, double end) {
1330 subscribe(vehID, std::vector<int>({ libsumo::VAR_LEADER }), begin, end,
1331 libsumo::TraCIResults({ {libsumo::VAR_LEADER, std::make_shared<libsumo::TraCIDouble>(dist)} }));
1332}
1333
1334
1335void
1336Vehicle::addSubscriptionFilterLanes(const std::vector<int>& lanes, bool noOpposite, double downstreamDist, double upstreamDist) {
1337 tcpip::Storage content;
1338 content.writeUnsignedByte((int)lanes.size());
1339 for (int lane : lanes) {
1340 content.writeUnsignedByte(lane < 0 ? lane + 256 : lane);
1341 }
1343 if (noOpposite) {
1344 addSubscriptionFilterNoOpposite();
1345 }
1346 if (downstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1347 addSubscriptionFilterDownstreamDistance(downstreamDist);
1348 }
1349 if (upstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1350 addSubscriptionFilterUpstreamDistance(upstreamDist);
1351 }
1352}
1353
1354
1355void
1356Vehicle::addSubscriptionFilterNoOpposite() {
1358}
1359
1360
1361void
1362Vehicle::addSubscriptionFilterDownstreamDistance(double dist) {
1363 tcpip::Storage content;
1364 StoHelp::writeTypedDouble(content, dist);
1366}
1367
1368
1369void
1370Vehicle::addSubscriptionFilterUpstreamDistance(double dist) {
1371 tcpip::Storage content;
1372 StoHelp::writeTypedDouble(content, dist);
1374}
1375
1376
1377void
1378Vehicle::addSubscriptionFilterCFManeuver(double downstreamDist, double upstreamDist) {
1379 addSubscriptionFilterLeadFollow(std::vector<int>(1));
1380 if (downstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1381 addSubscriptionFilterDownstreamDistance(downstreamDist);
1382 }
1383 if (upstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1384 addSubscriptionFilterUpstreamDistance(upstreamDist);
1385 }
1386}
1387
1388
1389void
1390Vehicle::addSubscriptionFilterLCManeuver(int direction, bool noOpposite, double downstreamDist, double upstreamDist) {
1391 if (direction == libsumo::INVALID_INT_VALUE) {
1392 addSubscriptionFilterLeadFollow({ -1, 0, 1 });
1393 } else if (direction != -1 && direction != 1) {
1394 // warnings.warn("Ignoring lane change subscription filter with non-neighboring lane offset direction=%s." % direction)
1395 return;
1396 } else {
1397 addSubscriptionFilterLeadFollow({ 0, direction });
1398 }
1399 if (noOpposite) {
1400 addSubscriptionFilterNoOpposite();
1401 }
1402 if (downstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1403 addSubscriptionFilterDownstreamDistance(downstreamDist);
1404 }
1405 if (upstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1406 addSubscriptionFilterUpstreamDistance(upstreamDist);
1407 }
1408}
1409
1410
1411void
1412Vehicle::addSubscriptionFilterLeadFollow(const std::vector<int>& lanes) {
1414 addSubscriptionFilterLanes(lanes);
1415}
1416
1417
1418void
1419Vehicle::addSubscriptionFilterTurn(double downstreamDist, double foeDistToJunction) {
1420 tcpip::Storage content;
1421 StoHelp::writeTypedDouble(content, foeDistToJunction);
1423 if (downstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1424 addSubscriptionFilterDownstreamDistance(downstreamDist);
1425 }
1426}
1427
1428
1429void
1430Vehicle::addSubscriptionFilterVClass(const std::vector<std::string>& vClasses) {
1431 tcpip::Storage content;
1432 StoHelp::writeTypedStringList(content, vClasses);
1434}
1435
1436
1437void
1438Vehicle::addSubscriptionFilterVType(const std::vector<std::string>& vTypes) {
1439 tcpip::Storage content;
1440 StoHelp::writeTypedStringList(content, vTypes);
1442}
1443
1444
1445void
1446Vehicle::addSubscriptionFilterFieldOfVision(double openingAngle) {
1447 tcpip::Storage content;
1448 StoHelp::writeTypedDouble(content, openingAngle);
1450}
1451
1452
1453void
1454Vehicle::addSubscriptionFilterLateralDistance(double lateralDist, double downstreamDist, double upstreamDist) {
1455 tcpip::Storage content;
1456 StoHelp::writeTypedDouble(content, lateralDist);
1458 if (downstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1459 addSubscriptionFilterDownstreamDistance(downstreamDist);
1460 }
1461 if (upstreamDist != libsumo::INVALID_DOUBLE_VALUE) {
1462 addSubscriptionFilterUpstreamDistance(upstreamDist);
1463 }
1464}
1465
1466
1467}
1468
1469
1470/****************************************************************************/
#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:57
void addFilter(int var, tcpip::Storage *add=nullptr)
Definition: Connection.cpp:341
std::mutex & getMutex() const
Definition: Connection.h:73
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_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 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