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