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-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
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 "MSBaseVehicle.h"
41 #include "MSNet.h"
42 
43 #define INVALID_SPEED 299792458 + 1 // nothing can go faster than the speed of light! Refs. #2577
44 
45 // ===========================================================================
46 // class declarations
47 // ===========================================================================
48 class SUMOSAXAttributes;
49 class MSMoveReminder;
50 class MSLaneChanger;
51 class MSVehicleTransfer;
53 class MSStoppingPlace;
54 class MSStop;
55 class MSChargingStation;
56 class MSOverheadWire;
57 class MSParkingArea;
58 class MSPerson;
59 class MSDevice;
60 class OutputDevice;
61 class Position;
62 class MSJunction;
63 class MSLeaderInfo;
67 
68 // ===========================================================================
69 // class definitions
70 // ===========================================================================
75 class MSVehicle : public MSBaseVehicle {
76 public:
77 
79  friend class MSLaneChanger;
80  friend class MSLaneChangerSublane;
81 
85  class State {
87  friend class MSVehicle;
88  friend class MSLaneChanger;
89  friend class MSLaneChangerSublane;
90 
91  public:
93  State(double pos, double speed, double posLat, double backPos);
94 
96  State(const State& state);
97 
99  State& operator=(const State& state);
100 
102  bool operator!=(const State& state);
103 
105  double pos() const {
106  return myPos;
107  }
108 
110  double speed() const {
111  return mySpeed;
112  };
113 
115  double posLat() const {
116  return myPosLat;
117  }
118 
120  double backPos() const {
121  return myBackPos;
122  }
123 
125  double lastCoveredDist() const {
126  return myLastCoveredDist;
127  }
128 
129 
130  private:
132  double myPos;
133 
135  double mySpeed;
136 
138  double myPosLat;
139 
141  // if the vehicle occupies multiple lanes, this is the position relative
142  // to the lane occupied by its back
143  double myBackPos;
144 
147 
153 
154  };
155 
156 
161  public:
164 
165  // return the waiting time within the last memory millisecs
166  SUMOTime cumulatedWaitingTime(SUMOTime memory = -1) const;
167 
168  // process time passing for dt millisecs
169  void passTime(SUMOTime dt, bool waiting);
170 
171  const std::string getState() const;
172 
173  void setState(const std::string& state);
174 
175  private:
178 
182  std::deque<std::pair<SUMOTime, SUMOTime> > myWaitingIntervals;
183 
186  };
187 
188 
201  };
202 
210  MSVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
211  MSVehicleType* type, const double speedFactor);
212 
214  virtual ~MSVehicle();
215 
216  void initDevices();
217 
219  bool hasValidRouteStart(std::string& msg);
220 
222 
223 
233 
234 
235 
237 
238 
242  bool hasArrived() const;
243 
254  bool replaceRoute(const MSRoute* route, const std::string& info, bool onInit = false, int offset = 0, bool addStops = true, bool removeStops = true, std::string* msgReturn = nullptr);
255 
257 
258 
260 
261 
279  void workOnMoveReminders(double oldPos, double newPos, double newSpeed);
281 
287  void workOnIdleReminders();
288 
294  bool checkActionStep(const SUMOTime t);
295 
301  void resetActionOffset(const SUMOTime timeUntilNextAction = 0);
302 
303 
313  void updateActionOffset(const SUMOTime oldActionStepLength, const SUMOTime newActionStepLength);
314 
315 
333  void planMove(const SUMOTime t, const MSLeaderInfo& ahead, const double lengthsInFront);
334 
337  void setApproachingForAllLinks(const SUMOTime t);
338 
339 
352  bool executeMove();
353 
355  void executeFractionalMove(double dist);
356 
363  double getDeltaPos(const double accel) const;
364 
365 
367 
368 
372  double getPositionOnLane() const {
373  return myState.myPos;
374  }
375 
379  double getLastStepDist() const {
380  return myState.lastCoveredDist();
381  }
382 
386  double getPositionOnLane(const MSLane* lane) const;
387 
396  inline double getBackPositionOnLane(const MSLane* lane) const {
397  return getBackPositionOnLane(lane, false);
398  }
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 
421  }
422 
427  double getRightSideOnLane() const;
428 
432  double lateralDistanceToLane(const int offset) const;
433 
435  double getLateralOverlap() const;
436  double getLateralOverlap(double posLat) const;
437 
443  double getRightSideOnEdge(const MSLane* lane = 0) const;
444 
450  double getCenterOnEdge(const MSLane* lane = 0) const;
451 
457  double getLatOffset(const MSLane* lane) const;
458 
462  double getSpeed() const {
463  return myState.mySpeed;
464  }
465 
466 
470  double getPreviousSpeed() const {
471  return myState.myPreviousSpeed;
472  }
473 
474 
478  void setPreviousSpeed(double prevspeed);
479 
480 
485  double getAcceleration() const {
486  return myAcceleration;
487  }
488 
490  double getCurrentApparentDecel() const;
491 
497  return myType->getActionStepLength();
498  }
499 
504  double getActionStepLengthSecs() const {
506  }
507 
508 
513  return myLastActionTime;
514  }
515 
517 
518 
519 
521 
522 
526  double getSlope() const;
527 
528 
536  Position getPosition(const double offset = 0) const;
537 
538 
546  Position getPositionAlongBestLanes(double offset) const;
547 
548 
552  const MSLane* getLane() const {
553  return myLane;
554  }
555 
561  return myLane;
562  }
563 
564 
569  double getMaxSpeedOnLane() const;
570 
574  inline bool isOnRoad() const {
575  return myAmOnNet;
576  }
577 
581  void
582  setIdling(bool amIdling) {
583  myAmIdling = amIdling;
584  }
585 
590  inline bool isIdling() const {
591  return myAmIdling;
592  }
593 
597  inline bool isActive() const {
598  return myActionStep;
599  }
600 
604  inline bool isActionStep(SUMOTime t) const {
605  return (t - myLastActionTime) % getActionStepLength() == 0;
606 // return t%getActionStepLength() == 0; // synchronized actions for all vehicles with identical actionsteplengths
607  }
608 
609 
613  bool isFrontOnLane(const MSLane* lane) const;
614 
615 
622  const MSEdge* getRerouteOrigin() const;
623 
624 
632  return myWaitingTime;
633  }
634 
645  return TIME2STEPS(myTimeLoss);
646  }
647 
648 
655  }
656 
664  }
665 
668  double getTimeLossSeconds() const {
669  return myTimeLoss;
670  }
671 
674  double getStopDelay() const;
675 
678  double getStopArrivalDelay() const;
679 
683  double getAngle() const {
684  return myAngle;
685  }
686 
687 
692  return Position(std::cos(myAngle) * myState.speed(), std::sin(myAngle) * myState.speed());
693  }
695 
697  double computeAngle() const;
698 
700  void setAngle(double angle, bool straightenFurther = false);
701 
708  void setActionStepLength(double actionStepLength, bool resetActionOffset = true);
709 
711  static bool overlap(const MSVehicle* veh1, const MSVehicle* veh2) {
712  if (veh1->myState.myPos < veh2->myState.myPos) {
713  return veh2->myState.myPos - veh2->getVehicleType().getLengthWithGap() < veh1->myState.myPos;
714  }
715  return veh1->myState.myPos - veh1->getVehicleType().getLengthWithGap() < veh2->myState.myPos;
716  }
717 
720  bool congested() const;
721 
722 
734  void activateReminders(const MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
735 
742  void enterLaneAtMove(MSLane* enteredLane, bool onTeleporting = false);
743 
744 
745 
754  void enterLaneAtInsertion(MSLane* enteredLane, double pos, double speed, double posLat,
755  MSMoveReminder::Notification notification);
756 
761  void setTentativeLaneAndPosition(MSLane* lane, double pos, double posLat = 0);
762 
767  void enterLaneAtLaneChange(MSLane* enteredLane);
768 
769 
771  void leaveLane(const MSMoveReminder::Notification reason, const MSLane* approachedLane = 0);
772 
779  void updateDriveItems();
780 
784  const std::pair<double, LinkDirection>& getNextTurn() {
785  return myNextTurn;
786  }
787 
788 
791 
792  const std::vector<MSLane*>& getFurtherLanes() const {
793  return myFurtherLanes;
794  }
795 
796  const std::vector<double>& getFurtherLanesPosLat() const {
797  return myFurtherLanesPosLat;
798  }
799 
800 
802  bool onFurtherEdge(const MSEdge* edge) const;
803 
806 
807  //
811  struct LaneQ {
813  MSLane* lane = nullptr;
815  double length;
819  double occupation;
826  /* @brief Longest sequence of (normal-edge) lanes that can be followed without a lane change
827  * The 'length' attribute is the sum of these lane lengths
828  * (There may be alternative sequences that have equal length)
829  * It is the 'best' in the strategic sense of reducing required lane-changes
830  */
831  std::vector<MSLane*> bestContinuations;
832  };
833 
837  const std::vector<LaneQ>& getBestLanes() const;
838 
856  void updateBestLanes(bool forceRebuild = false, const MSLane* startLane = 0);
857 
858 
862  const std::vector<MSLane*>& getBestLanesContinuation() const;
863 
864 
868  const std::vector<MSLane*>& getBestLanesContinuation(const MSLane* const l) const;
869 
876  const std::vector<const MSLane*> getUpcomingLanesUntil(double distance) const;
877 
883  const std::vector<const MSLane*> getPastLanesUntil(double distance) const;
884 
889  const std::vector<MSLane*> getUpstreamOppositeLanes() const;
890 
891  /* @brief returns the current signed offset from the lane that is most
892  * suited for continuing the current route (in the strategic sense of reducing lane-changes)
893  * - 0 if the vehicle is one it's best lane
894  * - negative if the vehicle should change to the right
895  * - positive if the vehicle should change to the left
896  */
897  int getBestLaneOffset() const;
898 
900  void adaptBestLanesOccupation(int laneIndex, double density);
901 
903 
905  void fixPosition();
906 
908  std::pair<const MSLane*, double> getLanePosAfterDist(double distance) const;
909 
917  inline const MSCFModel& getCarFollowModel() const {
918  return myType->getCarFollowModel();
919  }
920 
927  std::shared_ptr<MSSimpleDriverState> getDriverState() const;
928 
929 
935  return myCFVariables;
936  }
937 
939 
940 
941 
942 
945  bool replaceParkingArea(MSParkingArea* parkingArea, std::string& errorMsg);
946 
950 
953 
956  inline bool hasDriverState() const {
957  return myDriverState != nullptr;
958  }
959 
962 
964  bool stopsAt(MSStoppingPlace* stop) const;
965 
967  bool stopsAtEdge(const MSEdge* edge) const;
968 
971  bool willStop() const;
972 
974  bool isStoppedOnLane() const;
975 
977  bool keepStopping(bool afterProcessing = false) const;
978 
982  SUMOTime collisionStopTime() const;
983 
987  bool isRemoteControlled() const;
988 
992  bool wasRemoteControlled(SUMOTime lookBack = DELTA_T) const;
993 
995  double nextStopDist() const {
996  return myStopDist;
997  }
999 
1000  int getLaneIndex() const;
1001 
1011  double getDistanceToPosition(double destPos, const MSEdge* destEdge) const;
1012 
1013 
1021  double processNextStop(double currentVelocity);
1022 
1023 
1031  std::pair<const MSVehicle* const, double> getLeader(double dist = 0) const;
1032 
1041  std::pair<const MSVehicle* const, double> getFollower(double dist = 0) const;
1042 
1049  double getTimeGapOnLane() const;
1050 
1051 
1056  void addTransportable(MSTransportable* transportable);
1057 
1060 
1064  enum Signalling {
1095  };
1096 
1097 
1103  LC_NEVER = 0, // lcModel shall never trigger changes at this level
1104  LC_NOCONFLICT = 1, // lcModel may trigger changes if not in conflict with TraCI request
1105  LC_ALWAYS = 2 // lcModel may always trigger changes of this level regardless of requests
1106  };
1107 
1108 
1111  LCP_ALWAYS = 0, // change regardless of blockers, adapt own speed and speed of blockers
1112  LCP_NOOVERLAP = 1, // change unless overlapping with blockers, adapt own speed and speed of blockers
1113  LCP_URGENT = 2, // change if not blocked, adapt own speed and speed of blockers
1114  LCP_OPPORTUNISTIC = 3 // change if not blocked
1115  };
1116 
1117 
1121  void switchOnSignal(int signal) {
1122  mySignals |= signal;
1123  }
1124 
1125 
1129  void switchOffSignal(int signal) {
1130  mySignals &= ~signal;
1131  }
1132 
1133 
1137  int getSignals() const {
1138  return mySignals;
1139  }
1140 
1141 
1146  bool signalSet(int which) const {
1147  return (mySignals & which) != 0;
1148  }
1150 
1151 
1153  bool unsafeLinkAhead(const MSLane* lane) const;
1154 
1156  bool passingMinor() const;
1157 
1158 
1159 
1167  double getSpeedWithoutTraciInfluence() const;
1168 
1173  bool rerouteParkingArea(const std::string& parkingAreaID, std::string& errorMsg);
1174 
1181  bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string& errorMsg);
1182 
1183  bool handleCollisionStop(MSStop& stop, const double distToStop);
1184 
1189  bool resumeFromStopping();
1190 
1192  double updateFurtherLanes(std::vector<MSLane*>& furtherLanes,
1193  std::vector<double>& furtherLanesPosLat,
1194  const std::vector<MSLane*>& passedLanes);
1195 
1197  PositionVector getBoundingBox(double offset = 0) const;
1198 
1200  PositionVector getBoundingPoly(double offset = 0) const;
1201 
1212  };
1213 
1216  bool setExitManoeuvre();
1218  void setManoeuvreType(const MSVehicle::ManoeuvreType mType);
1219 
1221  bool manoeuvreIsComplete() const;
1224 
1225 
1232  class Manoeuvre {
1233 
1234  public:
1236  Manoeuvre();
1237 
1239  Manoeuvre(const Manoeuvre& manoeuvre);
1240 
1242  Manoeuvre& operator=(const Manoeuvre& manoeuvre);
1243 
1245  bool operator!=(const Manoeuvre& manoeuvre);
1246 
1249 
1251  bool configureExitManoeuvre(MSVehicle* veh);
1252 
1255 
1257  bool
1258  manoeuvreIsComplete(const ManoeuvreType checkType) const;
1259 
1261  bool
1262  manoeuvreIsComplete() const;
1263 
1265  double getGUIIncrement() const;
1266 
1269 
1271  void setManoeuvreType(const MSVehicle::ManoeuvreType mType);
1272 
1273  private:
1276 
1278  std::string myManoeuvreStop;
1279 
1282 
1285 
1288 
1289  // @brief Angle (radians) through which parking vehicle moves in each sim step
1291  };
1292 
1293  // Current or previous (completed) manoeuvre
1295 
1308  class Influencer : public BaseInfluencer {
1309  private:
1310 
1320  void vehicleStateChanged(const SUMOVehicle* const vehicle, MSNet::VehicleState to, const std::string& info = "");
1321  };
1322 
1323 
1326  GapControlState();
1327  virtual ~GapControlState();
1329  static void init();
1331  static void cleanup();
1333  void activate(double tauOriginal, double tauTarget, double additionalGap, double duration, double changeRate, double maxDecel, const MSVehicle* refVeh);
1335  void deactivate();
1337  double tauOriginal;
1339  double tauCurrent;
1341  double tauTarget;
1350  double changeRate;
1352  double maxDecel;
1356  bool active;
1365 
1367  static std::map<const MSVehicle*, GapControlState*> refVehMap;
1368 
1369  private:
1371  };
1372 
1373 
1374  public:
1376  Influencer();
1377 
1379  ~Influencer();
1380 
1382  static void init();
1384  static void cleanup();
1385 
1389  void setSpeedTimeLine(const std::vector<std::pair<SUMOTime, double> >& speedTimeLine);
1390 
1393  void activateGapController(double originalTau, double newTimeHeadway, double newSpaceHeadway, double duration, double changeRate, double maxDecel, MSVehicle* refVeh = nullptr);
1394 
1397  void deactivateGapController();
1398 
1402  void setLaneTimeLine(const std::vector<std::pair<SUMOTime, int> >& laneTimeLine);
1403 
1407  void adaptLaneTimeLine(int indexShift);
1408 
1412  void setSublaneChange(double latDist);
1413 
1415  int getSpeedMode() const;
1416 
1418  int getLaneChangeMode() const;
1419 
1421 
1423 
1435  double influenceSpeed(SUMOTime currentTime, double speed, double vSafe, double vMin, double vMax);
1436 
1449  double gapControlSpeed(SUMOTime currentTime, const SUMOVehicle* veh, double speed, double vSafe, double vMin, double vMax);
1450 
1458  int influenceChangeDecision(const SUMOTime currentTime, const MSEdge& currentEdge, const int currentLaneIndex, int state);
1459 
1460 
1466  double changeRequestRemainingSeconds(const SUMOTime currentTime) const;
1467 
1472  inline bool getRespectJunctionPriority() const {
1474  }
1475 
1476 
1480  inline bool getEmergencyBrakeRedLight() const {
1481  return myEmergencyBrakeRedLight;
1482  }
1483 
1488  inline bool getRespectJunctionLeaderPriority() const {
1490  }
1491 
1492 
1494  bool considerSafeVelocity() const {
1495  return myConsiderSafeVelocity;
1496  }
1497 
1501  void setSpeedMode(int speedMode);
1502 
1506  void setLaneChangeMode(int value);
1507 
1511  double getOriginalSpeed() const;
1512 
1514  void setOriginalSpeed(double speed);
1515 
1516  void setRemoteControlled(Position xyPos, MSLane* l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t);
1517 
1519  return myLastRemoteAccess;
1520  }
1521 
1523 
1525  double implicitSpeedRemote(const MSVehicle* veh, double oldSpeed);
1526 
1528  double implicitDeltaPosRemote(const MSVehicle* veh);
1529 
1530  bool isRemoteControlled() const;
1531 
1532  bool isRemoteAffected(SUMOTime t) const;
1533 
1534  void setSignals(int signals) {
1535  myTraCISignals = signals;
1536  }
1537 
1538  int getSignals() const {
1539  return myTraCISignals;
1540  }
1541 
1542  double getLatDist() const {
1543  return myLatDist;
1544  }
1545 
1546  void resetLatDist() {
1547  myLatDist = 0.;
1548  }
1549 
1550  bool ignoreOverlap() const {
1552  }
1553 
1554  private:
1556  std::vector<std::pair<SUMOTime, double> > mySpeedTimeLine;
1557 
1559  std::vector<std::pair<SUMOTime, int> > myLaneTimeLine;
1560 
1562  std::shared_ptr<GapControlState> myGapControlState;
1563 
1566 
1568  double myLatDist;
1569 
1572 
1575 
1578 
1581 
1584 
1587 
1590 
1593  double myRemotePos;
1599 
1601 
1615 
1616  // @brief the signals set via TraCI
1618 
1619  };
1620 
1621 
1629 
1630  const BaseInfluencer* getBaseInfluencer() const;
1631  const Influencer* getInfluencer() const;
1632 
1633  bool hasInfluencer() const {
1634  return myInfluencer != nullptr;
1635  }
1636 
1638  int influenceChangeDecision(int state);
1639 
1641  void setRemoteState(Position xyPos);
1642 
1644  double getSafeFollowSpeed(const std::pair<const MSVehicle*, double> leaderInfo,
1645  const double seen, const MSLane* const lane, double distToCrossing) const;
1646 
1648  static int nextLinkPriority(const std::vector<MSLane*>& conts);
1649 
1651  bool isLeader(const MSLink* link, const MSVehicle* veh) const;
1652 
1653  // @brief get the position of the back bumper;
1654  const Position getBackPosition() const;
1655 
1657  bool ignoreCollision() const;
1658 
1660  void updateParkingState();
1661 
1666  void replaceVehicleType(MSVehicleType* type);
1667 
1669 
1670 
1672  void saveState(OutputDevice& out);
1673 
1676  void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset);
1677 
1678  void loadPreviousApproaching(MSLink* link, bool setRequest,
1679  SUMOTime arrivalTime, double arrivalSpeed,
1680  SUMOTime arrivalTimeBraking, double arrivalSpeedBraking,
1681  double dist, double leaveSpeed);
1683 
1684 protected:
1685 
1688 
1704  void adaptLaneEntering2MoveReminder(const MSLane& enteredLane);
1706 
1707 
1715  void processLinkApproaches(double& vSafe, double& vSafeMin, double& vSafeMinDist);
1716 
1717 
1725  void processLaneAdvances(std::vector<MSLane*>& passedLanes, std::string& emergencyReason);
1726 
1727 
1735  double processTraCISpeedControl(double vSafe, double vNext);
1736 
1737 
1744  void removePassedDriveItems();
1745 
1748  void updateWaitingTime(double vNext);
1749 
1752  void updateTimeLoss(double vNext);
1753 
1754  /* @brief Check whether the vehicle is a train that can reverse its direction at the current point in its route
1755  * and return the speed in preparation for reversal
1756  *
1757  * @param[out] canReverse
1758  * @param[in] speedThreshold
1759  * @return speed for reversal
1760  */
1761  double checkReversal(bool& canReverse, double speedThreshold = SUMO_const_haltingSpeed, double seen = 0) const;
1762 
1765  void setBrakingSignals(double vNext) ;
1766 
1769  void setBlinkerInformation();
1770 
1773  void setEmergencyBlueLight(SUMOTime currentTime);
1774 
1776  void computeFurtherLanes(MSLane* enteredLane, double pos, bool collision = false);
1777 
1779  void updateOccupancyAndCurrentBestLane(const MSLane* startLane);
1780 
1782  double getBrakeGap(bool delayed = false) const;
1783 
1785  Position validatePosition(Position result, double offset = 0) const;
1786 
1788  virtual void drawOutsideNetwork(bool /*add*/) {};
1789 
1791  void boardTransportables(MSStop& stop);
1792 
1794  bool joinTrainPart(MSVehicle* veh);
1795 
1797  bool joinTrainPartFront(MSVehicle* veh);
1798 
1799 protected:
1800 
1804 
1806  double myTimeLoss;
1807 
1810 
1813 
1819 
1820 
1821 
1824 
1826 
1829 
1830  /* @brief Complex data structure for keeping and updating LaneQ:
1831  * Each element of the outer vector corresponds to an upcoming edge on the vehicles route
1832  * The first element corresponds to the current edge and is returned in getBestLanes()
1833  * The other elements are only used as a temporary structure in updateBestLanes();
1834  */
1835  std::vector<std::vector<LaneQ> > myBestLanes;
1836 
1837  /* @brief iterator to speed up retrieval of the current lane's LaneQ in getBestLaneOffset() and getBestLanesContinuation()
1838  * This is updated in updateOccupancyAndCurrentBestLane()
1839  */
1840  std::vector<LaneQ>::iterator myCurrentLaneInBestLanes;
1841 
1842  static std::vector<MSLane*> myEmptyLaneVector;
1843 
1846 
1849  std::pair<double, LinkDirection> myNextTurn;
1850 
1852  std::vector<MSLane*> myFurtherLanes;
1854  std::vector<double> myFurtherLanesPosLat;
1855 
1858 
1861 
1864 
1867 
1870 
1872 
1874  double myAngle;
1875 
1877  double myStopDist;
1878 
1881 
1883 
1888 
1889 protected:
1890 
1896  double myVLinkPass;
1897  double myVLinkWait;
1903  double myDistance;
1904  double accelV;
1907 
1908  DriveProcessItem(MSLink* link, double vPass, double vWait, bool setRequest,
1909  SUMOTime arrivalTime, double arrivalSpeed,
1910  SUMOTime arrivalTimeBraking, double arrivalSpeedBraking,
1911  double distance,
1912  double leaveSpeed = -1.) :
1913  myLink(link), myVLinkPass(vPass), myVLinkWait(vWait), mySetRequest(setRequest),
1914  myArrivalTime(arrivalTime), myArrivalSpeed(arrivalSpeed),
1915  myArrivalTimeBraking(arrivalTimeBraking), myArrivalSpeedBraking(arrivalSpeedBraking),
1916  myDistance(distance),
1917  accelV(leaveSpeed), hadStoppedVehicle(false), availableSpace(0) {
1918  assert(vWait >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1919  assert(vPass >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1920  };
1921 
1922 
1924  DriveProcessItem(double vWait, double distance, double _availableSpace = 0) :
1925  myLink(0), myVLinkPass(vWait), myVLinkWait(vWait), mySetRequest(false),
1928  myDistance(distance),
1929  accelV(-1), hadStoppedVehicle(false), availableSpace(_availableSpace) {
1930  assert(vWait >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1931  };
1932 
1933 
1934  inline void adaptLeaveSpeed(const double v) {
1935  if (accelV < 0) {
1936  accelV = v;
1937  } else {
1938  accelV = MIN2(accelV, v);
1939  }
1940  }
1941  inline double getLeaveSpeed() const {
1942  return accelV < 0 ? myVLinkPass : accelV;
1943  }
1944  };
1945 
1947  // TODO: Consider making LFLinkLanes a std::deque for efficient front removal (needs refactoring in checkRewindLinkLanes()...)
1948  typedef std::vector< DriveProcessItem > DriveItemVector;
1949 
1952 
1955 
1961  DriveItemVector::iterator myNextDriveItem;
1962 
1964  void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector& lfLinks, double& myStopDist, std::pair<double, LinkDirection>& myNextTurn) const;
1965 
1967  void checkRewindLinkLanes(const double lengthsInFront, DriveItemVector& lfLinks) const;
1968 
1970  void removeApproachingInformation(const DriveItemVector& lfLinks) const;
1971 
1972  /* @brief adapt safe velocity in accordance to a moving obstacle:
1973  * - a leader vehicle
1974  * - a vehicle or pedestrian that crosses this vehicles path on an upcoming intersection
1975  * @param[in] leaderInfo The leading vehicle and the (virtual) distance to it
1976  * @param[in] seen the distance to the end of the current lane
1977  * @param[in] lastLink the lastLink index
1978  * @param[in] lane The current Lane the vehicle is on
1979  * @param[in,out] the safe velocity for driving
1980  * @param[in,out] the safe velocity for arriving at the next link
1981  * @param[in] distToCrossing The distance to the crossing point with the current leader where relevant or -1
1982  */
1983  void adaptToLeader(const std::pair<const MSVehicle*, double> leaderInfo,
1984  const double seen, DriveProcessItem* const lastLink,
1985  const MSLane* const lane, double& v, double& vLinkPass,
1986  double distToCrossing = -1) const;
1987 
1988  /* @brief adapt safe velocity in accordance to multiple vehicles ahead:
1989  * @param[in] ahead The leader information according to the current lateral-resolution
1990  * @param[in] latOffset the lateral offset for locating the ego vehicle on the given lane
1991  * @param[in] seen the distance to the end of the current lane
1992  * @param[in] lastLink the lastLink index
1993  * @param[in] lane The current Lane the vehicle is on
1994  * @param[in,out] the safe velocity for driving
1995  * @param[in,out] the safe velocity for arriving at the next link
1996  */
1997  void adaptToLeaders(const MSLeaderInfo& ahead,
1998  double latOffset,
1999  const double seen, DriveProcessItem* const lastLink,
2000  const MSLane* const lane, double& v, double& vLinkPass) const;
2001 
2002  void adaptToLeaderDistance(const MSLeaderDistanceInfo& ahead, double latOffset,
2003  const double seen, DriveProcessItem* const lastLink,
2004  const MSLane* const lane, double& v, double& vLinkPass) const;
2005 
2007  void checkLinkLeader(const MSLink* link, const MSLane* lane, double seen,
2008  DriveProcessItem* const lastLink, double& v, double& vLinkPass, double& vLinkWait, bool& setRequest,
2009  bool isShadowLink = false) const;
2010 
2012  void checkLinkLeaderCurrentAndParallel(const MSLink* link, const MSLane* lane, double seen,
2013  DriveProcessItem* const lastLink, double& v, double& vLinkPass, double& vLinkWait, bool& setRequest) const;
2014 
2015 
2016  // @brief return the lane on which the back of this vehicle resides
2017  const MSLane* getBackLane() const;
2018 
2026  void updateState(double vNext);
2027 
2028 
2030  bool keepClear(const MSLink* link) const;
2031 
2033  bool ignoreRed(const MSLink* link, bool canBrake) const;
2034 
2035  double estimateTimeToNextStop() const;
2036 
2037  /* @brief special considerations for opposite direction driving so that the
2038  * result can be used directly by getPositionOnLane(...) */
2039  double getBackPositionOnLane(const MSLane* lane, bool calledByGetPosition) const;
2040 
2047  bool hasArrivedInternal(bool oppositeTransformed = true) const;
2048 
2049 
2050  SUMOTime getArrivalTime(SUMOTime t, double seen, double v, double arrivalSpeed) const;
2051 
2052 private:
2055 
2058 
2059 
2060 private:
2063 
2066 
2069 
2070 };
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:32
T MIN2(T a, T b)
Definition: StdDefs.h:74
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:61
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:103
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
saves leader/follower vehicles and their distances relative to an ego vehicle
Definition: MSLeaderInfo.h:133
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:627
VehicleState
Definition of a vehicle state.
Definition: MSNet.h:594
Definition of overhead wire segment.
A lane area vehicles can halt at.
Definition: MSParkingArea.h:58
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:1313
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:1308
void setLaneChangeMode(int value)
Sets lane changing behavior.
Definition: MSVehicle.cpp:778
TraciLaneChangePriority myTraciLaneChangePriority
flags for determining the priority of traci lane change requests
Definition: MSVehicle.h:1614
bool getEmergencyBrakeRedLight() const
Returns whether red lights shall be a reason to brake.
Definition: MSVehicle.h:1480
SUMOTime getLaneTimeLineEnd()
Definition: MSVehicle.cpp:467
void adaptLaneTimeLine(int indexShift)
Adapts lane timeline when moving to a new lane and the lane index changes.
Definition: MSVehicle.cpp:419
void setRemoteControlled(Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector &route, SUMOTime t)
Definition: MSVehicle.cpp:789
bool isRemoteAffected(SUMOTime t) const
Definition: MSVehicle.cpp:808
int getSpeedMode() const
return the current speed mode
Definition: MSVehicle.cpp:432
void deactivateGapController()
Deactivates the gap control.
Definition: MSVehicle.cpp:406
Influencer()
Constructor.
Definition: MSVehicle.cpp:357
void setSpeedMode(int speedMode)
Sets speed-constraining behaviors.
Definition: MSVehicle.cpp:767
std::shared_ptr< GapControlState > myGapControlState
The gap control state.
Definition: MSVehicle.h:1562
bool considerSafeVelocity() const
Returns whether safe velocities shall be considered.
Definition: MSVehicle.h:1494
int getSignals() const
Definition: MSVehicle.h:1538
bool myConsiderMaxDeceleration
Whether the maximum deceleration shall be regarded.
Definition: MSVehicle.h:1580
ConstMSEdgeVector myRemoteRoute
Definition: MSVehicle.h:1597
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, int > > &laneTimeLine)
Sets a new lane timeline.
Definition: MSVehicle.cpp:413
bool myRespectJunctionLeaderPriority
Whether the junction priority rules are respected (within)
Definition: MSVehicle.h:1589
void setOriginalSpeed(double speed)
Stores the originally longitudinal speed.
Definition: MSVehicle.cpp:658
double myOriginalSpeed
The velocity before influence.
Definition: MSVehicle.h:1565
double getLatDist() const
Definition: MSVehicle.h:1542
double implicitDeltaPosRemote(const MSVehicle *veh)
return the change in longitudinal position that is implicit in the new remote position
Definition: MSVehicle.cpp:896
double implicitSpeedRemote(const MSVehicle *veh, double oldSpeed)
return the speed that is implicit in the new remote position
Definition: MSVehicle.cpp:869
void postProcessRemoteControl(MSVehicle *v)
Definition: MSVehicle.cpp:813
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:427
double getOriginalSpeed() const
Returns the originally longitudinal speed to use.
Definition: MSVehicle.cpp:653
SUMOTime myLastRemoteAccess
Definition: MSVehicle.h:1598
std::vector< std::pair< SUMOTime, int > > myLaneTimeLine
The lane usage time line to apply.
Definition: MSVehicle.h:1559
bool getRespectJunctionLeaderPriority() const
Returns whether junction priority rules within the junction shall be respected (concerns vehicles wit...
Definition: MSVehicle.h:1488
LaneChangeMode myStrategicLC
lane changing which is necessary to follow the current route
Definition: MSVehicle.h:1603
LaneChangeMode mySpeedGainLC
lane changing to travel with higher speed
Definition: MSVehicle.h:1607
static void init()
Static initalization.
Definition: MSVehicle.cpp:382
LaneChangeMode mySublaneLC
changing to the prefered lateral alignment
Definition: MSVehicle.h:1611
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected (concerns approaching vehicles outside the...
Definition: MSVehicle.h:1472
static void cleanup()
Static cleanup.
Definition: MSVehicle.cpp:387
int getLaneChangeMode() const
return the current lane change mode
Definition: MSVehicle.cpp:444
SUMOTime getLaneTimeLineDuration()
Definition: MSVehicle.cpp:454
double influenceSpeed(SUMOTime currentTime, double speed, double vSafe, double vMin, double vMax)
Applies stored velocity information on the speed to use.
Definition: MSVehicle.cpp:477
double changeRequestRemainingSeconds(const SUMOTime currentTime) const
Return the remaining number of seconds of the current laneTimeLine assuming one exists.
Definition: MSVehicle.cpp:759
bool myConsiderSafeVelocity
Whether the safe velocity shall be regarded.
Definition: MSVehicle.h:1574
bool mySpeedAdaptationStarted
Whether influencing the speed has already started.
Definition: MSVehicle.h:1571
~Influencer()
Destructor.
Definition: MSVehicle.cpp:379
void setSignals(int signals)
Definition: MSVehicle.h:1534
double myLatDist
The requested lateral change.
Definition: MSVehicle.h:1568
bool myEmergencyBrakeRedLight
Whether red lights are a reason to brake.
Definition: MSVehicle.h:1586
LaneChangeMode myRightDriveLC
changing to the rightmost lane
Definition: MSVehicle.h:1609
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, double > > &speedTimeLine)
Sets a new velocity timeline.
Definition: MSVehicle.cpp:392
std::vector< std::pair< SUMOTime, double > > mySpeedTimeLine
The velocity time line to apply.
Definition: MSVehicle.h:1556
SUMOTime getLastAccessTimeStep() const
Definition: MSVehicle.h:1518
bool myConsiderMaxAcceleration
Whether the maximum acceleration shall be regarded.
Definition: MSVehicle.h:1577
LaneChangeMode myCooperativeLC
lane changing with the intent to help other vehicles
Definition: MSVehicle.h:1605
bool isRemoteControlled() const
Definition: MSVehicle.cpp:802
bool ignoreOverlap() const
Definition: MSVehicle.h:1550
bool myRespectJunctionPriority
Whether the junction priority rules are respected (approaching)
Definition: MSVehicle.h:1583
int influenceChangeDecision(const SUMOTime currentTime, const MSEdge &currentEdge, const int currentLaneIndex, int state)
Applies stored LaneChangeMode information and laneTimeLine.
Definition: MSVehicle.cpp:664
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:398
Container for manouevering time associated with stopping.
Definition: MSVehicle.h:1232
SUMOTime myManoeuvreCompleteTime
Time at which this manoeuvre should complete.
Definition: MSVehicle.h:1284
MSVehicle::ManoeuvreType getManoeuvreType() const
Accessor (get) for manoeuvre type.
Definition: MSVehicle.cpp:6815
std::string myManoeuvreStop
The name of the stop associated with the Manoeuvre - for debug output.
Definition: MSVehicle.h:1278
bool manoeuvreIsComplete() const
Check if any manoeuver is ongoing and whether the completion time is beyond currentTime.
Definition: MSVehicle.cpp:6949
bool configureExitManoeuvre(MSVehicle *veh)
Setup the myManoeuvre for exiting (Sets completion time and manoeuvre type)
Definition: MSVehicle.cpp:6868
void setManoeuvreType(const MSVehicle::ManoeuvreType mType)
Accessor (set) for manoeuvre type.
Definition: MSVehicle.cpp:6831
Manoeuvre & operator=(const Manoeuvre &manoeuvre)
Assignment operator.
Definition: MSVehicle.cpp:6790
Manoeuvre()
Constructor.
Definition: MSVehicle.cpp:6779
std::string myManoeuvreVehicleID
The name of the vehicle associated with the Manoeuvre - for debug output.
Definition: MSVehicle.h:1275
ManoeuvreType myManoeuvreType
Manoeuvre type - currently entry, exit or none.
Definition: MSVehicle.h:1287
double getGUIIncrement() const
Accessor for GUI rotation step when parking (radians)
Definition: MSVehicle.cpp:6810
SUMOTime myManoeuvreStartTime
Time at which the Manoeuvre for this stop started.
Definition: MSVehicle.h:1281
bool operator!=(const Manoeuvre &manoeuvre)
Operator !=.
Definition: MSVehicle.cpp:6800
bool entryManoeuvreIsComplete(MSVehicle *veh)
Configure an entry manoeuvre if nothing is configured - otherwise check if complete.
Definition: MSVehicle.cpp:6910
bool configureEntryManoeuvre(MSVehicle *veh)
Setup the entry manoeuvre for this vehicle (Sets completion time and manoeuvre type)
Definition: MSVehicle.cpp:6837
Container that holds the vehicles driving state (position+speed).
Definition: MSVehicle.h:85
double lastCoveredDist() const
previous Speed of this state
Definition: MSVehicle.h:125
double myPosLat
the stored lateral position
Definition: MSVehicle.h:138
double myPreviousSpeed
the speed at the begin of the previous time step
Definition: MSVehicle.h:146
double myPos
the stored position
Definition: MSVehicle.h:132
bool operator!=(const State &state)
Operator !=.
Definition: MSVehicle.cpp:155
double myLastCoveredDist
Definition: MSVehicle.h:152
double mySpeed
the stored speed (should be >=0 at any time)
Definition: MSVehicle.h:135
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:115
double pos() const
Position of this state.
Definition: MSVehicle.h:105
double speed() const
Speed of this state.
Definition: MSVehicle.h:110
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:120
double myBackPos
the stored back position
Definition: MSVehicle.h:143
Stores the waiting intervals over the previous seconds (memory is to be specified in ms....
Definition: MSVehicle.h:160
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:182
void setState(const std::string &state)
Definition: MSVehicle.cpp:242
SUMOTime myMemorySize
the maximal memory to store
Definition: MSVehicle.h:177
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:75
void setManoeuvreType(const MSVehicle::ManoeuvreType mType)
accessor function to myManoeuvre equivalent
Definition: MSVehicle.cpp:6826
TraciLaneChangePriority
modes for prioritizing traci lane change requests
Definition: MSVehicle.h:1110
@ LCP_NOOVERLAP
Definition: MSVehicle.h:1112
@ LCP_OPPORTUNISTIC
Definition: MSVehicle.h:1114
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:5894
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:6449
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:3075
const std::vector< double > & getFurtherLanesPosLat() const
Definition: MSVehicle.h:796
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:2854
void checkRewindLinkLanes(const double lengthsInFront, DriveItemVector &lfLinks) const
runs heuristic for keeping the intersection clear in case of downstream jamming
Definition: MSVehicle.cpp:4471
MSVehicle(const MSVehicle &)
invalidated copy constructor
bool willStop() const
Returns whether the vehicle will stop on the current edge.
Definition: MSVehicle.cpp:1472
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:2983
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:2802
bool hasDriverState() const
Whether this vehicle is equipped with a MSDriverState.
Definition: MSVehicle.h:956
static int nextLinkPriority(const std::vector< MSLane * > &conts)
get a numerical value for the priority of the upcoming link
Definition: MSVehicle.cpp:5459
double getTimeGapOnLane() const
Returns the time gap in seconds to the leader of the vehicle on the same lane.
Definition: MSVehicle.cpp:5769
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
Definition: MSVehicle.cpp:5069
bool myAmIdling
Whether the vehicle is trying to enter the network (eg after parking so engine is running)
Definition: MSVehicle.h:1863
SUMOTime myWaitingTime
The time the vehicle waits (is not faster than 0.1m/s) in seconds.
Definition: MSVehicle.h:1802
double getStopDelay() const
Returns the public transport stop delay in seconds.
Definition: MSVehicle.cpp:7052
double computeAngle() const
compute the current vehicle angle
Definition: MSVehicle.cpp:1330
double myTimeLoss
the time loss in seconds due to driving with less than maximum speed
Definition: MSVehicle.h:1806
SUMOTime myLastActionTime
Action offset (actions are taken at time myActionOffset + N*getActionStepLength()) Initialized to 0,...
Definition: MSVehicle.h:1818
bool hasArrivedInternal(bool oppositeTransformed=true) const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) metho...
Definition: MSVehicle.cpp:1038
bool replaceParkingArea(MSParkingArea *parkingArea, std::string &errorMsg)
replace the current parking area stop with a new stop with merge duration
Definition: MSVehicle.cpp:1411
void boardTransportables(MSStop &stop)
board persons and load transportables at the given stop
Definition: MSVehicle.cpp:1767
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:5525
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition: MSVehicle.h:574
void adaptLaneEntering2MoveReminder(const MSLane &enteredLane)
Adapts the vehicle's entering of a new lane.
Definition: MSVehicle.cpp:1106
void addTransportable(MSTransportable *transportable)
Adds a person or container to this vehicle.
Definition: MSVehicle.cpp:5780
MSParkingArea * getNextParkingArea()
get the upcoming parking area stop or nullptr
Definition: MSVehicle.cpp:1448
SUMOTime myJunctionConflictEntryTime
Definition: MSVehicle.h:1887
SUMOTime getLastActionTime() const
Returns the time of the vehicle's last action point.
Definition: MSVehicle.h:512
PositionVector getBoundingPoly(double offset=0) const
get bounding polygon
Definition: MSVehicle.cpp:6166
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:5878
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:631
const std::vector< MSLane * > & getFurtherLanes() const
Definition: MSVehicle.h:792
void workOnMoveReminders(double oldPos, double newPos, double newSpeed)
Processes active move reminder.
Definition: MSVehicle.cpp:1062
void setPreviousSpeed(double prevspeed)
Sets the influenced previous speed.
Definition: MSVehicle.cpp:6756
bool isStoppedOnLane() const
Definition: MSVehicle.cpp:1477
double myAcceleration
The current acceleration after dawdling in m/s.
Definition: MSVehicle.h:1845
SUMOTime getTimeLoss() const
Returns the SUMOTime lost (speed was lesser maximum speed)
Definition: MSVehicle.h:644
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:2713
bool isActive() const
Returns whether the current simulation step is an action point for the vehicle.
Definition: MSVehicle.h:597
const MSLane * getBackLane() const
Definition: MSVehicle.cpp:4267
double getTimeLossSeconds() const
Returns the time loss in seconds.
Definition: MSVehicle.h:668
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:4929
std::pair< double, LinkDirection > myNextTurn
the upcoming turn for the vehicle
Definition: MSVehicle.h:1849
double getBackPositionOnLane() const
Get the vehicle's position relative to its current lane.
Definition: MSVehicle.h:403
SUMOTime getArrivalTime(SUMOTime t, double seen, double v, double arrivalSpeed) const
Definition: MSVehicle.cpp:2694
double getAccumulatedWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s) within the last millisecs.
Definition: MSVehicle.h:662
bool isFrontOnLane(const MSLane *lane) const
Returns the information whether the front of the vehicle is on the given lane.
Definition: MSVehicle.cpp:4465
virtual ~MSVehicle()
Destructor.
Definition: MSVehicle.cpp:954
bool myAmRegisteredAsWaitingForPerson
Whether this vehicle is registered as waiting for a person (for deadlock-recognition)
Definition: MSVehicle.h:1866
bool stopsAt(MSStoppingPlace *stop) const
Returns whether the vehicle stops at the given stopping place.
Definition: MSVehicle.cpp:1874
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:3749
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:5051
void setEmergencyBlueLight(SUMOTime currentTime)
sets the blue flashing light for emergency vehicles
Definition: MSVehicle.cpp:5858
bool isActionStep(SUMOTime t) const
Returns whether the next simulation step will be an action point for the vehicle.
Definition: MSVehicle.h:604
MSAbstractLaneChangeModel * myLaneChangeModel
Definition: MSVehicle.h:1825
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:1175
bool hasValidRouteStart(std::string &msg)
checks wether the vehicle can depart on the first edge
Definition: MSVehicle.cpp:1000
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
Definition: MSVehicle.h:1852
bool signalSet(int which) const
Returns whether the given signal is on.
Definition: MSVehicle.h:1146
MSLane * getMutableLane() const
Returns the lane the vehicle is on Non const version indicates that something volatile is going on.
Definition: MSVehicle.h:560
MSCFModel::VehicleVariables * myCFVariables
The per vehicle variables of the car following model.
Definition: MSVehicle.h:2054
double getActionStepLengthSecs() const
Returns the vehicle's action step length in secs, i.e. the interval between two action points.
Definition: MSVehicle.h:504
bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string &errorMsg)
Definition: MSVehicle.cpp:6291
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:2838
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
Definition: MSVehicle.cpp:6424
double getMaxSpeedOnLane() const
Returns the maximal speed for the vehicle on its current lane (including speed factor and deviation,...
Definition: MSVehicle.cpp:1241
bool isRemoteControlled() const
Returns the information whether the vehicle is fully controlled via TraCI.
Definition: MSVehicle.cpp:6443
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived)
Definition: MSVehicle.h:1860
double nextStopDist() const
return the distance to the next stop or doubleMax if there is none.
Definition: MSVehicle.h:995
void enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
Definition: MSVehicle.cpp:4772
void adaptBestLanesOccupation(int laneIndex, double density)
update occupation from MSLaneChanger
Definition: MSVehicle.cpp:5678
void loadPreviousApproaching(MSLink *link, bool setRequest, SUMOTime arrivalTime, double arrivalSpeed, SUMOTime arrivalTimeBraking, double arrivalSpeedBraking, double dist, double leaveSpeed)
Definition: MSVehicle.cpp:6738
void setAngle(double angle, bool straightenFurther=false)
Set a custom vehicle angle in rad, optionally updates furtherLanePosLat.
Definition: MSVehicle.cpp:1284
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
Definition: MSVehicle.h:1840
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:3053
const MSLane * myLastBestLanesInternalLane
Definition: MSVehicle.h:1828
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
Definition: MSVehicle.cpp:5475
const std::vector< MSLane * > getUpstreamOppositeLanes() const
Returns the sequence of opposite lanes corresponding to past lanes.
Definition: MSVehicle.cpp:5652
WaitingTimeCollector myWaitingTimeCollector
Definition: MSVehicle.h:1803
void setRemoteState(Position xyPos)
sets position outside the road network
Definition: MSVehicle.cpp:6437
void fixPosition()
repair errors in vehicle position after changing between internal edges
Definition: MSVehicle.cpp:5686
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:485
double getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
Definition: MSVehicle.cpp:6414
PositionVector getBoundingBox(double offset=0) const
get bounding rectangle
Definition: MSVehicle.cpp:6135
ManoeuvreType
flag identifying which, if any, manoeuvre is in progress
Definition: MSVehicle.h:1205
@ MANOEUVRE_ENTRY
Manoeuvre into stopping place.
Definition: MSVehicle.h:1207
@ MANOEUVRE_NONE
not manouevring
Definition: MSVehicle.h:1211
@ MANOEUVRE_EXIT
Manoeuvre out of stopping place.
Definition: MSVehicle.h:1209
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:1142
void setBrakingSignals(double vNext)
sets the braking lights on/off
Definition: MSVehicle.cpp:3576
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
Definition: MSVehicle.cpp:5497
double estimateTimeToNextStop() const
Definition: MSVehicle.cpp:6958
MSParkingArea * getCurrentParkingArea()
get the current parking area stop or nullptr
Definition: MSVehicle.cpp:1462
const MSEdge * myLastBestLanesEdge
Definition: MSVehicle.h:1827
bool ignoreCollision() const
whether this vehicle is except from collision checks
Definition: MSVehicle.cpp:1509
Influencer * myInfluencer
An instance of a velocity/lane influencing instance; built in "getInfluencer".
Definition: MSVehicle.h:2057
void saveState(OutputDevice &out)
Saves the states of a vehicle.
Definition: MSVehicle.cpp:6646
bool replaceRoute(const MSRoute *route, const std::string &info, bool onInit=false, int offset=0, bool addStops=true, bool removeStops=true, std::string *msgReturn=nullptr)
Replaces the current route by the given one.
Definition: MSVehicle.cpp:1047
void setIdling(bool amIdling)
access function for Idling flag used to record whether vehicle is waiting to enter lane (after parkin...
Definition: MSVehicle.h:582
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
Definition: MSVehicle.cpp:978
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:1941
bool resumeFromStopping()
Definition: MSVehicle.cpp:6329
int getBestLaneOffset() const
Definition: MSVehicle.cpp:5668
double lateralDistanceToLane(const int offset) const
Get the minimal lateral distance required to move fully onto the lane at given offset.
Definition: MSVehicle.cpp:6012
bool stopsAtEdge(const MSEdge *edge) const
Returns whether the vehicle stops at the given edge.
Definition: MSVehicle.cpp:1890
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
Definition: MSVehicle.h:396
void resetActionOffset(const SUMOTime timeUntilNextAction=0)
Resets the action offset for the vehicle.
Definition: MSVehicle.cpp:1916
std::vector< DriveProcessItem > DriveItemVector
Container for used Links/visited Lanes during planMove() and executeMove.
Definition: MSVehicle.h:1948
void setBlinkerInformation()
sets the blue flashing light for emergency vehicles
Definition: MSVehicle.cpp:5797
DriveItemVector::iterator myNextDriveItem
iterator pointing to the next item in myLFLinkLanes
Definition: MSVehicle.h:1961
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:4965
bool isIdling() const
Returns whether a sim vehicle is waiting to enter a lane (after parking has completed)
Definition: MSVehicle.h:590
std::shared_ptr< MSSimpleDriverState > getDriverState() const
Returns the vehicle driver's state.
Definition: MSVehicle.cpp:6750
void removeApproachingInformation(const DriveItemVector &lfLinks) const
unregister approach from all upcoming links
Definition: MSVehicle.cpp:6070
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
Definition: MSVehicle.cpp:4259
SUMOTime myJunctionEntryTimeNeverYield
Definition: MSVehicle.h:1886
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:5941
bool rerouteParkingArea(const std::string &parkingAreaID, std::string &errorMsg)
Definition: MSVehicle.cpp:6215
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge)
Definition: MSVehicle.cpp:1032
const MSEdge * getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
Definition: MSVehicle.cpp:1271
void switchOffSignal(int signal)
Switches the given signal off.
Definition: MSVehicle.h:1129
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:4190
double getStopArrivalDelay() const
Returns the estimated public transport stop arrival delay in seconds.
Definition: MSVehicle.cpp:7073
int getSignals() const
Returns the signals.
Definition: MSVehicle.h:1137
int mySignals
State of things of the vehicle that can be on or off.
Definition: MSVehicle.h:1857
bool setExitManoeuvre()
accessor function to myManoeuvre equivalent
Definition: MSVehicle.cpp:6771
double myStopDist
distance to the next stop or doubleMax if there is none
Definition: MSVehicle.h:1877
bool myAmRegisteredAsWaitingForContainer
Whether this vehicle is registered as waiting for a container (for deadlock-recognition)
Definition: MSVehicle.h:1869
Signalling
Some boolean values which describe the state of some vehicle parts.
Definition: MSVehicle.h:1064
@ VEH_SIGNAL_EMERGENCY_RED
A red emergency light is on.
Definition: MSVehicle.h:1092
@ VEH_SIGNAL_NONE
Everything is switched off.
Definition: MSVehicle.h:1066
@ VEH_SIGNAL_FOGLIGHT
The fog lights are on (no visualisation)
Definition: MSVehicle.h:1078
@ VEH_SIGNAL_FRONTLIGHT
The front lights are on (no visualisation)
Definition: MSVehicle.h:1076
@ VEH_SIGNAL_DOOR_OPEN_LEFT
One of the left doors is opened.
Definition: MSVehicle.h:1086
@ VEH_SIGNAL_BLINKER_RIGHT
Right blinker lights are switched on.
Definition: MSVehicle.h:1068
@ VEH_SIGNAL_BRAKELIGHT
The brake lights are on.
Definition: MSVehicle.h:1074
@ VEH_SIGNAL_BACKDRIVE
The backwards driving lights are on (no visualisation)
Definition: MSVehicle.h:1082
@ VEH_SIGNAL_EMERGENCY_BLUE
A blue emergency light is on.
Definition: MSVehicle.h:1090
@ VEH_SIGNAL_BLINKER_LEFT
Left blinker lights are switched on.
Definition: MSVehicle.h:1070
@ VEH_SIGNAL_DOOR_OPEN_RIGHT
One of the right doors is opened.
Definition: MSVehicle.h:1088
@ VEH_SIGNAL_BLINKER_EMERGENCY
Blinker lights on both sides are switched on.
Definition: MSVehicle.h:1072
@ VEH_SIGNAL_WIPER
The wipers are on.
Definition: MSVehicle.h:1084
@ VEH_SIGNAL_EMERGENCY_YELLOW
A yellow emergency light is on.
Definition: MSVehicle.h:1094
@ VEH_SIGNAL_HIGHBEAM
The high beam lights are on (no visualisation)
Definition: MSVehicle.h:1080
bool isLeader(const MSLink *link, const MSVehicle *veh) const
whether the given vehicle must be followed at the given junction
Definition: MSVehicle.cpp:6527
SUMOTime getActionStepLength() const
Returns the vehicle's action step length in millisecs, i.e. the interval between two action points.
Definition: MSVehicle.h:496
bool myHaveToWaitOnNextLink
Definition: MSVehicle.h:1871
SUMOTime collisionStopTime() const
Returns the remaining time a vehicle needs to stop due to a collision. A negative value indicates tha...
Definition: MSVehicle.cpp:1503
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:5594
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:5727
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
Definition: MSVehicle.cpp:3909
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:5757
double getLastStepDist() const
Get the distance the vehicle covered in the previous timestep.
Definition: MSVehicle.h:379
void invalidateCachedPosition()
Definition: MSVehicle.h:419
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:784
ChangeRequest
Requests set via TraCI.
Definition: MSVehicle.h:192
@ REQUEST_HOLD
vehicle want's to keep the current lane
Definition: MSVehicle.h:200
@ REQUEST_LEFT
vehicle want's to change to left lane
Definition: MSVehicle.h:196
@ REQUEST_NONE
vehicle doesn't want to change
Definition: MSVehicle.h:194
@ REQUEST_RIGHT
vehicle want's to change to right lane
Definition: MSVehicle.h:198
void computeFurtherLanes(MSLane *enteredLane, double pos, bool collision=false)
updates myFurtherLanes on lane insertion or after collision
Definition: MSVehicle.cpp:4876
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:5693
SUMOTime myCollisionImmunity
amount of time for which the vehicle is immune from collisions
Definition: MSVehicle.h:1880
bool passingMinor() const
decide whether the vehicle is passing a minor link or has comitted to do so
Definition: MSVehicle.cpp:6511
void updateWaitingTime(double vNext)
Updates the vehicle's waiting time counters (accumulated and consecutive)
Definition: MSVehicle.cpp:3595
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
Definition: MSVehicle.cpp:4824
BaseInfluencer & getBaseInfluencer()
Returns the velocity/lane influencer.
Definition: MSVehicle.cpp:6397
Influencer & getInfluencer()
Definition: MSVehicle.cpp:6389
double getRightSideOnLane() const
Get the vehicle's lateral position on the lane:
Definition: MSVehicle.cpp:5888
bool unsafeLinkAhead(const MSLane *lane) const
whether the vehicle may safely move to the given lane with regard to upcoming links
Definition: MSVehicle.cpp:6082
double getCurrentApparentDecel() const
get apparent deceleration based on vType parameters and current acceleration
Definition: MSVehicle.cpp:6764
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:4277
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle's car following model variables.
Definition: MSVehicle.h:934
DriveItemVector myLFLinkLanesPrev
planned speeds from the previous step for un-registering from junctions after the new container is fi...
Definition: MSVehicle.h:1954
std::vector< std::vector< LaneQ > > myBestLanes
Definition: MSVehicle.h:1835
void setActionStepLength(double actionStepLength, bool resetActionOffset=true)
Sets the action steplength of the vehicle.
Definition: MSVehicle.cpp:1307
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:1128
bool myActionStep
The flag myActionStep indicates whether the current time step is an action point for the vehicle.
Definition: MSVehicle.h:1815
const Position getBackPosition() const
Definition: MSVehicle.cpp:1382
bool congested() const
Definition: MSVehicle.cpp:1324
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
Definition: MSVehicle.cpp:6690
double getSpeed() const
Returns the vehicle's current speed.
Definition: MSVehicle.h:462
void setApproachingForAllLinks(const SUMOTime t)
Register junction approaches for all link items in the current plan.
Definition: MSVehicle.cpp:4686
SUMOTime getAccumulatedWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s) within the last t millisecs.
Definition: MSVehicle.h:653
SUMOTime remainingStopDuration() const
Returns the remaining stop duration for a stopped vehicle or 0.
Definition: MSVehicle.cpp:1494
bool keepStopping(bool afterProcessing=false) const
Returns whether the vehicle is stopped and must continue to do so.
Definition: MSVehicle.cpp:1482
void workOnIdleReminders()
cycle through vehicle devices invoking notifyIdle
Definition: MSVehicle.cpp:1089
static std::vector< MSLane * > myEmptyLaneVector
Definition: MSVehicle.h:1842
Position myCachedPosition
Definition: MSVehicle.h:1882
MSVehicle::ManoeuvreType getManoeuvreType() const
accessor function to myManoeuvre equivalent
Definition: MSVehicle.cpp:6820
double checkReversal(bool &canReverse, double speedThreshold=SUMO_const_haltingSpeed, double seen=0) const
Definition: MSVehicle.cpp:3619
void removePassedDriveItems()
Erase passed drive items from myLFLinkLanes (and unregister approaching information for corresponding...
Definition: MSVehicle.cpp:3362
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
Definition: MSVehicle.cpp:5063
std::vector< double > myFurtherLanesPosLat
lateral positions on further lanes
Definition: MSVehicle.h:1854
bool checkActionStep(const SUMOTime t)
Returns whether the vehicle is supposed to take action in the current simulation step Updates myActio...
Definition: MSVehicle.cpp:1906
Position validatePosition(Position result, double offset=0) const
ensure that a vehicle-relative position is not invalid
Definition: MSVehicle.cpp:1250
bool keepClear(const MSLink *link) const
decide whether the given link must be kept clear
Definition: MSVehicle.cpp:6455
bool manoeuvreIsComplete() const
accessor function to myManoeuvre equivalent
Definition: MSVehicle.cpp:6953
double processNextStop(double currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
Definition: MSVehicle.cpp:1515
double myAngle
the angle in radians (
Definition: MSVehicle.h:1874
bool ignoreRed(const MSLink *link, bool canBrake) const
decide whether a red (or yellow light) may be ignore
Definition: MSVehicle.cpp:6467
double getPositionOnLane() const
Get the vehicle's position along the lane.
Definition: MSVehicle.h:372
const MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:552
void updateTimeLoss(double vNext)
Updates the vehicle's time loss.
Definition: MSVehicle.cpp:3607
MSDevice_DriverState * myDriverState
This vehicle's driver state.
Definition: MSVehicle.h:1812
bool joinTrainPart(MSVehicle *veh)
try joining the given vehicle to the rear of this one (to resolve joinTriggered)
Definition: MSVehicle.cpp:1820
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
Definition: MSVehicle.h:917
MSLane * myLane
The lane the vehicle is on.
Definition: MSVehicle.h:1823
bool onFurtherEdge(const MSEdge *edge) const
whether this vehicle has its back (and no its front) on the given edge
Definition: MSVehicle.cpp:6205
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:3333
Manoeuvre myManoeuvre
Definition: MSVehicle.h:1294
double getLateralOverlap() const
return the amount by which the vehicle extends laterally outside it's primary lane
Definition: MSVehicle.cpp:6064
double getAngle() const
Returns the vehicle's direction in radians.
Definition: MSVehicle.h:683
bool handleCollisionStop(MSStop &stop, const double distToStop)
Definition: MSVehicle.cpp:6302
bool hasInfluencer() const
whether the vehicle is individually influenced (via TraCI or special parameters)
Definition: MSVehicle.h:1633
double getPreviousSpeed() const
Returns the vehicle's speed before the previous time step.
Definition: MSVehicle.h:470
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:1837
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:1922
double getBrakeGap(bool delayed=false) const
get distance for coming to a stop (used for rerouting checks)
Definition: MSVehicle.cpp:1900
void executeFractionalMove(double dist)
move vehicle forward by the given distance during insertion
Definition: MSVehicle.cpp:4152
LaneChangeMode
modes for resolving conflicts between external control (traci) and vehicle control over lane changing...
Definition: MSVehicle.h:1102
@ LC_NOCONFLICT
Definition: MSVehicle.h:1104
virtual void drawOutsideNetwork(bool)
register vehicle for drawing while outside the network
Definition: MSVehicle.h:1788
void initDevices()
Definition: MSVehicle.cpp:991
State myState
This Vehicles driving state (pos and speed)
Definition: MSVehicle.h:1809
void adaptToLeaderDistance(const MSLeaderDistanceInfo &ahead, double latOffset, const double seen, DriveProcessItem *const lastLink, const MSLane *const lane, double &v, double &vLinkPass) const
Definition: MSVehicle.cpp:2770
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:5900
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:4739
double getDistanceToPosition(double destPos, const MSEdge *destEdge) const
Definition: MSVehicle.cpp:5710
void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector &lfLinks, double &myStopDist, std::pair< double, LinkDirection > &myNextTurn) const
Definition: MSVehicle.cpp:2007
void switchOnSignal(int signal)
Switches the given signal on.
Definition: MSVehicle.h:1121
static bool overlap(const MSVehicle *veh1, const MSVehicle *veh2)
Definition: MSVehicle.h:711
int getLaneIndex() const
Definition: MSVehicle.cpp:5872
void updateParkingState()
update state while parking
Definition: MSVehicle.cpp:4246
DriveItemVector myLFLinkLanes
container for the planned speeds in the current step
Definition: MSVehicle.h:1951
void updateDriveItems()
Check whether the drive items (myLFLinkLanes) are up to date, and update them if required.
Definition: MSVehicle.cpp:3416
Position getVelocityVector() const
Returns the vehicle's direction in radians.
Definition: MSVehicle.h:691
SUMOTime myJunctionEntryTime
time at which the current junction was entered
Definition: MSVehicle.h:1885
The car-following model and parameter.
Definition: MSVehicleType.h:62
double getLengthWithGap() const
Get vehicle's length including the minimum gap [m].
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:61
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:293
A list of positions.
Encapsulated SAX-Attributes.
Representation of a vehicle.
Definition: SUMOVehicle.h:60
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:1894
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:1908
double getLeaveSpeed() const
Definition: MSVehicle.h:1941
DriveProcessItem(double vWait, double distance, double _availableSpace=0)
constructor if the link shall not be passed
Definition: MSVehicle.h:1924
void adaptLeaveSpeed(const double v)
Definition: MSVehicle.h:1934
Container for state and parameters of the gap control.
Definition: MSVehicle.h:1325
bool active
Whether the gap control is active.
Definition: MSVehicle.h:1356
static std::map< const MSVehicle *, GapControlState * > refVehMap
stores reference vehicles currently in use by a gapController
Definition: MSVehicle.h:1367
SUMOTime lastUpdate
Time of the last update of the gap control.
Definition: MSVehicle.h:1362
double changeRate
Rate by which the current time and space headways are changed towards the target value....
Definition: MSVehicle.h:1350
double addGapTarget
Target value for the desired space headway.
Definition: MSVehicle.h:1345
static GapControlVehStateListener vehStateListener
Definition: MSVehicle.h:1370
double timeHeadwayIncrement
cache storage for the headway increments of the current operation
Definition: MSVehicle.h:1364
double tauOriginal
Original value for the desired headway (will be reset after duration has expired)
Definition: MSVehicle.h:1337
double tauCurrent
Current, interpolated value for the desired time headway.
Definition: MSVehicle.h:1339
double remainingDuration
Remaining duration for keeping the target headway.
Definition: MSVehicle.h:1347
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:1343
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:1341
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:1354
double maxDecel
Maximal deceleration to be applied due to the adapted headway.
Definition: MSVehicle.h:1352
bool gapAttained
Whether the desired gap was attained during the current activity phase (induces the remaining duratio...
Definition: MSVehicle.h:1358
const MSVehicle * prevLeader
The last recognized leader.
Definition: MSVehicle.h:1360
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:811
double length
The overall length which may be driven when using this lane without a lane change.
Definition: MSVehicle.h:815
bool allowsContinuation
Whether this lane allows to continue the drive.
Definition: MSVehicle.h:825
double nextOccupation
As occupation, but without the first lane.
Definition: MSVehicle.h:821
std::vector< MSLane * > bestContinuations
Definition: MSVehicle.h:831
MSLane * lane
The described lane.
Definition: MSVehicle.h:813
double currentLength
The length which may be driven on this lane.
Definition: MSVehicle.h:817
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive.
Definition: MSVehicle.h:823
double occupation
The overall vehicle sum on consecutive lanes which can be passed without a lane change.
Definition: MSVehicle.h:819