Eclipse SUMO - Simulation of Urban MObility
MSAbstractLaneChangeModel.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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
20 // Interface for lane-change models
21 /****************************************************************************/
22 #ifndef MSAbstractLaneChangeModel_h
23 #define MSAbstractLaneChangeModel_h
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #include <config.h>
29 
30 #include <microsim/MSGlobals.h>
31 #include <microsim/MSVehicle.h>
32 
33 class MSLane;
34 
35 // ===========================================================================
36 // used enumeration
37 // ===========================================================================
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
47 public:
48 
52  class MSLCMessager {
53  public:
59  MSLCMessager(MSVehicle* leader, MSVehicle* neighLead, MSVehicle* neighFollow)
60  : myLeader(leader), myNeighLeader(neighLead),
61  myNeighFollower(neighFollow) { }
62 
63 
66 
67 
73  void* informLeader(void* info, MSVehicle* sender) {
74  assert(myLeader != 0);
75  return myLeader->getLaneChangeModel().inform(info, sender);
76  }
77 
78 
84  void* informNeighLeader(void* info, MSVehicle* sender) {
85  assert(myNeighLeader != 0);
86  return myNeighLeader->getLaneChangeModel().inform(info, sender);
87  }
88 
89 
95  void* informNeighFollower(void* info, MSVehicle* sender) {
96  assert(myNeighFollower != 0);
97  return myNeighFollower->getLaneChangeModel().inform(info, sender);
98  }
99 
100 
101  private:
108 
109  };
110 
111  struct StateAndDist {
112  // @brief LaneChangeAction flags
113  int state;
114  // @brief Lateral distance to be completed in the next step
115  double latDist;
116  // @brief Full lateral distance required for the completion of the envisioned maneuver
117  double maneuverDist;
118  // @brief direction that was checked
119  int dir;
120 
121  StateAndDist(int _state, double _latDist, double _targetDist, int _dir) :
122  state(_state),
123  latDist(_latDist),
124  maneuverDist(_targetDist),
125  dir(_dir) {}
126 
127  bool sameDirection(const StateAndDist& other) const {
128  return latDist * other.latDist > 0;
129  }
130  };
131 
133  void static initGlobalOptions(const OptionsCont& oc);
134 
140 
142  inline static bool haveLateralDynamics() {
144  }
145 
149  virtual LaneChangeModel getModelID() const = 0;
150 
152  static bool haveLCOutput() {
153  return myLCOutput;
154  }
155 
157  static bool outputLCStarted() {
158  return myLCStartedOutput;
159  }
160 
162  static bool outputLCEnded() {
163  return myLCEndedOutput;
164  }
165 
171 
173  virtual ~MSAbstractLaneChangeModel();
174 
175  inline int getOwnState() const {
176  return myOwnState;
177  }
178 
179  inline int getPrevState() const {
181  return myPreviousState2;
182  }
183 
184  virtual void setOwnState(const int state);
185 
187  void setManeuverDist(const double dist);
189  double getManeuverDist() const;
190  double getPreviousManeuverDist() const;
191 
193  virtual void updateSafeLatDist(const double travelledLatDist);
194 
195  const std::pair<int, int>& getSavedState(const int dir) const {
196  if (dir == -1) {
197  return mySavedStateRight;
198  } else if (dir == 0) {
199  return mySavedStateCenter;
200  } else {
201  return mySavedStateLeft;
202  }
203  }
204 
205  void saveLCState(const int dir, const int stateWithoutTraCI, const int state) {
206  const auto pair = std::make_pair(stateWithoutTraCI | getCanceledState(dir), state);
207  if (dir == -1) {
208  mySavedStateRight = pair;
209  } else if (dir == 0) {
210  mySavedStateCenter = pair;
211  } else {
212  mySavedStateLeft = pair;
213  }
214  }
215 
218  void saveNeighbors(const int dir, const MSLeaderDistanceInfo& followers, const MSLeaderDistanceInfo& leaders);
219 
222  void saveNeighbors(const int dir, const std::pair<MSVehicle* const, double>& follower, const std::pair<MSVehicle* const, double>& leader);
223 
225  void clearNeighbors();
226 
228  const std::shared_ptr<MSLeaderDistanceInfo> getFollowers(const int dir);
229 
231  const std::shared_ptr<MSLeaderDistanceInfo> getLeaders(const int dir);
232 
233  int& getCanceledState(const int dir) {
234  if (dir == -1) {
235  return myCanceledStateRight;
236  } else if (dir == 0) {
237  return myCanceledStateCenter;
238  } else {
239  return myCanceledStateLeft;
240  }
241  }
242 
244  bool isStrategicBlocked() const;
245 
246  void setFollowerGaps(CLeaderDist follower, double secGap);
247  void setLeaderGaps(CLeaderDist, double secGap);
248  void setOrigLeaderGaps(CLeaderDist, double secGap);
249  void setFollowerGaps(const MSLeaderDistanceInfo& vehicles);
250  void setLeaderGaps(const MSLeaderDistanceInfo& vehicles);
251  void setOrigLeaderGaps(const MSLeaderDistanceInfo& vehicles);
252 
253  virtual void prepareStep() {
262  if (!myDontResetLCGaps) {
272  }
273  myCommittedSpeed = 0;
274  }
275 
280  virtual int wantsChange(
281  int laneOffset,
282  MSAbstractLaneChangeModel::MSLCMessager& msgPass, int blocked,
283  const std::pair<MSVehicle*, double>& leader,
284  const std::pair<MSVehicle*, double>& neighLead,
285  const std::pair<MSVehicle*, double>& neighFollow,
286  const MSLane& neighLane,
287  const std::vector<MSVehicle::LaneQ>& preb,
288  MSVehicle** lastBlocked,
289  MSVehicle** firstBlocked) {
290  UNUSED_PARAMETER(laneOffset);
291  UNUSED_PARAMETER(&msgPass);
292  UNUSED_PARAMETER(blocked);
293  UNUSED_PARAMETER(&leader);
294  UNUSED_PARAMETER(&neighLead);
295  UNUSED_PARAMETER(&neighFollow);
296  UNUSED_PARAMETER(&neighLane);
297  UNUSED_PARAMETER(&preb);
298  UNUSED_PARAMETER(lastBlocked);
299  UNUSED_PARAMETER(firstBlocked);
300  throw ProcessError("Method not implemented by model " + toString(myModel));
301  };
302 
303  virtual int wantsChangeSublane(
304  int laneOffset,
305  LaneChangeAction alternatives,
306  const MSLeaderDistanceInfo& leaders,
307  const MSLeaderDistanceInfo& followers,
308  const MSLeaderDistanceInfo& blockers,
309  const MSLeaderDistanceInfo& neighLeaders,
310  const MSLeaderDistanceInfo& neighFollowers,
311  const MSLeaderDistanceInfo& neighBlockers,
312  const MSLane& neighLane,
313  const std::vector<MSVehicle::LaneQ>& preb,
314  MSVehicle** lastBlocked,
315  MSVehicle** firstBlocked,
316  double& latDist, double& targetDistLat, int& blocked) {
317  UNUSED_PARAMETER(laneOffset);
318  UNUSED_PARAMETER(alternatives);
319  UNUSED_PARAMETER(&leaders);
320  UNUSED_PARAMETER(&followers);
321  UNUSED_PARAMETER(&blockers);
322  UNUSED_PARAMETER(&neighLeaders);
323  UNUSED_PARAMETER(&neighFollowers);
324  UNUSED_PARAMETER(&neighBlockers);
325  UNUSED_PARAMETER(&neighLane);
326  UNUSED_PARAMETER(&preb);
327  UNUSED_PARAMETER(lastBlocked);
328  UNUSED_PARAMETER(firstBlocked);
329  UNUSED_PARAMETER(latDist);
330  UNUSED_PARAMETER(targetDistLat);
331  UNUSED_PARAMETER(blocked);
332  throw ProcessError("Method not implemented by model " + toString(myModel));
333  }
334 
336  virtual void updateExpectedSublaneSpeeds(const MSLeaderDistanceInfo& ahead, int sublaneOffset, int laneIndex) {
337  UNUSED_PARAMETER(&ahead);
338  UNUSED_PARAMETER(sublaneOffset);
339  UNUSED_PARAMETER(laneIndex);
340  throw ProcessError("Method not implemented by model " + toString(myModel));
341  }
342 
345  UNUSED_PARAMETER(sd1);
346  UNUSED_PARAMETER(sd2);
347  throw ProcessError("Method not implemented by model " + toString(myModel));
348  }
349 
350  virtual void* inform(void* info, MSVehicle* sender) = 0;
351 
365  virtual double patchSpeed(const double min, const double wanted, const double max,
366  const MSCFModel& cfModel) = 0;
367 
368  /* @brief called once when the primary lane of the vehicle changes (updates
369  * the custom variables of each child implementation */
370  virtual void changed() = 0;
371 
372 
374  virtual double getSafetyFactor() const {
375  return 1.0;
376  }
377 
379  virtual double getOppositeSafetyFactor() const {
380  return 1.0;
381  }
382 
384  virtual bool debugVehicle() const {
385  return false;
386  }
387 
389  void changedToOpposite();
390 
391  void unchanged() {
392  if (myLastLaneChangeOffset > 0) {
394  } else if (myLastLaneChangeOffset < 0) {
396  }
397  }
398 
403  return myShadowLane;
404  }
405 
407  MSLane* getShadowLane(const MSLane* lane) const;
408 
410  MSLane* getShadowLane(const MSLane* lane, double posLat) const;
411 
413  void setShadowLane(MSLane* lane) {
414  myShadowLane = lane;
415  }
416 
417  const std::vector<MSLane*>& getShadowFurtherLanes() const {
418  return myShadowFurtherLanes;
419  }
420 
421  const std::vector<double>& getShadowFurtherLanesPosLat() const {
423  }
424 
429  return myTargetLane;
430  }
431 
432  const std::vector<MSLane*>& getFurtherTargetLanes() const {
433  return myFurtherTargetLanes;
434  }
435 
437  return myLastLaneChangeOffset;
438  }
439 
440 
442  inline bool pastMidpoint() const {
443  return myLaneChangeCompletion >= 0.5;
444  }
445 
447  SUMOTime remainingTime() const;
448 
460  virtual double estimateLCDuration(const double speed, const double remainingManeuverDist, const double decel) const;
461 
463  inline bool isChangingLanes() const {
464  return myLaneChangeCompletion < (1 - NUMERICAL_EPS);
465  }
466 
468  inline double getLaneChangeCompletion() const {
469  return myLaneChangeCompletion;
470  }
471 
473  inline int getLaneChangeDirection() const {
474  return myLaneChangeDirection;
475  }
476 
478  int getShadowDirection() const;
479 
481  double getAngleOffset() const;
482 
484  inline bool alreadyChanged() const {
485  return myAlreadyChanged;
486  }
487 
489  void resetChanged() {
490  myAlreadyChanged = false;
491  }
492 
494  bool startLaneChangeManeuver(MSLane* source, MSLane* target, int direction);
495 
497  void memorizeGapsAtLCInit();
498  void clearGapsAtLCInit();
499 
500  /* @brief continue the lane change maneuver and return whether the midpoint
501  * was passed in this step
502  */
503  bool updateCompletion();
504 
505  /* @brief update lane change shadow after the vehicle moved to a new lane */
506  void updateShadowLane();
507 
508  /* @brief update lane change reservations after the vehicle moved to a new lane
509  * @note The shadow lane should always be updated before updating the target lane. */
511 
512  /* @brief Determines the lane which the vehicle intends to enter during its current action step.
513  * targetDir is set to the offset of the returned lane with respect to the vehicle'a current lane. */
514  MSLane* determineTargetLane(int& targetDir) const;
515 
516  /* @brief finish the lane change maneuver
517  */
519 
520  /* @brief clean up all references to the shadow vehicle
521  */
522  void cleanupShadowLane();
523 
524  /* @brief clean up all references to the vehicle on its target lanes
525  */
526  void cleanupTargetLane();
527 
529  virtual void saveBlockerLength(double length) {
530  UNUSED_PARAMETER(length);
531  }
532 
534  myPartiallyOccupatedByShadow.push_back(lane);
535  }
536 
538  myNoPartiallyOccupatedByShadow.push_back(lane);
539  }
540 
542  void primaryLaneChanged(MSLane* source, MSLane* target, int direction);
543 
545  void laneChangeOutput(const std::string& tag, MSLane* source, MSLane* target, int direction, double maneuverDist = 0);
546 
548  virtual bool sublaneChangeCompleted(const double latDist) const {
549  UNUSED_PARAMETER(latDist);
550  throw ProcessError("Method not implemented by model " + toString(myModel));
551  }
552 
554  void setShadowApproachingInformation(MSLink* link) const;
556 
557  bool isOpposite() const {
558  return myAmOpposite;
559  }
560 
561  double getCommittedSpeed() const {
562  return myCommittedSpeed;
563  }
564 
566  double getSpeedLat() const {
567  return mySpeedLat;
568  }
569 
570  void setSpeedLat(double speedLat) {
571  mySpeedLat = speedLat;
572  }
573 
576  virtual double computeSpeedLat(double latDist, double& maneuverDist);
577 
580  virtual double getAssumedDecelForLaneChangeDuration() const;
581 
583  virtual std::string getParameter(const std::string& key) const {
584  throw InvalidArgument("Parameter '" + key + "' is not supported for laneChangeModel of type '" + toString(myModel) + "'");
585  }
586 
588  virtual void setParameter(const std::string& key, const std::string& value) {
589  UNUSED_PARAMETER(value);
590  throw InvalidArgument("Setting parameter '" + key + "' is not supported for laneChangeModel of type '" + toString(myModel) + "'");
591  }
592 
593 
596  void checkTraCICommands();
597 
598  static const double NO_NEIGHBOR;
599 
600 protected:
601  virtual bool congested(const MSVehicle* const neighLeader);
602 
603  virtual bool predInteraction(const std::pair<MSVehicle*, double>& leader);
604 
606  bool cancelRequest(int state, int laneOffset);
607 
608 
609 protected:
612 
619 
620  std::pair<int, int> mySavedStateRight;
621  std::pair<int, int> mySavedStateCenter;
622  std::pair<int, int> mySavedStateLeft;
626 
629  std::shared_ptr<MSLeaderDistanceInfo> myLeftFollowers;
630  std::shared_ptr<MSLeaderDistanceInfo> myLeftLeaders;
631  std::shared_ptr<MSLeaderDistanceInfo> myRightFollowers;
632  std::shared_ptr<MSLeaderDistanceInfo> myRightLeaders;
634 
636  double mySpeedLat;
637 
640 
643 
646 
650 
653 
656 
659  /* @brief Lanes that are partially (laterally) occupied by the back of the
660  * vehicle (analogue to MSVehicle::myFurtherLanes) */
661  std::vector<MSLane*> myShadowFurtherLanes;
662  std::vector<double> myShadowFurtherLanesPosLat;
663 
664 
673 
674  /* @brief Further upstream lanes that are affected by the vehicle's maneuver (analogue to MSVehicle::myFurtherLanes)
675  * @note If myTargetLane==nullptr, we may assume myFurtherTargetLanes.size()==0, otherwise we have
676  * myFurtherTargetLanes.size() == myVehicle.getFurtherLanes.size()
677  * Here it may occur that an element myFurtherTargetLanes[i]==nullptr if myFurtherLanes[i] has
678  * no parallel lane in the change direction.
679  * */
680  std::vector<MSLane*> myFurtherTargetLanes;
681 
684 
687 
689  std::vector<MSLane*> myPartiallyOccupatedByShadow;
690 
691  /* @brief list of lanes where there is no shadow vehicle partial occupator
692  * (when changing to a lane that has no predecessor) */
693  std::vector<MSLane*> myNoPartiallyOccupatedByShadow;
694 
698 
712 
716 
717  // @brief the maximum lateral speed when standing
719  // @brief the factor of maximum lateral speed to longitudinal speed
721 
722  /* @brief to be called by derived classes in their changed() method.
723  * If dir=0 is given, the current value remains unchanged */
724  void initLastLaneChangeOffset(int dir);
725 
728 
730  static bool myLCOutput;
731  static bool myLCStartedOutput;
732  static bool myLCEndedOutput;
733 
734 
735 private:
736  /* @brief information how long ago the vehicle has performed a lane-change,
737  * sign indicates direction of the last change
738  */
740 
742  mutable std::vector<MSLink*> myApproachedByShadow;
743 
746 
747 
748 private:
751 };
752 
753 
754 #endif
755 
756 /****************************************************************************/
757 
virtual bool sublaneChangeCompleted(const double latDist) const
whether the current change completes the manoeuvre
bool myDontResetLCGaps
Flag to prevent resetting the memorized values for LC relevant gaps until the LC output is triggered ...
bool isChangingLanes() const
return true if the vehicle currently performs a lane change maneuver
static double gLateralResolution
Definition: MSGlobals.h:85
std::vector< MSLane * > myPartiallyOccupatedByShadow
list of lanes where the shadow vehicle is partial occupator
const std::vector< double > & getShadowFurtherLanesPosLat() const
saves leader/follower vehicles and their distances relative to an ego vehicle
Definition: MSLeaderInfo.h:133
std::shared_ptr< MSLeaderDistanceInfo > myRightLeaders
double myLastLeaderSpeed
speeds of surrounding vehicles at the time of lane change
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
long long int SUMOTime
Definition: SUMOTime.h:35
std::pair< int, int > mySavedStateRight
std::shared_ptr< MSLeaderDistanceInfo > myLeftLeaders
int myPreviousState
lane changing state from the previous simulation step
virtual double getAssumedDecelForLaneChangeDuration() const
Returns a deceleration value which is used for the estimation of the duration of a lane change...
virtual void * inform(void *info, MSVehicle *sender)=0
void setLeaderGaps(CLeaderDist, double secGap)
void laneChangeOutput(const std::string &tag, MSLane *source, MSLane *target, int direction, double maneuverDist=0)
called once the vehicle ends a lane change manoeuvre (non-instant)
MSVehicle * myNeighLeader
The leader on the lane the vehicle want to change to.
void clearNeighbors()
Clear info on neighboring vehicle from previous step.
double myLastLeaderGap
the actual minimum longitudinal distances to vehicles on the target lane
int getShadowDirection() const
return the direction in which the current shadow lane lies
double getManeuverDist() const
Returns the remaining unblocked distance for the current maneuver. (only used by sublane model) ...
double myLaneChangeCompletion
progress of the lane change maneuver 0:started, 1:complete
static bool haveLateralDynamics()
whether any kind of lateral dynamics is active
The car-following model abstraction.
Definition: MSCFModel.h:57
std::pair< int, int > mySavedStateCenter
void * informNeighFollower(void *info, MSVehicle *sender)
Informs the follower on the desired lane.
double myPreviousManeuverDist
Maneuver distance from the previous simulation step.
Notification
Definition of a vehicle state.
static bool myLCOutput
whether to record lane-changing
std::shared_ptr< MSLeaderDistanceInfo > myRightFollowers
double myLastOrigLeaderGap
acutal and secure distance to closest leader vehicle on the original when performing lane change ...
MSLCMessager(MSVehicle *leader, MSVehicle *neighLead, MSVehicle *neighFollow)
Constructor.
SUMOTime DELTA_T
Definition: SUMOTime.cpp:35
double getAngleOffset() const
return the angle offset during a continuous change maneuver
virtual std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this laneChangeModel. Throw exception for unsupported key ...
virtual StateAndDist decideDirection(StateAndDist sd1, StateAndDist sd2) const
decide in which direction to move in case both directions are desirable
bool alreadyChanged() const
reset the flag whether a vehicle already moved to false
MSLane * myShadowLane
A lane that is partially occupied by the front of the vehicle but that is not the primary lane...
virtual bool predInteraction(const std::pair< MSVehicle *, double > &leader)
bool sameDirection(const StateAndDist &other) const
MSLane * myTargetLane
The target lane for the vehicle&#39;s current maneuver.
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:32
SUMOTime remainingTime() const
Compute the remaining time until LC completion.
void memorizeGapsAtLCInit()
Control for resetting the memorized values for LC relevant gaps until the LC output is triggered in t...
void checkTraCICommands()
Check for commands issued for the vehicle via TraCI and apply the appropriate state changes For the s...
MSAbstractLaneChangeModel & getLaneChangeModel()
Definition: MSVehicle.cpp:4609
virtual double getOppositeSafetyFactor() const
return factor for modifying the safety constraints for opposite-diretction overtaking of the car-foll...
std::vector< double > myShadowFurtherLanesPosLat
virtual double patchSpeed(const double min, const double wanted, const double max, const MSCFModel &cfModel)=0
Called to adapt the speed in order to allow a lane change. It uses information on LC-related desired ...
MSVehicle * myNeighFollower
The follower on the lane the vehicle want to change to.
void setFollowerGaps(CLeaderDist follower, double secGap)
const LaneChangeModel myModel
the type of this model
static bool myAllowOvertakingRight
whether overtaking on the right is permitted
A class responsible for exchanging messages between cars involved in lane-change interaction.
LaneChangeModel
The vehicle changes lanes (micro only)
virtual double estimateLCDuration(const double speed, const double remainingManeuverDist, const double decel) const
Calculates the maximal time needed to complete a lane change maneuver if lcMaxSpeedLatFactor and lcMa...
The action has not been determined.
std::vector< MSLane * > myNoPartiallyOccupatedByShadow
double myManeuverDist
The complete lateral distance the vehicle wants to travel to finish its maneuver Only used by sublane...
virtual LaneChangeModel getModelID() const =0
Returns the model&#39;s ID;.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
void setShadowPartialOccupator(MSLane *lane)
void setShadowLane(MSLane *lane)
set the shadow lane
virtual void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this laneChangeModel. Throw exception for unsupported key ...
virtual int wantsChange(int laneOffset, MSAbstractLaneChangeModel::MSLCMessager &msgPass, int blocked, const std::pair< MSVehicle *, double > &leader, const std::pair< MSVehicle *, double > &neighLead, const std::pair< MSVehicle *, double > &neighFollow, const MSLane &neighLane, const std::vector< MSVehicle::LaneQ > &preb, MSVehicle **lastBlocked, MSVehicle **firstBlocked)
Called to examine whether the vehicle wants to change using the given laneOffset. This method gets th...
std::vector< MSLane * > myShadowFurtherLanes
int getLaneChangeDirection() const
return the direction of the current lane change maneuver
int myLaneChangeDirection
direction of the lane change maneuver -1 means right, 1 means left
bool pastMidpoint() const
return whether the vehicle passed the midpoint of a continuous lane change maneuver ...
virtual void changed()=0
static void initGlobalOptions(const OptionsCont &oc)
init global model parameters
void setShadowApproachingInformation(MSLink *link) const
set approach information for the shadow vehicle
double myLastLeaderSecureGap
the minimum longitudinal distances to vehicles on the target lane that would be necessary for stringe...
int myOwnState
The current state of the vehicle.
MSLane * determineTargetLane(int &targetDir) const
virtual bool debugVehicle() const
whether the current vehicles shall be debugged
bool cancelRequest(int state, int laneOffset)
whether the influencer cancels the given request
double getLaneChangeCompletion() const
Get the current lane change completion ratio.
void setOrigLeaderGaps(CLeaderDist, double secGap)
bool startLaneChangeManeuver(MSLane *source, MSLane *target, int direction)
start the lane change maneuver and return whether it continues
virtual void updateExpectedSublaneSpeeds(const MSLeaderDistanceInfo &ahead, int sublaneOffset, int laneIndex)
update expected speeds for each sublane of the current edge
void primaryLaneChanged(MSLane *source, MSLane *target, int direction)
called once when the vehicles primary lane changes
MSAbstractLaneChangeModel & operator=(const MSAbstractLaneChangeModel &s)
Invalidated assignment operator.
MSVehicle & myVehicle
The vehicle this lane-changer belongs to.
void * informNeighLeader(void *info, MSVehicle *sender)
Informs the leader on the desired lane.
std::pair< const MSVehicle *, double > CLeaderDist
Definition: MSLeaderInfo.h:35
virtual double getSafetyFactor() const
return factor for modifying the safety constraints of the car-following model
std::shared_ptr< MSLeaderDistanceInfo > myLeftFollowers
Cached info on lc-relevant neighboring vehicles.
LaneChangeAction
The state of a vehicle&#39;s lane-change behavior.
void saveNeighbors(const int dir, const MSLeaderDistanceInfo &followers, const MSLeaderDistanceInfo &leaders)
Saves the lane change relevant vehicles, which are currently on neighboring lanes in the given direct...
virtual void setOwnState(const int state)
void setNoShadowPartialOccupator(MSLane *lane)
StateAndDist(int _state, double _latDist, double _targetDist, int _dir)
void * informLeader(void *info, MSVehicle *sender)
Informs the leader on the same lane.
void resetChanged()
reset the flag whether a vehicle already moved to false
A storage for options typed value containers)
Definition: OptionsCont.h:90
std::vector< MSLane * > myFurtherTargetLanes
double mySpeedLat
the current lateral speed
static bool haveLCOutput()
whether lanechange-output is active
virtual int wantsChangeSublane(int laneOffset, LaneChangeAction alternatives, const MSLeaderDistanceInfo &leaders, const MSLeaderDistanceInfo &followers, const MSLeaderDistanceInfo &blockers, const MSLeaderDistanceInfo &neighLeaders, const MSLeaderDistanceInfo &neighFollowers, const MSLeaderDistanceInfo &neighBlockers, const MSLane &neighLane, const std::vector< MSVehicle::LaneQ > &preb, MSVehicle **lastBlocked, MSVehicle **firstBlocked, double &latDist, double &targetDistLat, int &blocked)
virtual void saveBlockerLength(double length)
reserve space at the end of the lane to avoid dead locks
MSLane * getTargetLane() const
Returns the lane the vehicle has committed to enter during a sublane lane change. ...
virtual double computeSpeedLat(double latDist, double &maneuverDist)
decides the next lateral speed depending on the remaining lane change distance to be covered and upda...
const std::shared_ptr< MSLeaderDistanceInfo > getFollowers(const int dir)
Returns the neighboring, lc-relevant followers for the last step in the requested direction...
const std::vector< MSLane * > & getShadowFurtherLanes() const
void changedToOpposite()
called when a vehicle changes between lanes in opposite directions
static bool outputLCStarted()
whether start of maneuvers shall be recorede
double myCommittedSpeed
the speed when committing to a change maneuver
#define NUMERICAL_EPS
Definition: config.h:145
std::vector< MSLink * > myApproachedByShadow
links which are approached by the shadow vehicle
const std::shared_ptr< MSLeaderDistanceInfo > getLeaders(const int dir)
Returns the neighboring, lc-relevant leaders for the last step in the requested direction.
MSLane * getShadowLane() const
Returns the lane the vehicle&#39;s shadow is on during continuous/sublane lane change.
void setManeuverDist(const double dist)
Updates the remaining distance for the current maneuver while it is continued within non-action steps...
virtual void updateSafeLatDist(const double travelledLatDist)
Updates the value of safe lateral distances (in SL2015) during maneuver continuation in non-action st...
static bool outputLCEnded()
whether start of maneuvers shall be recorede
int myPreviousState2
lane changing state from step before the previous simulation step
double myLastLateralGapLeft
the minimum lateral gaps to other vehicles that were found when last changing to the left and right ...
static SUMOTime gLaneChangeDuration
Definition: MSGlobals.h:82
static MSAbstractLaneChangeModel * build(LaneChangeModel lcm, MSVehicle &vehicle)
Factory method for instantiating new lane changing models.
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
bool myAlreadyChanged
whether the vehicle has already moved this step
const MSCFModel & myCarFollowModel
The vehicle&#39;s car following model.
std::pair< int, int > mySavedStateLeft
bool myAmOpposite
whether the vehicle is driving in the opposite direction
MSAbstractLaneChangeModel(MSVehicle &v, const LaneChangeModel model)
Constructor.
double getSpeedLat() const
return the lateral speed of the current lane change maneuver
void saveLCState(const int dir, const int stateWithoutTraCI, const int state)
Interface for lane-change models.
const std::vector< MSLane * > & getFurtherTargetLanes() const
MSVehicle * myLeader
The leader on the informed vehicle&#39;s lane.
virtual bool congested(const MSVehicle *const neighLeader)
const std::pair< int, int > & getSavedState(const int dir) const
void endLaneChangeManeuver(const MSMoveReminder::Notification reason=MSMoveReminder::NOTIFICATION_LANE_CHANGE)
virtual ~MSAbstractLaneChangeModel()
Destructor.