Eclipse SUMO - Simulation of Urban MObility
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) 2012-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // C++ Vehicle API
16 /****************************************************************************/
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
23 #include <utils/geom/GeomHelper.h>
33 #include <microsim/MSVehicle.h>
35 #include <microsim/MSVehicleType.h>
37 #include <microsim/MSNet.h>
38 #include <microsim/MSEdge.h>
39 #include <microsim/MSLane.h>
40 #include <microsim/MSParkingArea.h>
41 #include <libsumo/TraCIDefs.h>
42 #include <libsumo/TraCIConstants.h>
43 #include "Helper.h"
44 #include "Route.h"
45 #include "Polygon.h"
46 #include "Vehicle.h"
47 
48 
49 // ===========================================================================
50 // debug defines
51 // ===========================================================================
52 //#define DEBUG_NEIGHBORS
53 //#define DEBUG_DYNAMIC_SHAPES
54 //#define DEBUG_MOVEXY
55 #define DEBUG_COND (veh->isSelected())
56 
57 
58 
59 namespace libsumo {
60 // ===========================================================================
61 // static member initializations
62 // ===========================================================================
65 
66 
67 // ===========================================================================
68 // static member definitions
69 // ===========================================================================
70 bool
72  return veh->isOnRoad() || veh->isParking() || veh->wasRemoteControlled();
73 }
74 
75 
76 bool
77 Vehicle::isOnInit(const std::string& vehicleID) {
78  SUMOVehicle* sumoVehicle = MSNet::getInstance()->getVehicleControl().getVehicle(vehicleID);
79  return sumoVehicle == nullptr || sumoVehicle->getLane() == nullptr;
80 }
81 
82 
83 std::vector<std::string>
85  std::vector<std::string> ids;
87  for (MSVehicleControl::constVehIt i = c.loadedVehBegin(); i != c.loadedVehEnd(); ++i) {
88  if (isVisible((*i).second)) {
89  ids.push_back((*i).first);
90  }
91  }
92  return ids;
93 }
94 
95 int
97  return (int)getIDList().size();
98 }
99 
100 
101 double
102 Vehicle::getSpeed(const std::string& vehicleID) {
103  MSVehicle* veh = Helper::getVehicle(vehicleID);
104  return isVisible(veh) ? veh->getSpeed() : INVALID_DOUBLE_VALUE;
105 }
106 
107 double
108 Vehicle::getLateralSpeed(const std::string& vehicleID) {
109  MSVehicle* veh = Helper::getVehicle(vehicleID);
111 }
112 
113 
114 double
115 Vehicle::getAcceleration(const std::string& vehicleID) {
116  MSVehicle* veh = Helper::getVehicle(vehicleID);
117  return isVisible(veh) ? veh->getAcceleration() : INVALID_DOUBLE_VALUE;
118 }
119 
120 
121 double
122 Vehicle::getSpeedWithoutTraCI(const std::string& vehicleID) {
123  MSVehicle* veh = Helper::getVehicle(vehicleID);
125 }
126 
127 
129 Vehicle::getPosition(const std::string& vehicleID, const bool includeZ) {
130  MSVehicle* veh = Helper::getVehicle(vehicleID);
131  if (isVisible(veh)) {
132  return Helper::makeTraCIPosition(veh->getPosition(), includeZ);
133  }
134  return TraCIPosition();
135 }
136 
137 
139 Vehicle::getPosition3D(const std::string& vehicleID) {
140  return getPosition(vehicleID, true);
141 }
142 
143 
144 double
145 Vehicle::getAngle(const std::string& vehicleID) {
146  MSVehicle* veh = Helper::getVehicle(vehicleID);
148 }
149 
150 
151 double
152 Vehicle::getSlope(const std::string& vehicleID) {
153  MSVehicle* veh = Helper::getVehicle(vehicleID);
154  return veh->isOnRoad() ? veh->getSlope() : INVALID_DOUBLE_VALUE;
155 }
156 
157 
158 std::string
159 Vehicle::getRoadID(const std::string& vehicleID) {
160  MSVehicle* veh = Helper::getVehicle(vehicleID);
161  return isVisible(veh) ? veh->getLane()->getEdge().getID() : "";
162 }
163 
164 
165 std::string
166 Vehicle::getLaneID(const std::string& vehicleID) {
167  MSVehicle* veh = Helper::getVehicle(vehicleID);
168  return veh->isOnRoad() ? veh->getLane()->getID() : "";
169 }
170 
171 
172 int
173 Vehicle::getLaneIndex(const std::string& vehicleID) {
174  MSVehicle* veh = Helper::getVehicle(vehicleID);
175  return veh->isOnRoad() ? veh->getLane()->getIndex() : INVALID_INT_VALUE;
176 }
177 
178 
179 std::string
180 Vehicle::getTypeID(const std::string& vehicleID) {
181  return Helper::getVehicleType(vehicleID).getID();
182 }
183 
184 
185 std::string
186 Vehicle::getRouteID(const std::string& vehicleID) {
187  return Helper::getVehicle(vehicleID)->getRoute().getID();
188 }
189 
190 
191 int
192 Vehicle::getRouteIndex(const std::string& vehicleID) {
193  MSVehicle* veh = Helper::getVehicle(vehicleID);
194  return veh->hasDeparted() ? veh->getRoutePosition() : INVALID_INT_VALUE;
195 }
196 
197 
199 Vehicle::getColor(const std::string& vehicleID) {
200  return Helper::makeTraCIColor(Helper::getVehicle(vehicleID)->getParameter().color);
201 }
202 
203 double
204 Vehicle::getLanePosition(const std::string& vehicleID) {
205  MSVehicle* veh = Helper::getVehicle(vehicleID);
206  return veh->isOnRoad() ? veh->getPositionOnLane() : INVALID_DOUBLE_VALUE;
207 }
208 
209 double
210 Vehicle::getLateralLanePosition(const std::string& vehicleID) {
211  MSVehicle* veh = Helper::getVehicle(vehicleID);
212  return veh->isOnRoad() ? veh->getLateralPositionOnLane() : INVALID_DOUBLE_VALUE;
213 }
214 
215 double
216 Vehicle::getCO2Emission(const std::string& vehicleID) {
217  MSVehicle* veh = Helper::getVehicle(vehicleID);
218  return isVisible(veh) ? veh->getCO2Emissions() : INVALID_DOUBLE_VALUE;
219 }
220 
221 double
222 Vehicle::getCOEmission(const std::string& vehicleID) {
223  MSVehicle* veh = Helper::getVehicle(vehicleID);
224  return isVisible(veh) ? veh->getCOEmissions() : INVALID_DOUBLE_VALUE;
225 }
226 
227 double
228 Vehicle::getHCEmission(const std::string& vehicleID) {
229  MSVehicle* veh = Helper::getVehicle(vehicleID);
230  return isVisible(veh) ? veh->getHCEmissions() : INVALID_DOUBLE_VALUE;
231 }
232 
233 double
234 Vehicle::getPMxEmission(const std::string& vehicleID) {
235  MSVehicle* veh = Helper::getVehicle(vehicleID);
236  return isVisible(veh) ? veh->getPMxEmissions() : INVALID_DOUBLE_VALUE;
237 }
238 
239 double
240 Vehicle::getNOxEmission(const std::string& vehicleID) {
241  MSVehicle* veh = Helper::getVehicle(vehicleID);
242  return isVisible(veh) ? veh->getNOxEmissions() : INVALID_DOUBLE_VALUE;
243 }
244 
245 double
246 Vehicle::getFuelConsumption(const std::string& vehicleID) {
247  MSVehicle* veh = Helper::getVehicle(vehicleID);
248  return isVisible(veh) ? veh->getFuelConsumption() : INVALID_DOUBLE_VALUE;
249 }
250 
251 double
252 Vehicle::getNoiseEmission(const std::string& vehicleID) {
253  MSVehicle* veh = Helper::getVehicle(vehicleID);
255 }
256 
257 double
258 Vehicle::getElectricityConsumption(const std::string& vehicleID) {
259  MSVehicle* veh = Helper::getVehicle(vehicleID);
261 }
262 
263 int
264 Vehicle::getPersonNumber(const std::string& vehicleID) {
265  return Helper::getVehicle(vehicleID)->getPersonNumber();
266 }
267 
268 int
269 Vehicle::getPersonCapacity(const std::string& vehicleID) {
270  return Helper::getVehicleType(vehicleID).getPersonCapacity();
271 }
272 
273 std::vector<std::string>
274 Vehicle::getPersonIDList(const std::string& vehicleID) {
275  return Helper::getVehicle(vehicleID)->getPersonIDList();
276 }
277 
278 std::pair<std::string, double>
279 Vehicle::getLeader(const std::string& vehicleID, double dist) {
280  MSVehicle* veh = Helper::getVehicle(vehicleID);
281  if (veh->isOnRoad()) {
282  std::pair<const MSVehicle* const, double> leaderInfo = veh->getLeader(dist);
283  return std::make_pair(
284  leaderInfo.first != nullptr ? leaderInfo.first->getID() : "",
285  leaderInfo.second);
286  } else {
287  return std::make_pair("", -1);
288  }
289 }
290 
291 
292 double
293 Vehicle::getWaitingTime(const std::string& vehicleID) {
294  return Helper::getVehicle(vehicleID)->getWaitingSeconds();
295 }
296 
297 
298 double
299 Vehicle::getAccumulatedWaitingTime(const std::string& vehicleID) {
301 }
302 
303 
304 double
305 Vehicle::getAdaptedTraveltime(const std::string& vehicleID, double time, const std::string& edgeID) {
306  MSEdge* edge = Helper::getEdge(edgeID);
307  double value = INVALID_DOUBLE_VALUE;
308  Helper::getVehicle(vehicleID)->getWeightsStorage().retrieveExistingTravelTime(edge, time, value);
309  return value;
310 }
311 
312 
313 double
314 Vehicle::getEffort(const std::string& vehicleID, double time, const std::string& edgeID) {
315  MSEdge* edge = Helper::getEdge(edgeID);
316  double value = INVALID_DOUBLE_VALUE;
317  Helper::getVehicle(vehicleID)->getWeightsStorage().retrieveExistingEffort(edge, time, value);
318  return value;
319 }
320 
321 
322 bool
323 Vehicle::isRouteValid(const std::string& vehicleID) {
324  std::string msg;
325  return Helper::getVehicle(vehicleID)->hasValidRoute(msg);
326 }
327 
328 
329 std::vector<std::string>
330 Vehicle::getRoute(const std::string& vehicleID) {
331  std::vector<std::string> result;
332  MSVehicle* veh = Helper::getVehicle(vehicleID);
333  const MSRoute& r = veh->getRoute();
334  for (MSRouteIterator i = r.begin(); i != r.end(); ++i) {
335  result.push_back((*i)->getID());
336  }
337  return result;
338 }
339 
340 
341 int
342 Vehicle::getSignals(const std::string& vehicleID) {
343  return Helper::getVehicle(vehicleID)->getSignals();
344 }
345 
346 
347 std::vector<TraCIBestLanesData>
348 Vehicle::getBestLanes(const std::string& vehicleID) {
349  std::vector<TraCIBestLanesData> result;
350  MSVehicle* veh = Helper::getVehicle(vehicleID);
351  if (veh->isOnRoad()) {
352  const std::vector<MSVehicle::LaneQ>& bestLanes = veh->getBestLanes();
353  for (std::vector<MSVehicle::LaneQ>::const_iterator i = bestLanes.begin(); i != bestLanes.end(); ++i) {
354  TraCIBestLanesData bld;
355  const MSVehicle::LaneQ& lq = *i;
356  bld.laneID = lq.lane->getID();
357  bld.length = lq.length;
358  bld.occupation = lq.nextOccupation;
361  for (std::vector<MSLane*>::const_iterator j = lq.bestContinuations.begin(); j != lq.bestContinuations.end(); ++j) {
362  if ((*j) != nullptr) {
363  bld.continuationLanes.push_back((*j)->getID());
364  }
365  }
366  result.push_back(bld);
367  }
368  }
369  return result;
370 }
371 
372 
373 std::vector<TraCINextTLSData>
374 Vehicle::getNextTLS(const std::string& vehicleID) {
375  std::vector<TraCINextTLSData> result;
376  MSVehicle* veh = Helper::getVehicle(vehicleID);
377  if (veh->isOnRoad()) {
378  const MSLane* lane = veh->getLane();
379  const std::vector<MSLane*>& bestLaneConts = veh->getBestLanesContinuation(lane);
380  double seen = veh->getLane()->getLength() - veh->getPositionOnLane();
381  int view = 1;
382  MSLinkCont::const_iterator link = MSLane::succLinkSec(*veh, view, *lane, bestLaneConts);
383  while (!lane->isLinkEnd(link)) {
384  if (!lane->getEdge().isInternal()) {
385  if ((*link)->isTLSControlled()) {
386  TraCINextTLSData ntd;
387  ntd.id = (*link)->getTLLogic()->getID();
388  ntd.tlIndex = (*link)->getTLIndex();
389  ntd.dist = seen;
390  ntd.state = (char)(*link)->getState();
391  result.push_back(ntd);
392  }
393  }
394  lane = (*link)->getViaLaneOrLane();
395  if (!lane->getEdge().isInternal()) {
396  view++;
397  }
398  seen += lane->getLength();
399  link = MSLane::succLinkSec(*veh, view, *lane, bestLaneConts);
400  }
401  // consider edges beyond bestLanes
402  const int remainingEdges = (int)(veh->getRoute().end() - veh->getCurrentRouteEdge()) - view;
403  //std::cout << SIMTIME << "remainingEdges=" << remainingEdges << " seen=" << seen << " view=" << view << " best=" << toString(bestLaneConts) << "\n";
404  for (int i = 0; i < remainingEdges; i++) {
405  const MSEdge* prev = *(veh->getCurrentRouteEdge() + view + i - 1);
406  const MSEdge* next = *(veh->getCurrentRouteEdge() + view + i);
407  const std::vector<MSLane*>* allowed = prev->allowedLanes(*next, veh->getVClass());
408  if (allowed != nullptr && allowed->size() != 0) {
409  for (MSLink* link : allowed->front()->getLinkCont()) {
410  if (&link->getLane()->getEdge() == next) {
411  if (link->isTLSControlled()) {
412  TraCINextTLSData ntd;
413  ntd.id = link->getTLLogic()->getID();
414  ntd.tlIndex = link->getTLIndex();
415  ntd.dist = seen;
416  ntd.state = (char)link->getState();
417  result.push_back(ntd);
418  }
419  seen += allowed->front()->getLength();
420  }
421  }
422  } else {
423  // invalid route, cannot determine nextTLS
424  break;
425  }
426  }
427  }
428  return result;
429 }
430 
431 
432 std::vector<TraCINextStopData>
433 Vehicle::getNextStops(const std::string& vehicleID) {
434  std::vector<TraCINextStopData> result;
435  MSVehicle* veh = Helper::getVehicle(vehicleID);
436  std::list<MSVehicle::Stop> stops = veh->getMyStops();
437  for (std::list<MSVehicle::Stop>::iterator it = stops.begin(); it != stops.end(); ++it) {
438  if (!it->collision) {
439  TraCINextStopData nsd;
440  nsd.lane = it->lane->getID();
441  nsd.endPos = it->getEndPos(*veh);
442  // all optionals, only one can be set
443  if (it->busstop != nullptr) {
444  nsd.stoppingPlaceID = it->busstop->getID();
445  }
446  if (it->containerstop != nullptr) {
447  nsd.stoppingPlaceID = it->containerstop->getID();
448  }
449  if (it->parkingarea != nullptr) {
450  nsd.stoppingPlaceID = it->parkingarea->getID();
451  }
452  if (it->chargingStation != nullptr) {
453  nsd.stoppingPlaceID = it->chargingStation->getID();
454  }
455  nsd.stopFlags = ((it->reached ? 1 : 0) +
456  (it->pars.parking ? 2 : 0) +
457  (it->pars.triggered ? 4 : 0) +
458  (it->pars.containerTriggered ? 8 : 0) +
459  (it->busstop != nullptr ? 16 : 0) +
460  (it->containerstop != nullptr ? 32 : 0) +
461  (it->chargingStation != nullptr ? 64 : 0) +
462  (it->parkingarea != nullptr ? 128 : 0));
463  nsd.duration = STEPS2TIME(it->reached ? it->duration : it->pars.duration);
464  nsd.until = STEPS2TIME(it->pars.until);
465  result.push_back(nsd);
466  }
467  }
468  return result;
469 }
470 
471 
472 int
473 Vehicle::getStopState(const std::string& vehicleID) {
474  MSVehicle* veh = Helper::getVehicle(vehicleID);
475  int result = 0;
476  if (veh->isStopped()) {
477  const MSVehicle::Stop& stop = veh->getNextStop();
478  result = ((stop.reached ? 1 : 0) +
479  (stop.pars.parking ? 2 : 0) +
480  (stop.pars.triggered ? 4 : 0) +
481  (stop.pars.containerTriggered ? 8 : 0) +
482  (stop.busstop != nullptr ? 16 : 0) +
483  (stop.containerstop != nullptr ? 32 : 0) +
484  (stop.chargingStation != nullptr ? 64 : 0) +
485  (stop.parkingarea != nullptr ? 128 : 0));
486  }
487  return result;
488 }
489 
490 
491 double
492 Vehicle::getDistance(const std::string& vehicleID) {
493  MSVehicle* veh = Helper::getVehicle(vehicleID);
494  if (veh->isOnRoad()) {
495  double distance;
496  if (veh->getLane()->isInternal()) {
497  // route edge still points to the edge before the intersection
498  const double normalEnd = (*veh->getCurrentRouteEdge())->getLength();
499  distance = (veh->getRoute().getDistanceBetween(veh->getDepartPos(), normalEnd,
500  veh->getRoute().begin(), veh->getCurrentRouteEdge())
501  + veh->getRoute().getDistanceBetween(normalEnd, veh->getPositionOnLane(),
502  *veh->getCurrentRouteEdge(), &veh->getLane()->getEdge()));
503  } else {
504  distance = veh->getRoute().getDistanceBetween(veh->getDepartPos(), veh->getPositionOnLane(),
505  veh->getRoute().begin(), veh->getCurrentRouteEdge());
506  }
507  if (distance == std::numeric_limits<double>::max()) {
508  return INVALID_DOUBLE_VALUE;
509  } else {
510  return distance;
511  }
512  } else {
513  return INVALID_DOUBLE_VALUE;
514  }
515 }
516 
517 
518 double
519 Vehicle::getDrivingDistance(const std::string& vehicleID, const std::string& edgeID, double position, int /* laneIndex */) {
520  MSVehicle* veh = Helper::getVehicle(vehicleID);
521  if (veh->isOnRoad()) {
522  double distance = veh->getRoute().getDistanceBetween(veh->getPositionOnLane(), position,
523  &veh->getLane()->getEdge(), Helper::getEdge(edgeID), true, veh->getRoutePosition());
524  if (distance == std::numeric_limits<double>::max()) {
525  return INVALID_DOUBLE_VALUE;
526  }
527  return distance;
528  } else {
529  return INVALID_DOUBLE_VALUE;
530  }
531 }
532 
533 
534 double
535 Vehicle::getDrivingDistance2D(const std::string& vehicleID, double x, double y) {
536  MSVehicle* veh = Helper::getVehicle(vehicleID);
537  if (veh->isOnRoad()) {
538  std::pair<MSLane*, double> roadPos = Helper::convertCartesianToRoadMap(Position(x, y), veh->getVehicleType().getVehicleClass());
539  double distance = veh->getRoute().getDistanceBetween(veh->getPositionOnLane(), roadPos.second,
540  veh->getEdge(), &roadPos.first->getEdge(), true, veh->getRoutePosition());
541  if (distance == std::numeric_limits<double>::max()) {
542  return INVALID_DOUBLE_VALUE;
543  }
544  return distance;
545  } else {
546  return INVALID_DOUBLE_VALUE;
547  }
548 }
549 
550 
551 double
552 Vehicle::getAllowedSpeed(const std::string& vehicleID) {
553  MSVehicle* veh = Helper::getVehicle(vehicleID);
554  if (veh->isOnRoad()) {
555  return veh->getLane()->getVehicleMaxSpeed(veh);
556  } else {
557  return INVALID_DOUBLE_VALUE;
558  }
559 }
560 
561 
562 double
563 Vehicle::getSpeedFactor(const std::string& vehicleID) {
564  return Helper::getVehicle(vehicleID)->getChosenSpeedFactor();
565 }
566 
567 
568 int
569 Vehicle::getSpeedMode(const std::string& vehicleID) {
570  return Helper::getVehicle(vehicleID)->getInfluencer().getSpeedMode();
571 }
572 
573 
574 int
575 Vehicle::getLaneChangeMode(const std::string& vehicleID) {
576  return Helper::getVehicle(vehicleID)->getInfluencer().getLaneChangeMode();
577 }
578 
579 
580 int
581 Vehicle::getRoutingMode(const std::string& vehicleID) {
582  return Helper::getVehicle(vehicleID)->getInfluencer().getRoutingMode();
583 }
584 
585 
586 std::string
587 Vehicle::getLine(const std::string& vehicleID) {
588  return Helper::getVehicle(vehicleID)->getParameter().line;
589 }
590 
591 
592 std::vector<std::string>
593 Vehicle::getVia(const std::string& vehicleID) {
594  return Helper::getVehicle(vehicleID)->getParameter().via;
595 }
596 
597 
598 std::pair<int, int>
599 Vehicle::getLaneChangeState(const std::string& vehicleID, int direction) {
600  MSVehicle* veh = Helper::getVehicle(vehicleID);
601  if (veh->isOnRoad()) {
602  return veh->getLaneChangeModel().getSavedState(direction);
603  } else {
604  return std::make_pair((int)LCA_UNKNOWN, (int)LCA_UNKNOWN);
605  }
606 }
607 
608 
609 std::string
610 Vehicle::getParameter(const std::string& vehicleID, const std::string& key) {
611  MSVehicle* veh = Helper::getVehicle(vehicleID);
612  if (StringUtils::startsWith(key, "device.")) {
613  StringTokenizer tok(key, ".");
614  if (tok.size() < 3) {
615  throw TraCIException("Invalid device parameter '" + key + "' for vehicle '" + vehicleID + "'.");
616  }
617  try {
618  return veh->getDeviceParameter(tok.get(1), key.substr(tok.get(0).size() + tok.get(1).size() + 2));
619  } catch (InvalidArgument& e) {
620  throw TraCIException("Vehicle '" + vehicleID + "' does not support device parameter '" + key + "' (" + e.what() + ").");
621  }
622  } else if (StringUtils::startsWith(key, "laneChangeModel.")) {
623  const std::string attrName = key.substr(16);
624  try {
625  return veh->getLaneChangeModel().getParameter(attrName);
626  } catch (InvalidArgument& e) {
627  throw TraCIException("Vehicle '" + vehicleID + "' does not support laneChangeModel parameter '" + key + "' (" + e.what() + ").");
628  }
629  } else if (StringUtils::startsWith(key, "carFollowModel.")) {
630  const std::string attrName = key.substr(15);
631  try {
632  return veh->getCarFollowModel().getParameter(veh, attrName);
633  } catch (InvalidArgument& e) {
634  throw TraCIException("Vehicle '" + vehicleID + "' does not support carFollowModel parameter '" + key + "' (" + e.what() + ").");
635  }
636  } else if (StringUtils::startsWith(key, "has.") && StringUtils::endsWith(key, ".device")) {
637  StringTokenizer tok(key, ".");
638  if (tok.size() != 3) {
639  throw TraCIException("Invalid check for device. Expected format is 'has.DEVICENAME.device'.");
640  }
641  return veh->hasDevice(tok.get(1)) ? "true" : "false";
642  } else {
643  return veh->getParameter().getParameter(key, "");
644  }
645 }
646 
647 
648 std::vector<std::pair<std::string, double> >
649 Vehicle::getNeighbors(const std::string& vehicleID, const int mode) {
650  int dir = (1 & mode) != 0 ? -1 : 1;
651  bool queryLeaders = (2 & mode) != 0;
652  bool blockersOnly = (4 & mode) != 0;
653 
654  MSVehicle* veh = Helper::getVehicle(vehicleID);
655  std::vector<std::pair<std::string, double> > neighs;
656  auto& lcm = veh->getLaneChangeModel();
657 
658 #ifdef DEBUG_NEIGHBORS
659  if (DEBUG_COND) {
660  std::cout << "getNeighbors() for veh '" << vehicleID << "': dir=" << dir
661  << ", queryLeaders=" << queryLeaders
662  << ", blockersOnly=" << blockersOnly << std::endl;
663  }
664 #endif
665 
666 
667 
668  if (blockersOnly) {
669  // Check if a blocking neigh exists in the given direction
670  bool blocked = false;
671  if (dir == -1) {
672  if (queryLeaders) {
673  blocked = (lcm.getOwnState() & LCA_BLOCKED_BY_RIGHT_LEADER) != 0;
674  } else {
675  blocked = (lcm.getOwnState() & LCA_BLOCKED_BY_RIGHT_FOLLOWER) != 0;
676  }
677  } else {
678  if (queryLeaders) {
679  blocked = (lcm.getOwnState() & LCA_BLOCKED_BY_LEFT_LEADER) != 0;
680  } else {
681  blocked = (lcm.getOwnState() & LCA_BLOCKED_BY_LEFT_FOLLOWER) != 0;
682  }
683  }
684 
685 #ifdef DEBUG_NEIGHBORS
686  if (DEBUG_COND) {
687  std::cout << " blocked=" << blocked << std::endl;
688  }
689 #endif
690 
691  if (!blocked) {
692  // Not blocked => return empty vector
693  return neighs;
694  }
695  }
696 
697  const std::shared_ptr<MSLeaderDistanceInfo> res = queryLeaders ? lcm.getLeaders(dir) : lcm.getFollowers(dir);
698  if (res != nullptr && res->hasVehicles()) {
699  auto distIt = begin(res->getDistances());
700  auto vehIt = begin(res->getVehicles());
701  while (distIt != end(res->getDistances())) {
702  if (*vehIt != nullptr) {
703  if (neighs.size() == 0 || neighs.back().first != (*vehIt)->getID()) {
704  neighs.push_back(std::make_pair((*vehIt)->getID(), *distIt));
705  }
706  }
707  ++vehIt;
708  ++distIt;
709  }
710  }
711  return neighs;
712 }
713 
714 
715 std::string
716 Vehicle::getEmissionClass(const std::string& vehicleID) {
717  return PollutantsInterface::getName(Helper::getVehicleType(vehicleID).getEmissionClass());
718 }
719 
720 std::string
721 Vehicle::getShapeClass(const std::string& vehicleID) {
722  return getVehicleShapeName(Helper::getVehicleType(vehicleID).getGuiShape());
723 }
724 
725 
726 double
727 Vehicle::getLength(const std::string& vehicleID) {
728  return Helper::getVehicleType(vehicleID).getLength();
729 }
730 
731 
732 double
733 Vehicle::getAccel(const std::string& vehicleID) {
735 }
736 
737 
738 double
739 Vehicle::getDecel(const std::string& vehicleID) {
741 }
742 
743 
744 double Vehicle::getEmergencyDecel(const std::string& vehicleID) {
746 }
747 
748 
749 double Vehicle::getApparentDecel(const std::string& vehicleID) {
751 }
752 
753 
754 double Vehicle::getActionStepLength(const std::string& vehicleID) {
756 }
757 
758 
759 double Vehicle::getLastActionTime(const std::string& vehicleID) {
760  return STEPS2TIME(Helper::getVehicle(vehicleID)->getLastActionTime());
761 }
762 
763 
764 double
765 Vehicle::getTau(const std::string& vehicleID) {
767 }
768 
769 
770 double
771 Vehicle::getImperfection(const std::string& vehicleID) {
773 }
774 
775 
776 double
777 Vehicle::getSpeedDeviation(const std::string& vehicleID) {
778  return Helper::getVehicleType(vehicleID).getSpeedFactor().getParameter()[1];
779 }
780 
781 
782 std::string
783 Vehicle::getVehicleClass(const std::string& vehicleID) {
784  return toString(Helper::getVehicleType(vehicleID).getVehicleClass());
785 }
786 
787 
788 double
789 Vehicle::getMinGap(const std::string& vehicleID) {
790  return Helper::getVehicleType(vehicleID).getMinGap();
791 }
792 
793 
794 double
795 Vehicle::getMinGapLat(const std::string& vehicleID) {
796  return Helper::getVehicleType(vehicleID).getMinGapLat();
797 }
798 
799 
800 double
801 Vehicle::getMaxSpeed(const std::string& vehicleID) {
802  return Helper::getVehicleType(vehicleID).getMaxSpeed();
803 }
804 
805 
806 double
807 Vehicle::getMaxSpeedLat(const std::string& vehicleID) {
808  return Helper::getVehicleType(vehicleID).getMaxSpeedLat();
809 }
810 
811 
812 std::string
813 Vehicle::getLateralAlignment(const std::string& vehicleID) {
814  return toString(Helper::getVehicleType(vehicleID).getPreferredLateralAlignment());
815 }
816 
817 
818 double
819 Vehicle::getWidth(const std::string& vehicleID) {
820  return Helper::getVehicleType(vehicleID).getWidth();
821 }
822 
823 
824 double
825 Vehicle::getHeight(const std::string& vehicleID) {
826  return Helper::getVehicleType(vehicleID).getHeight();
827 }
828 
829 
830 void
831 Vehicle::setStop(const std::string& vehicleID,
832  const std::string& edgeID,
833  double pos,
834  int laneIndex,
835  double duration,
836  int flags,
837  double startPos,
838  double until) {
839  MSVehicle* veh = Helper::getVehicle(vehicleID);
840  // optional stop flags
841  bool parking = false;
842  bool triggered = false;
843  bool containerTriggered = false;
844  SumoXMLTag stoppingPlaceType = SUMO_TAG_NOTHING;
845 
846  parking = ((flags & 1) != 0);
847  triggered = ((flags & 2) != 0);
848  containerTriggered = ((flags & 4) != 0);
849  if ((flags & 8) != 0) {
850  stoppingPlaceType = SUMO_TAG_BUS_STOP;
851  }
852  if ((flags & 16) != 0) {
853  stoppingPlaceType = SUMO_TAG_CONTAINER_STOP;
854  }
855  if ((flags & 32) != 0) {
856  stoppingPlaceType = SUMO_TAG_CHARGING_STATION;
857  }
858  if ((flags & 64) != 0) {
859  stoppingPlaceType = SUMO_TAG_PARKING_AREA;
860  }
861  const SUMOTime durationSteps = duration == INVALID_DOUBLE_VALUE ? SUMOTime_MAX : TIME2STEPS(duration);
862  const SUMOTime untilStep = until == INVALID_DOUBLE_VALUE ? -1 : TIME2STEPS(until);
863 
864  std::string error;
865  if (stoppingPlaceType != SUMO_TAG_NOTHING) {
866  // Forward command to vehicle
867  if (!veh->addTraciStopAtStoppingPlace(edgeID, durationSteps, untilStep, parking, triggered, containerTriggered, stoppingPlaceType, error)) {
868  throw TraCIException(error);
869  }
870  } else {
871  // check
872  if (startPos == INVALID_DOUBLE_VALUE) {
873  startPos = pos - POSITION_EPS;
874  }
875  if (startPos < 0.) {
876  throw TraCIException("Position on lane must not be negative.");
877  }
878  if (pos < startPos) {
879  throw TraCIException("End position on lane must be after start position.");
880  }
881  // get the actual lane that is referenced by laneIndex
882  MSEdge* road = MSEdge::dictionary(edgeID);
883  if (road == nullptr) {
884  throw TraCIException("Edge '" + edgeID + "' is not known.");
885  }
886  const std::vector<MSLane*>& allLanes = road->getLanes();
887  if ((laneIndex < 0) || laneIndex >= (int)(allLanes.size())) {
888  throw TraCIException("No lane with index '" + toString(laneIndex) + "' on edge '" + edgeID + "'.");
889  }
890  // Forward command to vehicle
891  if (!veh->addTraciStop(allLanes[laneIndex], startPos, pos, durationSteps, untilStep, parking, triggered, containerTriggered, error)) {
892  throw TraCIException(error);
893  }
894  }
895 }
896 
897 void
898 Vehicle::rerouteParkingArea(const std::string& vehicleID, const std::string& parkingAreaID) {
899  MSVehicle* veh = Helper::getVehicle(vehicleID);
900  std::string error;
901  // Forward command to vehicle
902  if (!veh->rerouteParkingArea(parkingAreaID, error)) {
903  throw TraCIException(error);
904  }
905 }
906 
907 void
908 Vehicle::resume(const std::string& vehicleID) {
909  MSVehicle* veh = Helper::getVehicle(vehicleID);
910  if (!veh->hasStops()) {
911  throw TraCIException("Failed to resume vehicle '" + veh->getID() + "', it has no stops.");
912  }
913  if (!veh->resumeFromStopping()) {
914  MSVehicle::Stop& sto = veh->getNextStop();
915  std::ostringstream strs;
916  strs << "reached: " << sto.reached;
917  strs << ", duration:" << sto.duration;
918  strs << ", edge:" << (*sto.edge)->getID();
919  strs << ", startPos: " << sto.pars.startPos;
920  std::string posStr = strs.str();
921  throw TraCIException("Failed to resume from stopping for vehicle '" + veh->getID() + "', " + posStr);
922  }
923 }
924 
925 
926 void
927 Vehicle::changeTarget(const std::string& vehicleID, const std::string& edgeID) {
928  MSVehicle* veh = Helper::getVehicle(vehicleID);
929  const MSEdge* destEdge = MSEdge::dictionary(edgeID);
930  const bool onInit = isOnInit(vehicleID);
931  if (destEdge == nullptr) {
932  throw TraCIException("Destination edge '" + edgeID + "' is not known.");
933  }
934  // build a new route between the vehicle's current edge and destination edge
935  ConstMSEdgeVector newRoute;
936  const MSEdge* currentEdge = veh->getRerouteOrigin();
938  currentEdge, destEdge, (const MSVehicle * const)veh, MSNet::getInstance()->getCurrentTimeStep(), newRoute);
939  // replace the vehicle's route by the new one (cost is updated by call to reroute())
940  if (!veh->replaceRouteEdges(newRoute, -1, 0, "traci:changeTarget", onInit)) {
941  throw TraCIException("Route replacement failed for vehicle '" + veh->getID() + "'.");
942  }
943  // route again to ensure usage of via/stops
944  try {
945  veh->reroute(MSNet::getInstance()->getCurrentTimeStep(), "traci:changeTarget", veh->getInfluencer().getRouterTT(), onInit);
946  } catch (ProcessError& e) {
947  throw TraCIException(e.what());
948  }
949 }
950 
951 
952 void
953 Vehicle::changeLane(const std::string& vehicleID, int laneIndex, double duration) {
954  std::vector<std::pair<SUMOTime, int> > laneTimeLine;
955  laneTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep(), laneIndex));
956  laneTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep() + TIME2STEPS(duration), laneIndex));
957  Helper::getVehicle(vehicleID)->getInfluencer().setLaneTimeLine(laneTimeLine);
958 }
959 
960 void
961 Vehicle::changeLaneRelative(const std::string& vehicleID, int indexOffset, double duration) {
962  std::vector<std::pair<SUMOTime, int> > laneTimeLine;
963  int laneIndex = Helper::getVehicle(vehicleID)->getLaneIndex() + indexOffset;
964  laneTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep(), laneIndex));
965  laneTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep() + TIME2STEPS(duration), laneIndex));
966  Helper::getVehicle(vehicleID)->getInfluencer().setLaneTimeLine(laneTimeLine);
967 }
968 
969 
970 void
971 Vehicle::changeSublane(const std::string& vehicleID, double latDist) {
972  Helper::getVehicle(vehicleID)->getInfluencer().setSublaneChange(latDist);
973 }
974 
975 
976 void
977 Vehicle::add(const std::string& vehicleID,
978  const std::string& routeID,
979  const std::string& typeID,
980  const std::string& depart,
981  const std::string& departLane,
982  const std::string& departPos,
983  const std::string& departSpeed,
984  const std::string& arrivalLane,
985  const std::string& arrivalPos,
986  const std::string& arrivalSpeed,
987  const std::string& fromTaz,
988  const std::string& toTaz,
989  const std::string& line,
990  int /*personCapacity*/,
991  int personNumber) {
993  if (veh != nullptr) {
994  throw TraCIException("The vehicle '" + vehicleID + "' to add already exists.");
995  }
996 
997  SUMOVehicleParameter vehicleParams;
998  vehicleParams.id = vehicleID;
999  MSVehicleType* vehicleType = MSNet::getInstance()->getVehicleControl().getVType(typeID);
1000  if (!vehicleType) {
1001  throw TraCIException("Invalid type '" + typeID + "' for vehicle '" + vehicleID + "'.");
1002  }
1003  const MSRoute* route = MSRoute::dictionary(routeID);
1004  if (!route) {
1005  if (routeID == "") {
1006  // assume, route was intentionally left blank because the caller
1007  // intends to control the vehicle remotely
1008  SUMOVehicleClass vclass = vehicleType->getVehicleClass();
1009  const std::string dummyRouteID = "DUMMY_ROUTE_" + SumoVehicleClassStrings.getString(vclass);
1010  route = MSRoute::dictionary(dummyRouteID);
1011  if (route == nullptr) {
1012  for (MSEdge* e : MSEdge::getAllEdges()) {
1013  if (e->getFunction() == EDGEFUNC_NORMAL && (e->getPermissions() & vclass) == vclass) {
1014  std::vector<std::string> edges;
1015  edges.push_back(e->getID());
1016  libsumo::Route::add(dummyRouteID, edges);
1017  break;
1018  }
1019  }
1020  }
1021  route = MSRoute::dictionary(dummyRouteID);
1022  if (!route) {
1023  throw TraCIException("Could not build dummy route for vehicle class: '" + SumoVehicleClassStrings.getString(vehicleType->getVehicleClass()) + "'");
1024  }
1025  } else {
1026  throw TraCIException("Invalid route '" + routeID + "' for vehicle '" + vehicleID + "'.");
1027  }
1028  }
1029  // check if the route implies a trip
1030  if (route->getEdges().size() == 2) {
1031  const MSEdgeVector& succ = route->getEdges().front()->getSuccessors();
1032  if (std::find(succ.begin(), succ.end(), route->getEdges().back()) == succ.end()) {
1033  vehicleParams.parametersSet |= VEHPARS_FORCE_REROUTE;
1034  }
1035  }
1036  if (fromTaz != "" || toTaz != "") {
1037  vehicleParams.parametersSet |= VEHPARS_FORCE_REROUTE;
1038  }
1039  std::string error;
1040  if (!SUMOVehicleParameter::parseDepart(depart, "vehicle", vehicleID, vehicleParams.depart, vehicleParams.departProcedure, error)) {
1041  throw TraCIException(error);
1042  }
1043  if (vehicleParams.departProcedure == DEPART_GIVEN && vehicleParams.depart < MSNet::getInstance()->getCurrentTimeStep()) {
1044  vehicleParams.depart = MSNet::getInstance()->getCurrentTimeStep();
1045  WRITE_WARNING("Departure time for vehicle '" + vehicleID + "' is in the past; using current time instead.");
1046  } else if (vehicleParams.departProcedure == DEPART_NOW) {
1047  vehicleParams.depart = MSNet::getInstance()->getCurrentTimeStep();
1048  }
1049  if (!SUMOVehicleParameter::parseDepartLane(departLane, "vehicle", vehicleID, vehicleParams.departLane, vehicleParams.departLaneProcedure, error)) {
1050  throw TraCIException(error);
1051  }
1052  if (!SUMOVehicleParameter::parseDepartPos(departPos, "vehicle", vehicleID, vehicleParams.departPos, vehicleParams.departPosProcedure, error)) {
1053  throw TraCIException(error);
1054  }
1055  if (!SUMOVehicleParameter::parseDepartSpeed(departSpeed, "vehicle", vehicleID, vehicleParams.departSpeed, vehicleParams.departSpeedProcedure, error)) {
1056  throw TraCIException(error);
1057  }
1058  if (!SUMOVehicleParameter::parseArrivalLane(arrivalLane, "vehicle", vehicleID, vehicleParams.arrivalLane, vehicleParams.arrivalLaneProcedure, error)) {
1059  throw TraCIException(error);
1060  }
1061  if (!SUMOVehicleParameter::parseArrivalPos(arrivalPos, "vehicle", vehicleID, vehicleParams.arrivalPos, vehicleParams.arrivalPosProcedure, error)) {
1062  throw TraCIException(error);
1063  }
1064  if (!SUMOVehicleParameter::parseArrivalSpeed(arrivalSpeed, "vehicle", vehicleID, vehicleParams.arrivalSpeed, vehicleParams.arrivalSpeedProcedure, error)) {
1065  throw TraCIException(error);
1066  }
1067  vehicleParams.fromTaz = fromTaz;
1068  vehicleParams.toTaz = toTaz;
1069  vehicleParams.line = line;
1070  //vehicleParams.personCapacity = personCapacity;
1071  vehicleParams.personNumber = personNumber;
1072 
1073  SUMOVehicleParameter* params = new SUMOVehicleParameter(vehicleParams);
1074  try {
1075  SUMOVehicle* vehicle = MSNet::getInstance()->getVehicleControl().buildVehicle(params, route, vehicleType, true, false);
1076  MSNet::getInstance()->getVehicleControl().addVehicle(vehicleParams.id, vehicle);
1078  } catch (ProcessError& e) {
1079  throw TraCIException(e.what());
1080  }
1081 }
1082 
1083 
1084 void
1085 Vehicle::moveToXY(const std::string& vehicleID, const std::string& edgeID, const int laneIndex,
1086  const double x, const double y, double angle, const int keepRoute) {
1087  MSVehicle* veh = Helper::getVehicle(vehicleID);
1088  const bool doKeepRoute = (keepRoute & 1) != 0 && veh->getID() != "VTD_EGO";
1089  const bool mayLeaveNetwork = (keepRoute & 2) != 0;
1090  const bool ignorePermissions = (keepRoute & 4) != 0;
1091  SUMOVehicleClass vClass = ignorePermissions ? SVC_IGNORING : veh->getVClass();
1092  // process
1093  const std::string origID = edgeID + "_" + toString(laneIndex);
1094  // @todo add an interpretation layer for OSM derived origID values (without lane index)
1095  Position pos(x, y);
1096 #ifdef DEBUG_MOVEXY
1097  const double origAngle = angle;
1098 #endif
1099  // angle must be in [0,360] because it will be compared against those returned by naviDegree()
1100  // angle set to INVALID_DOUBLE_VALUE is ignored in the evaluated and later set to the angle of the matched lane
1101  if (angle != INVALID_DOUBLE_VALUE) {
1102  while (angle >= 360.) {
1103  angle -= 360.;
1104  }
1105  while (angle < 0.) {
1106  angle += 360.;
1107  }
1108  }
1109 
1110  Position vehPos = veh->getPosition();
1111 #ifdef DEBUG_MOVEXY
1112  std::cout << std::endl << SIMTIME << " moveToXY veh=" << veh->getID() << " vehPos=" << vehPos << " lane=" << Named::getIDSecure(veh->getLane()) << std::endl;
1113  std::cout << " wantedPos=" << pos << " origID=" << origID << " laneIndex=" << laneIndex << " origAngle=" << origAngle << " angle=" << angle << " keepRoute=" << keepRoute << std::endl;
1114 #endif
1115 
1116  ConstMSEdgeVector edges;
1117  MSLane* lane = nullptr;
1118  double lanePos;
1119  double lanePosLat = 0;
1120  double bestDistance = std::numeric_limits<double>::max();
1121  int routeOffset = 0;
1122  bool found;
1123  double maxRouteDistance = 100;
1124  /* EGO vehicle is known to have a fixed route. @todo make this into a parameter of the TraCI call */
1125  if (doKeepRoute) {
1126  // case a): vehicle is on its earlier route
1127  // we additionally assume it is moving forward (SUMO-limit);
1128  // note that the route ("edges") is not changed in this case
1129 
1130  found = Helper::moveToXYMap_matchingRoutePosition(pos, origID,
1131  veh->getRoute().getEdges(), (int)(veh->getCurrentRouteEdge() - veh->getRoute().begin()),
1132  vClass,
1133  bestDistance, &lane, lanePos, routeOffset);
1134  // @note silenty ignoring mapping failure
1135  } else {
1136  double speed = pos.distanceTo2D(veh->getPosition()); // !!!veh->getSpeed();
1137  found = Helper::moveToXYMap(pos, maxRouteDistance, mayLeaveNetwork, origID, angle,
1138  speed, veh->getRoute().getEdges(), veh->getRoutePosition(), veh->getLane(), veh->getPositionOnLane(), veh->isOnRoad(),
1139  vClass,
1140  bestDistance, &lane, lanePos, routeOffset, edges);
1141  }
1142  if ((found && bestDistance <= maxRouteDistance) || mayLeaveNetwork) {
1143  // optionally compute lateral offset
1144  pos.setz(veh->getPosition().z());
1145  if (found && (MSGlobals::gLateralResolution > 0 || mayLeaveNetwork)) {
1146  const double perpDist = lane->getShape().distance2D(pos, false);
1147  if (perpDist != GeomHelper::INVALID_OFFSET) {
1148  lanePosLat = perpDist;
1149  if (!mayLeaveNetwork) {
1150  lanePosLat = MIN2(lanePosLat, 0.5 * (lane->getWidth() + veh->getVehicleType().getWidth() - MSGlobals::gLateralResolution));
1151  }
1152  // figure out whether the offset is to the left or to the right
1153  PositionVector tmp = lane->getShape();
1154  try {
1155  tmp.move2side(-lanePosLat); // moved to left
1156  } catch (ProcessError&) {
1157  WRITE_WARNING("Could not determine position on lane '" + lane->getID() + "' at lateral position " + toString(-lanePosLat) + ".");
1158  }
1159  //std::cout << " lane=" << lane->getID() << " posLat=" << lanePosLat << " shape=" << lane->getShape() << " tmp=" << tmp << " tmpDist=" << tmp.distance2D(pos) << "\n";
1160  if (tmp.distance2D(pos) > perpDist) {
1161  lanePosLat = -lanePosLat;
1162  }
1163  }
1164  pos.setz(lane->geometryPositionAtOffset(lanePos).z());
1165  }
1166  if (found && !mayLeaveNetwork && MSGlobals::gLateralResolution < 0) {
1167  // mapped position may differ from pos
1168  pos = lane->geometryPositionAtOffset(lanePos, -lanePosLat);
1169  }
1170  assert((found && lane != 0) || (!found && lane == 0));
1171  if (angle == INVALID_DOUBLE_VALUE) {
1172  if (lane != nullptr) {
1173  angle = GeomHelper::naviDegree(lane->getShape().rotationAtOffset(lanePos));
1174  } else {
1175  // compute angle outside road network from old and new position
1176  angle = GeomHelper::naviDegree(veh->getPosition().angleTo2D(pos));
1177  }
1178  }
1179  // use the best we have
1180 #ifdef DEBUG_MOVEXY
1181  std::cout << SIMTIME << " veh=" << vehicleID + " moveToXYResult lane='" << Named::getIDSecure(lane) << "' lanePos=" << lanePos << " lanePosLat=" << lanePosLat << "\n";
1182 #endif
1183  Helper::setRemoteControlled(veh, pos, lane, lanePos, lanePosLat, angle, routeOffset, edges, MSNet::getInstance()->getCurrentTimeStep());
1184  if (!veh->isOnRoad()) {
1186  }
1187  } else {
1188  if (lane == nullptr) {
1189  throw TraCIException("Could not map vehicle '" + vehicleID + "', no road found within " + toString(maxRouteDistance) + "m.");
1190  } else {
1191  throw TraCIException("Could not map vehicle '" + vehicleID + "', distance to road is " + toString(bestDistance) + ".");
1192  }
1193  }
1194 }
1195 
1196 void
1197 Vehicle::slowDown(const std::string& vehicleID, double speed, double duration) {
1198  MSVehicle* veh = Helper::getVehicle(vehicleID);
1199  std::vector<std::pair<SUMOTime, double> > speedTimeLine;
1200  speedTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep(), veh->getSpeed()));
1201  speedTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep() + TIME2STEPS(duration), speed));
1202  veh->getInfluencer().setSpeedTimeLine(speedTimeLine);
1203 }
1204 
1205 void
1206 Vehicle::openGap(const std::string& vehicleID, double newTimeHeadway, double newSpaceHeadway, double duration, double changeRate, double maxDecel, const std::string& referenceVehID) {
1207  MSVehicle* veh = Helper::getVehicle(vehicleID);
1208  MSVehicle* refVeh = nullptr;
1209  if (referenceVehID != "") {
1210  refVeh = Helper::getVehicle(referenceVehID);
1211  }
1212  const double originalTau = veh->getVehicleType().getCarFollowModel().getHeadwayTime();
1213  if (newTimeHeadway == -1) {
1214  newTimeHeadway = originalTau;
1215  }
1216  if (originalTau > newTimeHeadway) {
1217  WRITE_WARNING("Ignoring openGap(). New time headway must not be smaller than the original.");
1218  return;
1219  }
1220  veh->getInfluencer().activateGapController(originalTau, newTimeHeadway, newSpaceHeadway, duration, changeRate, maxDecel, refVeh);
1221 }
1222 
1223 void
1224 Vehicle::deactivateGapControl(const std::string& vehicleID) {
1225  MSVehicle* veh = Helper::getVehicle(vehicleID);
1226  if (veh->hasInfluencer()) {
1228  }
1229 }
1230 
1231 void
1232 Vehicle::requestToC(const std::string& vehID, double leadTime) {
1233  setParameter(vehID, "device.toc.requestToC", toString(leadTime));
1234 }
1235 
1236 void
1237 Vehicle::setSpeed(const std::string& vehicleID, double speed) {
1238  MSVehicle* veh = Helper::getVehicle(vehicleID);
1239  std::vector<std::pair<SUMOTime, double> > speedTimeLine;
1240  if (speed >= 0) {
1241  speedTimeLine.push_back(std::make_pair(MSNet::getInstance()->getCurrentTimeStep(), speed));
1242  speedTimeLine.push_back(std::make_pair(SUMOTime_MAX - DELTA_T, speed));
1243  }
1244  veh->getInfluencer().setSpeedTimeLine(speedTimeLine);
1245 }
1246 
1247 void
1248 Vehicle::setSpeedMode(const std::string& vehicleID, int speedMode) {
1249  Helper::getVehicle(vehicleID)->getInfluencer().setSpeedMode(speedMode);
1250 }
1251 
1252 void
1253 Vehicle::setLaneChangeMode(const std::string& vehicleID, int laneChangeMode) {
1254  Helper::getVehicle(vehicleID)->getInfluencer().setLaneChangeMode(laneChangeMode);
1255 }
1256 
1257 void
1258 Vehicle::setRoutingMode(const std::string& vehicleID, int routingMode) {
1259  Helper::getVehicle(vehicleID)->getInfluencer().setRoutingMode(routingMode);
1260 }
1261 
1262 void
1263 Vehicle::setType(const std::string& vehicleID, const std::string& typeID) {
1264  MSVehicleType* vehicleType = MSNet::getInstance()->getVehicleControl().getVType(typeID);
1265  if (vehicleType == nullptr) {
1266  throw TraCIException("Vehicle type '" + typeID + "' is not known");
1267  }
1268  Helper::getVehicle(vehicleID)->replaceVehicleType(vehicleType);
1269 }
1270 
1271 void
1272 Vehicle::setRouteID(const std::string& vehicleID, const std::string& routeID) {
1273  MSVehicle* veh = Helper::getVehicle(vehicleID);
1274  const MSRoute* r = MSRoute::dictionary(routeID);
1275  if (r == nullptr) {
1276  throw TraCIException("The route '" + routeID + "' is not known.");
1277  }
1278  std::string msg;
1279  if (!veh->hasValidRoute(msg, r)) {
1280  WRITE_WARNING("Invalid route replacement for vehicle '" + veh->getID() + "'. " + msg);
1282  throw TraCIException("Route replacement failed for " + veh->getID());
1283  }
1284  }
1285 
1286  if (!veh->replaceRoute(r, "traci:setRouteID", veh->getLane() == nullptr)) {
1287  throw TraCIException("Route replacement failed for " + veh->getID());
1288  }
1289 }
1290 
1291 void
1292 Vehicle::setRoute(const std::string& vehicleID, const std::vector<std::string>& edgeIDs) {
1293  MSVehicle* veh = Helper::getVehicle(vehicleID);
1294  ConstMSEdgeVector edges;
1295  try {
1296  MSEdge::parseEdgesList(edgeIDs, edges, "<unknown>");
1297  if (edges.size() > 0 && edges.back()->isInternal()) {
1298  edges.push_back(edges.back()->getLanes()[0]->getNextNormal());
1299  }
1300  } catch (ProcessError& e) {
1301  throw TraCIException("Invalid edge list for vehicle '" + veh->getID() + "' (" + e.what() + ")");
1302  }
1303  if (!veh->replaceRouteEdges(edges, -1, 0, "traci:setRoute", veh->getLane() == nullptr, true)) {
1304  throw TraCIException("Route replacement failed for " + veh->getID());
1305  }
1306 }
1307 
1308 void
1309 Vehicle::updateBestLanes(const std::string& vehicleID) {
1310  MSVehicle* veh = Helper::getVehicle(vehicleID);
1311  veh->updateBestLanes(true);
1312 }
1313 
1314 
1315 void
1316 Vehicle::setAdaptedTraveltime(const std::string& vehicleID, const std::string& edgeID,
1317  double time, double begSeconds, double endSeconds) {
1318  MSVehicle* veh = Helper::getVehicle(vehicleID);
1319  MSEdge* edge = MSEdge::dictionary(edgeID);
1320  if (edge == nullptr) {
1321  throw TraCIException("Edge '" + edgeID + "' is not known.");
1322  }
1323  if (time != INVALID_DOUBLE_VALUE) {
1324  // add time
1325  if (begSeconds == 0 && endSeconds == std::numeric_limits<double>::max()) {
1326  // clean up old values before setting whole range
1327  while (veh->getWeightsStorage().knowsTravelTime(edge)) {
1328  veh->getWeightsStorage().removeTravelTime(edge);
1329  }
1330  }
1331  veh->getWeightsStorage().addTravelTime(edge, begSeconds, endSeconds, time);
1332  } else {
1333  // remove time
1334  while (veh->getWeightsStorage().knowsTravelTime(edge)) {
1335  veh->getWeightsStorage().removeTravelTime(edge);
1336  }
1337  }
1338 }
1339 
1340 
1341 void
1342 Vehicle::setEffort(const std::string& vehicleID, const std::string& edgeID,
1343  double effort, double begSeconds, double endSeconds) {
1344  MSVehicle* veh = Helper::getVehicle(vehicleID);
1345  MSEdge* edge = MSEdge::dictionary(edgeID);
1346  if (edge == nullptr) {
1347  throw TraCIException("Edge '" + edgeID + "' is not known.");
1348  }
1349  if (effort != INVALID_DOUBLE_VALUE) {
1350  // add effort
1351  if (begSeconds == 0 && endSeconds == std::numeric_limits<double>::max()) {
1352  // clean up old values before setting whole range
1353  while (veh->getWeightsStorage().knowsEffort(edge)) {
1354  veh->getWeightsStorage().removeEffort(edge);
1355  }
1356  }
1357  veh->getWeightsStorage().addEffort(edge, begSeconds, endSeconds, effort);
1358  } else {
1359  // remove effort
1360  while (veh->getWeightsStorage().knowsEffort(edge)) {
1361  veh->getWeightsStorage().removeEffort(edge);
1362  }
1363  }
1364 }
1365 
1366 
1367 void
1368 Vehicle::rerouteTraveltime(const std::string& vehicleID, const bool currentTravelTimes) {
1369  UNUSED_PARAMETER(currentTravelTimes); // !!! see #5943
1370  MSVehicle* veh = Helper::getVehicle(vehicleID);
1371  veh->reroute(MSNet::getInstance()->getCurrentTimeStep(), "traci:rerouteTraveltime",
1372  veh->getInfluencer().getRouterTT(), isOnInit(vehicleID));
1373 }
1374 
1375 
1376 void
1377 Vehicle::rerouteEffort(const std::string& vehicleID) {
1378  MSVehicle* veh = Helper::getVehicle(vehicleID);
1379  veh->reroute(MSNet::getInstance()->getCurrentTimeStep(), "traci:rerouteEffort",
1380  MSNet::getInstance()->getRouterEffort(), isOnInit(vehicleID));
1381 }
1382 
1383 
1384 void
1385 Vehicle::setSignals(const std::string& vehicleID, int signals) {
1386  MSVehicle* veh = Helper::getVehicle(vehicleID);
1387  // set influencer to make the change persistent
1388  veh->getInfluencer().setSignals(signals);
1389  // set them now so that getSignals returns the correct value
1390  veh->switchOffSignal(0x0fffffff);
1391  if (signals >= 0) {
1392  veh->switchOnSignal(signals);
1393  }
1394 }
1395 
1396 
1397 void
1398 Vehicle::moveTo(const std::string& vehicleID, const std::string& laneID, double position) {
1399  MSVehicle* veh = Helper::getVehicle(vehicleID);
1400  MSLane* l = MSLane::dictionary(laneID);
1401  if (l == nullptr) {
1402  throw TraCIException("Unknown lane '" + laneID + "'.");
1403  }
1404  MSEdge* destinationEdge = &l->getEdge();
1405  const MSEdge* destinationRouteEdge = destinationEdge->getNormalBefore();
1406  // find edge in the remaining route
1407  MSRouteIterator it = std::find(veh->getCurrentRouteEdge(), veh->getRoute().end(), destinationRouteEdge);
1408  if (it == veh->getRoute().end()) {
1409  // find edge in the edges that were already passed
1410  it = std::find(veh->getRoute().begin(), veh->getRoute().end(), destinationRouteEdge);
1411  }
1412  if (it == veh->getRoute().end() ||
1413  // internal edge must continue the route
1414  (destinationEdge->isInternal() &&
1415  ((it + 1) == veh->getRoute().end()
1416  || l->getNextNormal() != *(it + 1)))) {
1417  throw TraCIException("Lane '" + laneID + "' is not on the route of vehicle '" + vehicleID + "'.");
1418  }
1420  if (veh->getLane() != nullptr) {
1422  } else {
1423  veh->setTentativeLaneAndPosition(l, position);
1424  }
1425  const int newRouteIndex = (int)(it - veh->getRoute().begin());
1426  veh->resetRoutePosition(newRouteIndex, veh->getParameter().departLaneProcedure);
1427  if (!veh->isOnRoad()) {
1429 
1430  }
1431  l->forceVehicleInsertion(veh, position,
1433 }
1434 
1435 
1436 void
1437 Vehicle::setActionStepLength(const std::string& vehicleID, double actionStepLength, bool resetActionOffset) {
1438  if (actionStepLength < 0.0) {
1439  WRITE_ERROR("Invalid action step length (<0). Ignoring command setActionStepLength().");
1440  return;
1441  }
1442  MSVehicle* veh = Helper::getVehicle(vehicleID);
1443  if (actionStepLength == 0.) {
1444  veh->resetActionOffset();
1445  } else {
1446  veh->setActionStepLength(actionStepLength, resetActionOffset);
1447  }
1448 }
1449 
1450 
1451 void
1452 Vehicle::remove(const std::string& vehicleID, char reason) {
1453  MSVehicle* veh = Helper::getVehicle(vehicleID);
1455  switch (reason) {
1456  case REMOVE_TELEPORT:
1457  // XXX semantics unclear
1458  // n = MSMoveReminder::NOTIFICATION_TELEPORT;
1460  break;
1461  case REMOVE_PARKING:
1462  // XXX semantics unclear
1463  // n = MSMoveReminder::NOTIFICATION_PARKING;
1465  break;
1466  case REMOVE_ARRIVED:
1468  break;
1469  case REMOVE_VAPORIZED:
1471  break;
1474  break;
1475  default:
1476  throw TraCIException("Unknown removal status.");
1477  }
1478  if (veh->hasDeparted()) {
1479  veh->onRemovalFromNet(n);
1480  if (veh->getLane() != nullptr) {
1481  veh->getLane()->removeVehicle(veh, n);
1482  }
1484  } else {
1487  }
1488 }
1489 
1490 
1491 void
1492 Vehicle::setColor(const std::string& vehicleID, const TraCIColor& col) {
1493  const SUMOVehicleParameter& p = Helper::getVehicle(vehicleID)->getParameter();
1494  p.color.set((unsigned char)col.r, (unsigned char)col.g, (unsigned char)col.b, (unsigned char)col.a);
1496 }
1497 
1498 
1499 void
1500 Vehicle::setSpeedFactor(const std::string& vehicleID, double factor) {
1501  Helper::getVehicle(vehicleID)->setChosenSpeedFactor(factor);
1502 }
1503 
1504 
1505 void
1506 Vehicle::setLine(const std::string& vehicleID, const std::string& line) {
1507  Helper::getVehicle(vehicleID)->getParameter().line = line;
1508 }
1509 
1510 
1511 void
1512 Vehicle::setVia(const std::string& vehicleID, const std::vector<std::string>& via) {
1513  MSVehicle* veh = Helper::getVehicle(vehicleID);
1514  try {
1515  // ensure edges exist
1516  ConstMSEdgeVector edges;
1517  MSEdge::parseEdgesList(via, edges, "<via-edges>");
1518  } catch (ProcessError& e) {
1519  throw TraCIException(e.what());
1520  }
1521  veh->getParameter().via = via;
1522 }
1523 
1524 
1525 void
1526 Vehicle::setLength(const std::string& vehicleID, double length) {
1527  Helper::getVehicle(vehicleID)->getSingularType().setLength(length);
1528 }
1529 
1530 
1531 void
1532 Vehicle::setMaxSpeed(const std::string& vehicleID, double speed) {
1533  Helper::getVehicle(vehicleID)->getSingularType().setMaxSpeed(speed);
1534 }
1535 
1536 
1537 void
1538 Vehicle::setVehicleClass(const std::string& vehicleID, const std::string& clazz) {
1540 }
1541 
1542 
1543 void
1544 Vehicle::setShapeClass(const std::string& vehicleID, const std::string& clazz) {
1546 }
1547 
1548 
1549 void
1550 Vehicle::setEmissionClass(const std::string& vehicleID, const std::string& clazz) {
1552 }
1553 
1554 
1555 void
1556 Vehicle::setWidth(const std::string& vehicleID, double width) {
1557  Helper::getVehicle(vehicleID)->getSingularType().setWidth(width);
1558 }
1559 
1560 
1561 void
1562 Vehicle::setHeight(const std::string& vehicleID, double height) {
1563  Helper::getVehicle(vehicleID)->getSingularType().setHeight(height);
1564 }
1565 
1566 
1567 void
1568 Vehicle::setMinGap(const std::string& vehicleID, double minGap) {
1569  Helper::getVehicle(vehicleID)->getSingularType().setMinGap(minGap);
1570 }
1571 
1572 
1573 void
1574 Vehicle::setAccel(const std::string& vehicleID, double accel) {
1575  Helper::getVehicle(vehicleID)->getSingularType().setAccel(accel);
1576 }
1577 
1578 
1579 void
1580 Vehicle::setDecel(const std::string& vehicleID, double decel) {
1581  VehicleType::setDecel(Helper::getVehicle(vehicleID)->getSingularType().getID(), decel);
1582 }
1583 
1584 
1585 void
1586 Vehicle::setEmergencyDecel(const std::string& vehicleID, double decel) {
1587  VehicleType::setEmergencyDecel(Helper::getVehicle(vehicleID)->getSingularType().getID(), decel);
1588 }
1589 
1590 
1591 void
1592 Vehicle::setApparentDecel(const std::string& vehicleID, double decel) {
1594 }
1595 
1596 
1597 void
1598 Vehicle::setImperfection(const std::string& vehicleID, double imperfection) {
1599  Helper::getVehicle(vehicleID)->getSingularType().setImperfection(imperfection);
1600 }
1601 
1602 
1603 void
1604 Vehicle::setTau(const std::string& vehicleID, double tau) {
1605  Helper::getVehicle(vehicleID)->getSingularType().setTau(tau);
1606 }
1607 
1608 
1609 void
1610 Vehicle::setMinGapLat(const std::string& vehicleID, double minGapLat) {
1611  Helper::getVehicle(vehicleID)->getSingularType().setMinGapLat(minGapLat);
1612 }
1613 
1614 
1615 void
1616 Vehicle::setMaxSpeedLat(const std::string& vehicleID, double speed) {
1617  Helper::getVehicle(vehicleID)->getSingularType().setMaxSpeedLat(speed);
1618 }
1619 
1620 
1621 void
1622 Vehicle::setLateralAlignment(const std::string& vehicleID, const std::string& latAlignment) {
1624 }
1625 
1626 
1627 void
1628 Vehicle::setParameter(const std::string& vehicleID, const std::string& key, const std::string& value) {
1629  MSVehicle* veh = Helper::getVehicle(vehicleID);
1630  if (StringUtils::startsWith(key, "device.")) {
1631  StringTokenizer tok(key, ".");
1632  if (tok.size() < 3) {
1633  throw TraCIException("Invalid device parameter '" + key + "' for vehicle '" + vehicleID + "'");
1634  }
1635  try {
1636  veh->setDeviceParameter(tok.get(1), key.substr(tok.get(0).size() + tok.get(1).size() + 2), value);
1637  } catch (InvalidArgument& e) {
1638  throw TraCIException("Vehicle '" + vehicleID + "' does not support device parameter '" + key + "' (" + e.what() + ").");
1639  }
1640  } else if (StringUtils::startsWith(key, "laneChangeModel.")) {
1641  const std::string attrName = key.substr(16);
1642  try {
1643  veh->getLaneChangeModel().setParameter(attrName, value);
1644  } catch (InvalidArgument& e) {
1645  throw TraCIException("Vehicle '" + vehicleID + "' does not support laneChangeModel parameter '" + key + "' (" + e.what() + ").");
1646  }
1647  } else if (StringUtils::startsWith(key, "carFollowModel.")) {
1648  const std::string attrName = key.substr(15);
1649  try {
1650  veh->getCarFollowModel().setParameter(veh, attrName, value);
1651  } catch (InvalidArgument& e) {
1652  throw TraCIException("Vehicle '" + vehicleID + "' does not support carFollowModel parameter '" + key + "' (" + e.what() + ").");
1653  }
1654  } else if (StringUtils::startsWith(key, "has.") && StringUtils::endsWith(key, ".device")) {
1655  StringTokenizer tok(key, ".");
1656  if (tok.size() != 3) {
1657  throw TraCIException("Invalid request for device status change. Expected format is 'has.DEVICENAME.device'");
1658  }
1659  const std::string deviceName = tok.get(1);
1660  bool create;
1661  try {
1662  create = StringUtils::toBool(value);
1663  } catch (BoolFormatException&) {
1664  throw TraCIException("Changing device status requires a 'true' or 'false'");
1665  }
1666  if (!create) {
1667  throw TraCIException("Device removal is not supported for device of type '" + deviceName + "'");
1668  }
1669  try {
1670  veh->createDevice(deviceName);
1671  } catch (InvalidArgument& e) {
1672  throw TraCIException("Cannot create vehicle device (" + std::string(e.what()) + ").");
1673  }
1674  } else {
1675  ((SUMOVehicleParameter&)veh->getParameter()).setParameter(key, value);
1676  }
1677 }
1678 
1679 
1680 void
1681 Vehicle::highlight(const std::string& vehicleID, const TraCIColor& col, double size, const int alphaMax, const double duration, const int type) {
1682  // NOTE: Code is duplicated in large parts in POI.cpp
1683  MSVehicle* veh = Helper::getVehicle(vehicleID);
1684 
1685  // Center of the highlight circle
1686  Position center = veh->getPosition();
1687  const double l2 = veh->getLength() * 0.5;
1688  center.sub(cos(veh->getAngle())*l2, sin(veh->getAngle())*l2);
1689  // Size of the highlight circle
1690  if (size <= 0) {
1691  size = veh->getLength() * 0.7;
1692  }
1693  // Make polygon shape
1694  const unsigned int nPoints = 34;
1695  const PositionVector circlePV = GeomHelper::makeRing(size, size + 1., center, nPoints);
1697 
1698 #ifdef DEBUG_DYNAMIC_SHAPES
1699  std::cout << SIMTIME << " Vehicle::highlight() for vehicle '" << vehicleID << "'\n"
1700  << " circle: " << circlePV << std::endl;
1701 #endif
1702 
1703  // Find a free polygon id
1704  int i = 0;
1705  std::string polyID = veh->getID() + "_hl" + toString(i);
1706  while (Polygon::exists(polyID)) {
1707  polyID = veh->getID() + "_hl" + toString(++i);
1708  }
1709  // Line width
1710  double lw = 0.;
1711  // Layer
1712  double lyr = 0.;
1713  if (MSNet::getInstance()->isGUINet()) {
1714  lyr = GLO_VEHICLE + 0.01;
1715  lyr += (type + 1) / 257.;
1716  }
1717  // Make Polygon
1718  Polygon::addHighlightPolygon(vehicleID, type, polyID, circle, col, true, "highlight", (int)lyr, lw);
1719 
1720  // Animation time line
1721  double maxAttack = 1.0; // maximal fade-in time
1722  std::vector<double> timeSpan;
1723  if (duration > 0.) {
1724  timeSpan = {0, MIN2(maxAttack, duration / 3.), 2.*duration / 3., duration};
1725  }
1726  // Alpha time line
1727  std::vector<double> alphaSpan;
1728  if (alphaMax > 0.) {
1729  alphaSpan = {0., (double) alphaMax, (double)(alphaMax) / 3., 0.};
1730  }
1731  // Attach dynamics
1732  Polygon::addDynamics(polyID, vehicleID, timeSpan, alphaSpan, false, true);
1733 }
1734 
1735 
1737 
1738 
1739 void
1740 Vehicle::subscribeLeader(const std::string& vehicleID, double /* dist */, double beginTime, double endTime) {
1741  // TODO handle dist correctly
1742  Vehicle::subscribe(vehicleID, std::vector<int>({libsumo::VAR_LEADER}), beginTime, endTime);
1743 }
1744 
1745 
1746 void
1747 Vehicle::storeShape(const std::string& id, PositionVector& shape) {
1748  shape.push_back(Helper::getVehicle(id)->getPosition());
1749 }
1750 
1751 
1752 std::shared_ptr<VariableWrapper>
1754  return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
1755 }
1756 
1757 
1758 bool
1759 Vehicle::handleVariable(const std::string& objID, const int variable, VariableWrapper* wrapper) {
1760  switch (variable) {
1761  case TRACI_ID_LIST:
1762  return wrapper->wrapStringList(objID, variable, getIDList());
1763  case ID_COUNT:
1764  return wrapper->wrapInt(objID, variable, getIDCount());
1765  case VAR_POSITION:
1766  return wrapper->wrapPosition(objID, variable, getPosition(objID));
1767  case VAR_POSITION3D:
1768  return wrapper->wrapPosition(objID, variable, getPosition(objID, true));
1769  case VAR_ANGLE:
1770  return wrapper->wrapDouble(objID, variable, getAngle(objID));
1771  case VAR_SPEED:
1772  return wrapper->wrapDouble(objID, variable, getSpeed(objID));
1773  case VAR_SPEED_LAT:
1774  return wrapper->wrapDouble(objID, variable, getLateralSpeed(objID));
1775  case VAR_ROAD_ID:
1776  return wrapper->wrapString(objID, variable, getRoadID(objID));
1778  return wrapper->wrapDouble(objID, variable, getSpeedWithoutTraCI(objID));
1779  case VAR_SLOPE:
1780  return wrapper->wrapDouble(objID, variable, getSlope(objID));
1781  case VAR_LANE_ID:
1782  return wrapper->wrapString(objID, variable, getLaneID(objID));
1783  case VAR_LANE_INDEX:
1784  return wrapper->wrapInt(objID, variable, getLaneIndex(objID));
1785  case VAR_TYPE:
1786  return wrapper->wrapString(objID, variable, getTypeID(objID));
1787  case VAR_ROUTE_ID:
1788  return wrapper->wrapString(objID, variable, getRouteID(objID));
1789  case VAR_ROUTE_INDEX:
1790  return wrapper->wrapInt(objID, variable, getRouteIndex(objID));
1791  case VAR_COLOR:
1792  return wrapper->wrapColor(objID, variable, getColor(objID));
1793  case VAR_LANEPOSITION:
1794  return wrapper->wrapDouble(objID, variable, getLanePosition(objID));
1795  case VAR_LANEPOSITION_LAT:
1796  return wrapper->wrapDouble(objID, variable, getLateralLanePosition(objID));
1797  case VAR_CO2EMISSION:
1798  return wrapper->wrapDouble(objID, variable, getCO2Emission(objID));
1799  case VAR_COEMISSION:
1800  return wrapper->wrapDouble(objID, variable, getCOEmission(objID));
1801  case VAR_HCEMISSION:
1802  return wrapper->wrapDouble(objID, variable, getHCEmission(objID));
1803  case VAR_PMXEMISSION:
1804  return wrapper->wrapDouble(objID, variable, getPMxEmission(objID));
1805  case VAR_NOXEMISSION:
1806  return wrapper->wrapDouble(objID, variable, getNOxEmission(objID));
1807  case VAR_FUELCONSUMPTION:
1808  return wrapper->wrapDouble(objID, variable, getFuelConsumption(objID));
1809  case VAR_NOISEEMISSION:
1810  return wrapper->wrapDouble(objID, variable, getNoiseEmission(objID));
1812  return wrapper->wrapDouble(objID, variable, getElectricityConsumption(objID));
1813  case VAR_PERSON_NUMBER:
1814  return wrapper->wrapInt(objID, variable, getPersonNumber(objID));
1815  case VAR_PERSON_CAPACITY:
1816  return wrapper->wrapInt(objID, variable, getPersonCapacity(objID));
1818  return wrapper->wrapStringList(objID, variable, getPersonIDList(objID));
1819  case VAR_WAITING_TIME:
1820  return wrapper->wrapDouble(objID, variable, getWaitingTime(objID));
1822  return wrapper->wrapDouble(objID, variable, getAccumulatedWaitingTime(objID));
1823  case VAR_ROUTE_VALID:
1824  return wrapper->wrapInt(objID, variable, isRouteValid(objID));
1825  case VAR_EDGES:
1826  return wrapper->wrapStringList(objID, variable, getRoute(objID));
1827  case VAR_SIGNALS:
1828  return wrapper->wrapInt(objID, variable, getSignals(objID));
1829  case VAR_STOPSTATE:
1830  return wrapper->wrapInt(objID, variable, getStopState(objID));
1831  case VAR_DISTANCE:
1832  return wrapper->wrapDouble(objID, variable, getDistance(objID));
1833  case VAR_ALLOWED_SPEED:
1834  return wrapper->wrapDouble(objID, variable, getAllowedSpeed(objID));
1835  case VAR_SPEED_FACTOR:
1836  return wrapper->wrapDouble(objID, variable, getSpeedFactor(objID));
1837  case VAR_SPEEDSETMODE:
1838  return wrapper->wrapInt(objID, variable, getSpeedMode(objID));
1839  case VAR_LANECHANGE_MODE:
1840  return wrapper->wrapInt(objID, variable, getLaneChangeMode(objID));
1841  case VAR_ROUTING_MODE:
1842  return wrapper->wrapInt(objID, variable, getRoutingMode(objID));
1843  case VAR_LINE:
1844  return wrapper->wrapString(objID, variable, getLine(objID));
1845  case VAR_VIA:
1846  return wrapper->wrapStringList(objID, variable, getVia(objID));
1847  case VAR_ACCELERATION:
1848  return wrapper->wrapDouble(objID, variable, getAcceleration(objID));
1849  case VAR_LASTACTIONTIME:
1850  return wrapper->wrapDouble(objID, variable, getLastActionTime(objID));
1851  case VAR_LEADER: {
1852  const auto& lead = getLeader(objID);
1853  TraCIRoadPosition rp;
1854  rp.edgeID = lead.first;
1855  rp.pos = lead.second;
1856  return wrapper->wrapRoadPosition(objID, variable, rp);
1857  }
1858  default:
1859  return false;
1860  }
1861 }
1862 
1863 
1864 }
1865 
1866 /****************************************************************************/
libsumo::Vehicle::getLaneID
static std::string getLaneID(const std::string &vehicleID)
Definition: Vehicle.cpp:166
libsumo::Helper::getEdge
static MSEdge * getEdge(const std::string &edgeID)
Definition: Helper.cpp:280
MSEdgeWeightsStorage::knowsEffort
bool knowsEffort(const MSEdge *const e) const
Returns the information whether any effort is known for the given edge.
Definition: MSEdgeWeightsStorage.cpp:120
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:66
SUMOAbstractRouter::compute
virtual bool compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &into, bool silent=false)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
MSVehicle::updateBestLanes
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
Definition: MSVehicle.cpp:4627
libsumo::Vehicle::highlight
static void highlight(const std::string &vehicleID, const TraCIColor &col, double size, const int alphaMax, const double duration, const int type)
Definition: Vehicle.cpp:1681
libsumo::VAR_LANE_ID
TRACI_CONST int VAR_LANE_ID
Definition: TraCIConstants.h:676
SUMOVehicleParameter::personNumber
int personNumber
The static number of persons in the vehicle when it departs (not including boarding persons)
Definition: SUMOVehicleParameter.h:644
UNUSED_PARAMETER
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:32
MSVehicleType::setHeight
void setHeight(const double &height)
Set a new value for this type's height.
Definition: MSVehicleType.cpp:101
libsumo::Vehicle::setSpeed
static void setSpeed(const std::string &vehicleID, double speed)
Definition: Vehicle.cpp:1237
libsumo::Vehicle::myContextSubscriptionResults
static ContextSubscriptionResults myContextSubscriptionResults
Definition: Vehicle.h:202
libsumo::VAR_SPEEDSETMODE
TRACI_CONST int VAR_SPEEDSETMODE
Definition: TraCIConstants.h:742
MSVehicle::getSpeedWithoutTraciInfluence
double getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
Definition: MSVehicle.cpp:5832
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:134
libsumo::Vehicle::setStop
static void setStop(const std::string &vehicleID, const std::string &edgeID, double pos=1., int laneIndex=0, double duration=INVALID_DOUBLE_VALUE, int flags=STOP_DEFAULT, double startPos=INVALID_DOUBLE_VALUE, double until=INVALID_DOUBLE_VALUE)
Definition: Vehicle.cpp:831
MSVehicle::LaneQ::bestLaneOffset
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive.
Definition: MSVehicle.h:823
libsumo::Vehicle::setLaneChangeMode
static void setLaneChangeMode(const std::string &vehicleID, int laneChangeMode)
Definition: Vehicle.cpp:1253
MSVehicle::Stop::busstop
MSStoppingPlace * busstop
(Optional) bus stop if one is assigned to the stop
Definition: MSVehicle.h:929
MSLane::dictionary
static bool dictionary(const std::string &id, MSLane *lane)
Static (sic!) container methods {.
Definition: MSLane.cpp:1855
MSBaseVehicle::getParameter
const SUMOVehicleParameter & getParameter() const
Returns the vehicle's parameter (including departure definition)
Definition: MSBaseVehicle.cpp:143
libsumo::Vehicle::getHCEmission
static double getHCEmission(const std::string &vehicleID)
Definition: Vehicle.cpp:228
MSVehicleType::getID
const std::string & getID() const
Returns the name of the vehicle type.
Definition: MSVehicleType.h:94
GUIGlObjectTypes.h
libsumo::Vehicle::mySubscriptionResults
static SubscriptionResults mySubscriptionResults
Definition: Vehicle.h:201
MSBaseVehicle::hasDeparted
bool hasDeparted() const
Returns whether this vehicle has already departed.
Definition: MSBaseVehicle.cpp:368
MSCFModel::getMaxAccel
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
Definition: MSCFModel.h:210
MIN2
T MIN2(T a, T b)
Definition: StdDefs.h:74
MSVehicleType::setPreferredLateralAlignment
void setPreferredLateralAlignment(LateralAlignment latAlignment)
Set vehicle's preferred lateral alignment.
Definition: MSVehicleType.cpp:162
libsumo::VAR_ROUTE_INDEX
TRACI_CONST int VAR_ROUTE_INDEX
Definition: TraCIConstants.h:820
SUMOVehicleParameter::parametersSet
int parametersSet
Information for the router which parameter were set, TraCI may modify this (whe changing color)
Definition: SUMOVehicleParameter.h:650
MSCFModel::getMaxDecel
double getMaxDecel() const
Get the vehicle type's maximal comfortable deceleration [m/s^2].
Definition: MSCFModel.h:218
TraCIPositionVector
A list of positions.
libsumo::Vehicle::getRouteID
static std::string getRouteID(const std::string &vehicleID)
Definition: Vehicle.cpp:186
MSVehicleType::setMinGapLat
void setMinGapLat(const double &minGapLat)
Set a new value for this type's minimum lataral gap.
Definition: MSVehicleType.cpp:123
libsumo::Vehicle::getPosition
static TraCIPosition getPosition(const std::string &vehicleID, const bool includeZ=false)
Definition: Vehicle.cpp:129
getVehicleClassID
SUMOVehicleClass getVehicleClassID(const std::string &name)
Returns the class id of the abstract class given by its name.
Definition: SUMOVehicleClass.cpp:201
StringUtils::toBool
static bool toBool(const std::string &sData)
converts a string into the bool value described by it by calling the char-type converter
Definition: StringUtils.cpp:342
MSVehicleType::setAccel
void setAccel(double accel)
Set a new value for this type's acceleration.
Definition: MSVehicleType.cpp:390
WRITE_WARNING
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
MSVehicle::Stop::reached
bool reached
Information whether the stop has been reached.
Definition: MSVehicle.h:945
MSVehicle::getMyStops
std::list< Stop > getMyStops()
Definition: MSVehicle.cpp:5812
MSVehicle::getBestLanes
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
Definition: MSVehicle.cpp:4621
libsumo::Vehicle::openGap
static void openGap(const std::string &vehicleID, double newTimeHeadway, double newSpaceHeadway, double duration, double changeRate, double maxDecel=INVALID_DOUBLE_VALUE, const std::string &referenceVehID="")
Definition: Vehicle.cpp:1206
MSNet.h
libsumo::TraCINextStopData::duration
double duration
The stopping duration.
Definition: TraCIDefs.h:323
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
MSVehicle::isStopped
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MSVehicle.cpp:1751
MSBaseVehicle::setDeviceParameter
void setDeviceParameter(const std::string &deviceName, const std::string &key, const std::string &value)
try to set the given parameter from any of the vehicles devices, raise InvalidArgument if no device p...
Definition: MSBaseVehicle.cpp:680
SUMOVehicleParameter::arrivalSpeedProcedure
ArrivalSpeedDefinition arrivalSpeedProcedure
Information how the vehicle's end speed shall be chosen.
Definition: SUMOVehicleParameter.h:531
libsumo::Polygon::addDynamics
static void addDynamics(const std::string &polygonID, const std::string &trackedID="", const std::vector< double > &timeSpan=std::vector< double >(), const std::vector< double > &alphaSpan=std::vector< double >(), bool looped=false, bool rotate=true)
Definition: Polygon.cpp:140
libsumo::Vehicle::getEffort
static double getEffort(const std::string &vehicleID, double time, const std::string &edgeID)
Definition: Vehicle.cpp:314
libsumo::Helper::getVehicle
static MSVehicle * getVehicle(const std::string &id)
Definition: Helper.cpp:339
libsumo::INVALID_DOUBLE_VALUE
TRACI_CONST double INVALID_DOUBLE_VALUE
Definition: TraCIConstants.h:363
MSLane::isLinkEnd
bool isLinkEnd(MSLinkCont::const_iterator &i) const
Definition: MSLane.cpp:1983
MSCFModel::getImperfection
virtual double getImperfection() const
Get the driver's imperfection.
Definition: MSCFModel.h:251
libsumo::Vehicle::getFuelConsumption
static double getFuelConsumption(const std::string &vehicleID)
Definition: Vehicle.cpp:246
MSVehicle::Stop::parkingarea
MSParkingArea * parkingarea
(Optional) parkingArea if one is assigned to the stop
Definition: MSVehicle.h:933
libsumo::VAR_POSITION
TRACI_CONST int VAR_POSITION
Definition: TraCIConstants.h:616
libsumo::VariableWrapper::wrapString
virtual bool wrapString(const std::string &objID, const int variable, const std::string &value)=0
libsumo::Vehicle::getCO2Emission
static double getCO2Emission(const std::string &vehicleID)
Definition: Vehicle.cpp:216
libsumo::VAR_FUELCONSUMPTION
TRACI_CONST int VAR_FUELCONSUMPTION
Definition: TraCIConstants.h:797
SUMOVehicleParameter::color
RGBColor color
The vehicle's color, TraCI may change this.
Definition: SUMOVehicleParameter.h:471
libsumo::Vehicle::getLaneChangeState
static std::pair< int, int > getLaneChangeState(const std::string &vehicleID, int direction)
Definition: Vehicle.cpp:599
libsumo::Helper::makeTraCIColor
static TraCIColor makeTraCIColor(const RGBColor &color)
Definition: Helper.cpp:247
MSVehicleControl::getVType
MSVehicleType * getVType(const std::string &id=DEFAULT_VTYPE_ID, std::mt19937 *rng=nullptr)
Returns the named vehicle type or a sample from the named distribution.
Definition: MSVehicleControl.cpp:348
libsumo::Vehicle::getStopState
static int getStopState(const std::string &vehicleID)
Definition: Vehicle.cpp:473
MSVehicle::isOnRoad
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition: MSVehicle.h:583
libsumo::TraCINextStopData::lane
std::string lane
The lane to stop at.
Definition: TraCIDefs.h:315
libsumo::Vehicle::getSpeedMode
static int getSpeedMode(const std::string &vehicleID)
Definition: Vehicle.cpp:569
libsumo::Vehicle::isRouteValid
static bool isRouteValid(const std::string &vehicleID)
Definition: Vehicle.cpp:323
libsumo::TraCINextStopData::until
double until
The time at which the vehicle may continue its journey.
Definition: TraCIDefs.h:325
libsumo::Vehicle::getSlope
static double getSlope(const std::string &vehicleID)
Definition: Vehicle.cpp:152
libsumo::TraCINextStopData::stopFlags
int stopFlags
Stop flags.
Definition: TraCIDefs.h:321
MSVehicle::Stop::duration
SUMOTime duration
The stopping duration.
Definition: MSVehicle.h:939
MSAbstractLaneChangeModel::getSavedState
const std::pair< int, int > & getSavedState(const int dir) const
Definition: MSAbstractLaneChangeModel.h:195
DELTA_T
SUMOTime DELTA_T
Definition: SUMOTime.cpp:35
libsumo::VAR_SPEED_WITHOUT_TRACI
TRACI_CONST int VAR_SPEED_WITHOUT_TRACI
Definition: TraCIConstants.h:736
libsumo::VAR_ROAD_ID
TRACI_CONST int VAR_ROAD_ID
Definition: TraCIConstants.h:673
MSRoute::end
MSRouteIterator end() const
Returns the end of the list of edges to pass.
Definition: MSRoute.cpp:76
libsumo::Vehicle::handleVariable
static bool handleVariable(const std::string &objID, const int variable, VariableWrapper *wrapper)
Definition: Vehicle.cpp:1759
libsumo::TraCIPosition
A 3D-position.
Definition: TraCIDefs.h:110
MSVehicle::setTentativeLaneAndPosition
void setTentativeLaneAndPosition(MSLane *lane, double pos, double posLat=0)
set tentative lane and position during insertion to ensure that all cfmodels work (some of them requi...
Definition: MSVehicle.cpp:5240
MSVehicle::hasInfluencer
bool hasInfluencer() const
Definition: MSVehicle.h:1680
MSRouteIterator
ConstMSEdgeVector::const_iterator MSRouteIterator
Definition: MSRoute.h:58
SUMOVehicleParserHelper.h
libsumo::VariableWrapper
Definition: Subscription.h:114
Position::z
double z() const
Returns the z-position.
Definition: Position.h:67
libsumo::REMOVE_PARKING
TRACI_CONST int REMOVE_PARKING
Definition: TraCIConstants.h:385
SUMOVehicleParameter::departSpeed
double departSpeed
(optional) The initial speed of the vehicle
Definition: SUMOVehicleParameter.h:500
libsumo::Vehicle::getLaneIndex
static int getLaneIndex(const std::string &vehicleID)
Definition: Vehicle.cpp:173
libsumo::VAR_COLOR
TRACI_CONST int VAR_COLOR
Definition: TraCIConstants.h:628
MSVehicle::LaneQ::length
double length
The overall length which may be driven when using this lane without a lane change.
Definition: MSVehicle.h:815
libsumo::Vehicle::getAccumulatedWaitingTime
static double getAccumulatedWaitingTime(const std::string &vehicleID)
Definition: Vehicle.cpp:299
libsumo::Vehicle::resume
static void resume(const std::string &vehicleID)
Definition: Vehicle.cpp:908
libsumo::Vehicle
Definition: Vehicle.h:51
SUMOVehicleParameter::departPosProcedure
DepartPosDefinition departPosProcedure
Information how the vehicle shall choose the departure position.
Definition: SUMOVehicleParameter.h:491
MSVehicleType::setVClass
void setVClass(SUMOVehicleClass vclass)
Set a new value for this type's vehicle class.
Definition: MSVehicleType.cpp:156
VEHPARS_FORCE_REROUTE
const int VEHPARS_FORCE_REROUTE
Definition: SUMOVehicleParameter.h:63
libsumo::VAR_VIA
TRACI_CONST int VAR_VIA
Definition: TraCIConstants.h:776
libsumo::VAR_SIGNALS
TRACI_CONST int VAR_SIGNALS
Definition: TraCIConstants.h:712
MSCFModel::getApparentDecel
double getApparentDecel() const
Get the vehicle type's apparent deceleration [m/s^2] (the one regarded by its followers.
Definition: MSCFModel.h:234
SUMOVehicleParameter::parseDepartSpeed
static bool parseDepartSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, DepartSpeedDefinition &dsd, std::string &error)
Validates a given departSpeed value.
Definition: SUMOVehicleParameter.cpp:357
libsumo::TraCIColor::a
int a
Definition: TraCIDefs.h:144
SUMO_TAG_CONTAINER_STOP
A container stop.
Definition: SUMOXMLDefinitions.h:106
libsumo::TraCIBestLanesData::bestLaneOffset
int bestLaneOffset
The offset of this lane from the best lane.
Definition: TraCIDefs.h:337
libsumo::Vehicle::setRouteID
static void setRouteID(const std::string &vehicleID, const std::string &routeID)
Definition: Vehicle.cpp:1272
MSVehicle::Influencer::setLaneTimeLine
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, int > > &laneTimeLine)
Sets a new lane timeline.
Definition: MSVehicle.cpp:408
MSVehicle::addTraciStopAtStoppingPlace
bool addTraciStopAtStoppingPlace(const std::string &stopId, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, const SumoXMLTag stoppingPlaceType, std::string &errorMsg)
Definition: MSVehicle.cpp:5676
MSVehicleType::getMaxSpeedLat
double getMaxSpeedLat() const
Get vehicle's maximum lateral speed [m/s].
Definition: MSVehicleType.h:314
libsumo::VAR_WAITING_TIME
TRACI_CONST int VAR_WAITING_TIME
Definition: TraCIConstants.h:823
libsumo::TraCIColor::g
int g
Definition: TraCIDefs.h:144
MSNet::getInsertionControl
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:390
MSBaseVehicle::getLength
double getLength() const
Returns the vehicle's length.
Definition: MSBaseVehicle.h:394
SUMOVehicleParameter::parseDepartLane
static bool parseDepartLane(const std::string &val, const std::string &element, const std::string &id, int &lane, DepartLaneDefinition &dld, std::string &error)
Validates a given departLane value.
Definition: SUMOVehicleParameter.cpp:250
MSLane::succLinkSec
static MSLinkCont::const_iterator succLinkSec(const SUMOVehicle &veh, int nRouteSuccs, const MSLane &succLinkSource, const std::vector< MSLane * > &conts)
Definition: MSLane.cpp:2050
libsumo::Vehicle::makeWrapper
static std::shared_ptr< VariableWrapper > makeWrapper()
Definition: Vehicle.cpp:1753
libsumo::VAR_ALLOWED_SPEED
TRACI_CONST int VAR_ALLOWED_SPEED
Definition: TraCIConstants.h:755
MSVehicle::LaneQ
A structure representing the best lanes for continuing the current route starting at 'lane'.
Definition: MSVehicle.h:811
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
libsumo::Vehicle::getSignals
static int getSignals(const std::string &vehicleID)
Definition: Vehicle.cpp:342
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:61
libsumo::Helper::moveToXYMap
static bool moveToXYMap(const Position &pos, double maxRouteDistance, bool mayLeaveNetwork, const std::string &origID, const double angle, double speed, const ConstMSEdgeVector &currentRoute, const int routePosition, MSLane *currentLane, double currentLanePos, bool onRoad, SUMOVehicleClass vClass, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset, ConstMSEdgeVector &edges)
Definition: Helper.cpp:822
GeomHelper::naviDegree
static double naviDegree(const double angle)
Definition: GeomHelper.cpp:194
MSBaseVehicle::getRoute
const MSRoute & getRoute() const
Returns the current route.
Definition: MSBaseVehicle.h:110
MSVehicle::resumeFromStopping
bool resumeFromStopping()
Definition: MSVehicle.cpp:5756
ConstMSEdgeVector
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:73
libsumo::VAR_PERSON_NUMBER
TRACI_CONST int VAR_PERSON_NUMBER
Definition: TraCIConstants.h:803
SUMOVehicle::isOnRoad
virtual bool isOnRoad() const =0
Returns the information whether the vehicle is on a road (is simulated)
MSBaseVehicle::hasValidRoute
bool hasValidRoute(std::string &msg, const MSRoute *route=0) const
Validates the current or given route.
Definition: MSBaseVehicle.cpp:403
MSAbstractLaneChangeModel::getSpeedLat
double getSpeedLat() const
return the lateral speed of the current lane change maneuver
Definition: MSAbstractLaneChangeModel.h:566
libsumo::VariableWrapper::wrapRoadPosition
virtual bool wrapRoadPosition(const std::string &objID, const int variable, const TraCIRoadPosition &value)=0
MSVehicle::Influencer::activateGapController
void activateGapController(double originalTau, double newTimeHeadway, double newSpaceHeadway, double duration, double changeRate, double maxDecel, MSVehicle *refVeh=nullptr)
Activates the gap control with the given parameters,.
Definition: MSVehicle.cpp:393
libsumo::VAR_COEMISSION
TRACI_CONST int VAR_COEMISSION
Definition: TraCIConstants.h:785
SUMOVehicleParameter::departProcedure
DepartDefinition departProcedure
Information how the vehicle shall choose the depart time.
Definition: SUMOVehicleParameter.h:479
libsumo::ContextSubscriptionResults
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
Definition: TraCIDefs.h:205
MSVehicle::onRemovalFromNet
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
Definition: MSVehicle.cpp:1055
libsumo::Vehicle::moveTo
static void moveTo(const std::string &vehicleID, const std::string &laneID, double position)
Definition: Vehicle.cpp:1398
MSRoute::getEdges
const ConstMSEdgeVector & getEdges() const
Definition: MSRoute.h:121
libsumo::TraCINextTLSData::tlIndex
int tlIndex
The tls index of the controlled link.
Definition: TraCIDefs.h:305
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:291
SUMO_TAG_NOTHING
invalid tag
Definition: SUMOXMLDefinitions.h:44
MSEdge.h
GLO_VEHICLE
Definition: GUIGlObjectTypes.h:142
libsumo::INVALID_INT_VALUE
TRACI_CONST int INVALID_INT_VALUE
Definition: TraCIConstants.h:365
libsumo::Helper::makeTraCIPosition
static TraCIPosition makeTraCIPosition(const Position &position, const bool includeZ=false)
Definition: Helper.cpp:264
MSVehicle::getHarmonoise_NoiseEmissions
double getHarmonoise_NoiseEmissions() const
Returns noise emissions of the current state.
Definition: MSVehicle.cpp:5142
libsumo::TraCIColor
A color.
Definition: TraCIDefs.h:136
MSVehicleType::setMinGap
void setMinGap(const double &minGap)
Set a new value for this type's minimum gap.
Definition: MSVehicleType.cpp:112
libsumo::VAR_NOISEEMISSION
TRACI_CONST int VAR_NOISEEMISSION
Definition: TraCIConstants.h:800
MSAbstractLaneChangeModel::getLeaders
const std::shared_ptr< MSLeaderDistanceInfo > getLeaders(const int dir)
Returns the neighboring, lc-relevant leaders for the last step in the requested direction.
Definition: MSAbstractLaneChangeModel.cpp:229
MSInsertionControl.h
MSVehicleType::setWidth
void setWidth(const double &width)
Set a new value for this type's width.
Definition: MSVehicleType.cpp:252
libsumo::VAR_LEADER
TRACI_CONST int VAR_LEADER
Definition: TraCIConstants.h:817
PollutantsInterface::getName
static std::string getName(const SUMOEmissionClass c)
Checks whether the string describes a known vehicle class.
Definition: PollutantsInterface.cpp:100
MSVehicleControl::scheduleVehicleRemoval
void scheduleVehicleRemoval(SUMOVehicle *veh, bool checkDuplicate=false)
Removes a vehicle after it has ended.
Definition: MSVehicleControl.cpp:115
MSLane::forceVehicleInsertion
void forceVehicleInsertion(MSVehicle *veh, double pos, MSMoveReminder::Notification notification, double posLat=0)
Inserts the given vehicle at the given position.
Definition: MSLane.cpp:1013
libsumo::VAR_ROUTE_ID
TRACI_CONST int VAR_ROUTE_ID
Definition: TraCIConstants.h:682
libsumo::Vehicle::deactivateGapControl
static void deactivateGapControl(const std::string &vehicleID)
Definition: Vehicle.cpp:1224
PositionVector
A list of positions.
Definition: PositionVector.h:46
libsumo::TraCIRoadPosition::edgeID
std::string edgeID
Definition: TraCIDefs.h:128
Vehicle.h
MSVehicleType::getPersonCapacity
int getPersonCapacity() const
Get this vehicle type's person capacity.
Definition: MSVehicleType.h:285
MSMoveReminder::NOTIFICATION_TELEPORT_ARRIVED
The vehicle was teleported out of the net.
Definition: MSMoveReminder.h:109
libsumo::TraCINextTLSData::dist
double dist
The distance to the tls.
Definition: TraCIDefs.h:307
MSVehicle::getNextStop
Stop & getNextStop()
Definition: MSVehicle.cpp:5807
getVehicleShapeName
std::string getVehicleShapeName(SUMOVehicleShape id)
Returns the class name of the shape class given by its id.
Definition: SUMOVehicleClass.cpp:359
SUMOVehicleParameter::parseArrivalPos
static bool parseArrivalPos(const std::string &val, const std::string &element, const std::string &id, double &pos, ArrivalPosDefinition &apd, std::string &error)
Validates a given arrivalPos value.
Definition: SUMOVehicleParameter.cpp:421
MSVehicleType::getMinGapLat
double getMinGapLat() const
Get the minimum lateral gap that vehicles of this type maintain.
Definition: MSVehicleType.h:133
libsumo::TraCIColor::b
int b
Definition: TraCIDefs.h:144
MSVehicle::getCarFollowModel
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
Definition: MSVehicle.h:894
SUMOVehicleParameter::Stop::triggered
bool triggered
whether an arriving person lets the vehicle continue
Definition: SUMOVehicleParameter.h:607
MSVehicle::getSlope
double getSlope() const
Returns the slope of the road at vehicle's position.
Definition: MSVehicle.cpp:1269
libsumo::TraCINextStopData::stoppingPlaceID
std::string stoppingPlaceID
Id assigned to the stop.
Definition: TraCIDefs.h:319
MSRoute
Definition: MSRoute.h:67
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:42
MSVehicleControl::constVehIt
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
Definition: MSVehicleControl.h:75
SUMOVehicleParameter::depart
SUMOTime depart
Definition: SUMOVehicleParameter.h:476
MSEdgeWeightsStorage::addEffort
void addEffort(const MSEdge *const e, double begin, double end, double value)
Adds an effort information for an edge and a time span.
Definition: MSEdgeWeightsStorage.cpp:83
MSDevice.h
libsumo::VariableWrapper::wrapColor
virtual bool wrapColor(const std::string &objID, const int variable, const TraCIColor &value)=0
libsumo::Vehicle::getBestLanes
static std::vector< TraCIBestLanesData > getBestLanes(const std::string &vehicleID)
Definition: Vehicle.cpp:348
Parameterised::getParameter
const std::string getParameter(const std::string &key, const std::string &defaultValue="") const
Returns the value for a given key.
Definition: Parameterised.cpp:71
MSGlobals::gLateralResolution
static double gLateralResolution
Definition: MSGlobals.h:85
MSVehicle.h
SumoVehicleClassStrings
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
MSMoveReminder::NOTIFICATION_VAPORIZED
The vehicle got vaporized.
Definition: MSMoveReminder.h:107
MSBaseVehicle::getChosenSpeedFactor
double getChosenSpeedFactor() const
Returns the precomputed factor by which the driver wants to be faster than the speed limit.
Definition: MSBaseVehicle.h:410
MSVehicleType.h
libsumo::TraCIBestLanesData::allowsContinuation
bool allowsContinuation
Whether this lane allows continuing the route.
Definition: TraCIDefs.h:339
libsumo::REMOVE_TELEPORT
TRACI_CONST int REMOVE_TELEPORT
Definition: TraCIConstants.h:383
libsumo
Definition: Edge.cpp:30
MSVehicle::getLateralPositionOnLane
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
Definition: MSVehicle.h:434
libsumo::Vehicle::getLateralLanePosition
static double getLateralLanePosition(const std::string &vehicleID)
Definition: Vehicle.cpp:210
libsumo::Vehicle::getLastActionTime
static double getLastActionTime(const std::string &vehicleID)
Definition: Vehicle.cpp:759
MSBaseVehicle::getEdge
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
Definition: MSBaseVehicle.cpp:170
GeomHelper::makeRing
static PositionVector makeRing(const double radius1, const double radius2, const Position &center, unsigned int nPoints)
Definition: GeomHelper.cpp:255
MSVehicleType::getHeight
double getHeight() const
Get the height which vehicles of this class shall have when being drawn.
Definition: MSVehicleType.h:254
MSVehicle::Influencer::getRouterTT
SUMOAbstractRouter< MSEdge, SUMOVehicle > & getRouterTT() const
Definition: MSVehicle.cpp:896
libsumo::Vehicle::getDrivingDistance
static double getDrivingDistance(const std::string &vehicleID, const std::string &edgeID, double position, int laneIndex=0)
Definition: Vehicle.cpp:519
MSEdge::isInternal
bool isInternal() const
return whether this edge is an internal edge
Definition: MSEdge.h:233
MSTrafficLightLogic.h
MSVehicle::switchOffSignal
void switchOffSignal(int signal)
Switches the given signal off.
Definition: MSVehicle.h:1241
MSVehicle::switchOnSignal
void switchOnSignal(int signal)
Switches the given signal on.
Definition: MSVehicle.h:1233
MSVehicle::getPosition
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:1280
libsumo::VAR_NOXEMISSION
TRACI_CONST int VAR_NOXEMISSION
Definition: TraCIConstants.h:794
libsumo::Route::add
static void add(const std::string &routeID, const std::vector< std::string > &edgeIDs)
Definition: Route.cpp:85
SUMOVehicleParameter::line
std::string line
The vehicle's line (mainly for public transport)
Definition: SUMOVehicleParameter.h:555
MSVehicleControl::buildVehicle
virtual SUMOVehicle * buildVehicle(SUMOVehicleParameter *defs, const MSRoute *route, MSVehicleType *type, const bool ignoreStopErrors, const bool fromRouteFile=true)
Builds a vehicle, increases the number of built vehicles.
Definition: MSVehicleControl.cpp:103
libsumo::Vehicle::changeSublane
static void changeSublane(const std::string &vehicleID, double latDist)
Definition: Vehicle.cpp:971
MSEdgeWeightsStorage::knowsTravelTime
bool knowsTravelTime(const MSEdge *const e) const
Returns the information whether any travel time is known for the given edge.
Definition: MSEdgeWeightsStorage.cpp:114
libsumo::Vehicle::setSignals
static void setSignals(const std::string &vehicleID, int signals)
Definition: Vehicle.cpp:1385
StringTokenizer::get
std::string get(int pos) const
returns the item at the given position
Definition: StringTokenizer.cpp:125
MSVehicle::Influencer::getSpeedMode
int getSpeedMode() const
return the current speed mode
Definition: MSVehicle.cpp:427
libsumo::TraCIBestLanesData
Definition: TraCIDefs.h:329
libsumo::Vehicle::getVia
static std::vector< std::string > getVia(const std::string &vehicleID)
Definition: Vehicle.cpp:593
libsumo::VAR_STOPSTATE
TRACI_CONST int VAR_STOPSTATE
Definition: TraCIConstants.h:749
MSEdgeWeightsStorage::retrieveExistingTravelTime
bool retrieveExistingTravelTime(const MSEdge *const e, const double t, double &value) const
Returns a travel time for an edge and time if stored.
Definition: MSEdgeWeightsStorage.cpp:40
libsumo::VariableWrapper::wrapDouble
virtual bool wrapDouble(const std::string &objID, const int variable, const double value)=0
MSVehicleControl::addVehicle
virtual bool addVehicle(const std::string &id, SUMOVehicle *v)
Tries to insert the vehicle into the internal vehicle container.
Definition: MSVehicleControl.cpp:210
libsumo::TraCINextTLSData::state
char state
The current state of the tls.
Definition: TraCIDefs.h:309
MSBaseVehicle::createDevice
void createDevice(const std::string &deviceName)
create device of the given type
Definition: MSBaseVehicle.cpp:650
LCA_BLOCKED_BY_LEFT_LEADER
Definition: SUMOXMLDefinitions.h:1243
MSVehicle::getPMxEmissions
double getPMxEmissions() const
Returns PMx emission of the current state.
Definition: MSVehicle.cpp:5124
SIMTIME
#define SIMTIME
Definition: SUMOTime.h:64
MSBaseVehicle::getDepartPos
double getDepartPos() const
Returns this vehicle's real departure position.
Definition: MSBaseVehicle.h:269
libsumo::Vehicle::getPosition3D
static TraCIPosition getPosition3D(const std::string &vehicleID)
Definition: Vehicle.cpp:139
Distribution_Parameterized::getParameter
std::vector< double > & getParameter()
Returns the parameters of this distribution.
Definition: Distribution_Parameterized.cpp:111
libsumo::Vehicle::getIDCount
static int getIDCount()
Definition: Vehicle.cpp:96
MSVehicleControl::getVehicle
SUMOVehicle * getVehicle(const std::string &id) const
Returns the vehicle with the given id.
Definition: MSVehicleControl.cpp:235
MSBaseVehicle::getDeviceParameter
std::string getDeviceParameter(const std::string &deviceName, const std::string &key) const
try to retrieve the given parameter from any of the vehicles devices, raise InvalidArgument if no dev...
Definition: MSBaseVehicle.cpp:669
libsumo::TraCIBestLanesData::occupation
double occupation
The traffic density along length.
Definition: TraCIDefs.h:335
libsumo::VAR_ACCUMULATED_WAITING_TIME
TRACI_CONST int VAR_ACCUMULATED_WAITING_TIME
Definition: TraCIConstants.h:826
libsumo::TraCINextStopData::endPos
double endPos
The stopping position end.
Definition: TraCIDefs.h:317
MSVehicle::getPositionOnLane
double getPositionOnLane() const
Get the vehicle's position along the lane.
Definition: MSVehicle.h:397
libsumo::Vehicle::rerouteParkingArea
static void rerouteParkingArea(const std::string &vehicleID, const std::string &parkingAreaID)
Definition: Vehicle.cpp:898
MSVehicle::getLeader
std::pair< const MSVehicle *const, double > getLeader(double dist=0) const
Returns the leader of the vehicle looking for a fixed distance.
Definition: MSVehicle.cpp:5059
libsumo::Vehicle::setParameter
static void setParameter(const std::string &vehicleID, const std::string &key, const std::string &value)
Definition: Vehicle.cpp:1628
TraCIConstants.h
StringUtils::endsWith
static bool endsWith(const std::string &str, const std::string suffix)
Checks whether a given string ends with the suffix.
Definition: StringUtils.cpp:148
MSCFModel::setParameter
virtual void setParameter(MSVehicle *veh, const std::string &key, const std::string &value) const
try to set the given parameter for this carFollowingModel
Definition: MSCFModel.h:585
SUMO_TAG_CHARGING_STATION
A Charging Station.
Definition: SUMOXMLDefinitions.h:112
MSVehicleType::getCarFollowModel
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
Definition: MSVehicleType.h:141
MSEdgeWeightsStorage.h
libsumo::VAR_ROUTE_VALID
TRACI_CONST int VAR_ROUTE_VALID
Definition: TraCIConstants.h:965
SUMOVehicleParameter::arrivalLaneProcedure
ArrivalLaneDefinition arrivalLaneProcedure
Information how the vehicle shall choose the lane to arrive on.
Definition: SUMOVehicleParameter.h:513
libsumo::VAR_ANGLE
TRACI_CONST int VAR_ANGLE
Definition: TraCIConstants.h:622
libsumo::Vehicle::getLateralSpeed
static double getLateralSpeed(const std::string &vehicleID)
Definition: Vehicle.cpp:108
MSVehicleType::getWidth
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
Definition: MSVehicleType.h:247
PollutantsInterface.h
libsumo::Vehicle::requestToC
static void requestToC(const std::string &vehID, double leadTime)
Definition: Vehicle.cpp:1232
TIME2STEPS
#define TIME2STEPS(x)
Definition: SUMOTime.h:59
MSBaseVehicle::setChosenSpeedFactor
void setChosenSpeedFactor(const double factor)
Returns the precomputed factor by which the driver wants to be faster than the speed limit.
Definition: MSBaseVehicle.h:417
libsumo::TraCIBestLanesData::length
double length
The length than can be driven from that lane without lane change.
Definition: TraCIDefs.h:333
libsumo::Vehicle::setRoute
static void setRoute(const std::string &vehicleID, const std::vector< std::string > &edgeIDs)
Definition: Vehicle.cpp:1292
libsumo::Vehicle::getCOEmission
static double getCOEmission(const std::string &vehicleID)
Definition: Vehicle.cpp:222
GeomHelper::INVALID_OFFSET
static const double INVALID_OFFSET
a value to signify offsets outside the range of [0, Line.length()]
Definition: GeomHelper.h:52
MSVehicle::getCOEmissions
double getCOEmissions() const
Returns CO emission of the current state.
Definition: MSVehicle.cpp:5106
libsumo::VariableWrapper::wrapStringList
virtual bool wrapStringList(const std::string &objID, const int variable, const std::vector< std::string > &value)=0
libsumo::Polygon::addHighlightPolygon
static LIBSUMO_SUBSCRIPTION_API void addHighlightPolygon(const std::string &objectID, const int type, const std::string &polygonID, const TraCIPositionVector &shape, const TraCIColor &color, bool fill, const std::string &polygonType, int layer, double lineWidth)
Definition: Polygon.cpp:133
libsumo::Vehicle::getIDList
static std::vector< std::string > getIDList()
Definition: Vehicle.cpp:84
VEHPARS_COLOR_SET
const int VEHPARS_COLOR_SET
Definition: SUMOVehicleParameter.h:46
SUMOVehicleParameter::parseArrivalLane
static bool parseArrivalLane(const std::string &val, const std::string &element, const std::string &id, int &lane, ArrivalLaneDefinition &ald, std::string &error)
Validates a given arrivalLane value.
Definition: SUMOVehicleParameter.cpp:392
libsumo::REMOVE_VAPORIZED
TRACI_CONST int REMOVE_VAPORIZED
Definition: TraCIConstants.h:389
LCA_BLOCKED_BY_RIGHT_FOLLOWER
The vehicle is blocked by right follower.
Definition: SUMOXMLDefinitions.h:1249
MSNet::getCurrentTimeStep
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:284
StringTokenizer
Definition: StringTokenizer.h:62
libsumo::Vehicle::isOnInit
static bool isOnInit(const std::string &vehicleID)
Definition: Vehicle.cpp:77
MSEdge::dictionary
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn't already in the dictionary....
Definition: MSEdge.cpp:804
MSVehicleControl::loadedVehEnd
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
Definition: MSVehicleControl.h:186
libsumo::Vehicle::getRoutingMode
static int getRoutingMode(const std::string &vehicleID)
Definition: Vehicle.cpp:581
STEPS2TIME
#define STEPS2TIME(x)
Definition: SUMOTime.h:57
SUMOVehicle::getLane
virtual MSLane * getLane() const =0
Returns the lane the vehicle is on.
MSVehicle::Influencer::setSpeedTimeLine
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, double > > &speedTimeLine)
Sets a new velocity timeline.
Definition: MSVehicle.cpp:387
libsumo::VAR_SLOPE
TRACI_CONST int VAR_SLOPE
Definition: TraCIConstants.h:604
SUMOVehicleParameter::id
std::string id
The vehicle's id.
Definition: SUMOVehicleParameter.h:462
libsumo::VAR_PMXEMISSION
TRACI_CONST int VAR_PMXEMISSION
Definition: TraCIConstants.h:791
SUMO_TAG_PARKING_AREA
A parking area.
Definition: SUMOXMLDefinitions.h:108
MSLane::getLength
double getLength() const
Returns the lane's length.
Definition: MSLane.h:541
libsumo::Vehicle::getParameter
static std::string getParameter(const std::string &vehicleID, const std::string &key)
Definition: Vehicle.cpp:610
libsumo::Vehicle::updateBestLanes
static void updateBestLanes(const std::string &vehicleID)
Definition: Vehicle.cpp:1309
MSAbstractLaneChangeModel::getParameter
virtual std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this laneChangeModel. Throw exception for unsupported key
Definition: MSAbstractLaneChangeModel.h:583
libsumo::VAR_LASTACTIONTIME
TRACI_CONST int VAR_LASTACTIONTIME
Definition: TraCIConstants.h:646
MSVehicleControl::deleteVehicle
virtual void deleteVehicle(SUMOVehicle *v, bool discard=false)
Deletes the vehicle.
Definition: MSVehicleControl.cpp:245
SUMOVehicleParameter::arrivalPos
double arrivalPos
(optional) The position the vehicle shall arrive on
Definition: SUMOVehicleParameter.h:516
SUMOVehicleParameter::fromTaz
std::string fromTaz
The vehicle's origin zone (district)
Definition: SUMOVehicleParameter.h:558
MSVehicle::Influencer::setSublaneChange
void setSublaneChange(double latDist)
Sets a new sublane-change request.
Definition: MSVehicle.cpp:422
libsumo::Helper::moveToXYMap_matchingRoutePosition
static bool moveToXYMap_matchingRoutePosition(const Position &pos, const std::string &origID, const ConstMSEdgeVector &currentRoute, int routeIndex, SUMOVehicleClass vClass, double &bestDistance, MSLane **lane, double &lanePos, int &routeOffset)
Definition: Helper.cpp:1045
ProcessError
Definition: UtilExceptions.h:40
libsumo::REMOVE_ARRIVED
TRACI_CONST int REMOVE_ARRIVED
Definition: TraCIConstants.h:387
MSVehicle::getLaneChangeModel
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:4609
SUMOVehicleParameter::arrivalPosProcedure
ArrivalPosDefinition arrivalPosProcedure
Information how the vehicle shall choose the arrival position.
Definition: SUMOVehicleParameter.h:519
MSVehicle::getAngle
double getAngle() const
Returns the vehicle's direction in radians.
Definition: MSVehicle.h:681
Helper.h
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
libsumo::Vehicle::getPersonIDList
static std::vector< std::string > getPersonIDList(const std::string &vehicleID)
Definition: Vehicle.cpp:274
MSVehicle::LaneQ::lane
MSLane * lane
The described lane.
Definition: MSVehicle.h:813
MSVehicle::Influencer::setRoutingMode
void setRoutingMode(int value)
Sets routing behavior.
Definition: MSVehicle.h:1554
MSVehicle::getHCEmissions
double getHCEmissions() const
Returns HC emission of the current state.
Definition: MSVehicle.cpp:5112
MSVehicle::Stop::containerstop
MSStoppingPlace * containerstop
(Optional) container stop if one is assigned to the stop
Definition: MSVehicle.h:931
libsumo::Helper::makeTraCIPositionVector
static TraCIPositionVector makeTraCIPositionVector(const PositionVector &positionVector)
helper functions
Definition: Helper.cpp:224
libsumo::TRACI_ID_LIST
TRACI_CONST int TRACI_ID_LIST
Definition: TraCIConstants.h:496
SUMOVehicleParameter::parseArrivalSpeed
static bool parseArrivalSpeed(const std::string &val, const std::string &element, const std::string &id, double &speed, ArrivalSpeedDefinition &asd, std::string &error)
Validates a given arrivalSpeed value.
Definition: SUMOVehicleParameter.cpp:481
MSVehicleType::setLength
void setLength(const double &length)
Set a new value for this type's length.
Definition: MSVehicleType.cpp:90
Position::sub
void sub(double dx, double dy)
Substracts the given position from this one.
Definition: Position.h:147
libsumo::Vehicle::getAcceleration
static double getAcceleration(const std::string &vehicleID)
Definition: Vehicle.cpp:115
SUMOVehicleParameter::parseDepart
static bool parseDepart(const std::string &val, const std::string &element, const std::string &id, SUMOTime &depart, DepartDefinition &dd, std::string &error)
Validates a given depart value.
Definition: SUMOVehicleParameter.cpp:219
MSLane::getNextNormal
const MSEdge * getNextNormal() const
Returns the lane's follower if it is an internal lane, the edge of the lane otherwise.
Definition: MSLane.cpp:1827
MSVehicleType::getMinGap
double getMinGap() const
Get the free space in front of vehicles of this class.
Definition: MSVehicleType.h:126
MSVehicle::getSignals
int getSignals() const
Returns the signals.
Definition: MSVehicle.h:1249
MSLane::removeVehicle
virtual MSVehicle * removeVehicle(MSVehicle *remVehicle, MSMoveReminder::Notification notification, bool notify=true)
Definition: MSLane.cpp:2169
libsumo::TraCIColor::r
int r
Definition: TraCIDefs.h:144
MSEdge
A road/street connecting two junctions.
Definition: MSEdge.h:76
libsumo::TraCIBestLanesData::laneID
std::string laneID
The id of the lane.
Definition: TraCIDefs.h:331
libsumo::Vehicle::getSpeed
static double getSpeed(const std::string &vehicleID)
Definition: Vehicle.cpp:102
DEBUG_COND
#define DEBUG_COND
Definition: Vehicle.cpp:55
Route.h
MSVehicle::Stop::edge
MSRouteIterator edge
The edge in the route to stop at.
Definition: MSVehicle.h:925
MSVehicle::LaneQ::allowsContinuation
bool allowsContinuation
Whether this lane allows to continue the drive.
Definition: MSVehicle.h:825
LIBSUMO_SUBSCRIPTION_IMPLEMENTATION
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
Definition: TraCIDefs.h:51
MSVehicle::getRerouteOrigin
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
Definition: MSVehicle.cpp:1397
libsumo::Vehicle::remove
static void remove(const std::string &vehicleID, char reason=REMOVE_VAPORIZED)
Definition: Vehicle.cpp:1452
MSEdgeWeightsStorage::removeEffort
void removeEffort(const MSEdge *const e)
Removes the effort information for an edge.
Definition: MSEdgeWeightsStorage.cpp:105
MSVehicle::getNOxEmissions
double getNOxEmissions() const
Returns NOx emission of the current state.
Definition: MSVehicle.cpp:5118
MSEdgeWeightsStorage::retrieveExistingEffort
bool retrieveExistingEffort(const MSEdge *const e, const double t, double &value) const
Returns an effort for an edge and time if stored.
Definition: MSEdgeWeightsStorage.cpp:55
MSInsertionControl::add
void add(SUMOVehicle *veh)
Adds a single vehicle for departure.
Definition: MSInsertionControl.cpp:71
StringUtils::startsWith
static bool startsWith(const std::string &str, const std::string prefix)
Checks whether a given string starts with the prefix.
Definition: StringUtils.cpp:142
MSGlobals::gCheckRoutes
static bool gCheckRoutes
Definition: MSGlobals.h:79
libsumo::ID_COUNT
TRACI_CONST int ID_COUNT
Definition: TraCIConstants.h:499
MSBaseVehicle::getVehicleType
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
Definition: MSBaseVehicle.h:118
MSParkingArea.h
EDGEFUNC_NORMAL
Definition: SUMOXMLDefinitions.h:1076
libsumo::VAR_SPEED_FACTOR
TRACI_CONST int VAR_SPEED_FACTOR
Definition: TraCIConstants.h:727
MSMoveReminder::NOTIFICATION_DEPARTED
The vehicle has departed (was inserted into the network)
Definition: MSMoveReminder.h:91
MSEdge::allowedLanes
const std::vector< MSLane * > * allowedLanes(const MSEdge &destination, SUMOVehicleClass vclass=SVC_IGNORING) const
Get the allowed lanes to reach the destination-edge.
Definition: MSEdge.cpp:398
libsumo::VAR_LINE
TRACI_CONST int VAR_LINE
Definition: TraCIConstants.h:773
MSVehicle::getAccumulatedWaitingSeconds
double getAccumulatedWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s) within the last millisecs.
Definition: MSVehicle.h:667
SUMOVehicleParameter::arrivalLane
int arrivalLane
Definition: SUMOVehicleParameter.h:510
libsumo::Vehicle::getTypeID
static std::string getTypeID(const std::string &vehicleID)
Definition: Vehicle.cpp:180
MSVehicle::getLaneIndex
int getLaneIndex() const
Definition: MSVehicle.cpp:5233
StringTokenizer::size
int size() const
returns the number of existing substrings
Definition: StringTokenizer.cpp:138
libsumo::Vehicle::changeLane
static void changeLane(const std::string &vehicleID, int laneIndex, double duration)
Definition: Vehicle.cpp:953
MSBaseVehicle::replaceRouteEdges
bool replaceRouteEdges(ConstMSEdgeVector &edges, double cost, double savings, const std::string &info, bool onInit=false, bool check=false, bool removeStops=true)
Replaces the current route by the given edges.
Definition: MSBaseVehicle.cpp:292
libsumo::TraCIException
Definition: TraCIDefs.h:90
MSVehicleType::getSpeedFactor
const Distribution_Parameterized & getSpeedFactor() const
Returns this type's speed factor.
Definition: MSVehicleType.h:210
MSVehicle::Influencer::getRoutingMode
int getRoutingMode() const
return the current routing mode
Definition: MSVehicle.h:1469
libsumo::VAR_DISTANCE
TRACI_CONST int VAR_DISTANCE
Definition: TraCIConstants.h:947
MSAbstractLaneChangeModel::setParameter
virtual void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this laneChangeModel. Throw exception for unsupported key
Definition: MSAbstractLaneChangeModel.h:588
libsumo::Vehicle::slowDown
static void slowDown(const std::string &vehicleID, double speed, double duration)
Definition: Vehicle.cpp:1197
libsumo::Vehicle::getLine
static std::string getLine(const std::string &vehicleID)
Definition: Vehicle.cpp:587
MSVehicleType::setShape
void setShape(SUMOVehicleShape shape)
Set a new value for this type's shape.
Definition: MSVehicleType.cpp:273
MSVehicle::Stop::pars
const SUMOVehicleParameter::Stop pars
The stop parameter.
Definition: MSVehicle.h:937
libsumo::Vehicle::changeTarget
static void changeTarget(const std::string &vehicleID, const std::string &edgeID)
Definition: Vehicle.cpp:927
libsumo::VAR_EDGES
TRACI_CONST int VAR_EDGES
Definition: TraCIConstants.h:685
MSVehicle::Stop
Definition of vehicle stop (position and duration)
Definition: MSVehicle.h:921
SUMOVehicleParameter::Stop::startPos
double startPos
The stopping position start.
Definition: SUMOVehicleParameter.h:595
MSVehicle::getLane
MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:561
BoolFormatException
Definition: UtilExceptions.h:109
MSCFModel::getParameter
virtual std::string getParameter(const MSVehicle *veh, const std::string &key) const
try to get the given parameter for this carFollowingModel
Definition: MSCFModel.h:572
PositionVector::distance2D
double distance2D(const Position &p, bool perpendicular=false) const
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector)
Definition: PositionVector.cpp:1242
libsumo::Vehicle::getAllowedSpeed
static double getAllowedSpeed(const std::string &vehicleID)
Definition: Vehicle.cpp:552
libsumo::TraCINextStopData
Definition: TraCIDefs.h:313
libsumo::Vehicle::getNextStops
static std::vector< TraCINextStopData > getNextStops(const std::string &vehicleID)
Definition: Vehicle.cpp:433
MSVehicleType::setMaxSpeedLat
void setMaxSpeedLat(const double &maxSpeedLat)
Set a new value for this type's maximum lateral speed.
Definition: MSVehicleType.cpp:145
Position::angleTo2D
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position
Definition: Position.h:254
MSLane::getEdge
MSEdge & getEdge() const
Returns the lane's edge.
Definition: MSLane.h:670
libsumo::Vehicle::setLine
static void setLine(const std::string &vehicleID, const std::string &line)
Definition: Vehicle.cpp:1506
Position::distanceTo2D
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:244
PollutantsInterface::getClassByName
static SUMOEmissionClass getClassByName(const std::string &eClass, const SUMOVehicleClass vc=SVC_IGNORING)
Checks whether the string describes a known vehicle class.
Definition: PollutantsInterface.cpp:54
Polygon.h
libsumo::TraCINextTLSData::id
std::string id
The id of the next tls.
Definition: TraCIDefs.h:303
libsumo::Vehicle::getRouteIndex
static int getRouteIndex(const std::string &vehicleID)
Definition: Vehicle.cpp:192
SUMOVehicleParameter::departLane
int departLane
(optional) The lane the vehicle shall depart from (index in edge)
Definition: SUMOVehicleParameter.h:482
MSEdgeWeightsStorage::addTravelTime
void addTravelTime(const MSEdge *const e, double begin, double end, double value)
Adds a travel time information for an edge and a time span.
Definition: MSEdgeWeightsStorage.cpp:70
MSVehicle::Stop::chargingStation
MSStoppingPlace * chargingStation
(Optional) charging station if one is assigned to the stop
Definition: MSVehicle.h:935
libsumo::VAR_TYPE
TRACI_CONST int VAR_TYPE
Definition: TraCIConstants.h:670
MSVehicle::getInfluencer
Influencer & getInfluencer()
Returns the velocity/lane influencer.
Definition: MSVehicle.cpp:5817
libsumo::REMOVE_TELEPORT_ARRIVED
TRACI_CONST int REMOVE_TELEPORT_ARRIVED
Definition: TraCIConstants.h:391
libsumo::Vehicle::rerouteTraveltime
static void rerouteTraveltime(const std::string &vehicleID, const bool currentTravelTimes=true)
Definition: Vehicle.cpp:1368
toString
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
StringUtils.h
SUMO_TAG_BUS_STOP
A bus stop.
Definition: SUMOXMLDefinitions.h:98
libsumo::Vehicle::rerouteEffort
static void rerouteEffort(const std::string &vehicleID)
Definition: Vehicle.cpp:1377
MSLane::getShape
const PositionVector & getShape() const
Returns this lane's shape.
Definition: MSLane.h:478
MSVehicle::getWeightsStorage
const MSEdgeWeightsStorage & getWeightsStorage() const
Returns the vehicle's internal edge travel times/efforts container.
Definition: MSVehicle.cpp:1196
SUMOVehicleParameter::departLaneProcedure
DepartLaneDefinition departLaneProcedure
Information how the vehicle shall choose the lane to depart from.
Definition: SUMOVehicleParameter.h:485
libsumo::VAR_CO2EMISSION
TRACI_CONST int VAR_CO2EMISSION
Definition: TraCIConstants.h:782
SUMOVehicleParameter::Stop::containerTriggered
bool containerTriggered
whether an arriving container lets the vehicle continue
Definition: SUMOVehicleParameter.h:610
libsumo::Vehicle::isVisible
static bool isVisible(const SUMOVehicle *veh)
Definition: Vehicle.cpp:71
MSVehicle::LaneQ::bestContinuations
std::vector< MSLane * > bestContinuations
Definition: MSVehicle.h:831
MSBaseVehicle::getPersonIDList
std::vector< std::string > getPersonIDList() const
Returns the list of persons.
Definition: MSBaseVehicle.cpp:589
libsumo::Vehicle::setSpeedMode
static void setSpeedMode(const std::string &vehicleID, int speedMode)
Definition: Vehicle.cpp:1248
MSNet::getInstance
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:168
libsumo::Polygon::exists
static bool exists(std::string polyID)
Checks if a polygon of the given name exists already in the simulation.
Definition: Polygon.cpp:295
libsumo::VAR_LANEPOSITION_LAT
TRACI_CONST int VAR_LANEPOSITION_LAT
Definition: TraCIConstants.h:758
SUMOVehicleParameter::via
std::vector< std::string > via
List of the via-edges the vehicle must visit.
Definition: SUMOVehicleParameter.h:641
MSCFModel::getHeadwayTime
virtual double getHeadwayTime() const
Get the driver's desired headway [s].
Definition: MSCFModel.h:259
MSMoveReminder::NOTIFICATION_ARRIVED
The vehicle arrived at its destination (is deleted)
Definition: MSMoveReminder.h:105
libsumo::VAR_LANECHANGE_MODE
TRACI_CONST int VAR_LANECHANGE_MODE
Definition: TraCIConstants.h:752
libsumo::LAST_STEP_PERSON_ID_LIST
TRACI_CONST int LAST_STEP_PERSON_ID_LIST
Definition: TraCIConstants.h:541
MSVehicleType::getActionStepLengthSecs
double getActionStepLengthSecs() const
Returns this type's default action step length in seconds.
Definition: MSVehicleType.h:226
MSBaseVehicle::hasDevice
bool hasDevice(const std::string &deviceName) const
check whether the vehicle is equiped with a device of the given type
Definition: MSBaseVehicle.cpp:639
MSVehicle::resetRoutePosition
void resetRoutePosition(int index, DepartLaneDefinition departLaneProcedure)
Definition: MSVehicle.cpp:1186
libsumo::Vehicle::storeShape
static void storeShape(const std::string &id, PositionVector &shape)
Saves the shape of the requested object in the given container.
Definition: Vehicle.cpp:1747
libsumo::Vehicle::getDrivingDistance2D
static double getDrivingDistance2D(const std::string &vehicleID, double x, double y)
Definition: Vehicle.cpp:535
PositionVector::rotationAtOffset
double rotationAtOffset(double pos) const
Returns the rotation at the given length.
Definition: PositionVector.cpp:286
libsumo::Vehicle::subscribeLeader
LIBSUMO_VEHICLE_TYPE_SETTER static LIBSUMO_SUBSCRIPTION_API void subscribeLeader(const std::string &vehicleID, double dist=0., double beginTime=libsumo::INVALID_DOUBLE_VALUE, double endTime=libsumo::INVALID_DOUBLE_VALUE)
Definition: Vehicle.cpp:1740
libsumo::Helper::setRemoteControlled
static void setRemoteControlled(MSVehicle *v, Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, ConstMSEdgeVector route, SUMOTime t)
Definition: Helper.cpp:786
MSVehicle::addTraciStop
bool addTraciStop(MSLane *const lane, const double startPos, const double endPos, const SUMOTime duration, const SUMOTime until, const bool parking, const bool triggered, const bool containerTriggered, std::string &errorMsg)
Definition: MSVehicle.cpp:5623
MSVehicleType::getLength
double getLength() const
Get vehicle's length [m].
Definition: MSVehicleType.h:110
InvalidArgument
Definition: UtilExceptions.h:57
MSVehicle::Influencer::setLaneChangeMode
void setLaneChangeMode(int value)
Sets lane changing behavior.
Definition: MSVehicle.cpp:768
MSVehicle::getElectricityConsumption
double getElectricityConsumption() const
Returns electricity consumption of the current state.
Definition: MSVehicle.cpp:5136
libsumo::Vehicle::getNoiseEmission
static double getNoiseEmission(const std::string &vehicleID)
Definition: Vehicle.cpp:252
libsumo::VAR_SPEED_LAT
TRACI_CONST int VAR_SPEED_LAT
Definition: TraCIConstants.h:610
MSVehicleType::setApparentDecel
void setApparentDecel(double apparentDecel)
Set a new value for this type's apparent deceleration.
Definition: MSVehicleType.cpp:417
libsumo::Vehicle::setEffort
static void setEffort(const std::string &vehicleID, const std::string &edgeID, double effort=INVALID_DOUBLE_VALUE, double begSeconds=0, double endSeconds=std::numeric_limits< double >::max())
Definition: Vehicle.cpp:1342
MSVehicle::getRoutePosition
int getRoutePosition() const
Definition: MSVehicle.cpp:1180
libsumo::Vehicle::getAdaptedTraveltime
static double getAdaptedTraveltime(const std::string &vehicleID, double time, const std::string &edgeID)
Definition: Vehicle.cpp:305
libsumo::VariableWrapper::wrapInt
virtual bool wrapInt(const std::string &objID, const int variable, const int value)=0
libsumo::Vehicle::getSpeedWithoutTraCI
static double getSpeedWithoutTraCI(const std::string &vehicleID)
Definition: Vehicle.cpp:122
MSVehicle::Influencer::setSignals
void setSignals(int signals)
Definition: MSVehicle.h:1581
MSVehicle::resetActionOffset
void resetActionOffset(const SUMOTime timeUntilNextAction=0)
Resets the action offset for the vehicle.
Definition: MSVehicle.cpp:2110
MSEdgeVector
std::vector< MSEdge * > MSEdgeVector
Definition: MSEdge.h:72
libsumo::VAR_LANEPOSITION
TRACI_CONST int VAR_LANEPOSITION
Definition: TraCIConstants.h:697
MSBaseVehicle::getVClass
SUMOVehicleClass getVClass() const
Returns the vehicle's access class.
Definition: MSBaseVehicle.h:126
libsumo::VAR_POSITION3D
TRACI_CONST int VAR_POSITION3D
Definition: TraCIConstants.h:619
libsumo::VAR_ACCELERATION
TRACI_CONST int VAR_ACCELERATION
Definition: TraCIConstants.h:835
MSBaseVehicle::getSingularType
MSVehicleType & getSingularType()
Replaces the current vehicle type with a new one used by this vehicle only.
Definition: MSBaseVehicle.cpp:702
MSBaseVehicle::getPersonNumber
int getPersonNumber() const
Returns the number of persons.
Definition: MSBaseVehicle.cpp:583
MSBaseVehicle::getCurrentRouteEdge
const MSRouteIterator & getCurrentRouteEdge() const
Returns an iterator pointing to the current edge in this vehicles route.
Definition: MSBaseVehicle.h:200
DEPART_GIVEN
The time is given.
Definition: SUMOVehicleParameter.h:96
MSEdge::parseEdgesList
static void parseEdgesList(const std::string &desc, ConstMSEdgeVector &into, const std::string &rid)
Parses the given string assuming it contains a list of edge ids divided by spaces.
Definition: MSEdge.cpp:861
MSCFModel::getEmergencyDecel
double getEmergencyDecel() const
Get the vehicle type's maximal phisically possible deceleration [m/s^2].
Definition: MSCFModel.h:226
MSVehicle::getBestLanesContinuation
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
Definition: MSVehicle.cpp:4987
MSBaseVehicle::getID
const std::string & getID() const
Returns the name of the vehicle.
Definition: MSBaseVehicle.cpp:137
libsumo::Vehicle::setType
static void setType(const std::string &vehicleID, const std::string &typeID)
Definition: Vehicle.cpp:1263
libsumo::Vehicle::getAngle
static double getAngle(const std::string &vehicleID)
Definition: Vehicle.cpp:145
libsumo::TraCIRoadPosition::pos
double pos
Definition: TraCIDefs.h:129
MSEdge::getLanes
const std::vector< MSLane * > & getLanes() const
Returns this edge's lanes.
Definition: MSEdge.h:165
MSVehicle::Influencer::getLaneChangeMode
int getLaneChangeMode() const
return the current lane change mode
Definition: MSVehicle.cpp:437
MSVehicle::getFuelConsumption
double getFuelConsumption() const
Returns fuel consumption of the current state.
Definition: MSVehicle.cpp:5130
MSVehicleType::getMaxSpeed
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
Definition: MSVehicleType.h:162
MSVehicle::getAcceleration
double getAcceleration() const
Returns the vehicle's acceleration in m/s (this is computed as the last step's mean acceleration in c...
Definition: MSVehicle.h:494
MSRoute::begin
MSRouteIterator begin() const
Returns the begin of the list of edges to pass.
Definition: MSRoute.cpp:70
MSLane::getWidth
double getWidth() const
Returns the lane's width.
Definition: MSLane.h:557
LCA_BLOCKED_BY_RIGHT_LEADER
The vehicle is blocked by right leader.
Definition: SUMOXMLDefinitions.h:1247
libsumo::VAR_ELECTRICITYCONSUMPTION
TRACI_CONST int VAR_ELECTRICITYCONSUMPTION
Definition: TraCIConstants.h:844
MSEdge::getNormalBefore
const MSEdge * getNormalBefore() const
if this edge is an internal edge, return its first normal predecessor, otherwise the edge itself
Definition: MSEdge.cpp:740
libsumo::Vehicle::getNOxEmission
static double getNOxEmission(const std::string &vehicleID)
Definition: Vehicle.cpp:240
getVehicleShapeID
SUMOVehicleShape getVehicleShapeID(const std::string &name)
Returns the class id of the shape class given by its name.
Definition: SUMOVehicleClass.cpp:343
libsumo::TraCINextTLSData
Definition: TraCIDefs.h:301
libsumo::TraCIRoadPosition
An edgeId, position and laneIndex.
Definition: TraCIDefs.h:122
libsumo::Vehicle::getWaitingTime
static double getWaitingTime(const std::string &vehicleID)
Definition: Vehicle.cpp:293
libsumo::Vehicle::getPersonNumber
static int getPersonNumber(const std::string &vehicleID)
Definition: Vehicle.cpp:264
MSRoute::dictionary
static bool dictionary(const std::string &id, const MSRoute *route)
Adds a route to the dictionary.
Definition: MSRoute.cpp:114
config.h
MSVehicleType::setMaxSpeed
void setMaxSpeed(const double &maxSpeed)
Set a new value for this type's maximum speed.
Definition: MSVehicleType.cpp:134
MSVehicleControl
The class responsible for building and deletion of vehicles.
Definition: MSVehicleControl.h:72
Named::getIDSecure
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
Definition: Named.h:70
libsumo::VAR_HCEMISSION
TRACI_CONST int VAR_HCEMISSION
Definition: TraCIConstants.h:788
MSLane::isInternal
bool isInternal() const
Definition: MSLane.cpp:1999
GeomHelper.h
MSVehicle::getSpeed
double getSpeed() const
Returns the vehicle's current speed.
Definition: MSVehicle.h:477
libsumo::Vehicle::getPMxEmission
static double getPMxEmission(const std::string &vehicleID)
Definition: Vehicle.cpp:234
libsumo::Vehicle::getLaneChangeMode
static int getLaneChangeMode(const std::string &vehicleID)
Definition: Vehicle.cpp:575
StringTokenizer.h
MSEdgeWeightsStorage::removeTravelTime
void removeTravelTime(const MSEdge *const e)
Removes the travel time information for an edge.
Definition: MSEdgeWeightsStorage.cpp:96
libsumo::VAR_SPEED
TRACI_CONST int VAR_SPEED
Definition: TraCIConstants.h:607
MSVehicle::setActionStepLength
void setActionStepLength(double actionStepLength, bool resetActionOffset=true)
Sets the action steplength of the vehicle.
Definition: MSVehicle.cpp:1433
MSLane::geometryPositionAtOffset
const Position geometryPositionAtOffset(double offset, double lateralOffset=0) const
Definition: MSLane.h:505
MSVehicle::replaceRoute
bool replaceRoute(const MSRoute *route, const std::string &info, bool onInit=false, int offset=0, bool addStops=true, bool removeStops=true)
Replaces the current route by the given one.
Definition: MSVehicle.cpp:1078
libsumo::Vehicle::setAdaptedTraveltime
static void setAdaptedTraveltime(const std::string &vehicleID, const std::string &edgeID, double time=INVALID_DOUBLE_VALUE, double begSeconds=0, double endSeconds=std::numeric_limits< double >::max())
Definition: Vehicle.cpp:1316
libsumo::TraCIBestLanesData::continuationLanes
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
Definition: TraCIDefs.h:341
libsumo::Vehicle::getLanePosition
static double getLanePosition(const std::string &vehicleID)
Definition: Vehicle.cpp:204
MSVehicle::Influencer::deactivateGapController
void deactivateGapController()
Deactivates the gap control.
Definition: MSVehicle.cpp:401
SUMOVehicleParameter::toTaz
std::string toTaz
The vehicle's destination zone (district)
Definition: SUMOVehicleParameter.h:561
SUMOXMLDefinitions::LateralAlignments
static StringBijection< LateralAlignment > LateralAlignments
lateral alignments
Definition: SUMOXMLDefinitions.h:1396
libsumo::Vehicle::getNeighbors
static std::vector< std::pair< std::string, double > > getNeighbors(const std::string &vehicleID, const int mode)
Definition: Vehicle.cpp:649
SUMOTime_MAX
#define SUMOTime_MAX
Definition: SUMOTime.h:36
MSVehicleControl::loadedVehBegin
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
Definition: MSVehicleControl.h:178
MSLane.h
SUMOVehicleParameter::parseDepartPos
static bool parseDepartPos(const std::string &val, const std::string &element, const std::string &id, double &pos, DepartPosDefinition &dpd, std::string &error)
Validates a given departPos value.
Definition: SUMOVehicleParameter.cpp:287
MSLane::getVehicleMaxSpeed
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
Definition: MSLane.h:519
MSBaseVehicle::reroute
void reroute(SUMOTime t, const std::string &info, SUMOAbstractRouter< MSEdge, SUMOVehicle > &router, const bool onInit=false, const bool withTaz=false, const bool silent=false)
Performs a rerouting using the given router.
Definition: MSBaseVehicle.cpp:176
libsumo::VAR_PERSON_CAPACITY
TRACI_CONST int VAR_PERSON_CAPACITY
Definition: TraCIConstants.h:806
MSVehicleType::getVehicleClass
SUMOVehicleClass getVehicleClass() const
Get this vehicle type's vehicle class.
Definition: MSVehicleType.h:185
libsumo::VariableWrapper::wrapPosition
virtual bool wrapPosition(const std::string &objID, const int variable, const TraCIPosition &value)=0
SVC_IGNORING
vehicles ignoring classes
Definition: SUMOVehicleClass.h:136
MSVehicle::Influencer::setSpeedMode
void setSpeedMode(int speedMode)
Sets speed-constraining behaviors.
Definition: MSVehicle.cpp:758
MSEdge::getAllEdges
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition: MSEdge.cpp:837
MSRoute::getDistanceBetween
double getDistanceBetween(double fromPos, double toPos, const MSEdge *fromEdge, const MSEdge *toEdge, bool includeInternal=true, int routePosition=0) const
Compute the distance between 2 given edges on this route, including the length of internal lanes....
Definition: MSRoute.cpp:277
SUMOVehicleParameter::Stop::parking
bool parking
whether the vehicle is removed from the net while stopping
Definition: SUMOVehicleParameter.h:613
libsumo::Helper::getVehicleType
static const MSVehicleType & getVehicleType(const std::string &vehicleID)
Definition: Helper.cpp:353
libsumo::Vehicle::setRoutingMode
static void setRoutingMode(const std::string &vehicleID, int routingMode)
Definition: Vehicle.cpp:1258
MSVehicleControl.h
Position::setz
void setz(double z)
set position z
Definition: Position.h:82
MSVehicle::LaneQ::nextOccupation
double nextOccupation
As occupation, but without the first lane.
Definition: MSVehicle.h:821
TraCIDefs.h
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:77
MSMoveReminder::Notification
Notification
Definition of a vehicle state.
Definition: MSMoveReminder.h:89
POSITION_EPS
#define POSITION_EPS
Definition: config.h:169
MSVehicle::getCO2Emissions
double getCO2Emissions() const
Returns CO2 emission of the current state.
Definition: MSVehicle.cpp:5100
libsumo::Vehicle::getLeader
static std::pair< std::string, double > getLeader(const std::string &vehicleID, double dist=0.)
Definition: Vehicle.cpp:279
WRITE_ERROR
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:245
libsumo::VAR_LANE_INDEX
TRACI_CONST int VAR_LANE_INDEX
Definition: TraCIConstants.h:679
SUMOVehicle::wasRemoteControlled
virtual bool wasRemoteControlled(SUMOTime lookBack=DELTA_T) const =0
Returns the information whether the vehicle is fully controlled via TraCI.
MSLane::getIndex
int getIndex() const
Returns the lane's index.
Definition: MSLane.h:564
libsumo::Vehicle::getRoute
static std::vector< std::string > getRoute(const std::string &vehicleID)
Definition: Vehicle.cpp:330
libsumo::Vehicle::setVia
static void setVia(const std::string &vehicleID, const std::vector< std::string > &via)
Definition: Vehicle.cpp:1512
libsumo::Helper::convertCartesianToRoadMap
static std::pair< MSLane *, double > convertCartesianToRoadMap(const Position &pos, const SUMOVehicleClass vClass)
Definition: Helper.cpp:307
LCA_UNKNOWN
The action has not been determined.
Definition: SUMOXMLDefinitions.h:1237
MSNet::getVehicleControl
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:337
MSVehicle::rerouteParkingArea
bool rerouteParkingArea(const std::string &parkingAreaID, std::string &errorMsg)
Definition: MSVehicle.cpp:5549
libsumo::SubscriptionResults
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
Definition: TraCIDefs.h:204
libsumo::Vehicle::getNextTLS
static std::vector< TraCINextTLSData > getNextTLS(const std::string &vehicleID)
Definition: Vehicle.cpp:374
MSMoveReminder::NOTIFICATION_TELEPORT
The vehicle is being teleported.
Definition: MSMoveReminder.h:101
SUMOVehicle::isParking
virtual bool isParking() const =0
Returns the information whether the vehicle is parked.
SUMOVehicleParameter::departPos
double departPos
(optional) The position the vehicle shall depart from
Definition: SUMOVehicleParameter.h:488
SUMOVehicleParameter::departSpeedProcedure
DepartSpeedDefinition departSpeedProcedure
Information how the vehicle's initial speed shall be chosen.
Definition: SUMOVehicleParameter.h:503
PositionVector::move2side
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
Definition: PositionVector.cpp:1086
MSVehicleType::setTau
void setTau(double tau)
Set a new value for this type's headway.
Definition: MSVehicleType.cpp:435
DEPART_NOW
The vehicle is discarded if emission fails (not fully implemented yet)
Definition: SUMOVehicleParameter.h:102
RGBColor::set
void set(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
assigns new values
Definition: RGBColor.cpp:80
MSVehicleType::setEmissionClass
void setEmissionClass(SUMOEmissionClass eclass)
Set a new value for this type's emission class.
Definition: MSVehicleType.cpp:238
libsumo::Vehicle::getRoadID
static std::string getRoadID(const std::string &vehicleID)
Definition: Vehicle.cpp:159
libsumo::VAR_ROUTING_MODE
TRACI_CONST int VAR_ROUTING_MODE
Definition: TraCIConstants.h:733
MSVehicleType::setImperfection
void setImperfection(double imperfection)
Set a new value for this type's imperfection.
Definition: MSVehicleType.cpp:426
libsumo::Vehicle::changeLaneRelative
static void changeLaneRelative(const std::string &vehicleID, int indexOffset, double duration)
Definition: Vehicle.cpp:961
libsumo::Vehicle::add
static void add(const std::string &vehicleID, const std::string &routeID, const std::string &typeID="DEFAULT_VEHTYPE", const std::string &depart="now", const std::string &departLane="first", const std::string &departPos="base", const std::string &departSpeed="0", const std::string &arrivalLane="current", const std::string &arrivalPos="max", const std::string &arrivalSpeed="current", const std::string &fromTaz="", const std::string &toTaz="", const std::string &line="", int personCapacity=4, int personNumber=0)
Definition: Vehicle.cpp:977
MSAbstractLaneChangeModel.h
MSVehicle::getWaitingSeconds
double getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:657
SUMOVehicleParameter::arrivalSpeed
double arrivalSpeed
(optional) The final speed of the vehicle (not used yet)
Definition: SUMOVehicleParameter.h:528
MSBaseVehicle::replaceVehicleType
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
Definition: MSBaseVehicle.cpp:692
MSVehicle::hasStops
bool hasStops() const
Returns whether the vehicle has to stop somewhere.
Definition: MSVehicle.h:995
LCA_BLOCKED_BY_LEFT_FOLLOWER
The vehicle is blocked by left follower.
Definition: SUMOXMLDefinitions.h:1245
libsumo::Vehicle::getDistance
static double getDistance(const std::string &vehicleID)
Definition: Vehicle.cpp:492
libsumo::Vehicle::moveToXY
static void moveToXY(const std::string &vehicleID, const std::string &edgeID, const int laneIndex, const double x, const double y, double angle=INVALID_DOUBLE_VALUE, const int keepRoute=1)
Definition: Vehicle.cpp:1085
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
libsumo::Vehicle::getElectricityConsumption
static double getElectricityConsumption(const std::string &vehicleID)
Definition: Vehicle.cpp:258
MSInsertionControl::alreadyDeparted
void alreadyDeparted(SUMOVehicle *veh)
stops trying to emit the given vehicle (because it already departed)
Definition: MSInsertionControl.cpp:278