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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // Performs sub-lane changing of vehicles
19 /****************************************************************************/
20 #ifndef MSLaneChangerSublane_h
21 #define MSLaneChangerSublane_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
34 #include "MSLaneChanger.h"
35 
36 
37 // ===========================================================================
38 // class declarations
39 // ===========================================================================
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
50 public:
52  MSLaneChangerSublane(const std::vector<MSLane*>* lanes, bool allowChanging);
53 
56 
57 protected:
58 
60  virtual bool change();
61 
63  virtual void initChanger();
64 
66  virtual void updateChanger(bool vehHasChanged);
67 
78  int laneOffset,
79  LaneChangeAction alternatives,
80  const std::vector<MSVehicle::LaneQ>& preb,
81  double& latDist,
82  double& maneuverDist) const;
83 
85  // (used to continue sublane changing in non-action steps).
86  bool continueChangeSublane(MSVehicle* vehicle, ChangerIt& from);
87 
89  bool startChangeSublane(MSVehicle* vehicle, ChangerIt& from, double latDist);
90 
92  bool checkChangeToNewLane(MSVehicle* vehicle, const int direction, ChangerIt from, ChangerIt to);
93 
95  MSLeaderDistanceInfo getLeaders(const ChangerIt& target, const MSVehicle* ego) const;
96 
98  void abortLCManeuver(MSVehicle* vehicle);
99 
102  StateAndDist checkChangeHelper(MSVehicle* vehicle, int laneOffset, LaneChangeAction alternatives);
103 
105  void outputLCStarted(MSVehicle* vehicle, ChangerIt& from, ChangerIt& to, int direction);
107  void outputLCEnded(MSVehicle* vehicle, ChangerIt& from, ChangerIt& to, int direction);
108 
109 private:
112 
115 
118 };
119 
120 
121 #endif
122 
123 /****************************************************************************/
124 
void outputLCStarted(MSVehicle *vehicle, ChangerIt &from, ChangerIt &to, int direction)
optional output for start of lane-change maneuvre
saves leader/follower vehicles and their distances relative to an ego vehicle
Definition: MSLeaderInfo.h:135
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:83
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
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:54
MSLaneChangerSublane()
Default constructor.
bool startChangeSublane(MSVehicle *vehicle, ChangerIt &from, double latDist)
change by the specified amount and return whether a new lane was entered
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
MSAbstractLaneChangeModel::StateAndDist StateAndDist