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