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 /****************************************************************************/
15 // Performs sub-lane changing of vehicles
16 /****************************************************************************/
17 #ifndef MSLaneChangerSublane_h
18 #define MSLaneChangerSublane_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
27 #include "MSLaneChanger.h"
28 
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
43 public:
45  MSLaneChangerSublane(const std::vector<MSLane*>* lanes, bool allowChanging);
46 
49 
50 protected:
51 
53  virtual bool change();
54 
56  virtual void initChanger();
57 
59  virtual void updateChanger(bool vehHasChanged);
60 
71  int laneOffset,
72  LaneChangeAction alternatives,
73  const std::vector<MSVehicle::LaneQ>& preb,
74  double& latDist,
75  double& maneuverDist) const;
76 
78  // (used to continue sublane changing in non-action steps).
79  bool continueChangeSublane(MSVehicle* vehicle, ChangerIt& from);
80 
82  bool startChangeSublane(MSVehicle* vehicle, ChangerIt& from, double latDist, double maneuverDist);
83 
85  bool checkChangeToNewLane(MSVehicle* vehicle, const int direction, ChangerIt from, ChangerIt to);
86 
88  MSLeaderDistanceInfo getLeaders(const ChangerIt& target, const MSVehicle* ego) const;
89 
91  void abortLCManeuver(MSVehicle* vehicle);
92 
95  StateAndDist checkChangeHelper(MSVehicle* vehicle, int laneOffset, LaneChangeAction alternatives);
96 
98  void outputLCStarted(MSVehicle* vehicle, ChangerIt& from, ChangerIt& to, int direction, double maneuverDist);
100  void outputLCEnded(MSVehicle* vehicle, ChangerIt& from, ChangerIt& to, int direction);
101 
102 private:
105 
108 
111 };
112 
113 
114 #endif
115 
116 /****************************************************************************/
117 
MSLaneChangerSublane::getLeaders
MSLeaderDistanceInfo getLeaders(const ChangerIt &target, const MSVehicle *ego) const
get leaders for ego on the given lane
Definition: MSLaneChangerSublane.cpp:509
MSLaneChangerSublane::MSLaneChangerSublane
MSLaneChangerSublane(const MSLaneChangerSublane &)
Copy constructor.
MSLaneChanger.h
MSLaneChanger
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:47
MSLeaderDistanceInfo
saves leader/follower vehicles and their distances relative to an ego vehicle
Definition: MSLeaderInfo.h:132
MSLaneChangerSublane::checkChangeSublane
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
Definition: MSLaneChangerSublane.cpp:577
MSAbstractLaneChangeModel::StateAndDist
Definition: MSAbstractLaneChangeModel.h:110
MSLaneChangerSublane::outputLCEnded
void outputLCEnded(MSVehicle *vehicle, ChangerIt &from, ChangerIt &to, int direction)
optional output for end of lane-change maneuvre
Definition: MSLaneChangerSublane.cpp:496
MSLaneChangerSublane
Performs lane changing of vehicles.
Definition: MSLaneChangerSublane.h:42
MSLaneChangerSublane::startChangeSublane
bool startChangeSublane(MSVehicle *vehicle, ChangerIt &from, double latDist, double maneuverDist)
change by the specified amount and return whether a new lane was entered
Definition: MSLaneChangerSublane.cpp:276
MSLaneChangerSublane::StateAndDist
MSAbstractLaneChangeModel::StateAndDist StateAndDist
Definition: MSLaneChangerSublane.h:93
MSLaneChangerSublane::~MSLaneChangerSublane
~MSLaneChangerSublane()
Destructor.
Definition: MSLaneChangerSublane.cpp:68
MSLaneChangerSublane::continueChangeSublane
bool continueChangeSublane(MSVehicle *vehicle, ChangerIt &from)
Continue a sublane-lane change maneuver and return whether the midpoint was passed in this step.
Definition: MSLaneChangerSublane.cpp:254
LaneChangeAction
LaneChangeAction
The state of a vehicle's lane-change behavior.
Definition: SUMOXMLDefinitions.h:1218
MSLaneChangerSublane::operator=
MSLaneChangerSublane & operator=(const MSLaneChangerSublane &)
Assignment operator.
MSLaneChangerSublane::checkChangeToNewLane
bool checkChangeToNewLane(MSVehicle *vehicle, const int direction, ChangerIt from, ChangerIt to)
check whether the given vehicle has entered the new lane 'to->lane' during a sublane LC-step
Definition: MSLaneChangerSublane.cpp:441
MSLaneChangerSublane::updateChanger
virtual void updateChanger(bool vehHasChanged)
Definition: MSLaneChangerSublane.cpp:85
MSLaneChangerSublane::abortLCManeuver
void abortLCManeuver(MSVehicle *vehicle)
immediately stop lane-changing and register vehicle as unchanged
Definition: MSLaneChangerSublane.cpp:207
MSLaneChangerSublane::change
virtual bool change()
Definition: MSLaneChangerSublane.cpp:106
MSLaneChangerSublane::outputLCStarted
void outputLCStarted(MSVehicle *vehicle, ChangerIt &from, ChangerIt &to, int direction, double maneuverDist)
optional output for start of lane-change maneuvre
Definition: MSLaneChangerSublane.cpp:468
MSLaneChanger::ChangerIt
Changer::iterator ChangerIt
the iterator moving over the ChangeElems
Definition: MSLaneChanger.h:108
MSLaneChangerSublane::MSLaneChangerSublane
MSLaneChangerSublane()
Default constructor.
config.h
MSLaneChangerSublane::initChanger
virtual void initChanger()
Initialize the changer before looping over all vehicles.
Definition: MSLaneChangerSublane.cpp:71
MSLaneChangerSublane::checkChangeHelper
StateAndDist checkChangeHelper(MSVehicle *vehicle, int laneOffset, LaneChangeAction alternatives)
helper function that calls checkChangeSublane and sets blocker information
Definition: MSLaneChangerSublane.cpp:234
MSAbstractLaneChangeModel.h
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79