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.dev/sumo
3// Copyright (C) 2001-2023 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// ===========================================================================
49class MSMoveReminder;
50class MSLaneChanger;
53class MSStoppingPlace;
54class MSStop;
56class MSOverheadWire;
57class MSParkingArea;
58class MSPerson;
59class MSDevice;
60class OutputDevice;
61class Position;
62class MSJunction;
63class MSLeaderInfo;
68
69
70// ===========================================================================
71// class definitions
72// ===========================================================================
77class MSVehicle : public MSBaseVehicle {
78public:
79
81 friend class MSLaneChanger;
83
87 class State {
89 friend class MSVehicle;
90 friend class MSLaneChanger;
92
93 public:
95 State(double pos, double speed, double posLat, double backPos, double previousSpeed);
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
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(ConstMSRoutePtr route, const std::string& info, bool onInit = false, int offset = 0, bool addStops = true, bool removeStops = true, std::string* msgReturn = nullptr);
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
340
342 void registerInsertionApproach(MSLink* link, double dist);
343
344
357 bool executeMove();
358
360 void executeFractionalMove(double dist);
361
368 double getDeltaPos(const double accel) const;
369
370
372
373
377 double getPositionOnLane() const {
378 return myState.myPos;
379 }
380
384 double getLastStepDist() const {
385 return myState.lastCoveredDist();
386 }
387
391 double getPositionOnLane(const MSLane* lane) const;
392
401 inline double getBackPositionOnLane(const MSLane* lane) const {
402 return getBackPositionOnLane(lane, false);
403 }
404
408 double getBackPositionOnLane() const {
410 }
411
417 return myState.myPosLat;
418 }
419
420 void setLateralPositionOnLane(double posLat) {
421 myState.myPosLat = posLat;
422 }
423
426 }
427
432 double getRightSideOnLane() const;
433
438 double getLeftSideOnLane() const;
439
444 double getRightSideOnLane(const MSLane* lane) const;
445
450 double getLeftSideOnLane(const MSLane* lane) const;
451
455 double lateralDistanceToLane(const int offset) const;
456
458 double getLateralOverlap() const;
459 double getLateralOverlap(const MSLane* lane) const;
460 double getLateralOverlap(double posLat, const MSLane* lane) const;
461
467 double getLeftSideOnEdge(const MSLane* lane = 0) const;
468
474 double getRightSideOnEdge(const MSLane* lane = 0) const;
475
481 double getCenterOnEdge(const MSLane* lane = 0) const;
482
488 double getLatOffset(const MSLane* lane) const;
489
493 double getSpeed() const {
494 return myState.mySpeed;
495 }
496
497
501 double getPreviousSpeed() const {
503 }
504
505
510 void setPreviousSpeed(double prevSpeed, double prevAcceleration);
511
512
517 double getAcceleration() const {
518 return myAcceleration;
519 }
520
522 double getCurrentApparentDecel() const;
523
529 return myType->getActionStepLength();
530 }
531
536 double getActionStepLengthSecs() const {
538 }
539
540
545 return myLastActionTime;
546 }
547
549
550
551
553
554
558 double getSlope() const;
559
560
568 Position getPosition(const double offset = 0) const;
569
570
578 Position getPositionAlongBestLanes(double offset) const;
579
580
584 const MSLane* getLane() const {
585 return myLane;
586 }
587
593 return myLane;
594 }
595
596 // @brief return the lane on which the back of this vehicle resides
597 const MSLane* getBackLane() const;
598
603 double getMaxSpeedOnLane() const;
604
608 inline bool isOnRoad() const {
609 return myAmOnNet;
610 }
611
615 void
616 setIdling(bool amIdling) {
617 myAmIdling = amIdling;
618 }
619
624 inline bool isIdling() const {
625 return myAmIdling;
626 }
627
631 inline bool isActive() const {
632 return myActionStep;
633 }
634
638 inline bool isActionStep(SUMOTime t) const {
639 return (t - myLastActionTime) % getActionStepLength() == 0;
640// return t%getActionStepLength() == 0; // synchronized actions for all vehicles with identical actionsteplengths
641 }
642
643
647 bool isFrontOnLane(const MSLane* lane) const;
648
652 const MSEdge* getCurrentEdge() const;
653
655 const MSEdge* getNextEdgePtr() const;
656
663 ConstMSEdgeVector::const_iterator getRerouteOrigin() const;
664
665
673 return myWaitingTime;
674 }
675
683 return myTimeSinceStartup;
684 }
685
686 inline double getTimeSinceStartupSeconds() const {
688 }
689
700 return TIME2STEPS(myTimeLoss);
701 }
702
703
710 }
711
719 }
720
723 double getTimeLossSeconds() const {
724 return myTimeLoss;
725 }
726
729 double getStopDelay() const;
730
733 double getStopArrivalDelay() const;
734
738 double getAngle() const {
739 return myAngle;
740 }
741
742
747 return Position(std::cos(myAngle) * myState.speed(), std::sin(myAngle) * myState.speed());
748 }
750
752 double computeAngle() const;
753
755 void setAngle(double angle, bool straightenFurther = false);
756
763 void setActionStepLength(double actionStepLength, bool resetActionOffset = true);
764
766 static bool overlap(const MSVehicle* veh1, const MSVehicle* veh2) {
767 if (veh1->myState.myPos < veh2->myState.myPos) {
768 return veh2->myState.myPos - veh2->getVehicleType().getLengthWithGap() < veh1->myState.myPos;
769 }
770 return veh1->myState.myPos - veh1->getVehicleType().getLengthWithGap() < veh2->myState.myPos;
771 }
772
775 bool congested() const;
776
777
789 void activateReminders(const MSMoveReminder::Notification reason, const MSLane* enteredLane = 0);
790
797 void enterLaneAtMove(MSLane* enteredLane, bool onTeleporting = false);
798
799
800
809 void enterLaneAtInsertion(MSLane* enteredLane, double pos, double speed, double posLat,
810 MSMoveReminder::Notification notification);
811
816 void setTentativeLaneAndPosition(MSLane* lane, double pos, double posLat = 0);
817
822 void enterLaneAtLaneChange(MSLane* enteredLane);
823
824
826 void leaveLane(const MSMoveReminder::Notification reason, const MSLane* approachedLane = 0);
827
834 void updateDriveItems();
835
839 const std::pair<double, const MSLink*>& getNextTurn() {
840 return myNextTurn;
841 }
842
843
846
847 const std::vector<MSLane*>& getFurtherLanes() const {
848 return myFurtherLanes;
849 }
850
851 const std::vector<double>& getFurtherLanesPosLat() const {
853 }
854
855
857 bool onFurtherEdge(const MSEdge* edge) const;
858
860 bool isBidiOn(const MSLane* lane) const;
861
864
865 //
869 struct LaneQ {
871 MSLane* lane = nullptr;
873 double length;
884 /* @brief Longest sequence of (normal-edge) lanes that can be followed without a lane change
885 * The 'length' attribute is the sum of these lane lengths
886 * (There may be alternative sequences that have equal length)
887 * It is the 'best' in the strategic sense of reducing required lane-changes
888 */
889 std::vector<MSLane*> bestContinuations;
890 };
891
895 const std::vector<LaneQ>& getBestLanes() const;
896
914 void updateBestLanes(bool forceRebuild = false, const MSLane* startLane = 0);
915
916
920 const std::vector<MSLane*>& getBestLanesContinuation() const;
921
922
926 const std::vector<MSLane*>& getBestLanesContinuation(const MSLane* const l) const;
927
934 const std::vector<const MSLane*> getUpcomingLanesUntil(double distance) const;
935
941 const std::vector<const MSLane*> getPastLanesUntil(double distance) const;
942
947 const std::vector<MSLane*> getUpstreamOppositeLanes() const;
948
949 /* @brief returns the current signed offset from the lane that is most
950 * suited for continuing the current route (in the strategic sense of reducing lane-changes)
951 * - 0 if the vehicle is one it's best lane
952 * - negative if the vehicle should change to the right
953 * - positive if the vehicle should change to the left
954 */
955 int getBestLaneOffset() const;
956
958 double getBestLaneDist() const;
959
961 void adaptBestLanesOccupation(int laneIndex, double density);
962
964
966 void fixPosition();
967
969 std::pair<const MSLane*, double> getLanePosAfterDist(double distance) const;
970
978 inline const MSCFModel& getCarFollowModel() const {
979 return myType->getCarFollowModel();
980 }
981
987 std::shared_ptr<MSSimpleDriverState> getDriverState() const;
988
993 double getFriction() const;
994
1000 return myCFVariables;
1001 }
1002
1005 inline bool hasDriverState() const {
1006 return myDriverState != nullptr;
1007 }
1009
1010
1013
1016 bool willStop() const;
1017
1019 bool isStoppedOnLane() const;
1020
1022 bool keepStopping(bool afterProcessing = false) const;
1023
1028
1032 bool isRemoteControlled() const;
1033
1037 bool wasRemoteControlled(SUMOTime lookBack = DELTA_T) const;
1038
1040 double nextStopDist() const {
1041 return myStopDist;
1042 }
1044
1045 int getLaneIndex() const;
1046
1056 double getDistanceToPosition(double destPos, const MSEdge* destEdge) const;
1057
1058
1066 double processNextStop(double currentVelocity);
1067
1068
1076 std::pair<const MSVehicle* const, double> getLeader(double dist = 0) const;
1077
1086 std::pair<const MSVehicle* const, double> getFollower(double dist = 0) const;
1087
1094 double getTimeGapOnLane() const;
1095
1096
1101 void addTransportable(MSTransportable* transportable);
1102
1105
1141
1142
1148 LC_NEVER = 0, // lcModel shall never trigger changes at this level
1149 LC_NOCONFLICT = 1, // lcModel may trigger changes if not in conflict with TraCI request
1150 LC_ALWAYS = 2 // lcModel may always trigger changes of this level regardless of requests
1152
1153
1156 LCP_ALWAYS = 0, // change regardless of blockers, adapt own speed and speed of blockers
1157 LCP_NOOVERLAP = 1, // change unless overlapping with blockers, adapt own speed and speed of blockers
1158 LCP_URGENT = 2, // change if not blocked, adapt own speed and speed of blockers
1159 LCP_OPPORTUNISTIC = 3 // change if not blocked
1161
1162
1166 void switchOnSignal(int signal) {
1167 mySignals |= signal;
1168 }
1169
1170
1174 void switchOffSignal(int signal) {
1175 mySignals &= ~signal;
1176 }
1177
1178
1182 int getSignals() const {
1183 return mySignals;
1184 }
1185
1186
1191 bool signalSet(int which) const {
1192 return (mySignals & which) != 0;
1193 }
1195
1196
1198 bool unsafeLinkAhead(const MSLane* lane) const;
1199
1201 bool passingMinor() const;
1202
1203
1204
1212 double getSpeedWithoutTraciInfluence() const;
1213
1218 bool rerouteParkingArea(const std::string& parkingAreaID, std::string& errorMsg);
1219
1226 bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string& errorMsg);
1227
1228 bool handleCollisionStop(MSStop& stop, const double distToStop);
1229
1234 bool resumeFromStopping();
1235
1237 double updateFurtherLanes(std::vector<MSLane*>& furtherLanes,
1238 std::vector<double>& furtherLanesPosLat,
1239 const std::vector<MSLane*>& passedLanes);
1240
1242 PositionVector getBoundingBox(double offset = 0) const;
1243
1245 PositionVector getBoundingPoly(double offset = 0) const;
1246
1258
1261 bool setExitManoeuvre();
1264
1266 bool manoeuvreIsComplete() const;
1269
1270
1278
1279 public:
1281 Manoeuvre();
1282
1284 Manoeuvre(const Manoeuvre& manoeuvre);
1285
1287 Manoeuvre& operator=(const Manoeuvre& manoeuvre);
1288
1290 bool operator!=(const Manoeuvre& manoeuvre);
1291
1294
1297
1300
1302 bool
1303 manoeuvreIsComplete(const ManoeuvreType checkType) const;
1304
1306 bool
1307 manoeuvreIsComplete() const;
1308
1310 double getGUIIncrement() const;
1311
1314
1317
1318 private:
1321
1323 std::string myManoeuvreStop;
1324
1327
1330
1333
1334 // @brief Angle (radians) through which parking vehicle moves in each sim step
1336 };
1337
1338 // Current or previous (completed) manoeuvre
1340
1354 private:
1355
1365 void vehicleStateChanged(const SUMOVehicle* const vehicle, MSNet::VehicleState to, const std::string& info = "");
1366 };
1367
1368
1372 virtual ~GapControlState();
1374 static void init();
1376 static void cleanup();
1378 void activate(double tauOriginal, double tauTarget, double additionalGap, double duration, double changeRate, double maxDecel, const MSVehicle* refVeh);
1380 void deactivate();
1397 double maxDecel;
1410
1412 static std::map<const MSVehicle*, GapControlState*> refVehMap;
1413
1414 private:
1416 };
1417
1418
1419 public:
1421 Influencer();
1422
1424 ~Influencer();
1425
1427 static void init();
1429 static void cleanup();
1430
1434 void setSpeedTimeLine(const std::vector<std::pair<SUMOTime, double> >& speedTimeLine);
1435
1438 void activateGapController(double originalTau, double newTimeHeadway, double newSpaceHeadway, double duration, double changeRate, double maxDecel, MSVehicle* refVeh = nullptr);
1439
1443
1447 void setLaneTimeLine(const std::vector<std::pair<SUMOTime, int> >& laneTimeLine);
1448
1452 void adaptLaneTimeLine(int indexShift);
1453
1457 void setSublaneChange(double latDist);
1458
1460 int getSpeedMode() const;
1461
1463 int getLaneChangeMode() const;
1464
1466
1468
1480 double influenceSpeed(SUMOTime currentTime, double speed, double vSafe, double vMin, double vMax);
1481
1494 double gapControlSpeed(SUMOTime currentTime, const SUMOVehicle* veh, double speed, double vSafe, double vMin, double vMax);
1495
1503 int influenceChangeDecision(const SUMOTime currentTime, const MSEdge& currentEdge, const int currentLaneIndex, int state);
1504
1505
1511 double changeRequestRemainingSeconds(const SUMOTime currentTime) const;
1512
1517 inline bool getRespectJunctionPriority() const {
1519 }
1520
1521
1525 inline bool getEmergencyBrakeRedLight() const {
1527 }
1528
1535 }
1536
1537
1541 }
1542
1546 void setSpeedMode(int speedMode);
1547
1551 void setLaneChangeMode(int value);
1552
1556 double getOriginalSpeed() const;
1557
1559 void setOriginalSpeed(double speed);
1560
1561 void setRemoteControlled(Position xyPos, MSLane* l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector& route, SUMOTime t);
1562
1564 return myLastRemoteAccess;
1565 }
1566
1569
1572
1574 double implicitSpeedRemote(const MSVehicle* veh, double oldSpeed);
1575
1577 double implicitDeltaPosRemote(const MSVehicle* veh);
1578
1579 bool isRemoteControlled() const;
1580
1581 bool isRemoteAffected(SUMOTime t) const;
1582
1583 void setSignals(int signals) {
1584 myTraCISignals = signals;
1585 }
1586
1587 int getSignals() const {
1588 return myTraCISignals;
1589 }
1590
1591 double getLatDist() const {
1592 return myLatDist;
1593 }
1594
1596 myLatDist = 0.;
1597 }
1598
1599 bool ignoreOverlap() const {
1601 }
1602
1603 private:
1605 std::vector<std::pair<SUMOTime, double> > mySpeedTimeLine;
1606
1608 std::vector<std::pair<SUMOTime, int> > myLaneTimeLine;
1609
1611 std::shared_ptr<GapControlState> myGapControlState;
1612
1615
1618
1621
1624
1627
1630
1633
1636
1639
1648
1650
1651
1662
1664
1665 // @brief the signals set via TraCI
1667
1668 };
1669
1670
1678
1679 const BaseInfluencer* getBaseInfluencer() const;
1680 const Influencer* getInfluencer() const;
1681
1682 bool hasInfluencer() const {
1683 return myInfluencer != nullptr;
1684 }
1685
1687 int influenceChangeDecision(int state);
1688
1690 void setRemoteState(Position xyPos);
1691
1693 static int nextLinkPriority(const std::vector<MSLane*>& conts);
1694
1696 bool isLeader(const MSLink* link, const MSVehicle* veh, const double gap) const;
1697
1698 // @brief get the position of the back bumper;
1699 const Position getBackPosition() const;
1700
1702 bool ignoreCollision() const;
1703
1705 void updateParkingState();
1706
1712
1714
1715
1717 void saveState(OutputDevice& out);
1718
1721 void loadState(const SUMOSAXAttributes& attrs, const SUMOTime offset);
1722
1723 void loadPreviousApproaching(MSLink* link, bool setRequest,
1724 SUMOTime arrivalTime, double arrivalSpeed,
1725 double arrivalSpeedBraking,
1726 double dist, double leaveSpeed);
1728
1729protected:
1730
1733
1749 void adaptLaneEntering2MoveReminder(const MSLane& enteredLane);
1751
1752
1760 void processLinkApproaches(double& vSafe, double& vSafeMin, double& vSafeMinDist);
1761
1762
1770 void processLaneAdvances(std::vector<MSLane*>& passedLanes, std::string& emergencyReason);
1771
1772
1780 double processTraCISpeedControl(double vSafe, double vNext);
1781
1782
1790
1793 void updateWaitingTime(double vNext);
1794
1797 void updateTimeLoss(double vNext);
1798
1799 /* @brief Check whether the vehicle is a train that can reverse its direction at the current point in its route
1800 * and return the speed in preparation for reversal
1801 *
1802 * @param[out] canReverse
1803 * @param[in] speedThreshold
1804 * @return speed for reversal
1805 */
1806 double checkReversal(bool& canReverse, double speedThreshold = SUMO_const_haltingSpeed, double seen = 0) const;
1807
1810 void setBrakingSignals(double vNext) ;
1811
1814 void setBlinkerInformation();
1815
1818 void setEmergencyBlueLight(SUMOTime currentTime);
1819
1821 void computeFurtherLanes(MSLane* enteredLane, double pos, bool collision = false);
1822
1824 void updateOccupancyAndCurrentBestLane(const MSLane* startLane);
1825
1827 double getBrakeGap(bool delayed = false) const;
1828
1830 Position validatePosition(Position result, double offset = 0) const;
1831
1833 virtual void drawOutsideNetwork(bool /*add*/) {};
1834
1836 void boardTransportables(MSStop& stop);
1837
1839 bool joinTrainPart(MSVehicle* veh);
1840
1842 bool joinTrainPartFront(MSVehicle* veh);
1843
1845 double slowDownForSchedule(double vMinComfortable) const;
1846
1848 void interpolateLateralZ(Position& pos, double offset, double posLat) const;
1849
1853 double getDistanceToLeaveJunction() const;
1854
1855protected:
1856
1860
1863
1866
1869
1872
1878
1879
1880
1883
1885
1888
1889 /* @brief Complex data structure for keeping and updating LaneQ:
1890 * Each element of the outer vector corresponds to an upcoming edge on the vehicles route
1891 * The first element corresponds to the current edge and is returned in getBestLanes()
1892 * The other elements are only used as a temporary structure in updateBestLanes();
1893 */
1894 std::vector<std::vector<LaneQ> > myBestLanes;
1895
1896 /* @brief iterator to speed up retrieval of the current lane's LaneQ in getBestLaneOffset() and getBestLanesContinuation()
1897 * This is updated in updateOccupancyAndCurrentBestLane()
1898 */
1899 std::vector<LaneQ>::iterator myCurrentLaneInBestLanes;
1900
1901 static std::vector<MSLane*> myEmptyLaneVector;
1902
1905
1908 std::pair<double, const MSLink*> myNextTurn;
1909
1911 std::vector<MSLane*> myFurtherLanes;
1913 std::vector<double> myFurtherLanesPosLat;
1914
1917
1920
1923
1925
1927 double myAngle;
1928
1931
1934
1936
1941
1944
1945protected:
1946
1959 double accelV;
1962
1963 DriveProcessItem(MSLink* link, double vPass, double vWait, bool setRequest,
1964 SUMOTime arrivalTime, double arrivalSpeed,
1965 double arrivalSpeedBraking,
1966 double distance,
1967 double leaveSpeed) :
1968 myLink(link), myVLinkPass(vPass), myVLinkWait(vWait), mySetRequest(setRequest),
1969 myArrivalTime(arrivalTime), myArrivalSpeed(arrivalSpeed),
1970 myArrivalSpeedBraking(arrivalSpeedBraking),
1971 myDistance(distance),
1972 accelV(leaveSpeed), hadStoppedVehicle(false), availableSpace(0) {
1973 assert(vWait >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1974 assert(vPass >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1975 };
1976
1977
1979 DriveProcessItem(double vWait, double distance, double _availableSpace = 0) :
1980 myLink(0), myVLinkPass(vWait), myVLinkWait(vWait), mySetRequest(false),
1983 myDistance(distance),
1984 accelV(-1), hadStoppedVehicle(false), availableSpace(_availableSpace) {
1985 assert(vWait >= 0 || !MSGlobals::gSemiImplicitEulerUpdate);
1986 };
1987
1988
1989 inline void adaptLeaveSpeed(const double v) {
1990 if (accelV < 0) {
1991 accelV = v;
1992 } else {
1993 accelV = MIN2(accelV, v);
1994 }
1995 }
1996 inline double getLeaveSpeed() const {
1997 return accelV < 0 ? myVLinkPass : accelV;
1998 }
1999 };
2000
2002 // TODO: Consider making LFLinkLanes a std::deque for efficient front removal (needs refactoring in checkRewindLinkLanes()...)
2003 typedef std::vector< DriveProcessItem > DriveItemVector;
2004
2007
2010
2016 DriveItemVector::iterator myNextDriveItem;
2017
2019 void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector& lfLinks, double& myStopDist, std::pair<double, const MSLink*>& myNextTurn) const;
2020
2022 void checkRewindLinkLanes(const double lengthsInFront, DriveItemVector& lfLinks) const;
2023
2025 void removeApproachingInformation(const DriveItemVector& lfLinks) const;
2026
2027 /* @brief adapt safe velocity in accordance to a moving obstacle:
2028 * - a leader vehicle
2029 * - a vehicle or pedestrian that crosses this vehicles path on an upcoming intersection
2030 * @param[in] leaderInfo The leading vehicle and the (virtual) distance to it
2031 * @param[in] lastLink the lastLink index
2032 * @param[in,out] the safe velocity for driving
2033 * @param[in,out] the safe velocity for arriving at the next link
2034 */
2035 void adaptToLeader(const std::pair<const MSVehicle*, double> leaderInfo,
2036 double seen,
2037 DriveProcessItem* const lastLink,
2038 double& v, double& vLinkPass) const;
2039
2041 bool brakeForOverlap(const MSLink* link, const MSLane* lane) const;
2042
2043public:
2044 void adaptToJunctionLeader(const std::pair<const MSVehicle*, double> leaderInfo,
2045 const double seen, DriveProcessItem* const lastLink,
2046 const MSLane* const lane, double& v, double& vLinkPass,
2047 double distToCrossing = -1) const;
2048
2049 void adaptToOncomingLeader(const std::pair<const MSVehicle*, double> leaderInfo,
2050 DriveProcessItem* const lastLink,
2051 double& v, double& vLinkPass) const;
2052
2054 bool ignoreRed(const MSLink* link, bool canBrake) const;
2055
2057 bool ignoreFoe(const SUMOTrafficObject* foe) const;
2058
2060 inline double accelThresholdForWaiting() const {
2061 return 0.5 * getCarFollowModel().getMaxAccel();
2062 }
2063
2064
2065protected:
2066
2067 /* @brief adapt safe velocity in accordance to multiple vehicles ahead:
2068 * @param[in] ahead The leader information according to the current lateral-resolution
2069 * @param[in] latOffset the lateral offset for locating the ego vehicle on the given lane
2070 * @param[in] seen the distance to the end of the current lane
2071 * @param[in] lastLink the lastLink index
2072 * @param[in] lane The current Lane the vehicle is on
2073 * @param[in,out] the safe velocity for driving
2074 * @param[in,out] the safe velocity for arriving at the next link
2075 */
2076 void adaptToLeaders(const MSLeaderInfo& ahead,
2077 double latOffset,
2078 const double seen, DriveProcessItem* const lastLink,
2079 const MSLane* const lane, double& v, double& vLinkPass) const;
2080
2081 void adaptToLeaderDistance(const MSLeaderDistanceInfo& ahead, double latOffset,
2082 double seen,
2083 DriveProcessItem* const lastLink,
2084 double& v, double& vLinkPass) const;
2085
2087 void checkLinkLeader(const MSLink* link, const MSLane* lane, double seen,
2088 DriveProcessItem* const lastLink, double& v, double& vLinkPass, double& vLinkWait, bool& setRequest,
2089 bool isShadowLink = false) const;
2090
2092 void checkLinkLeaderCurrentAndParallel(const MSLink* link, const MSLane* lane, double seen,
2093 DriveProcessItem* const lastLink, double& v, double& vLinkPass, double& vLinkWait, bool& setRequest) const;
2094
2095
2103 void updateState(double vNext);
2104
2105
2107 bool keepClear(const MSLink* link) const;
2108
2110 std::pair<double, double> estimateTimeToNextStop() const;
2111
2112 /* @brief special considerations for opposite direction driving so that the
2113 * result can be used directly by getPositionOnLane(...) */
2114 double getBackPositionOnLane(const MSLane* lane, bool calledByGetPosition) const;
2115
2122 bool hasArrivedInternal(bool oppositeTransformed = true) const;
2123
2124
2125 SUMOTime getArrivalTime(SUMOTime t, double seen, double v, double arrivalSpeed) const;
2126
2128 bool isOppositeLane(const MSLane* lane) const;
2129
2131 void cleanupFurtherLanes();
2132
2133private:
2136
2139
2140
2141private:
2144
2147
2150
2151};
long long int SUMOTime
Definition: GUI.h:36
std::vector< const MSEdge * > ConstMSEdgeVector
Definition: MSEdge.h:74
std::shared_ptr< const MSRoute > ConstMSRoutePtr
Definition: Route.h:32
SUMOTime DELTA_T
Definition: SUMOTime.cpp:38
#define STEPS2TIME(x)
Definition: SUMOTime.h:55
#define TIME2STEPS(x)
Definition: SUMOTime.h:57
T MIN2(T a, T b)
Definition: StdDefs.h:76
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:58
Interface for lane-change models.
The base class for microscopic and mesoscopic vehicles.
Definition: MSBaseVehicle.h:55
MSVehicleType * myType
This vehicle's type.
void addStops(const bool ignoreStopErrors, MSRouteIterator *searchStart=nullptr, bool addRouteStops=true)
Adds stops to the built vehicle.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
The car-following model abstraction.
Definition: MSCFModel.h:55
double getMaxAccel() const
Get the vehicle type's maximum acceleration [m/s^2].
Definition: MSCFModel.h:256
The ToC Device controls transition of control between automated and manual driving.
A device which collects info on current friction Coefficient on the road.
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:112
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:84
saves leader/follower vehicles and their distances relative to an ego vehicle
Definition: MSLeaderInfo.h:144
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:637
VehicleState
Definition of a vehicle state.
Definition: MSNet.h:604
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:1358
void vehicleStateChanged(const SUMOVehicle *const vehicle, MSNet::VehicleState to, const std::string &info="")
Called if a vehicle changes its state.
Definition: MSVehicle.cpp:261
Changes the wished vehicle speed / lanes.
Definition: MSVehicle.h:1353
void setLaneChangeMode(int value)
Sets lane changing behavior.
Definition: MSVehicle.cpp:781
TraciLaneChangePriority myTraciLaneChangePriority
flags for determining the priority of traci lane change requests
Definition: MSVehicle.h:1663
bool getEmergencyBrakeRedLight() const
Returns whether red lights shall be a reason to brake.
Definition: MSVehicle.h:1525
SUMOTime getLaneTimeLineEnd()
Definition: MSVehicle.cpp:470
void adaptLaneTimeLine(int indexShift)
Adapts lane timeline when moving to a new lane and the lane index changes.
Definition: MSVehicle.cpp:422
void setRemoteControlled(Position xyPos, MSLane *l, double pos, double posLat, double angle, int edgeOffset, const ConstMSEdgeVector &route, SUMOTime t)
Definition: MSVehicle.cpp:792
bool isRemoteAffected(SUMOTime t) const
Definition: MSVehicle.cpp:811
int getSpeedMode() const
return the current speed mode
Definition: MSVehicle.cpp:435
void deactivateGapController()
Deactivates the gap control.
Definition: MSVehicle.cpp:409
Influencer()
Constructor.
Definition: MSVehicle.cpp:360
void setSpeedMode(int speedMode)
Sets speed-constraining behaviors.
Definition: MSVehicle.cpp:770
std::shared_ptr< GapControlState > myGapControlState
The gap control state.
Definition: MSVehicle.h:1611
bool considerSafeVelocity() const
Returns whether safe velocities shall be considered.
Definition: MSVehicle.h:1539
int getSignals() const
Definition: MSVehicle.h:1587
bool myConsiderMaxDeceleration
Whether the maximum deceleration shall be regarded.
Definition: MSVehicle.h:1629
ConstMSEdgeVector myRemoteRoute
Definition: MSVehicle.h:1646
void setLaneTimeLine(const std::vector< std::pair< SUMOTime, int > > &laneTimeLine)
Sets a new lane timeline.
Definition: MSVehicle.cpp:416
bool myRespectJunctionLeaderPriority
Whether the junction priority rules are respected (within)
Definition: MSVehicle.h:1638
void setOriginalSpeed(double speed)
Stores the originally longitudinal speed.
Definition: MSVehicle.cpp:661
double myOriginalSpeed
The velocity before influence.
Definition: MSVehicle.h:1614
double getLatDist() const
Definition: MSVehicle.h:1591
double implicitDeltaPosRemote(const MSVehicle *veh)
return the change in longitudinal position that is implicit in the new remote position
Definition: MSVehicle.cpp:928
double implicitSpeedRemote(const MSVehicle *veh, double oldSpeed)
return the speed that is implicit in the new remote position
Definition: MSVehicle.cpp:901
void postProcessRemoteControl(MSVehicle *v)
update position from remote control
Definition: MSVehicle.cpp:832
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:509
void setSublaneChange(double latDist)
Sets a new sublane-change request.
Definition: MSVehicle.cpp:430
double getOriginalSpeed() const
Returns the originally longitudinal speed to use.
Definition: MSVehicle.cpp:656
SUMOTime myLastRemoteAccess
Definition: MSVehicle.h:1647
std::vector< std::pair< SUMOTime, int > > myLaneTimeLine
The lane usage time line to apply.
Definition: MSVehicle.h:1608
bool getRespectJunctionLeaderPriority() const
Returns whether junction priority rules within the junction shall be respected (concerns vehicles wit...
Definition: MSVehicle.h:1533
LaneChangeMode myStrategicLC
lane changing which is necessary to follow the current route
Definition: MSVehicle.h:1652
LaneChangeMode mySpeedGainLC
lane changing to travel with higher speed
Definition: MSVehicle.h:1656
static void init()
Static initalization.
Definition: MSVehicle.cpp:385
LaneChangeMode mySublaneLC
changing to the prefered lateral alignment
Definition: MSVehicle.h:1660
bool getRespectJunctionPriority() const
Returns whether junction priority rules shall be respected (concerns approaching vehicles outside the...
Definition: MSVehicle.h:1517
static void cleanup()
Static cleanup.
Definition: MSVehicle.cpp:390
int getLaneChangeMode() const
return the current lane change mode
Definition: MSVehicle.cpp:447
SUMOTime getLaneTimeLineDuration()
Definition: MSVehicle.cpp:457
double influenceSpeed(SUMOTime currentTime, double speed, double vSafe, double vMin, double vMax)
Applies stored velocity information on the speed to use.
Definition: MSVehicle.cpp:480
double changeRequestRemainingSeconds(const SUMOTime currentTime) const
Return the remaining number of seconds of the current laneTimeLine assuming one exists.
Definition: MSVehicle.cpp:762
bool myConsiderSafeVelocity
Whether the safe velocity shall be regarded.
Definition: MSVehicle.h:1623
bool mySpeedAdaptationStarted
Whether influencing the speed has already started.
Definition: MSVehicle.h:1620
~Influencer()
Destructor.
Definition: MSVehicle.cpp:382
void setSignals(int signals)
Definition: MSVehicle.h:1583
double myLatDist
The requested lateral change.
Definition: MSVehicle.h:1617
bool myEmergencyBrakeRedLight
Whether red lights are a reason to brake.
Definition: MSVehicle.h:1635
LaneChangeMode myRightDriveLC
changing to the rightmost lane
Definition: MSVehicle.h:1658
void setSpeedTimeLine(const std::vector< std::pair< SUMOTime, double > > &speedTimeLine)
Sets a new velocity timeline.
Definition: MSVehicle.cpp:395
void updateRemoteControlRoute(MSVehicle *v)
update route if provided by remote control
Definition: MSVehicle.cpp:817
std::vector< std::pair< SUMOTime, double > > mySpeedTimeLine
The velocity time line to apply.
Definition: MSVehicle.h:1605
SUMOTime getLastAccessTimeStep() const
Definition: MSVehicle.h:1563
bool myConsiderMaxAcceleration
Whether the maximum acceleration shall be regarded.
Definition: MSVehicle.h:1626
LaneChangeMode myCooperativeLC
lane changing with the intent to help other vehicles
Definition: MSVehicle.h:1654
bool isRemoteControlled() const
Definition: MSVehicle.cpp:805
bool ignoreOverlap() const
Definition: MSVehicle.h:1599
bool myRespectJunctionPriority
Whether the junction priority rules are respected (approaching)
Definition: MSVehicle.h:1632
int influenceChangeDecision(const SUMOTime currentTime, const MSEdge &currentEdge, const int currentLaneIndex, int state)
Applies stored LaneChangeMode information and laneTimeLine.
Definition: MSVehicle.cpp:667
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:401
Container for manouevering time associated with stopping.
Definition: MSVehicle.h:1277
SUMOTime myManoeuvreCompleteTime
Time at which this manoeuvre should complete.
Definition: MSVehicle.h:1329
MSVehicle::ManoeuvreType getManoeuvreType() const
Accessor (get) for manoeuvre type.
Definition: MSVehicle.cpp:7561
std::string myManoeuvreStop
The name of the stop associated with the Manoeuvre - for debug output.
Definition: MSVehicle.h:1323
bool manoeuvreIsComplete() const
Check if any manoeuver is ongoing and whether the completion time is beyond currentTime.
Definition: MSVehicle.cpp:7695
bool configureExitManoeuvre(MSVehicle *veh)
Setup the myManoeuvre for exiting (Sets completion time and manoeuvre type)
Definition: MSVehicle.cpp:7614
void setManoeuvreType(const MSVehicle::ManoeuvreType mType)
Accessor (set) for manoeuvre type.
Definition: MSVehicle.cpp:7577
Manoeuvre & operator=(const Manoeuvre &manoeuvre)
Assignment operator.
Definition: MSVehicle.cpp:7536
Manoeuvre()
Constructor.
Definition: MSVehicle.cpp:7525
std::string myManoeuvreVehicleID
The name of the vehicle associated with the Manoeuvre - for debug output.
Definition: MSVehicle.h:1320
ManoeuvreType myManoeuvreType
Manoeuvre type - currently entry, exit or none.
Definition: MSVehicle.h:1332
double getGUIIncrement() const
Accessor for GUI rotation step when parking (radians)
Definition: MSVehicle.cpp:7556
SUMOTime myManoeuvreStartTime
Time at which the Manoeuvre for this stop started.
Definition: MSVehicle.h:1326
bool operator!=(const Manoeuvre &manoeuvre)
Operator !=.
Definition: MSVehicle.cpp:7546
bool entryManoeuvreIsComplete(MSVehicle *veh)
Configure an entry manoeuvre if nothing is configured - otherwise check if complete.
Definition: MSVehicle.cpp:7656
bool configureEntryManoeuvre(MSVehicle *veh)
Setup the entry manoeuvre for this vehicle (Sets completion time and manoeuvre type)
Definition: MSVehicle.cpp:7583
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
State(double pos, double speed, double posLat, double backPos, double previousSpeed)
Constructor.
Definition: MSVehicle.cpp:168
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:158
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:146
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
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:202
const std::string getState() const
Definition: MSVehicle.cpp:234
SUMOTime cumulatedWaitingTime(SUMOTime memory=-1) const
Definition: MSVehicle.cpp:180
std::deque< std::pair< SUMOTime, SUMOTime > > myWaitingIntervals
Definition: MSVehicle.h:184
void setState(const std::string &state)
Definition: MSVehicle.cpp:245
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:176
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:7572
TraciLaneChangePriority
modes for prioritizing traci lane change requests
Definition: MSVehicle.h:1155
@ LCP_NOOVERLAP
Definition: MSVehicle.h:1157
@ LCP_OPPORTUNISTIC
Definition: MSVehicle.h:1159
const std::vector< double > & getFurtherLanesPosLat() const
Definition: MSVehicle.h:851
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:6540
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:7136
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:3479
SUMOTime getTimeSinceStartup() const
Returns the SUMOTime spent driving since startup (speed was larger than 0.1m/s)
Definition: MSVehicle.h:682
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:3328
void checkRewindLinkLanes(const double lengthsInFront, DriveItemVector &lfLinks) const
runs heuristic for keeping the intersection clear in case of downstream jamming
Definition: MSVehicle.cpp:4951
MSVehicle(const MSVehicle &)
invalidated copy constructor
bool willStop() const
Returns whether the vehicle will stop on the current edge.
Definition: MSVehicle.cpp:1549
bool hasDriverState() const
Whether this vehicle is equipped with a MSDriverState.
Definition: MSVehicle.h:1005
static int nextLinkPriority(const std::vector< MSLane * > &conts)
get a numerical value for the priority of the upcoming link
Definition: MSVehicle.cpp:6077
double getTimeGapOnLane() const
Returns the time gap in seconds to the leader of the vehicle on the same lane.
Definition: MSVehicle.cpp:6398
void updateBestLanes(bool forceRebuild=false, const MSLane *startLane=0)
computes the best lanes to use in order to continue the route
Definition: MSVehicle.cpp:5644
bool myAmIdling
Whether the vehicle is trying to enter the network (eg after parking so engine is running)
Definition: MSVehicle.h:1922
SUMOTime myWaitingTime
The time the vehicle waits (is not faster than 0.1m/s) in seconds.
Definition: MSVehicle.h:1858
double getStopDelay() const
Returns the public transport stop delay in seconds.
Definition: MSVehicle.cpp:7798
double computeAngle() const
compute the current vehicle angle
Definition: MSVehicle.cpp:1447
double myTimeLoss
the time loss in seconds due to driving with less than maximum speed
Definition: MSVehicle.h:1862
SUMOTime myLastActionTime
Action offset (actions are taken at time myActionOffset + N*getActionStepLength()) Initialized to 0,...
Definition: MSVehicle.h:1877
ConstMSEdgeVector::const_iterator getRerouteOrigin() const
Returns the starting point for reroutes (usually the current edge)
Definition: MSVehicle.cpp:1387
bool hasArrivedInternal(bool oppositeTransformed=true) const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge) metho...
Definition: MSVehicle.cpp:1088
double getFriction() const
Returns the current friction on the road as perceived by the friction device.
Definition: MSVehicle.cpp:7492
bool ignoreFoe(const SUMOTrafficObject *foe) const
decide whether a given foe object may be ignored
Definition: MSVehicle.cpp:7197
void boardTransportables(MSStop &stop)
board persons and load transportables at the given stop
Definition: MSVehicle.cpp:1857
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:6143
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition: MSVehicle.h:608
void adaptLaneEntering2MoveReminder(const MSLane &enteredLane)
Adapts the vehicle's entering of a new lane.
Definition: MSVehicle.cpp:1174
void addTransportable(MSTransportable *transportable)
Adds a person or container to this vehicle.
Definition: MSVehicle.cpp:6409
SUMOTime myJunctionConflictEntryTime
Definition: MSVehicle.h:1940
SUMOTime getLastActionTime() const
Returns the time of the vehicle's last action point.
Definition: MSVehicle.h:544
double getLeftSideOnEdge(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:6546
PositionVector getBoundingPoly(double offset=0) const
get bounding polygon
Definition: MSVehicle.cpp:6840
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:6507
bool brakeForOverlap(const MSLink *link, const MSLane *lane) const
handle with transitions
Definition: MSVehicle.cpp:2085
SUMOTime getWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s)
Definition: MSVehicle.h:672
void workOnMoveReminders(double oldPos, double newPos, double newSpeed)
Processes active move reminder.
Definition: MSVehicle.cpp:1115
bool isStoppedOnLane() const
Definition: MSVehicle.cpp:1554
double myAcceleration
The current acceleration after dawdling in m/s.
Definition: MSVehicle.h:1904
void registerInsertionApproach(MSLink *link, double dist)
register approach on insertion
Definition: MSVehicle.cpp:5219
SUMOTime getTimeLoss() const
Returns the SUMOTime lost (speed was lesser maximum speed)
Definition: MSVehicle.h:699
void cleanupFurtherLanes()
remove vehicle from further lanes (on leaving the network)
Definition: MSVehicle.cpp:1003
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:2943
bool isActive() const
Returns whether the current simulation step is an action point for the vehicle.
Definition: MSVehicle.h:631
const MSLane * getBackLane() const
Definition: MSVehicle.cpp:4745
double getTimeLossSeconds() const
Returns the time loss in seconds.
Definition: MSVehicle.h:723
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:5489
double getBackPositionOnLane() const
Get the vehicle's position relative to its current lane.
Definition: MSVehicle.h:408
void setPreviousSpeed(double prevSpeed, double prevAcceleration)
Sets the influenced previous speed.
Definition: MSVehicle.cpp:7498
const std::pair< double, const MSLink * > & getNextTurn()
Get the distance and direction of the next upcoming turn for the vehicle (within its look-ahead range...
Definition: MSVehicle.h:839
SUMOTime getArrivalTime(SUMOTime t, double seen, double v, double arrivalSpeed) const
Definition: MSVehicle.cpp:2924
double getAccumulatedWaitingSeconds() const
Returns the number of seconds waited (speed was lesser than 0.1m/s) within the last millisecs.
Definition: MSVehicle.h:717
bool isFrontOnLane(const MSLane *lane) const
Returns the information whether the front of the vehicle is on the given lane.
Definition: MSVehicle.cpp:4945
virtual ~MSVehicle()
Destructor.
Definition: MSVehicle.cpp:991
double getTimeSinceStartupSeconds() const
Definition: MSVehicle.h:686
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:4188
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:5620
void setEmergencyBlueLight(SUMOTime currentTime)
sets the blue flashing light for emergency vehicles
Definition: MSVehicle.cpp:6487
bool isActionStep(SUMOTime t) const
Returns whether the next simulation step will be an action point for the vehicle.
Definition: MSVehicle.h:638
MSAbstractLaneChangeModel * myLaneChangeModel
Definition: MSVehicle.h:1884
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:1291
bool hasValidRouteStart(std::string &msg)
checks wether the vehicle can depart on the first edge
Definition: MSVehicle.cpp:1050
double getLeftSideOnLane() const
Get the lateral position of the vehicles left side on the lane:
Definition: MSVehicle.cpp:6522
std::vector< MSLane * > myFurtherLanes
The information into which lanes the vehicle laps into.
Definition: MSVehicle.h:1911
bool signalSet(int which) const
Returns whether the given signal is on.
Definition: MSVehicle.h:1191
MSCFModel::VehicleVariables * myCFVariables
The per vehicle variables of the car following model.
Definition: MSVehicle.h:2135
double getActionStepLengthSecs() const
Returns the vehicle's action step length in secs, i.e. the interval between two action points.
Definition: MSVehicle.h:536
bool addTraciStop(SUMOVehicleParameter::Stop stop, std::string &errorMsg)
Definition: MSVehicle.cpp:6974
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:3312
void planMoveInternal(const SUMOTime t, MSLeaderInfo ahead, DriveItemVector &lfLinks, double &myStopDist, std::pair< double, const MSLink * > &myNextTurn) const
Definition: MSVehicle.cpp:2120
std::pair< double, const MSLink * > myNextTurn
the upcoming turn for the vehicle
Definition: MSVehicle.h:1908
double getDistanceToLeaveJunction() const
get the distance from the start of this lane to the start of the next normal lane (or 0 if this lane ...
Definition: MSVehicle.cpp:1276
int influenceChangeDecision(int state)
allow TraCI to influence a lane change decision
Definition: MSVehicle.cpp:7111
double getMaxSpeedOnLane() const
Returns the maximal speed for the vehicle on its current lane (including speed factor and deviation,...
Definition: MSVehicle.cpp:1357
bool isRemoteControlled() const
Returns the information whether the vehicle is fully controlled via TraCI.
Definition: MSVehicle.cpp:7130
bool myAmOnNet
Whether the vehicle is on the network (not parking, teleported, vaporized, or arrived)
Definition: MSVehicle.h:1919
double nextStopDist() const
return the distance to the next stop or doubleMax if there is none.
Definition: MSVehicle.h:1040
void enterLaneAtMove(MSLane *enteredLane, bool onTeleporting=false)
Update when the vehicle enters a new lane in the move step.
Definition: MSVehicle.cpp:5263
void adaptBestLanesOccupation(int laneIndex, double density)
update occupation from MSLaneChanger
Definition: MSVehicle.cpp:6306
std::pair< double, double > estimateTimeToNextStop() const
return time (s) and distance to the next stop
Definition: MSVehicle.cpp:7704
double accelThresholdForWaiting() const
maximum acceleration to consider a vehicle as 'waiting' at low speed
Definition: MSVehicle.h:2060
void setAngle(double angle, bool straightenFurther=false)
Set a custom vehicle angle in rad, optionally updates furtherLanePosLat.
Definition: MSVehicle.cpp:1400
std::vector< LaneQ >::iterator myCurrentLaneInBestLanes
Definition: MSVehicle.h:1899
MSVehicle & operator=(const MSVehicle &)
invalidated assignment operator
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:3457
const MSLane * myLastBestLanesInternalLane
Definition: MSVehicle.h:1887
void updateOccupancyAndCurrentBestLane(const MSLane *startLane)
updates LaneQ::nextOccupation and myCurrentLaneInBestLanes
Definition: MSVehicle.cpp:6093
const std::vector< MSLane * > getUpstreamOppositeLanes() const
Returns the sequence of opposite lanes corresponding to past lanes.
Definition: MSVehicle.cpp:6270
WaitingTimeCollector myWaitingTimeCollector
Definition: MSVehicle.h:1859
void setRemoteState(Position xyPos)
sets position outside the road network
Definition: MSVehicle.cpp:7124
void fixPosition()
repair errors in vehicle position after changing between internal edges
Definition: MSVehicle.cpp:6314
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:517
double getSpeedWithoutTraciInfluence() const
Returns the uninfluenced velocity.
Definition: MSVehicle.cpp:7101
PositionVector getBoundingBox(double offset=0) const
get bounding rectangle
Definition: MSVehicle.cpp:6809
ManoeuvreType
flag identifying which, if any, manoeuvre is in progress
Definition: MSVehicle.h:1250
@ MANOEUVRE_ENTRY
Manoeuvre into stopping place.
Definition: MSVehicle.h:1252
@ MANOEUVRE_NONE
not manouevring
Definition: MSVehicle.h:1256
@ MANOEUVRE_EXIT
Manoeuvre out of stopping place.
Definition: MSVehicle.h:1254
const MSEdge * getNextEdgePtr() const
returns the next edge (possibly an internal edge)
Definition: MSVehicle.cpp:7840
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:1223
void setBrakingSignals(double vNext)
sets the braking lights on/off
Definition: MSVehicle.cpp:3992
const std::vector< MSLane * > & getBestLanesContinuation() const
Returns the best sequence of lanes to continue the route starting at myLane.
Definition: MSVehicle.cpp:6115
const MSEdge * myLastBestLanesEdge
Definition: MSVehicle.h:1886
bool ignoreCollision() const
whether this vehicle is except from collision checks
Definition: MSVehicle.cpp:1588
Influencer * myInfluencer
An instance of a velocity/lane influencing instance; built in "getInfluencer".
Definition: MSVehicle.h:2138
void saveState(OutputDevice &out)
Saves the states of a vehicle.
Definition: MSVehicle.cpp:7374
void setIdling(bool amIdling)
access function for Idling flag used to record whether vehicle is waiting to enter lane (after parkin...
Definition: MSVehicle.h:616
void onRemovalFromNet(const MSMoveReminder::Notification reason)
Called when the vehicle is removed from the network.
Definition: MSVehicle.cpp:1024
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:2015
bool resumeFromStopping()
Definition: MSVehicle.cpp:7012
int getBestLaneOffset() const
Definition: MSVehicle.cpp:6286
void adaptToJunctionLeader(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:3141
double lateralDistanceToLane(const int offset) const
Get the minimal lateral distance required to move fully onto the lane at given offset.
Definition: MSVehicle.cpp:6682
double getBackPositionOnLane(const MSLane *lane) const
Get the vehicle's position relative to the given lane.
Definition: MSVehicle.h:401
void resetActionOffset(const SUMOTime timeUntilNextAction=0)
Resets the action offset for the vehicle.
Definition: MSVehicle.cpp:1990
std::vector< DriveProcessItem > DriveItemVector
Container for used Links/visited Lanes during planMove() and executeMove.
Definition: MSVehicle.h:2003
void interpolateLateralZ(Position &pos, double offset, double posLat) const
perform lateral z interpolation in elevated networks
Definition: MSVehicle.cpp:1260
void setBlinkerInformation()
sets the blue flashing light for emergency vehicles
Definition: MSVehicle.cpp:6426
const MSEdge * getCurrentEdge() const
Returns the edge the vehicle is currently at (possibly an internal edge or nullptr)
Definition: MSVehicle.cpp:7835
void adaptToLeaderDistance(const MSLeaderDistanceInfo &ahead, double latOffset, double seen, DriveProcessItem *const lastLink, double &v, double &vLinkPass) const
Definition: MSVehicle.cpp:3023
DriveItemVector::iterator myNextDriveItem
iterator pointing to the next item in myLFLinkLanes
Definition: MSVehicle.h:2016
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:5529
bool isIdling() const
Returns whether a sim vehicle is waiting to enter a lane (after parking has completed)
Definition: MSVehicle.h:624
std::shared_ptr< MSSimpleDriverState > getDriverState() const
Returns the vehicle driver's state.
Definition: MSVehicle.cpp:7486
void removeApproachingInformation(const DriveItemVector &lfLinks) const
unregister approach from all upcoming links
Definition: MSVehicle.cpp:6744
void replaceVehicleType(MSVehicleType *type)
Replaces the current vehicle type by the one given.
Definition: MSVehicle.cpp:4737
SUMOTime myJunctionEntryTimeNeverYield
Definition: MSVehicle.h:1939
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:6602
bool rerouteParkingArea(const std::string &parkingAreaID, std::string &errorMsg)
Definition: MSVehicle.cpp:6898
bool hasArrived() const
Returns whether this vehicle has already arived (reached the arrivalPosition on its final edge)
Definition: MSVehicle.cpp:1082
void switchOffSignal(int signal)
Switches the given signal off.
Definition: MSVehicle.h:1174
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:4667
double getStopArrivalDelay() const
Returns the estimated public transport stop arrival delay in seconds.
Definition: MSVehicle.cpp:7819
int getSignals() const
Returns the signals.
Definition: MSVehicle.h:1182
int mySignals
State of things of the vehicle that can be on or off.
Definition: MSVehicle.h:1916
bool setExitManoeuvre()
accessor function to myManoeuvre equivalent
Definition: MSVehicle.cpp:7517
bool isOppositeLane(const MSLane *lane) const
whether the give lane is reverse direction of the current route or not
Definition: MSVehicle.cpp:5631
double myStopDist
distance to the next stop or doubleMax if there is none
Definition: MSVehicle.h:1930
Signalling
Some boolean values which describe the state of some vehicle parts.
Definition: MSVehicle.h:1109
@ VEH_SIGNAL_EMERGENCY_RED
A red emergency light is on.
Definition: MSVehicle.h:1137
@ VEH_SIGNAL_NONE
Everything is switched off.
Definition: MSVehicle.h:1111
@ VEH_SIGNAL_FOGLIGHT
The fog lights are on (no visualisation)
Definition: MSVehicle.h:1123
@ VEH_SIGNAL_FRONTLIGHT
The front lights are on (no visualisation)
Definition: MSVehicle.h:1121
@ VEH_SIGNAL_DOOR_OPEN_LEFT
One of the left doors is opened.
Definition: MSVehicle.h:1131
@ VEH_SIGNAL_BLINKER_RIGHT
Right blinker lights are switched on.
Definition: MSVehicle.h:1113
@ VEH_SIGNAL_BRAKELIGHT
The brake lights are on.
Definition: MSVehicle.h:1119
@ VEH_SIGNAL_BACKDRIVE
The backwards driving lights are on (no visualisation)
Definition: MSVehicle.h:1127
@ VEH_SIGNAL_EMERGENCY_BLUE
A blue emergency light is on.
Definition: MSVehicle.h:1135
@ VEH_SIGNAL_BLINKER_LEFT
Left blinker lights are switched on.
Definition: MSVehicle.h:1115
@ VEH_SIGNAL_DOOR_OPEN_RIGHT
One of the right doors is opened.
Definition: MSVehicle.h:1133
@ VEH_SIGNAL_BLINKER_EMERGENCY
Blinker lights on both sides are switched on.
Definition: MSVehicle.h:1117
@ VEH_SIGNAL_WIPER
The wipers are on.
Definition: MSVehicle.h:1129
@ VEH_SIGNAL_EMERGENCY_YELLOW
A yellow emergency light is on.
Definition: MSVehicle.h:1139
@ VEH_SIGNAL_HIGHBEAM
The high beam lights are on (no visualisation)
Definition: MSVehicle.h:1125
SUMOTime getActionStepLength() const
Returns the vehicle's action step length in millisecs, i.e. the interval between two action points.
Definition: MSVehicle.h:528
bool myHaveToWaitOnNextLink
Definition: MSVehicle.h:1924
SUMOTime collisionStopTime() const
Returns the remaining time a vehicle needs to stop due to a collision. A negative value indicates tha...
Definition: MSVehicle.cpp:1582
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:6212
double getBestLaneDist() const
returns the distance that can be driven without lane change
Definition: MSVehicle.cpp:6295
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:6356
double slowDownForSchedule(double vMinComfortable) const
optionally return an upper bound on speed to stay within the schedule
Definition: MSVehicle.cpp:2885
bool executeMove()
Executes planned vehicle movements with regards to right-of-way.
Definition: MSVehicle.cpp:4352
const MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:584
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:6386
double getLastStepDist() const
Get the distance the vehicle covered in the previous timestep.
Definition: MSVehicle.h:384
void invalidateCachedPosition()
Definition: MSVehicle.h:424
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
bool isLeader(const MSLink *link, const MSVehicle *veh, const double gap) const
whether the given vehicle must be followed at the given junction
Definition: MSVehicle.cpp:7231
void computeFurtherLanes(MSLane *enteredLane, double pos, bool collision=false)
updates myFurtherLanes on lane insertion or after collision
Definition: MSVehicle.cpp:5423
MSLane * getMutableLane() const
Returns the lane the vehicle is on Non const version indicates that something volatile is going on.
Definition: MSVehicle.h:592
std::pair< const MSLane *, double > getLanePosAfterDist(double distance) const
return lane and position along bestlanes at the given distance
Definition: MSVehicle.cpp:6321
SUMOTime myCollisionImmunity
amount of time for which the vehicle is immune from collisions
Definition: MSVehicle.h:1933
bool passingMinor() const
decide whether the vehicle is passing a minor link or has comitted to do so
Definition: MSVehicle.cpp:7215
void updateWaitingTime(double vNext)
Updates the vehicle's waiting time counters (accumulated and consecutive)
Definition: MSVehicle.cpp:4011
void enterLaneAtLaneChange(MSLane *enteredLane)
Update when the vehicle enters a new lane in the laneChange step.
Definition: MSVehicle.cpp:5324
BaseInfluencer & getBaseInfluencer()
Returns the velocity/lane influencer.
Definition: MSVehicle.cpp:7084
Influencer & getInfluencer()
Definition: MSVehicle.cpp:7076
bool isBidiOn(const MSLane *lane) const
whether this vehicle is driving against lane
Definition: MSVehicle.cpp:6890
double getRightSideOnLane() const
Get the lateral position of the vehicles right side on the lane:
Definition: MSVehicle.cpp:6516
bool unsafeLinkAhead(const MSLane *lane) const
whether the vehicle may safely move to the given lane with regard to upcoming links
Definition: MSVehicle.cpp:6756
double getCurrentApparentDecel() const
get apparent deceleration based on vType parameters and current acceleration
Definition: MSVehicle.cpp:7510
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:4755
DriveItemVector myLFLinkLanesPrev
planned speeds from the previous step for un-registering from junctions after the new container is fi...
Definition: MSVehicle.h:2009
std::vector< std::vector< LaneQ > > myBestLanes
Definition: MSVehicle.h:1894
void setActionStepLength(double actionStepLength, bool resetActionOffset=true)
Sets the action steplength of the vehicle.
Definition: MSVehicle.cpp:1424
double getLateralPositionOnLane() const
Get the vehicle's lateral position on the lane.
Definition: MSVehicle.h:416
double getSlope() const
Returns the slope of the road at vehicle's position in degrees.
Definition: MSVehicle.cpp:1196
bool myActionStep
The flag myActionStep indicates whether the current time step is an action point for the vehicle.
Definition: MSVehicle.h:1874
const Position getBackPosition() const
Definition: MSVehicle.cpp:1511
bool congested() const
Definition: MSVehicle.cpp:1441
void loadState(const SUMOSAXAttributes &attrs, const SUMOTime offset)
Loads the state of this vehicle from the given description.
Definition: MSVehicle.cpp:7420
SUMOTime myTimeSinceStartup
duration of driving (speed > SUMO_const_haltingSpeed) after the last halting eposide
Definition: MSVehicle.h:1943
double getSpeed() const
Returns the vehicle's current speed.
Definition: MSVehicle.h:493
void setApproachingForAllLinks(const SUMOTime t)
Register junction approaches for all link items in the current plan.
Definition: MSVehicle.cpp:5166
SUMOTime getAccumulatedWaitingTime() const
Returns the SUMOTime waited (speed was lesser than 0.1m/s) within the last t millisecs.
Definition: MSVehicle.h:708
SUMOTime remainingStopDuration() const
Returns the remaining stop duration for a stopped vehicle or 0.
Definition: MSVehicle.cpp:1573
bool keepStopping(bool afterProcessing=false) const
Returns whether the vehicle is stopped and must continue to do so.
Definition: MSVehicle.cpp:1559
void workOnIdleReminders()
cycle through vehicle devices invoking notifyIdle
Definition: MSVehicle.cpp:1158
static std::vector< MSLane * > myEmptyLaneVector
Definition: MSVehicle.h:1901
Position myCachedPosition
Definition: MSVehicle.h:1935
bool replaceRoute(ConstMSRoutePtr 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:1097
MSVehicle::ManoeuvreType getManoeuvreType() const
accessor function to myManoeuvre equivalent
Definition: MSVehicle.cpp:7566
double checkReversal(bool &canReverse, double speedThreshold=SUMO_const_haltingSpeed, double seen=0) const
Definition: MSVehicle.cpp:4038
void removePassedDriveItems()
Erase passed drive items from myLFLinkLanes (and unregister approaching information for corresponding...
Definition: MSVehicle.cpp:3778
const std::vector< MSLane * > & getFurtherLanes() const
Definition: MSVehicle.h:847
const std::vector< LaneQ > & getBestLanes() const
Returns the description of best lanes to use in order to continue the route.
Definition: MSVehicle.cpp:5638
std::vector< double > myFurtherLanesPosLat
lateral positions on further lanes
Definition: MSVehicle.h:1913
bool checkActionStep(const SUMOTime t)
Returns whether the vehicle is supposed to take action in the current simulation step Updates myActio...
Definition: MSVehicle.cpp:1980
const MSCFModel & getCarFollowModel() const
Returns the vehicle's car following model definition.
Definition: MSVehicle.h:978
Position validatePosition(Position result, double offset=0) const
ensure that a vehicle-relative position is not invalid
Definition: MSVehicle.cpp:1366
void loadPreviousApproaching(MSLink *link, bool setRequest, SUMOTime arrivalTime, double arrivalSpeed, double arrivalSpeedBraking, double dist, double leaveSpeed)
Definition: MSVehicle.cpp:7474
bool keepClear(const MSLink *link) const
decide whether the given link must be kept clear
Definition: MSVehicle.cpp:7142
bool manoeuvreIsComplete() const
accessor function to myManoeuvre equivalent
Definition: MSVehicle.cpp:7699
double processNextStop(double currentVelocity)
Processes stops, returns the velocity needed to reach the stop.
Definition: MSVehicle.cpp:1594
double myAngle
the angle in radians (
Definition: MSVehicle.h:1927
bool ignoreRed(const MSLink *link, bool canBrake) const
decide whether a red (or yellow light) may be ignored
Definition: MSVehicle.cpp:7154
double getPositionOnLane() const
Get the vehicle's position along the lane.
Definition: MSVehicle.h:377
void updateTimeLoss(double vNext)
Updates the vehicle's time loss.
Definition: MSVehicle.cpp:4026
MSDevice_DriverState * myDriverState
This vehicle's driver state.
Definition: MSVehicle.h:1868
bool joinTrainPart(MSVehicle *veh)
try joining the given vehicle to the rear of this one (to resolve joinTriggered)
Definition: MSVehicle.cpp:1912
MSLane * myLane
The lane the vehicle is on.
Definition: MSVehicle.h:1882
bool onFurtherEdge(const MSEdge *edge) const
whether this vehicle has its back (and no its front) on the given edge
Definition: MSVehicle.cpp:6879
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:3749
Manoeuvre myManoeuvre
Definition: MSVehicle.h:1339
double getLateralOverlap() const
return the amount by which the vehicle extends laterally outside it's primary lane
Definition: MSVehicle.cpp:6738
double getAngle() const
Returns the vehicle's direction in radians.
Definition: MSVehicle.h:738
bool handleCollisionStop(MSStop &stop, const double distToStop)
Definition: MSVehicle.cpp:6985
bool hasInfluencer() const
whether the vehicle is individually influenced (via TraCI or special parameters)
Definition: MSVehicle.h:1682
MSDevice_Friction * myFrictionDevice
This vehicle's friction perception.
Definition: MSVehicle.h:1871
double getPreviousSpeed() const
Returns the vehicle's speed before the previous time step.
Definition: MSVehicle.h:501
MSCFModel::VehicleVariables * getCarFollowVariables() const
Returns the vehicle's car following model variables.
Definition: MSVehicle.h:999
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:1933
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:1996
double getBrakeGap(bool delayed=false) const
get distance for coming to a stop (used for rerouting checks)
Definition: MSVehicle.cpp:1974
void executeFractionalMove(double dist)
move vehicle forward by the given distance during insertion
Definition: MSVehicle.cpp:4610
LaneChangeMode
modes for resolving conflicts between external control (traci) and vehicle control over lane changing...
Definition: MSVehicle.h:1147
@ LC_NOCONFLICT
Definition: MSVehicle.h:1149
virtual void drawOutsideNetwork(bool)
register vehicle for drawing while outside the network
Definition: MSVehicle.h:1833
void initDevices()
Definition: MSVehicle.cpp:1040
void adaptToOncomingLeader(const std::pair< const MSVehicle *, double > leaderInfo, DriveProcessItem *const lastLink, double &v, double &vLinkPass) const
Definition: MSVehicle.cpp:3247
State myState
This Vehicles driving state (pos and speed)
Definition: MSVehicle.h:1865
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:6552
void setLateralPositionOnLane(double posLat)
Definition: MSVehicle.h:420
void adaptToLeader(const std::pair< const MSVehicle *, double > leaderInfo, double seen, DriveProcessItem *const lastLink, double &v, double &vLinkPass) const
Definition: MSVehicle.cpp:3055
void activateReminders(const MSMoveReminder::Notification reason, const MSLane *enteredLane=0)
"Activates" all current move reminder
Definition: MSVehicle.cpp:5230
double getDistanceToPosition(double destPos, const MSEdge *destEdge) const
Definition: MSVehicle.cpp:6338
void switchOnSignal(int signal)
Switches the given signal on.
Definition: MSVehicle.h:1166
static bool overlap(const MSVehicle *veh1, const MSVehicle *veh2)
Definition: MSVehicle.h:766
int getLaneIndex() const
Definition: MSVehicle.cpp:6501
void updateParkingState()
update state while parking
Definition: MSVehicle.cpp:4721
DriveItemVector myLFLinkLanes
container for the planned speeds in the current step
Definition: MSVehicle.h:2006
void updateDriveItems()
Check whether the drive items (myLFLinkLanes) are up to date, and update them if required.
Definition: MSVehicle.cpp:3832
Position getVelocityVector() const
Returns the vehicle's direction in radians.
Definition: MSVehicle.h:746
SUMOTime myJunctionEntryTime
time at which the current junction was entered
Definition: MSVehicle.h:1938
The car-following model and parameter.
Definition: MSVehicleType.h:63
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:300
A list of positions.
Encapsulated SAX-Attributes.
Representation of a vehicle, person, or container.
Representation of a vehicle.
Definition: SUMOVehicle.h:62
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:1950
DriveProcessItem(MSLink *link, double vPass, double vWait, bool setRequest, SUMOTime arrivalTime, double arrivalSpeed, double arrivalSpeedBraking, double distance, double leaveSpeed)
Definition: MSVehicle.h:1963
double getLeaveSpeed() const
Definition: MSVehicle.h:1996
DriveProcessItem(double vWait, double distance, double _availableSpace=0)
constructor if the link shall not be passed
Definition: MSVehicle.h:1979
void adaptLeaveSpeed(const double v)
Definition: MSVehicle.h:1989
Container for state and parameters of the gap control.
Definition: MSVehicle.h:1370
bool active
Whether the gap control is active.
Definition: MSVehicle.h:1401
static std::map< const MSVehicle *, GapControlState * > refVehMap
stores reference vehicles currently in use by a gapController
Definition: MSVehicle.h:1412
SUMOTime lastUpdate
Time of the last update of the gap control.
Definition: MSVehicle.h:1407
double changeRate
Rate by which the current time and space headways are changed towards the target value....
Definition: MSVehicle.h:1395
double addGapTarget
Target value for the desired space headway.
Definition: MSVehicle.h:1390
static GapControlVehStateListener vehStateListener
Definition: MSVehicle.h:1415
double timeHeadwayIncrement
cache storage for the headway increments of the current operation
Definition: MSVehicle.h:1409
double tauOriginal
Original value for the desired headway (will be reset after duration has expired)
Definition: MSVehicle.h:1382
double tauCurrent
Current, interpolated value for the desired time headway.
Definition: MSVehicle.h:1384
double remainingDuration
Remaining duration for keeping the target headway.
Definition: MSVehicle.h:1392
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:317
double addGapCurrent
Current, interpolated value for the desired space headway.
Definition: MSVehicle.h:1388
static void cleanup()
Static cleanup (removes vehicle state listener)
Definition: MSVehicle.cpp:311
double tauTarget
Target value for the desired time headway.
Definition: MSVehicle.h:1386
void deactivate()
Stop gap control.
Definition: MSVehicle.cpp:347
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:1399
double maxDecel
Maximal deceleration to be applied due to the adapted headway.
Definition: MSVehicle.h:1397
bool gapAttained
Whether the desired gap was attained during the current activity phase (induces the remaining duratio...
Definition: MSVehicle.h:1403
const MSVehicle * prevLeader
The last recognized leader.
Definition: MSVehicle.h:1405
static void init()
Static initalization (adds vehicle state listener)
Definition: MSVehicle.cpp:300
A structure representing the best lanes for continuing the current route starting at 'lane'.
Definition: MSVehicle.h:869
double length
The overall length which may be driven when using this lane without a lane change.
Definition: MSVehicle.h:873
bool allowsContinuation
Whether this lane allows to continue the drive.
Definition: MSVehicle.h:883
double nextOccupation
As occupation, but without the first lane.
Definition: MSVehicle.h:879
std::vector< MSLane * > bestContinuations
Definition: MSVehicle.h:889
MSLane * lane
The described lane.
Definition: MSVehicle.h:871
double currentLength
The length which may be driven on this lane.
Definition: MSVehicle.h:875
int bestLaneOffset
The (signed) number of lanes to be crossed to get to the lane which allows to continue the drive.
Definition: MSVehicle.h:881
double occupation
The overall vehicle sum on consecutive lanes which can be passed without a lane change.
Definition: MSVehicle.h:877