Eclipse SUMO - Simulation of Urban MObility
MSVehicle.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
27 // Representation of a vehicle in the micro simulation
28 /****************************************************************************/
29 #pragma once
30 #include <config.h>
31 
32 #include <list>
33 #include <deque>
34 #include <map>
35 #include <set>
36 #include <string>
37 #include <vector>
38 #include <memory>
39 #include "MSGlobals.h"
40 #include "MSVehicleType.h"
41 #include "MSBaseVehicle.h"
42 #include "MSLink.h"
43 #include "MSLane.h"
44 #include "MSNet.h"
45 
46 #define INVALID_SPEED 299792458 + 1 // nothing can go faster than the speed of light! Refs. #2577
47 
48 // ===========================================================================
49 // class declarations
50 // ===========================================================================
51 class SUMOSAXAttributes;
52 class MSMoveReminder;
53 class MSLaneChanger;
54 class MSVehicleTransfer;
56 class MSStoppingPlace;
57 class MSStop;
58 class MSChargingStation;
59 class MSOverheadWire;
60 class MSParkingArea;
61 class MSPerson;
62 class MSDevice;
63 class OutputDevice;
64 class Position;
65 class MSJunction;
66 class MSLeaderInfo;
69 
70 // ===========================================================================
71 // class definitions
72 // ===========================================================================
77 class MSVehicle : public MSBaseVehicle {
78 public:
79 
81  friend class MSLaneChanger;
82  friend class MSLaneChangerSublane;
83 
87  class State {
89  friend class MSVehicle;
90  friend class MSLaneChanger;
91  friend class MSLaneChangerSublane;
92 
93  public:
95  State(double pos, double speed, double posLat, double backPos);
96 
98  State(const State& state);
99 
101  State& operator=(const State& state);
102 
104  bool operator!=(const State& state);
105 
107  double pos() const {
108  return myPos;
109  }
110 
112  double speed() const {
113  return mySpeed;
114  };
115 
117  double posLat() const {
118  return myPosLat;
119  }
120 
122  double backPos() const {
123  return myBackPos;
124  }
125 
127  double lastCoveredDist() const {
128  return myLastCoveredDist;
129  }
130 
131 
132  private:
134  double myPos;
135 
137  double mySpeed;
138 
140  double myPosLat;
141 
143  // if the vehicle occupies multiple lanes, this is the position relative
144  // to the lane occupied by its back
145  double myBackPos;
146 
149 
155 
156  };
157 
158 
163  public:
166 
167  // return the waiting time within the last memory millisecs
168  SUMOTime cumulatedWaitingTime(SUMOTime memory = -1) const;
169 
170  // process time passing for dt millisecs
171  void passTime(SUMOTime dt, bool waiting);
172 
173  const std::string getState() const;
174 
175  void setState(const std::string& state);
176 
177  private:
180 
184  std::deque<std::pair<SUMOTime, SUMOTime> > myWaitingIntervals;
185 
188  };
189 
190 
203  };
204 
212  MSVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
213  MSVehicleType* type, const double speedFactor);
214 
216  virtual ~MSVehicle();
217 
218  void initDevices();
219 
221  bool hasValidRouteStart(std::string& msg);
222 
224 
225 
235 
236 
237 
239 
240 
244  bool hasArrived() const;
245 
256  bool replaceRoute(const MSRoute* route, const std::string& info, bool onInit = false, int offset = 0, bool addStops = true, bool removeStops = true);
257 
259 
260 
262 
263 
281  void workOnMoveReminders(double oldPos, double newPos, double newSpeed);
283 
289  void workOnIdleReminders();
290 
296  bool checkActionStep(const SUMOTime t);
297 
303  void resetActionOffset(const SUMOTime timeUntilNextAction = 0);
304 
305 
315  void updateActionOffset(const SUMOTime oldActionStepLength, const SUMOTime newActionStepLength);
316 
317 
335  void planMove(const SUMOTime t, const MSLeaderInfo& ahead, const double lengthsInFront);
336 
339  void setApproachingForAllLinks(const SUMOTime t);
340 
341 
354  bool executeMove();
355 
357  void executeFractionalMove(double dist);
358 
365  double getDeltaPos(const double accel) const;
366 
367 
369 
370 
374  double getPositionOnLane() const {
375  return myState.myPos;
376  }
377 
381  double getLastStepDist() const {
382  return myState.lastCoveredDist();
383  }
384 
388  double getPositionOnLane(const MSLane* lane) const;
389 
398  double getBackPositionOnLane(const MSLane* lane) const;
399 
403  double getBackPositionOnLane() const {
405  }
406 
411  double getLateralPositionOnLane() const {
412  return myState.myPosLat;
413  }
414 
415  void setLateralPositionOnLane(double posLat) {
416  myState.myPosLat = posLat;
417  }
418 
423  double getRightSideOnLane() const;
424 
428  double lateralDistanceToLane(const int offset) const;
429 
431  double getLateralOverlap() const;
432  double getLateralOverlap(double posLat) const;
433 
439  double getRightSideOnEdge(const MSLane* lane = 0) const;
440 
446  double getCenterOnEdge(const MSLane* lane = 0) const;
447 
453  double getLatOffset(const MSLane* lane) const;
454 
458  double getSpeed() const {
459  return myState.mySpeed;
460  }
461 
462 
466  double getPreviousSpeed() const {
467  return myState.myPreviousSpeed;
468  }
469 
470 
474  void setPreviousSpeed(double prevspeed) {
475  myState.mySpeed = MAX2(0., prevspeed);
476  }
477 
478 
483  double getAcceleration() const {
484  return myAcceleration;
485  }
486 
488  double getCurrentApparentDecel() const;
489 
495  return myType->getActionStepLength();
496  }
497 
502  double getActionStepLengthSecs() const {
504  }
505 
506 
511  return myLastActionTime;
512  }
513 
515 
516 
517 
519 
520 
524  double getSlope() const;
525 
526 
534  Position getPosition(const double offset = 0) const;
535 
536 
544  Position getPositionAlongBestLanes(double offset) const;
545 
546 
550  const MSLane* getLane() const {
551  return myLane;
552  }
553 
559  return myLane;
560  }
561 
562 
567  double
569  if (myLane != 0) {
570  return myLane->getVehicleMaxSpeed(this);
571  } else {
572  return myType->getMaxSpeed();
573  }
574  }
575 
576 
580  inline bool isOnRoad() const {
581  return myAmOnNet;
582  }
583 
587  void
588  setIdling(bool amIdling) {
589  myAmIdling = amIdling;
590  }
591 
596  inline bool isIdling() const {
597  return myAmIdling;
598  }
599 
603  inline bool isActive() const {
604  return myActionStep;
605  }
606 
610  inline bool isActionStep(SUMOTime t) const {
611  return (t - myLastActionTime) % getActionStepLength() == 0;
612 // return t%getActionStepLength() == 0; // synchronized actions for all vehicles with identical actionsteplengths
613  }
614 
615 
619  bool isFrontOnLane(const MSLane* lane) const;
620 
621 
628  const MSEdge* getRerouteOrigin() const;
629 
630 
638  return myWaitingTime;
639  }
640 
651  return TIME2STEPS(myTimeLoss);
652  }
653 
654 
661  }
662 
669  double getWaitingSeconds() const {
670  return STEPS2TIME(myWaitingTime);
671  }
672 
673 
681  }
682 
685  double getTimeLossSeconds() const {
686  return myTimeLoss;
687  }
688 
691  double getStopDelay() const;
692 
695  double getStopArrivalDelay() const;
696 
700  double getAngle() const {
701  return myAngle;
702  }
703 
704 
709  return Position(std::cos(myAngle) * myState.speed(), std::sin(myAngle) * myState.speed());
710  }
712 
714  double computeAngle() const;
715 
717  void setAngle(double angle, bool straightenFurther = false);
718 
725  void setActionStepLength(double actionStepLength, bool resetActionOffset = true);
726 
728  static bool overlap(const MSVehicle* veh1, const MSVehicle* veh2) {
729  if (veh1->myState.myPos < veh2->myState.myPos) {
730  return veh2->myState.myPos - veh2->getVehicleType().getLengthWithGap() < veh1->myState.myPos;
731  }
732  return veh1->myState.myPos - veh1->getVehicleType().getLengthWithGap() < veh2->myState.myPos;
733  }
734 
737  bool congested() const {
738  return myState.mySpeed < double(60.0) / double(3.6) || myLane->getSpeedLimit() < (60.1 / 3.6);
739  }
740 
741 
753  void activateReminders(const MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
754 
761  bool enterLaneAtMove(MSLane* enteredLane, bool onTeleporting = false);
762 
763 
764 
773  void enterLaneAtInsertion(MSLane* enteredLane, double pos, double speed, double posLat,
774  MSMoveReminder::Notification notification);
775 
780  void setTentativeLaneAndPosition(MSLane* lane, double pos, double posLat = 0);
781 
786  void enterLaneAtLaneChange(MSLane* enteredLane);
787 
788 
790  void leaveLane(const MSMoveReminder::Notification reason, const MSLane* approachedLane = 0);
791 
798  void updateDriveItems();
799 
803  const std::pair<double, LinkDirection>& getNextTurn() {
804  return myNextTurn;
805  }
806 
807 
810 
811  const std::vector<MSLane*>& getFurtherLanes() const {
812  return myFurtherLanes;
813  }
814 
815  const std::vector<double>& getFurtherLanesPosLat() const {
816  return myFurtherLanesPosLat;
817  }
818 
819 
821  bool onFurtherEdge(const MSEdge* edge) const;
822 
825 
826  //
830  struct LaneQ {
834  double length;
838  double occupation;
845  /* @brief Longest sequence of (normal-edge) lanes that can be followed without a lane change
846  * The 'length' attribute is the sum of these lane lengths
847  * (There may be alternative sequences that have equal length)
848  * It is the 'best' in the strategic sense of reducing required lane-changes
849  */
850  std::vector<MSLane*> bestContinuations;
851  };
852 
856  const std::vector<LaneQ>& getBestLanes() const;
857 
875  void updateBestLanes(bool forceRebuild = false, const MSLane* startLane = 0);
876 
877 
881  const std::vector<MSLane*>& getBestLanesContinuation() const;
882 
883 
887  const std::vector<MSLane*>& getBestLanesContinuation(const MSLane* const l) const;
888 
895  const std::vector<const MSLane*> getUpcomingLanesUntil(double distance) const;
896 
902  const std::vector<const MSLane*> getPastLanesUntil(double distance) const;
903 
904  /* @brief returns the current signed offset from the lane that is most
905  * suited for continuing the current route (in the strategic sense of reducing lane-changes)
906  * - 0 if the vehicle is one it's best lane
907  * - negative if the vehicle should change to the right
908  * - positive if the vehicle should change to the left
909  */
910  int getBestLaneOffset() const;
911 
913  void adaptBestLanesOccupation(int laneIndex, double density);
914 
916 
918  void fixPosition();
919 
921  std::pair<const MSLane*, double> getLanePosAfterDist(double distance) const;
922 
930  inline const MSCFModel& getCarFollowModel() const {
931  return myType->getCarFollowModel();
932  }
933 
940  std::shared_ptr<MSSimpleDriverState> getDriverState() const;
941 
942 
948  return myCFVariables;
949  }
950 
952 
953 
954 
955 
958  bool replaceParkingArea(MSParkingArea* parkingArea, std::string& errorMsg);
959 
963 
966 
969  inline bool hasDriverState() const {
970  return myDriverState != nullptr;
971  }
972 
975 
977  bool stopsAt(MSStoppingPlace* stop) const;
978 
980  bool stopsAtEdge(const MSEdge* edge) const;
981 
984  bool willStop() const;
985 
987  bool isStoppedOnLane() const;
988 
990  bool keepStopping(bool afterProcessing = false) const;
991 
995  SUMOTime collisionStopTime() const;
996 
1000  bool isRemoteControlled() const;
1001 
1005  bool wasRemoteControlled(SUMOTime lookBack = DELTA_T) const;
1006 
1008  double nextStopDist() const {
1009  return myStopDist;
1010  }
1012 
1013  int getLaneIndex() const;
1014 
1024  double getDistanceToPosition(double destPos, const MSEdge* destEdge) const;
1025 
1026 
1034  double processNextStop(double currentVelocity);
1035 
1036 
1044  std::pair<const MSVehicle* const, double> getLeader(double dist = 0) const;
1045 
1054  std::pair<const MSVehicle* const, double> getFollower(double dist = 0) const;
1055 
1062  double getTimeGapOnLane() const;
1063 
1064 
1069  void addTransportable(MSTransportable* transportable);
1070 
1073 
1077  enum Signalling {
1108  };
1109 
1110 
1116  LC_NEVER = 0, // lcModel shall never trigger changes at this level
1117  LC_NOCONFLICT = 1, // lcModel may trigger changes if not in conflict with TraCI request
1118  LC_ALWAYS = 2 // lcModel may always trigger changes of this level regardless of requests
1119  };
1120 
1121 
1124  LCP_ALWAYS = 0, // change regardless of blockers, adapt own speed and speed of blockers
1125  LCP_NOOVERLAP = 1, // change unless overlapping with blockers, adapt own speed and speed of blockers
1126  LCP_URGENT = 2, // change if not blocked, adapt own speed and speed of blockers
1127  LCP_OPPORTUNISTIC = 3 // change if not blocked
1128  };
1129 
1130 
1134  void switchOnSignal(int signal) {
1135  mySignals |= signal;
1136  }
1137 
1138 
1142  void switchOffSignal(int signal) {
1143  mySignals &= ~signal;
1144  }
1145 
1146 
1150  int getSignals() const {
1151  return mySignals;
1152  }
1153 
1154 
1159  bool signalSet(int which) const {
1160  return (mySignals & which) != 0;
1161  }
1163 
1164 
1166  bool unsafeLinkAhead(const MSLane* lane) const;
1167 
1169  bool passingMinor() const;
1170 
1171 
1172 
1180  double getSpeedWithoutTraciInfluence() const;
1181 
1186  bool rerouteParkingArea(const std::string& parkingAreaID, std::string& errorMsg);
1187 
1194  bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string& errorMsg);
1195 
1205  bool replaceStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string& info, std::string& errorMsg);
1206 
1207  bool handleCollisionStop(MSStop& stop, const bool collision, const double distToStop, const std::string& errorMsgStart, std::string& errorMsg);
1208 
1213  MSStop& getNextStop();
1214 
1217 
1222  bool resumeFromStopping();
1223 
1225  double updateFurtherLanes(std::vector<MSLane*>& furtherLanes,
1226  std::vector<double>& furtherLanesPosLat,
1227  const std::vector<MSLane*>& passedLanes);
1228 
1231 
1234 
1245  };
1246 
1249  bool setExitManoeuvre();
1251  void setManoeuvreType(const MSVehicle::ManoeuvreType mType);
1252 
1254  bool manoeuvreIsComplete() const;
1257 
1258 
1265  class Manoeuvre {
1266 
1267  public:
1269  Manoeuvre();
1270 
1272  Manoeuvre(const Manoeuvre& manoeuvre);
1273 
1275  Manoeuvre& operator=(const Manoeuvre& manoeuvre);
1276 
1278  bool operator!=(const Manoeuvre& manoeuvre);
1279 
1282 
1284  bool configureExitManoeuvre(MSVehicle* veh);
1285 
1288 
1290  bool
1291  manoeuvreIsComplete(const ManoeuvreType checkType) const;
1292 
1294  bool
1295  manoeuvreIsComplete() const;
1296 
1298  double getGUIIncrement() const;
1299 
1302 
1304  void setManoeuvreType(const MSVehicle::ManoeuvreType mType);
1305 
1306  private:
1309 
1311  std::string myManoeuvreStop;
1312 
1315 
1318 
1321 
1322  // @brief Angle (radians) through which parking vehicle moves in each sim step
1324  };
1325 
1326  // Current or previous (completed) manoeuvre
1328 
1341  class Influencer : public BaseInfluencer {
1342  private:
1343 
1353  void vehicleStateChanged(const SUMOVehicle* const vehicle, MSNet::VehicleState to, const std::string& info = "");
1354  };
1355 
1356 
1359  GapControlState();
1360  virtual ~GapControlState();
1362  static void init();
1364  static void cleanup();
1366  void activate(double tauOriginal, double tauTarget, double additionalGap, double duration, double changeRate, double maxDecel, const MSVehicle* refVeh);
1368  void deactivate();
1370  double tauOriginal;
1372  double tauCurrent;
1374  double tauTarget;
1383  double changeRate;
1385  double maxDecel;
1389  bool active;
1398 
1400  static std::map<const MSVehicle*, GapControlState*> refVehMap;
1401 
1402  private:
1404  };
1405 
1406 
1407  public:
1409  Influencer();
1410 
1412  ~Influencer();
1413 
1415  static void init();
1417  static void cleanup();
1418 
1422  void setSpeedTimeLine(const std::vector<std::pair<SUMOTime, double> >& speedTimeLine);
1423 
1426  void activateGapController(double originalTau, double newTimeHeadway, double newSpaceHeadway, double duration, double changeRate, double maxDecel, MSVehicle* refVeh = nullptr);
1427 
1430  void deactivateGapController();
1431 
1435  void setLaneTimeLine(const std::vector<std::pair<SUMOTime, int> >& laneTimeLine);
1436 
1440  void adaptLaneTimeLine(int indexShift);
1441 
1445  void setSublaneChange(double latDist);
1446 
1448  int getSpeedMode() const;
1449 
1451  int getLaneChangeMode() const;
1452 
1454 
1456 
1468  double influenceSpeed(SUMOTime currentTime, double speed, double vSafe, double vMin, double vMax);
1469 
1482  double gapControlSpeed(SUMOTime currentTime, const SUMOVehicle* veh, double speed, double vSafe, double vMin, double vMax);
1483 
1491  int influenceChangeDecision(const SUMOTime currentTime, const MSEdge& currentEdge, const int currentLaneIndex, int state);
1492 
1493 
1499  double changeRequestRemainingSeconds(const SUMOTime currentTime) const;
1500 
1504  inline bool getRespectJunctionPriority() const {
1506  }
1507 
1508 
1512  inline bool getEmergencyBrakeRedLight() const {
1513  return myEmergencyBrakeRedLight;
1514  }
1515 
1516 
1518  bool considerSafeVelocity() const {
1519  return myConsiderSafeVelocity;
1520  }
1521 
1525  void setSpeedMode(int speedMode);
1526 
1530  void setLaneChangeMode(int value);
1531 
1535  double getOriginalSpeed() const;
1536 
1537  void setRemoteControlled(Position xyPos, MSLane* l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t);
1538 
1540  return myLastRemoteAccess;
1541  }
1542 
1544 
1546  double implicitSpeedRemote(const MSVehicle* veh, double oldSpeed);
1547 
1549  double implicitDeltaPosRemote(const MSVehicle* veh);
1550 
1551  bool isRemoteControlled() const;
1552 
1553  bool isRemoteAffected(SUMOTime t) const;
1554 
1555  void setSignals(int signals) {
1556  myTraCISignals = signals;
1557  }
1558 
1559  int getSignals() const {
1560  return myTraCISignals;
1561  }
1562 
1563  double getLatDist() const {
1564  return myLatDist;
1565  }
1566 
1567  void resetLatDist() {
1568  myLatDist = 0.;
1569  }
1570 
1571  bool ignoreOverlap() const {
1573  }
1574 
1575  private:
1577  std::vector<std::pair<SUMOTime, double> > mySpeedTimeLine;
1578 
1580  std::vector<std::pair<SUMOTime, int> > myLaneTimeLine;
1581 
1583  std::shared_ptr<GapControlState> myGapControlState;
1584 
1587 
1589  double myLatDist;
1590 
1593 
1596 
1599 
1602 
1605 
1608 
1611  double myRemotePos;
1617 
1619 
1633 
1634  // @brief the signals set via TraCI
1636 
1637  };
1638 
1639 
1647 
1648  const BaseInfluencer* getBaseInfluencer() const;
1649  const Influencer* getInfluencer() const;
1650 
1651  bool hasInfluencer() const {
1652  return myInfluencer != nullptr;
1653  }
1654 
1656  int influenceChangeDecision(int state);
1657 
1659  void setRemoteState(Position xyPos);
1660 
1662  double getSafeFollowSpeed(const std::pair<const MSVehicle*, double> leaderInfo,
1663  const double seen, const MSLane* const lane, double distToCrossing) const;
1664 
1666  static int nextLinkPriority(const std::vector<MSLane*>& conts);
1667 
1669  bool isLeader(const MSLink* link, const MSVehicle* veh) const;
1670 
1671  // @brief get the position of the back bumper;
1672  const Position getBackPosition() const;
1673 
1675  bool ignoreCollision();
1676 
1678  void updateParkingState();
1679 
1681 
1682 
1684  void saveState(OutputDevice& out);
1685 
1688  void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset);
1689 
1690  void loadPreviousApproaching(MSLink* link, bool setRequest,
1691  SUMOTime arrivalTime, double arrivalSpeed,
1692  SUMOTime arrivalTimeBraking, double arrivalSpeedBraking,
1693  double dist, double leaveSpeed);
1695 
1696 protected:
1697 
1698  double getSpaceTillLastStanding(const MSLane* l, bool& foundStopped) const;
1699 
1702 
1718  void adaptLaneEntering2MoveReminder(const MSLane& enteredLane);
1720 
1721 
1729  void processLinkApproaches(double& vSafe, double& vSafeMin, double& vSafeMinDist);
1730 
1731 
1739  void processLaneAdvances(std::vector<MSLane*>& passedLanes, std::string& emergencyReason);
1740 
1741 
1749  double processTraCISpeedControl(double vSafe, double vNext);
1750 
1751 
1758  void removePassedDriveItems();
1759 
1762  void updateWaitingTime(double vNext);
1763 
1766  void updateTimeLoss(double vNext);
1767 
1768  /* @brief Check whether the vehicle is a train that can reverse its direction at the current point in its route
1769  * and return the speed in preparation for reversal
1770  *
1771  * @param[out] canReverse
1772  * @param[in] speedThreshold
1773  * @return speed for reversal
1774  */
1775  double checkReversal(bool& canReverse, double speedThreshold = SUMO_const_haltingSpeed, double seen = 0) const;
1776 
1779  void setBrakingSignals(double vNext) ;
1780 
1783  void setBlinkerInformation();
1784 
1787  void setEmergencyBlueLight(SUMOTime currentTime);
1788 
1790  void updateOccupancyAndCurrentBestLane(const MSLane* startLane);
1791 
1793  double getBrakeGap() const;
1794 
1796  Position validatePosition(Position result, double offset = 0) const;
1797 
1799  virtual void drawOutsideNetwork(bool /*add*/) {};
1800 
1802  void boardTransportables(MSStop& stop);
1803 
1805  bool joinTrainPart(MSVehicle* veh);
1806 
1808  bool joinTrainPartFront(MSVehicle* veh);
1809 
1810 protected:
1811 
1815 
1817  double myTimeLoss;
1818 
1821 
1824 
1830 
1831 
1832 
1835 
1837 
1840 
1841  /* @brief Complex data structure for keeping and updating LaneQ:
1842  * Each element of the outer vector corresponds to an upcoming edge on the vehicles route
1843  * The first element corresponds to the current edge and is returned in getBestLanes()
1844  * The other elements are only used as a temporary structure in updateBestLanes();
1845  */
1846  std::vector<std::vector<LaneQ> > myBestLanes;
1847 
1848  /* @brief iterator to speed up retrieval of the current lane's LaneQ in getBestLaneOffset() and getBestLanesContinuation()
1849  * This is updated in updateOccupancyAndCurrentBestLane()
1850  */
1851  std::vector<LaneQ>::iterator myCurrentLaneInBestLanes;
1852 
1853  static std::vector<MSLane*> myEmptyLaneVector;
1854 
1857 
1860  std::pair<double, LinkDirection> myNextTurn;
1861 
1863  std::vector<MSLane*> myFurtherLanes;
1865  std::vector<double> myFurtherLanesPosLat;
1866 
1869 
1872 
1875 
1878 
1881 
1883 
1885  double myAngle;
1886 
1888  double myStopDist;
1889 
1892 
1894 
1899 
1900 protected:
1901 
1907  double myVLinkPass;
1908  double myVLinkWait;
1914  double myDistance;
1915  double accelV;
1918 
1919  DriveProcessItem(MSLink* link, double vPass, double vWait, bool setRequest,
1920  SUMOTime arrivalTime, double arrivalSpeed,
1921  SUMOTime arrivalTimeBraking, double arrivalSpeedBraking,
1922  double distance,
1923  double leaveSpeed = -1.) :
1924  myLink(link), myVLinkPass(vPass), myVLinkWait(vWait), mySetRequest(setRequest),
1925  myArrivalTime(arrivalTime), myArrivalSpeed(arrivalSpeed),
1926  myArrivalTimeBraking(arrivalTimeBraking), myArrivalSpeedBraking(arrivalSpeedBraking),
1927  myDistance(distance),
1928  accelV(leaveSpeed), hadStoppedVehicle(false), availableSpace(0) {
1929  assert(vWait >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1930  assert(vPass >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1931  };
1932 
1933 
1935  DriveProcessItem(double vWait, double distance, double _availableSpace = 0) :
1936  myLink(0), myVLinkPass(vWait), myVLinkWait(vWait), mySetRequest(false),
1939  myDistance(distance),
1940  accelV(-1), hadStoppedVehicle(false), availableSpace(_availableSpace) {
1941  assert(vWait >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1942  };
1943 
1944 
1945  inline void adaptLeaveSpeed(const double v) {
1946  if (accelV < 0) {
1947  accelV = v;
1948  } else {
1949  accelV = MIN2(accelV, v);
1950  }
1951  }
1952  inline double getLeaveSpeed() const {
1953  return accelV < 0 ? myVLinkPass : accelV;
1954  }
1955  };
1956 
1958  // TODO: Consider making LFLinkLanes a std::deque for efficient front removal (needs refactoring in checkRewindLinkLanes()...)
1959  typedef std::vector< DriveProcessItem > DriveItemVector;
1960 
1963 
1966 
1972  DriveItemVector::iterator myNextDriveItem;
1973 
1975  void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector& lfLinks, double& myStopDist, std::pair<double, LinkDirection>& myNextTurn) const;
1976 
1978  void checkRewindLinkLanes(const double lengthsInFront, DriveItemVector& lfLinks) const;
1979 
1981  void removeApproachingInformation(const DriveItemVector& lfLinks) const;
1982 
1983 
1985  inline double estimateLeaveSpeed(const MSLink* const link, const double vLinkPass) const {
1986  // estimate leave speed for passing time computation
1987  // l=linkLength, a=accel, t=continuousTime, v=vLeave
1988  // l=v*t + 0.5*a*t^2, solve for t and multiply with a, then add v
1989  return MIN2(link->getViaLaneOrLane()->getVehicleMaxSpeed(this),
1990  getCarFollowModel().estimateSpeedAfterDistance(link->getLength(), vLinkPass, getVehicleType().getCarFollowModel().getMaxAccel()));
1991  }
1992 
1993 
1994  /* @brief adapt safe velocity in accordance to a moving obstacle:
1995  * - a leader vehicle
1996  * - a vehicle or pedestrian that crosses this vehicles path on an upcoming intersection
1997  * @param[in] leaderInfo The leading vehicle and the (virtual) distance to it
1998  * @param[in] seen the distance to the end of the current lane
1999  * @param[in] lastLink the lastLink index
2000  * @param[in] lane The current Lane the vehicle is on
2001  * @param[in,out] the safe velocity for driving
2002  * @param[in,out] the safe velocity for arriving at the next link
2003  * @param[in] distToCrossing The distance to the crossing point with the current leader where relevant or -1
2004  */
2005  void adaptToLeader(const std::pair<const MSVehicle*, double> leaderInfo,
2006  const double seen, DriveProcessItem* const lastLink,
2007  const MSLane* const lane, double& v, double& vLinkPass,
2008  double distToCrossing = -1) const;
2009 
2010  /* @brief adapt safe velocity in accordance to multiple vehicles ahead:
2011  * @param[in] ahead The leader information according to the current lateral-resolution
2012  * @param[in] latOffset the lateral offset for locating the ego vehicle on the given lane
2013  * @param[in] seen the distance to the end of the current lane
2014  * @param[in] lastLink the lastLink index
2015  * @param[in] lane The current Lane the vehicle is on
2016  * @param[in,out] the safe velocity for driving
2017  * @param[in,out] the safe velocity for arriving at the next link
2018  */
2019  void adaptToLeaders(const MSLeaderInfo& ahead,
2020  double latOffset,
2021  const double seen, DriveProcessItem* const lastLink,
2022  const MSLane* const lane, double& v, double& vLinkPass) const;
2023 
2025  void checkLinkLeader(const MSLink* link, const MSLane* lane, double seen,
2026  DriveProcessItem* const lastLink, double& v, double& vLinkPass, double& vLinkWait, bool& setRequest,
2027  bool isShadowLink = false) const;
2028 
2030  void checkLinkLeaderCurrentAndParallel(const MSLink* link, const MSLane* lane, double seen,
2031  DriveProcessItem* const lastLink, double& v, double& vLinkPass, double& vLinkWait, bool& setRequest) const;
2032 
2033 
2034  // @brief return the lane on which the back of this vehicle resides
2035  const MSLane* getBackLane() const;
2036 
2044  void updateState(double vNext);
2045 
2046 
2048  bool keepClear(const MSLink* link) const;
2049 
2051  bool ignoreRed(const MSLink* link, bool canBrake) const;
2052 
2053  double estimateTimeToNextStop() const;
2054 
2055 private:
2058 
2061 
2062 
2063 private:
2066 
2069 
2072 
2073 };
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:74
SUMOTime DELTA_T
Definition: SUMOTime.cpp:37
#define STEPS2TIME(x)
Definition: SUMOTime.h:53
#define TIME2STEPS(x)
Definition: SUMOTime.h:55
long long int SUMOTime
Definition: SUMOTime.h:31
T MIN2(T a, T b)
Definition: StdDefs.h:73
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:60
T MAX2(T a, T b)
Definition: StdDefs.h:79
Interface for lane-change models.
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:51
void addStops(const bool ignoreStopErrors, MSRouteIterator *searchStart=nullptr)
Adds stops to the built vehicle.
MSVehicleType * myType
This vehicle's type.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
The car-following model abstraction.
Definition: MSCFModel.h:55
The ToC Device controls transition of control between automated and manual driving.
Abstract in-vehicle / in-person device.
Definition: MSDevice.h:61
A road/street connecting two junctions.
Definition: MSEdge.h:77
static bool gSemiImplicitEulerUpdate
Definition: MSGlobals.h:53
static SUMOTime gWaitingTimeMemory
length of memory for waiting times (in millisecs)
Definition: MSGlobals.h:97
The base class for an intersection.
Definition: MSJunction.h:58
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:45
Performs lane changing of vehicles.
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
double getSpeedLimit() const
Returns the lane's maximum allowed speed.
Definition: MSLane.h:531
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
Definition: MSLane.h:517
Something on a lane to be noticed about vehicle movement.
Notification
Definition of a vehicle state.
Interface for objects listening to vehicle state changes.
Definition: MSNet.h:620
VehicleState
Definition of a vehicle state.
Definition: MSNet.h:587
Definition of overhead wire segment.
A lane area vehicles can halt at.
Definition: MSParkingArea.h:57
Provides an interface to an error whose fluctuation is controlled via the driver's 'awareness',...
Definition: MSStop.h:44
A lane area vehicles can halt at.
A static instance of this class in GapControlState deactivates gap control for vehicles whose referen...
Definition: MSVehicle.h:1346
void vehicleStateChanged(const SUMOVehicle *const vehicle, MSNet::VehicleState to, const std::string &info="")
Called if a vehicle changes its state.
Definition: MSVehicle.cpp:258
Changes the wished vehicle speed / lanes.
Definition: MSVehicle.h:1341
void setLaneChangeMode(int value)
Sets lane changing behavior.
Definition: MSVehicle.cpp:772
TraciLaneChangePriority myTraciLaneChangePriority
flags for determining the priority of traci lane change requests
Definition: MSVehicle.h:1632
bool getEmergencyBrakeRedLight() const
Returns whether red lights shall be a reason to brake.
Definition: MSVehicle.h:1512
SUMOTime getLaneTimeLineEnd()
Definition: MSVehicle.cpp:464
void adaptLaneTimeLine(int indexShift)
Adapts lane timeline when moving to a new lane and the lane index changes.
Definition: MSVehicle.cpp:418
void setRemoteControlled(Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector &route, SUMOTime t)
Definition: MSVehicle.cpp:783
bool isRemoteAffected(SUMOTime t) const
Definition: MSVehicle.cpp:802
int getSpeedMode() const
return the current speed mode
Definition: MSVehicle.cpp:431
void deactivateGapController()
Deactivates the gap control.
Definition: MSVehicle.cpp:405
Influencer()
Constructor.
Definition: MSVehicle.cpp:357
void setSpeedMode(int speedMode)
Sets speed-constraining behaviors.
Definition: MSVehicle.cpp:762
std::shared_ptr< GapControlState > myGapControlState
The gap control state.
Definition: MSVehicle.h:1583
bool considerSafeVelocity() const
Returns whether safe velocities shall be considered.
Definition: MSVehicle.h:1518
int getSignals() const
Definition: MSVehicle.h:1559
bool myConsiderMaxDeceleration
Whether the maximum deceleration shall be regarded.
Definition: MSVehicle.h:1601
ConstMSEdgeVector myRemoteRoute
Definition: MSVehicle.h:1615
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, int > > &laneTimeLine)
Sets a new lane timeline.
Definition: MSVehicle.cpp:412
double myOriginalSpeed
The velocity before influence.
Definition: MSVehicle.h:1586
double getLatDist() const
Definition: MSVehicle.h:1563
double implicitDeltaPosRemote(const MSVehicle *veh)
return the change in longitudinal position that is implicit in the new remote position
Definition: MSVehicle.cpp:886
double implicitSpeedRemote(const MSVehicle *veh, double oldSpeed)
return the speed that is implicit in the new remote position
Definition: MSVehicle.cpp:859
void postProcessRemoteControl(MSVehicle *v)
Definition: MSVehicle.cpp:807
double gapControlSpeed(SUMOTime currentTime, const SUMOVehicle *veh, double speed, double vSafe, double vMin, double vMax)
Applies gap control logic on the speed.
Definition: MSVehicle.cpp:506
void setSublaneChange(double latDist)
Sets a new sublane-change request.
Definition: MSVehicle.cpp:426
double getOriginalSpeed() const
Returns the originally longitudinal speed to use.
Definition: MSVehicle.cpp:653
SUMOTime myLastRemoteAccess
Definition: MSVehicle.h:1616
std::vector< std::pair< SUMOTime, int > > myLaneTimeLine
The lane usage time line to apply.
Definition: MSVehicle.h:1580
LaneChangeMode myStrategicLC
lane changing which is necessary to follow the current route
Definition: MSVehicle.h:1621
LaneChangeMode mySpeedGainLC
lane changing to travel with higher speed
Definition: MSVehicle.h:1625
static void init()
Static initalization.
Definition: MSVehicle.cpp:381
LaneChangeMode mySublaneLC
changing to the prefered lateral alignment
Definition: MSVehicle.h:1629
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected.
Definition: MSVehicle.h:1504
static void cleanup()
Static cleanup.
Definition: MSVehicle.cpp:386
int getLaneChangeMode() const
return the current lane change mode
Definition: MSVehicle.cpp:441
SUMOTime getLaneTimeLineDuration()
Definition: MSVehicle.cpp:451
double influenceSpeed(SUMOTime currentTime, double speed, double vSafe, double vMin, double vMax)
Applies stored velocity information on the speed to use.
Definition: MSVehicle.cpp:474
double changeRequestRemainingSeconds(const SUMOTime currentTime) const
Return the remaining number of seconds of the current laneTimeLine assuming one exists.
Definition: MSVehicle.cpp:754
bool myConsiderSafeVelocity
Whether the safe velocity shall be regarded.
Definition: MSVehicle.h:1595
bool mySpeedAdaptationStarted
Whether influencing the speed has already started.
Definition: MSVehicle.h:1592
~Influencer()
Destructor.
Definition: MSVehicle.cpp:378
void setSignals(int signals)
Definition: MSVehicle.h:1555
double myLatDist
The requested lateral change.
Definition: MSVehicle.h:1589
bool myEmergencyBrakeRedLight
Whether red lights are a reason to brake.
Definition: MSVehicle.h:1607
LaneChangeMode myRightDriveLC
changing to the rightmost lane
Definition: MSVehicle.h:1627
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, double > > &speedTimeLine)
Sets a new velocity timeline.
Definition: MSVehicle.cpp:391
std::vector< std::pair< SUMOTime, double > > mySpeedTimeLine
The velocity time line to apply.
Definition: MSVehicle.h:1577
SUMOTime getLastAccessTimeStep() const
Definition: MSVehicle.h:1539
bool myConsiderMaxAcceleration
Whether the maximum acceleration shall be regarded.
Definition: MSVehicle.h:1598
LaneChangeMode myCooperativeLC
lane changing with the intent to help other vehicles
Definition: MSVehicle.h:1623
bool isRemoteControlled() const
Definition: MSVehicle.cpp:796
bool ignoreOverlap() const
Definition: MSVehicle.h:1571
bool myRespectJunctionPriority
Whether the junction priority rules are respected.
Definition: MSVehicle.h:1604
int influenceChangeDecision(const SUMOTime currentTime, const MSEdge &currentEdge, const int currentLaneIndex, int state)
Applies stored LaneChangeMode information and laneTimeLine.
Definition: MSVehicle.cpp:659
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:397
Container for manouevering time associated with stopping.
Definition: MSVehicle.h:1265
SUMOTime myManoeuvreCompleteTime
Time at which this manoeuvre should complete.
Definition: MSVehicle.h:1317
MSVehicle::ManoeuvreType getManoeuvreType() const
Accessor (get) for manoeuvre type.
Definition: MSVehicle.cpp:6461
std::string myManoeuvreStop
The name of the stop associated with the Manoeuvre - for debug output.
Definition: MSVehicle.h:1311
bool manoeuvreIsComplete() const
Check if any manoeuver is ongoing and whether the completion time is beyond currentTime.
Definition: MSVehicle.cpp:6595
bool configureExitManoeuvre(MSVehicle *veh)
Setup the myManoeuvre for exiting (Sets completion time and manoeuvre type)
Definition: MSVehicle.cpp:6514
void setManoeuvreType(const MSVehicle::ManoeuvreType mType)
Accessor (set) for manoeuvre type.
Definition: MSVehicle.cpp:6477
Manoeuvre & operator=(const Manoeuvre &manoeuvre)
Assignment operator.
Definition: MSVehicle.cpp:6436
Manoeuvre()
Constructor.
Definition: MSVehicle.cpp:6425
std::string myManoeuvreVehicleID
The name of the vehicle associated with the Manoeuvre - for debug output.
Definition: MSVehicle.h:1308
ManoeuvreType myManoeuvreType
Manoeuvre type - currently entry, exit or none.
Definition: MSVehicle.h:1320
double getGUIIncrement() const
Accessor for GUI rotation step when parking (radians)
Definition: MSVehicle.cpp:6456
SUMOTime myManoeuvreStartTime
Time at which the Manoeuvre for this stop started.
Definition: MSVehicle.h:1314
bool operator!=(const Manoeuvre &manoeuvre)
Operator !=.
Definition: MSVehicle.cpp:6446
bool entryManoeuvreIsComplete(MSVehicle *veh)
Configure an entry manoeuvre if nothing is configured - otherwise check if complete.
Definition: MSVehicle.cpp:6556
bool configureEntryManoeuvre(MSVehicle *veh)
Setup the entry manoeuvre for this vehicle (Sets completion time and manoeuvre type)
Definition: MSVehicle.cpp:6483
Container that holds the vehicles driving state (position+speed).
Definition: MSVehicle.h:87
double lastCoveredDist() const
previous Speed of this state
Definition: MSVehicle.h:127
double myPosLat
the stored lateral position
Definition: MSVehicle.h:140
double myPreviousSpeed
the speed at the begin of the previous time step
Definition: MSVehicle.h:148
double myPos
the stored position
Definition: MSVehicle.h:134
bool operator!=(const State &state)
Operator !=.
Definition: MSVehicle.cpp:155
double myLastCoveredDist
Definition: MSVehicle.h:154
double mySpeed
the stored speed (should be >=0 at any time)
Definition: MSVehicle.h:137
State & operator=(const State &state)
Assignment operator.
Definition: MSVehicle.cpp:143
double posLat() const
Lateral Position of this state (m relative to the centerline of the lane).
Definition: MSVehicle.h:117
double pos() const
Position of this state.
Definition: MSVehicle.h:107
double speed() const
Speed of this state.
Definition: MSVehicle.h:112
State(double pos, double speed, double posLat, double backPos)
Constructor.
Definition: MSVehicle.cpp:165
double backPos() const
back Position of this state
Definition: MSVehicle.h:122
double myBackPos
the stored back position
Definition: MSVehicle.h:145
Stores the waiting intervals over the previous seconds (memory is to be specified in ms....
Definition: MSVehicle.h:162
void passTime(SUMOTime dt, bool waiting)
Definition: MSVehicle.cpp:199
const std::string getState() const
Definition: MSVehicle.cpp:231
SUMOTime cumulatedWaitingTime(SUMOTime memory=-1) const
Definition: MSVehicle.cpp:177
std::deque< std::pair< SUMOTime, SUMOTime > > myWaitingIntervals
Definition: MSVehicle.h:184
void setState(const std::string &state)
Definition: MSVehicle.cpp:242
SUMOTime myMemorySize
the maximal memory to store
Definition: MSVehicle.h:179
void appendWaitingTime(SUMOTime dt)
append an amount of dt millisecs to the stored waiting times
WaitingTimeCollector(SUMOTime memory=MSGlobals::gWaitingTimeMemory)
Constructor.
Definition: MSVehicle.cpp:173
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
void setManoeuvreType(const MSVehicle::ManoeuvreType mType)
accessor function to myManoeuvre equivalent
Definition: MSVehicle.cpp:6472
TraciLaneChangePriority
modes for prioritizing traci lane change requests
Definition: MSVehicle.h:1123
@ LCP_NOOVERLAP
Definition: MSVehicle.h:1125
@ LCP_OPPORTUNISTIC
Definition: MSVehicle.h:1127
double getRightSideOnEdge(const MSLane *lane=0) const
Get the vehicle's lateral position on the edge of the given lane (or its current edge if lane == 0)
Definition: MSVehicle.cpp:5479
bool wasRemoteControlled(SUMOTime lookBack=DELTA_T) const
Returns the information whether the vehicle is fully controlled via TraCI within the lookBack time.
Definition: MSVehicle.cpp:6118
void processLinkApproaches(double &vSafe, double &vSafeMin, double &vSafeMinDist)
This method iterates through the driveprocess items for the vehicle and adapts the given in/out param...
Definition: MSVehicle.cpp:2841
const std::vector< double > & getFurtherLanesPosLat() const
Definition: MSVehicle.h:815
void checkLinkLeader(const MSLink *link, const MSLane *lane, double seen, DriveProcessItem *const lastLink, double &v, double &vLinkPass, double &vLinkWait, bool &setRequest, bool isShadowLink=false) const
checks for link leaders on the given link
Definition: MSVehicle.cpp:2627
void checkRewindLinkLanes(const double lengthsInFront, DriveItemVector &lfLinks) const
runs heuristic for keeping the intersection clear in case of downstream jamming
Definition: MSVehicle.cpp:4164
MSVehicle(const MSVehicle &)
invalidated copy constructor
double estimateLeaveSpeed(const MSLink *const link, const double vLinkPass) const
estimate leaving speed when accelerating across a link
Definition: MSVehicle.h:1985
bool willStop() const
Returns whether the vehicle will stop on the current edge.
Definition: MSVehicle.cpp:1437
double getSafeFollowSpeed(const std::pair< const MSVehicle *, double > leaderInfo, const double seen, const MSLane *const lane, double distToCrossing) const
compute safe speed for following the given leader
Definition: MSVehicle.cpp:2738
void adaptToLeader(const std::pair< const MSVehicle *, double > leaderInfo, const double seen, DriveProcessItem *const lastLink, const MSLane *const lane, double &v, double &vLinkPass, double distToCrossing=-1) const
Definition: MSVehicle.cpp:2575
bool hasDriverState() const
Whether this vehicle is equipped with a MSDriverState.
Definition: MSVehicle.h:969
static int nextLinkPriority(const std::vector< MSLane * > &conts)
get a numerical value for the priority of the upcoming link
Definition: MSVehicle.cpp:5068
double getTimeGapOnLane() const
Returns the time gap in seconds to the leader of the vehicle on the same lane.
Definition: MSVehicle.cpp:5353
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
Definition: MSVehicle.cpp:4717
bool myAmIdling
Whether the vehicle is trying to enter the network (eg after parking so engine is running)
Definition: MSVehicle.h:1874
SUMOTime myWaitingTime
The time the vehicle waits (is not faster than 0.1m/s) in seconds.
Definition: MSVehicle.h:1813
bool enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
Definition: MSVehicle.cpp:4452
double getStopDelay() const
Returns the public transport stop delay in seconds.
Definition: MSVehicle.cpp:6693
double computeAngle() const
compute the current vehicle angle
Definition: MSVehicle.cpp:1295
double myTimeLoss
the time loss in seconds due to driving with less than maximum speed
Definition: MSVehicle.h:1817
SUMOTime myLastActionTime
Action offset (actions are taken at time myActionOffset + N*getActionStepLength()) Initialized to 0,...
Definition: MSVehicle.h:1829
bool replaceParkingArea(MSParkingArea *parkingArea, std::string &errorMsg)
replace the current parking area stop with a new stop with merge duration
Definition: MSVehicle.cpp:1376
void boardTransportables(MSStop &stop)
board persons and load transportables at the given stop
Definition: MSVehicle.cpp:1700
const std::vector< const MSLane * > getUpcomingLanesUntil(double distance) const
Returns the upcoming (best followed by default 0) sequence of lanes to continue the route starting at...
Definition: MSVehicle.cpp:5134
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition: MSVehicle.h:580
void adaptLaneEntering2MoveReminder(const MSLane &enteredLane)
Adapts the vehicle's entering of a new lane.
Definition: MSVehicle.cpp:1089
void addTransportable(MSTransportable *transportable)
Adds a person or container to this vehicle.
Definition: MSVehicle.cpp:5364
MSParkingArea * getNextParkingArea()
get the upcoming parking area stop or nullptr
Definition: MSVehicle.cpp:1413
SUMOTime myJunctionConflictEntryTime
Definition: MSVehicle.h:1898
SUMOTime getLastActionTime() const
Returns the time of the vehicle's last action point.
Definition: MSVehicle.h:510
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:5463
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:637
const std::vector< MSLane * > & getFurtherLanes() const
Definition: MSVehicle.h:811
void workOnMoveReminders(double oldPos, double newPos, double newSpeed)
Processes active move reminder.
Definition: MSVehicle.cpp:1045
bool replaceStop(int nextStopIndex, SUMOVehicleParameter::Stop stop, const std::string &info, std::string &errorMsg)
Definition: MSVehicle.cpp:5884
void setPreviousSpeed(double prevspeed)
Sets the influenced previous speed.
Definition: MSVehicle.h:474
bool isStoppedOnLane() const
Definition: MSVehicle.cpp:1442
double myAcceleration
The current acceleration after dawdling in m/s.
Definition: MSVehicle.h:1856
SUMOTime getTimeLoss() const
Returns the SUMOTime lost (speed was lesser maximum speed)
Definition: MSVehicle.h:650
void adaptToLeaders(const MSLeaderInfo &ahead, double latOffset, const double seen, DriveProcessItem *const lastLink, const MSLane *const lane, double &v, double &vLinkPass) const
Definition: MSVehicle.cpp:2526
bool isActive() const
Returns whether the current simulation step is an action point for the vehicle.
Definition: MSVehicle.h:603
const MSLane * getBackLane() const
Definition: MSVehicle.cpp:3965
double getTimeLossSeconds() const
Returns the time loss in seconds.
Definition: MSVehicle.h:685
void enterLaneAtInsertion(MSLane *enteredLane, double pos, double speed, double posLat, MSMoveReminder::Notification notification)
Update when the vehicle enters a new lane in the emit step.
Definition: MSVehicle.cpp:4556
std::pair< double, LinkDirection > myNextTurn
the upcoming turn for the vehicle
Definition: MSVehicle.h:1860
double getBackPositionOnLane() const
Get the vehicle's position relative to its current lane.
Definition: MSVehicle.h:403
double getAccumulatedWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s) within the last millisecs.
Definition: MSVehicle.h:679
bool isFrontOnLane(const MSLane *lane) const
Returns the information whether the front of the vehicle is on the given lane.
Definition: MSVehicle.cpp:4135
virtual ~MSVehicle()
Destructor.
Definition: MSVehicle.cpp:944
double getSpaceTillLastStanding(const MSLane *l, bool &foundStopped) const
Definition: MSVehicle.cpp:4141
bool myAmRegisteredAsWaitingForPerson
Whether this vehicle is registered as waiting for a person (for deadlock-recognition)
Definition: MSVehicle.h:1877
bool stopsAt(MSStoppingPlace *stop) const
Returns whether the vehicle stops at the given stopping place.
Definition: MSVehicle.cpp:1801
void processLaneAdvances(std::vector< MSLane * > &passedLanes, std::string &emergencyReason)
This method checks if the vehicle has advanced over one or several lanes along its route and triggers...
Definition: MSVehicle.cpp:3502
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:4699
void setEmergencyBlueLight(SUMOTime currentTime)
sets the blue flashing light for emergency vehicles
Definition: MSVehicle.cpp:5442
bool isActionStep(SUMOTime t) const
Returns whether the next simulation step will be an action point for the vehicle.
Definition: MSVehicle.h:610
MSAbstractLaneChangeModel * myLaneChangeModel
Definition: MSVehicle.h:1836
Position getPositionAlongBestLanes(double offset) const
Return the (x,y)-position, which the vehicle would reach if it continued along its best continuation ...
Definition: MSVehicle.cpp:1155
bool hasValidRouteStart(std::string &msg)
checks wether the vehicle can depart on the first edge
Definition: MSVehicle.cpp:989
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
Definition: MSVehicle.h:1863
bool signalSet(int which) const
Returns whether the given signal is on.
Definition: MSVehicle.h:1159
MSLane * getMutableLane() const
Returns the lane the vehicle is on Non const version indicates that something volatile is going on.
Definition: MSVehicle.h:558
MSCFModel::VehicleVariables * myCFVariables
The per vehicle variables of the car following model.
Definition: MSVehicle.h:2057
double getActionStepLengthSecs() const
Returns the vehicle's action step length in secs, i.e. the interval between two action points.
Definition: MSVehicle.h:502
bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string &errorMsg)
Definition: MSVehicle.cpp:5852
void checkLinkLeaderCurrentAndParallel(const MSLink *link, const MSLane *lane, double seen, DriveProcessItem *const lastLink, double &v, double &vLinkPass, double &vLinkWait, bool &setRequest) const
checks for link leaders of the current link as well as the parallel link (if there is one)
Definition: MSVehicle.cpp:2611
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
Definition: MSVehicle.cpp:6093
double getMaxSpeedOnLane() const
Returns the maximal speed for the vehicle on its current lane (including speed factor and deviation,...
Definition: MSVehicle.h:568
bool isRemoteControlled() const
Returns the information whether the vehicle is fully controlled via TraCI.
Definition: MSVehicle.cpp:6112
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived)
Definition: MSVehicle.h:1871
double nextStopDist() const
return the distance to the next stop or doubleMax if there is none.
Definition: MSVehicle.h:1008
void adaptBestLanesOccupation(int laneIndex, double density)
update occupation from MSLaneChanger
Definition: MSVehicle.cpp:5262
void loadPreviousApproaching(MSLink *link, bool setRequest, SUMOTime arrivalTime, double arrivalSpeed, SUMOTime arrivalTimeBraking, double arrivalSpeedBraking, double dist, double leaveSpeed)
Definition: MSVehicle.cpp:6392
void setAngle(double angle, bool straightenFurther=false)
Set a custom vehicle angle in rad, optionally updates furtherLanePosLat.
Definition: MSVehicle.cpp:1255
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
Definition: MSVehicle.h:1851
double getDeltaPos(const double accel) const
calculates the distance covered in the next integration step given an acceleration and assuming the c...
Definition: MSVehicle.cpp:2819
const MSLane * myLastBestLanesInternalLane
Definition: MSVehicle.h:1839
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
Definition: MSVehicle.cpp:5084
WaitingTimeCollector myWaitingTimeCollector
Definition: MSVehicle.h:1814
void setRemoteState(Position xyPos)
sets position outside the road network
Definition: MSVehicle.cpp:6106
void fixPosition()
repair errors in vehicle position after changing between internal edges
Definition: MSVehicle.cpp:5270
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:483
double getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
Definition: MSVehicle.cpp:6084
bool ignoreCollision()
whether this vehicle is except from collision checks
Definition: MSVehicle.cpp:1474
ManoeuvreType
flag identifying which, if any, manoeuvre is in progress
Definition: MSVehicle.h:1238
@ MANOEUVRE_ENTRY
Manoeuvre into stopping place.
Definition: MSVehicle.h:1240
@ MANOEUVRE_NONE
not manouevring
Definition: MSVehicle.h:1244
@ MANOEUVRE_EXIT
Manoeuvre out of stopping place.
Definition: MSVehicle.h:1242
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:1030
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:1122
void setBrakingSignals(double vNext)
sets the braking lights on/off
Definition: MSVehicle.cpp:3334
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
Definition: MSVehicle.cpp:5106
double estimateTimeToNextStop() const
Definition: MSVehicle.cpp:6604
MSParkingArea * getCurrentParkingArea()
get the current parking area stop or nullptr
Definition: MSVehicle.cpp:1427
const MSEdge * myLastBestLanesEdge
Definition: MSVehicle.h:1838
PositionVector getBoundingPoly() const
get bounding polygon
Definition: MSVehicle.cpp:5732
Influencer * myInfluencer
An instance of a velocity/lane influencing instance; built in "getInfluencer".
Definition: MSVehicle.h:2060
void saveState(OutputDevice &out)
Saves the states of a vehicle.
Definition: MSVehicle.cpp:6308
void setIdling(bool amIdling)
access function for Idling flag used to record whether vehicle is waiting to enter lane (after parkin...
Definition: MSVehicle.h:588
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
Definition: MSVehicle.cpp:967
void planMove(const SUMOTime t, const MSLeaderInfo &ahead, const double lengthsInFront)
Compute safe velocities for the upcoming lanes based on positions and speeds from the last time step....
Definition: MSVehicle.cpp:1868
PositionVector getBoundingBox() const
get bounding rectangle
Definition: MSVehicle.cpp:5716
bool resumeFromStopping()
Definition: MSVehicle.cpp:5987
int getBestLaneOffset() const
Definition: MSVehicle.cpp:5252
double lateralDistanceToLane(const int offset) const
Get the minimal lateral distance required to move fully onto the lane at given offset.
Definition: MSVehicle.cpp:5595
bool stopsAtEdge(const MSEdge *edge) const
Returns whether the vehicle stops at the given edge.
Definition: MSVehicle.cpp:1817
void resetActionOffset(const SUMOTime timeUntilNextAction=0)
Resets the action offset for the vehicle.
Definition: MSVehicle.cpp:1843
std::vector< DriveProcessItem > DriveItemVector
Container for used Links/visited Lanes during planMove() and executeMove.
Definition: MSVehicle.h:1959
void setBlinkerInformation()
sets the blue flashing light for emergency vehicles
Definition: MSVehicle.cpp:5381
double getWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:669
DriveItemVector::iterator myNextDriveItem
iterator pointing to the next item in myLFLinkLanes
Definition: MSVehicle.h:1972
void leaveLane(const MSMoveReminder::Notification reason, const MSLane *approachedLane=0)
Update of members if vehicle leaves a new lane in the lane change step or at arrival.
Definition: MSVehicle.cpp:4634
bool isIdling() const
Returns whether a sim vehicle is waiting to enter a lane (after parking has completed)
Definition: MSVehicle.h:596
std::shared_ptr< MSSimpleDriverState > getDriverState() const
Returns the vehicle driver's state.
Definition: MSVehicle.cpp:6404
const SUMOVehicleParameter::Stop * getNextStopParameter() const
return parameters for the next stop (SUMOVehicle Interface)
Definition: MSVehicle.cpp:6051
void removeApproachingInformation(const DriveItemVector &lfLinks) const
unregister approach from all upcoming links
Definition: MSVehicle.cpp:5651
SUMOTime myJunctionEntryTimeNeverYield
Definition: MSVehicle.h:1897
double getLatOffset(const MSLane *lane) const
Get the offset that that must be added to interpret myState.myPosLat for the given lane.
Definition: MSVehicle.cpp:5523
bool rerouteParkingArea(const std::string &parkingAreaID, std::string &errorMsg)
Definition: MSVehicle.cpp:5778
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge)
Definition: MSVehicle.cpp:1021
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
Definition: MSVehicle.cpp:1242
void switchOffSignal(int signal)
Switches the given signal off.
Definition: MSVehicle.h:1142
void updateState(double vNext)
updates the vehicles state, given a next value for its speed. This value can be negative in case of t...
Definition: MSVehicle.cpp:3899
double getStopArrivalDelay() const
Returns the estimated public transport stop arrival delay in seconds.
Definition: MSVehicle.cpp:6714
int getSignals() const
Returns the signals.
Definition: MSVehicle.h:1150
int mySignals
State of things of the vehicle that can be on or off.
Definition: MSVehicle.h:1868
bool setExitManoeuvre()
accessor function to myManoeuvre equivalent
Definition: MSVehicle.cpp:6417
double myStopDist
distance to the next stop or doubleMax if there is none
Definition: MSVehicle.h:1888
double getBrakeGap() const
get distance for coming to a stop (used for rerouting checks)
Definition: MSVehicle.cpp:1827
bool myAmRegisteredAsWaitingForContainer
Whether this vehicle is registered as waiting for a container (for deadlock-recognition)
Definition: MSVehicle.h:1880
Signalling
Some boolean values which describe the state of some vehicle parts.
Definition: MSVehicle.h:1077
@ VEH_SIGNAL_EMERGENCY_RED
A red emergency light is on.
Definition: MSVehicle.h:1105
@ VEH_SIGNAL_NONE
Everything is switched off.
Definition: MSVehicle.h:1079
@ VEH_SIGNAL_FOGLIGHT
The fog lights are on (no visualisation)
Definition: MSVehicle.h:1091
@ VEH_SIGNAL_FRONTLIGHT
The front lights are on (no visualisation)
Definition: MSVehicle.h:1089
@ VEH_SIGNAL_DOOR_OPEN_LEFT
One of the left doors is opened.
Definition: MSVehicle.h:1099
@ VEH_SIGNAL_BLINKER_RIGHT
Right blinker lights are switched on.
Definition: MSVehicle.h:1081
@ VEH_SIGNAL_BRAKELIGHT
The brake lights are on.
Definition: MSVehicle.h:1087
@ VEH_SIGNAL_BACKDRIVE
The backwards driving lights are on (no visualisation)
Definition: MSVehicle.h:1095
@ VEH_SIGNAL_EMERGENCY_BLUE
A blue emergency light is on.
Definition: MSVehicle.h:1103
@ VEH_SIGNAL_BLINKER_LEFT
Left blinker lights are switched on.
Definition: MSVehicle.h:1083
@ VEH_SIGNAL_DOOR_OPEN_RIGHT
One of the right doors is opened.
Definition: MSVehicle.h:1101
@ VEH_SIGNAL_BLINKER_EMERGENCY
Blinker lights on both sides are switched on.
Definition: MSVehicle.h:1085
@ VEH_SIGNAL_WIPER
The wipers are on.
Definition: MSVehicle.h:1097
@ VEH_SIGNAL_EMERGENCY_YELLOW
A yellow emergency light is on.
Definition: MSVehicle.h:1107
@ VEH_SIGNAL_HIGHBEAM
The high beam lights are on (no visualisation)
Definition: MSVehicle.h:1093
bool isLeader(const MSLink *link, const MSVehicle *veh) const
whether the given vehicle must be followed at the given junction
Definition: MSVehicle.cpp:6196
SUMOTime getActionStepLength() const
Returns the vehicle's action step length in millisecs, i.e. the interval between two action points.
Definition: MSVehicle.h:494
bool myHaveToWaitOnNextLink
Definition: MSVehicle.h:1882
SUMOTime collisionStopTime() const
Returns the remaining time a vehicle needs to stop due to a collision. A negative value indicates tha...
Definition: MSVehicle.cpp:1468
const std::vector< const MSLane * > getPastLanesUntil(double distance) const
Returns the sequence of past lanes (right-most on edge) based on the route starting at the current la...
Definition: MSVehicle.cpp:5199
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:5311
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
Definition: MSVehicle.cpp:3662
std::pair< const MSVehicle *const, double > getFollower(double dist=0) const
Returns the follower of the vehicle looking for a fixed distance.
Definition: MSVehicle.cpp:5341
double getLastStepDist() const
Get the distance the vehicle covered in the previous timestep.
Definition: MSVehicle.h:381
const std::pair< double, LinkDirection > & getNextTurn()
Get the distance and direction of the next upcoming turn for the vehicle (within its look-ahead range...
Definition: MSVehicle.h:803
ChangeRequest
Requests set via TraCI.
Definition: MSVehicle.h:194
@ REQUEST_HOLD
vehicle want's to keep the current lane
Definition: MSVehicle.h:202
@ REQUEST_LEFT
vehicle want's to change to left lane
Definition: MSVehicle.h:198
@ REQUEST_NONE
vehicle doesn't want to change
Definition: MSVehicle.h:196
@ REQUEST_RIGHT
vehicle want's to change to right lane
Definition: MSVehicle.h:200
MSVehicle & operator=(const MSVehicle &)
invalidated assignment operator
std::pair< const MSLane *, double > getLanePosAfterDist(double distance) const
return lane and position along bestlanes at the given distance
Definition: MSVehicle.cpp:5277
SUMOTime myCollisionImmunity
amount of time for which the vehicle is immune from collisions
Definition: MSVehicle.h:1891
bool passingMinor() const
decide whether the vehicle is passing a minor link or has comitted to do so
Definition: MSVehicle.cpp:6180
void updateWaitingTime(double vNext)
Updates the vehicle's waiting time counters (accumulated and consecutive)
Definition: MSVehicle.cpp:3353
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
Definition: MSVehicle.cpp:4505
BaseInfluencer & getBaseInfluencer()
Returns the velocity/lane influencer.
Definition: MSVehicle.cpp:6067
Influencer & getInfluencer()
Definition: MSVehicle.cpp:6059
double getRightSideOnLane() const
Get the vehicle's lateral position on the lane:
Definition: MSVehicle.cpp:5473
bool unsafeLinkAhead(const MSLane *lane) const
whether the vehicle may safely move to the given lane with regard to upcoming links
Definition: MSVehicle.cpp:5663
double getCurrentApparentDecel() const
get apparent deceleration based on vType parameters and current acceleration
Definition: MSVehicle.cpp:6410
double updateFurtherLanes(std::vector< MSLane * > &furtherLanes, std::vector< double > &furtherLanesPosLat, const std::vector< MSLane * > &passedLanes)
update a vector of further lanes and return the new backPos
Definition: MSVehicle.cpp:3975
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle's car following model variables.
Definition: MSVehicle.h:947
DriveItemVector myLFLinkLanesPrev
planned speeds from the previous step for un-registering from junctions after the new container is fi...
Definition: MSVehicle.h:1965
std::vector< std::vector< LaneQ > > myBestLanes
Definition: MSVehicle.h:1846
void setActionStepLength(double actionStepLength, bool resetActionOffset=true)
Sets the action steplength of the vehicle.
Definition: MSVehicle.cpp:1278
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
Definition: MSVehicle.h:411
double getSlope() const
Returns the slope of the road at vehicle's position in degrees.
Definition: MSVehicle.cpp:1111
bool myActionStep
The flag myActionStep indicates whether the current time step is an action point for the vehicle.
Definition: MSVehicle.h:1826
const Position getBackPosition() const
Definition: MSVehicle.cpp:1347
bool congested() const
Definition: MSVehicle.h:737
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
Definition: MSVehicle.cpp:6346
double getSpeed() const
Returns the vehicle's current speed.
Definition: MSVehicle.h:458
void setApproachingForAllLinks(const SUMOTime t)
Register junction approaches for all link items in the current plan.
Definition: MSVehicle.cpp:4372
SUMOTime getAccumulatedWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s) within the last t millisecs.
Definition: MSVehicle.h:659
SUMOTime remainingStopDuration() const
Returns the remaining stop duration for a stopped vehicle or 0.
Definition: MSVehicle.cpp:1459
bool keepStopping(bool afterProcessing=false) const
Returns whether the vehicle is stopped and must continue to do so.
Definition: MSVehicle.cpp:1447
void workOnIdleReminders()
cycle through vehicle devices invoking notifyIdle
Definition: MSVehicle.cpp:1072
static std::vector< MSLane * > myEmptyLaneVector
Definition: MSVehicle.h:1853
Position myCachedPosition
Definition: MSVehicle.h:1893
MSVehicle::ManoeuvreType getManoeuvreType() const
accessor function to myManoeuvre equivalent
Definition: MSVehicle.cpp:6466
double checkReversal(bool &canReverse, double speedThreshold=SUMO_const_haltingSpeed, double seen=0) const
Definition: MSVehicle.cpp:3377
void removePassedDriveItems()
Erase passed drive items from myLFLinkLanes (and unregister approaching information for corresponding...
Definition: MSVehicle.cpp:3118
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
Definition: MSVehicle.cpp:4711
std::vector< double > myFurtherLanesPosLat
lateral positions on further lanes
Definition: MSVehicle.h:1865
bool checkActionStep(const SUMOTime t)
Returns whether the vehicle is supposed to take action in the current simulation step Updates myActio...
Definition: MSVehicle.cpp:1833
Position validatePosition(Position result, double offset=0) const
ensure that a vehicle-relative position is not invalid
Definition: MSVehicle.cpp:1221
bool keepClear(const MSLink *link) const
decide whether the given link must be kept clear
Definition: MSVehicle.cpp:6124
bool manoeuvreIsComplete() const
accessor function to myManoeuvre equivalent
Definition: MSVehicle.cpp:6599
double processNextStop(double currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
Definition: MSVehicle.cpp:1480
double myAngle
the angle in radians (
Definition: MSVehicle.h:1885
bool ignoreRed(const MSLink *link, bool canBrake) const
decide whether a red (or yellow light) may be ignore
Definition: MSVehicle.cpp:6136
double getPositionOnLane() const
Get the vehicle's position along the lane.
Definition: MSVehicle.h:374
const MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:550
void updateTimeLoss(double vNext)
Updates the vehicle's time loss.
Definition: MSVehicle.cpp:3365
MSStop & getNextStop()
Definition: MSVehicle.cpp:6046
MSDevice_DriverState * myDriverState
This vehicle's driver state.
Definition: MSVehicle.h:1823
bool joinTrainPart(MSVehicle *veh)
try joining the given vehicle to the rear of this one (to resolve joinTriggered)
Definition: MSVehicle.cpp:1747
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
Definition: MSVehicle.h:930
MSLane * myLane
The lane the vehicle is on.
Definition: MSVehicle.h:1834
bool onFurtherEdge(const MSEdge *edge) const
whether this vehicle has its back (and no its front) on the given edge
Definition: MSVehicle.cpp:5768
double processTraCISpeedControl(double vSafe, double vNext)
Check for speed advices from the traci client and adjust the speed vNext in the current (euler) / aft...
Definition: MSVehicle.cpp:3090
Manoeuvre myManoeuvre
Definition: MSVehicle.h:1327
double getLateralOverlap() const
return the amount by which the vehicle extends laterally outside it's primary lane
Definition: MSVehicle.cpp:5645
double getAngle() const
Returns the vehicle's direction in radians.
Definition: MSVehicle.h:700
bool hasInfluencer() const
Definition: MSVehicle.h:1651
double getPreviousSpeed() const
Returns the vehicle's speed before the previous time step.
Definition: MSVehicle.h:466
MSVehicle()
invalidated default constructor
bool joinTrainPartFront(MSVehicle *veh)
try joining the given vehicle to the front of this one (to resolve joinTriggered)
Definition: MSVehicle.cpp:1764
void updateActionOffset(const SUMOTime oldActionStepLength, const SUMOTime newActionStepLength)
Process an updated action step length value (only affects the vehicle's action offset,...
Definition: MSVehicle.cpp:1849
void executeFractionalMove(double dist)
move vehicle forward by the given distance during insertion
Definition: MSVehicle.cpp:3861
LaneChangeMode
modes for resolving conflicts between external control (traci) and vehicle control over lane changing...
Definition: MSVehicle.h:1115
@ LC_NOCONFLICT
Definition: MSVehicle.h:1117
virtual void drawOutsideNetwork(bool)
register vehicle for drawing while outside the network
Definition: MSVehicle.h:1799
void initDevices()
Definition: MSVehicle.cpp:980
State myState
This Vehicles driving state (pos and speed)
Definition: MSVehicle.h:1820
double getCenterOnEdge(const MSLane *lane=0) const
Get the vehicle's lateral position on the edge of the given lane (or its current edge if lane == 0)
Definition: MSVehicle.cpp:5485
void setLateralPositionOnLane(double posLat)
Definition: MSVehicle.h:415
void activateReminders(const MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
"Activates" all current move reminder
Definition: MSVehicle.cpp:4419
double getDistanceToPosition(double destPos, const MSEdge *destEdge) const
Definition: MSVehicle.cpp:5294
void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector &lfLinks, double &myStopDist, std::pair< double, LinkDirection > &myNextTurn) const
Definition: MSVehicle.cpp:1934
void switchOnSignal(int signal)
Switches the given signal on.
Definition: MSVehicle.h:1134
static bool overlap(const MSVehicle *veh1, const MSVehicle *veh2)
Definition: MSVehicle.h:728
int getLaneIndex() const
Definition: MSVehicle.cpp:5456
void updateParkingState()
update state while parking
Definition: MSVehicle.cpp:3960
bool handleCollisionStop(MSStop &stop, const bool collision, const double distToStop, const std::string &errorMsgStart, std::string &errorMsg)
Definition: MSVehicle.cpp:5962
DriveItemVector myLFLinkLanes
container for the planned speeds in the current step
Definition: MSVehicle.h:1962
void updateDriveItems()
Check whether the drive items (myLFLinkLanes) are up to date, and update them if required.
Definition: MSVehicle.cpp:3172
Position getVelocityVector() const
Returns the vehicle's direction in radians.
Definition: MSVehicle.h:708
SUMOTime myJunctionEntryTime
time at which the current junction was entered
Definition: MSVehicle.h:1896
The car-following model and parameter.
Definition: MSVehicleType.h:62
double getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
double getActionStepLengthSecs() const
Returns this type's default action step length in seconds.
const MSCFModel & getCarFollowModel() const
Returns the vehicle type's car following model definition (const version)
SUMOTime getActionStepLength() const
Returns this type's default action step length.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
A list of positions.
Encapsulated SAX-Attributes.
Representation of a vehicle.
Definition: SUMOVehicle.h:58
Definition of vehicle stop (position and duration)
Structure representing possible vehicle parameter.
Drive process items represent bounds on the safe velocity corresponding to the upcoming links.
Definition: MSVehicle.h:1905
DriveProcessItem(MSLink *link, double vPass, double vWait, bool setRequest, SUMOTime arrivalTime, double arrivalSpeed, SUMOTime arrivalTimeBraking, double arrivalSpeedBraking, double distance, double leaveSpeed=-1.)
Definition: MSVehicle.h:1919
double getLeaveSpeed() const
Definition: MSVehicle.h:1952
DriveProcessItem(double vWait, double distance, double _availableSpace=0)
constructor if the link shall not be passed
Definition: MSVehicle.h:1935
void adaptLeaveSpeed(const double v)
Definition: MSVehicle.h:1945
Container for state and parameters of the gap control.
Definition: MSVehicle.h:1358
bool active
Whether the gap control is active.
Definition: MSVehicle.h:1389
static std::map< const MSVehicle *, GapControlState * > refVehMap
stores reference vehicles currently in use by a gapController
Definition: MSVehicle.h:1400
SUMOTime lastUpdate
Time of the last update of the gap control.
Definition: MSVehicle.h:1395
double changeRate
Rate by which the current time and space headways are changed towards the target value....
Definition: MSVehicle.h:1383
double addGapTarget
Target value for the desired space headway.
Definition: MSVehicle.h:1378
static GapControlVehStateListener vehStateListener
Definition: MSVehicle.h:1403
double timeHeadwayIncrement
cache storage for the headway increments of the current operation
Definition: MSVehicle.h:1397
double tauOriginal
Original value for the desired headway (will be reset after duration has expired)
Definition: MSVehicle.h:1370
double tauCurrent
Current, interpolated value for the desired time headway.
Definition: MSVehicle.h:1372
double remainingDuration
Remaining duration for keeping the target headway.
Definition: MSVehicle.h:1380
void activate(double tauOriginal, double tauTarget, double additionalGap, double duration, double changeRate, double maxDecel, const MSVehicle *refVeh)
Start gap control with given params.
Definition: MSVehicle.cpp:314
double addGapCurrent
Current, interpolated value for the desired space headway.
Definition: MSVehicle.h:1376
static void cleanup()
Static cleanup (removes vehicle state listener)
Definition: MSVehicle.cpp:308
double tauTarget
Target value for the desired time headway.
Definition: MSVehicle.h:1374
void deactivate()
Stop gap control.
Definition: MSVehicle.cpp:344
const MSVehicle * referenceVeh
reference vehicle for the gap - if it is null, the current leader on the ego's lane is used as a refe...
Definition: MSVehicle.h:1387
double maxDecel
Maximal deceleration to be applied due to the adapted headway.
Definition: MSVehicle.h:1385
bool gapAttained
Whether the desired gap was attained during the current activity phase (induces the remaining duratio...
Definition: MSVehicle.h:1391
const MSVehicle * prevLeader
The last recognized leader.
Definition: MSVehicle.h:1393
static void init()
Static initalization (adds vehicle state listener)
Definition: MSVehicle.cpp:297
A structure representing the best lanes for continuing the current route starting at 'lane'.
Definition: MSVehicle.h:830
double length
The overall length which may be driven when using this lane without a lane change.
Definition: MSVehicle.h:834
bool allowsContinuation
Whether this lane allows to continue the drive.
Definition: MSVehicle.h:844
double nextOccupation
As occupation, but without the first lane.
Definition: MSVehicle.h:840
std::vector< MSLane * > bestContinuations
Definition: MSVehicle.h:850
MSLane * lane
The described lane.
Definition: MSVehicle.h:832
double currentLength
The length which may be driven on this lane.
Definition: MSVehicle.h:836
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive.
Definition: MSVehicle.h:842
double occupation
The overall vehicle sum on consecutive lanes which can be passed without a lane change.
Definition: MSVehicle.h:838