Eclipse SUMO - Simulation of Urban MObility
MSLaneChangerSublane.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2002-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 /****************************************************************************/
16 // Performs sub-lane changing of vehicles
17 /****************************************************************************/
18 #ifndef MSLaneChangerSublane_h
19 #define MSLaneChangerSublane_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
28 #include "MSLaneChanger.h"
29 
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 
35 
36 // ===========================================================================
37 // class definitions
38 // ===========================================================================
44 public:
46  MSLaneChangerSublane(const std::vector<MSLane*>* lanes, bool allowChanging);
47 
50 
51 protected:
52 
54  virtual bool change();
55 
57  virtual void initChanger();
58 
60  virtual void updateChanger(bool vehHasChanged);
61 
72  int laneOffset,
73  LaneChangeAction alternatives,
74  const std::vector<MSVehicle::LaneQ>& preb,
75  double& latDist,
76  double& maneuverDist) const;
77 
79  // (used to continue sublane changing in non-action steps).
80  bool continueChangeSublane(MSVehicle* vehicle, ChangerIt& from);
81 
83  bool startChangeSublane(MSVehicle* vehicle, ChangerIt& from, double latDist, double maneuverDist);
84 
86  bool checkChangeToNewLane(MSVehicle* vehicle, const int direction, ChangerIt from, ChangerIt to);
87 
89  MSLeaderDistanceInfo getLeaders(const ChangerIt& target, const MSVehicle* ego) const;
90 
92  void abortLCManeuver(MSVehicle* vehicle);
93 
96  StateAndDist checkChangeHelper(MSVehicle* vehicle, int laneOffset, LaneChangeAction alternatives);
97 
99  void outputLCStarted(MSVehicle* vehicle, ChangerIt& from, ChangerIt& to, int direction, double maneuverDist);
101  void outputLCEnded(MSVehicle* vehicle, ChangerIt& from, ChangerIt& to, int direction);
102 
103 private:
106 
109 
112 };
113 
114 
115 #endif
116 
117 /****************************************************************************/
118 
saves leader/follower vehicles and their distances relative to an ego vehicle
Definition: MSLeaderInfo.h:133
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
bool checkChangeToNewLane(MSVehicle *vehicle, const int direction, ChangerIt from, ChangerIt to)
check whether the given vehicle has entered the new lane &#39;to->lane&#39; during a sublane LC-step ...
void abortLCManeuver(MSVehicle *vehicle)
immediately stop lane-changing and register vehicle as unchanged
void outputLCStarted(MSVehicle *vehicle, ChangerIt &from, ChangerIt &to, int direction, double maneuverDist)
optional output for start of lane-change maneuvre
StateAndDist checkChangeHelper(MSVehicle *vehicle, int laneOffset, LaneChangeAction alternatives)
helper function that calls checkChangeSublane and sets blocker information
int checkChangeSublane(int laneOffset, LaneChangeAction alternatives, const std::vector< MSVehicle::LaneQ > &preb, double &latDist, double &maneuverDist) const
check whether sub-lane changing in the given direction is desirable and possible
void outputLCEnded(MSVehicle *vehicle, ChangerIt &from, ChangerIt &to, int direction)
optional output for end of lane-change maneuvre
virtual void updateChanger(bool vehHasChanged)
Performs lane changing of vehicles.
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:48
MSLaneChangerSublane()
Default constructor.
virtual void initChanger()
Initialize the changer before looping over all vehicles.
~MSLaneChangerSublane()
Destructor.
MSLaneChangerSublane & operator=(const MSLaneChangerSublane &)
Assignment operator.
bool continueChangeSublane(MSVehicle *vehicle, ChangerIt &from)
Continue a sublane-lane change maneuver and return whether the midpoint was passed in this step...
MSLeaderDistanceInfo getLeaders(const ChangerIt &target, const MSVehicle *ego) const
get leaders for ego on the given lane
LaneChangeAction
The state of a vehicle&#39;s lane-change behavior.
Changer::iterator ChangerIt
the iterator moving over the ChangeElems
bool startChangeSublane(MSVehicle *vehicle, ChangerIt &from, double latDist, double maneuverDist)
change by the specified amount and return whether a new lane was entered
MSAbstractLaneChangeModel::StateAndDist StateAndDist