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-2020 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 /****************************************************************************/
19 // Performs sub-lane changing of vehicles
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
23 
25 #include "MSLaneChanger.h"
26 
27 
28 // ===========================================================================
29 // class declarations
30 // ===========================================================================
31 
32 
33 // ===========================================================================
34 // class definitions
35 // ===========================================================================
41 public:
43  MSLaneChangerSublane(const std::vector<MSLane*>* lanes, bool allowChanging);
44 
47 
48 protected:
49 
51  virtual bool change();
52 
54  virtual void initChanger();
55 
57  virtual void updateChanger(bool vehHasChanged);
58 
69  int laneOffset,
70  LaneChangeAction alternatives,
71  const std::vector<MSVehicle::LaneQ>& preb,
72  double& latDist,
73  double& maneuverDist) const;
74 
76  // (used to continue sublane changing in non-action steps).
77  bool continueChangeSublane(MSVehicle* vehicle, ChangerIt& from);
78 
80  bool startChangeSublane(MSVehicle* vehicle, ChangerIt& from, double latDist, double maneuverDist);
81 
83  bool checkChangeToNewLane(MSVehicle* vehicle, const int direction, ChangerIt from, ChangerIt to);
84 
86  MSLeaderDistanceInfo getLeaders(const ChangerIt& target, const MSVehicle* ego) const;
87 
89  void abortLCManeuver(MSVehicle* vehicle);
90 
93  StateAndDist checkChangeHelper(MSVehicle* vehicle, int laneOffset, LaneChangeAction alternatives);
94 
96  void outputLCStarted(MSVehicle* vehicle, ChangerIt& from, ChangerIt& to, int direction, double maneuverDist);
98  void outputLCEnded(MSVehicle* vehicle, ChangerIt& from, ChangerIt& to, int direction);
99 
100 private:
103 
106 
109 };
LaneChangeAction
The state of a vehicle's lane-change behavior.
Performs lane changing of vehicles.
Definition: MSLaneChanger.h:45
Changer::iterator ChangerIt
the iterator moving over the ChangeElems
Performs lane changing of vehicles.
bool startChangeSublane(MSVehicle *vehicle, ChangerIt &from, double latDist, double maneuverDist)
change by the specified amount and return whether a new lane was entered
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
void outputLCStarted(MSVehicle *vehicle, ChangerIt &from, ChangerIt &to, int direction, double maneuverDist)
optional output for start of lane-change maneuvre
MSLaneChangerSublane(const MSLaneChangerSublane &)
Copy constructor.
MSLaneChangerSublane & operator=(const MSLaneChangerSublane &)
Assignment operator.
MSLeaderDistanceInfo getLeaders(const ChangerIt &target, const MSVehicle *ego) const
get leaders for ego on the given lane
StateAndDist checkChangeHelper(MSVehicle *vehicle, int laneOffset, LaneChangeAction alternatives)
helper function that calls checkChangeSublane and sets blocker information
virtual void initChanger()
Initialize the changer before looping over all vehicles.
virtual void updateChanger(bool vehHasChanged)
void abortLCManeuver(MSVehicle *vehicle)
immediately stop lane-changing and register vehicle as unchanged
MSLaneChangerSublane()
Default constructor.
void outputLCEnded(MSVehicle *vehicle, ChangerIt &from, ChangerIt &to, int direction)
optional output for end of lane-change maneuvre
MSAbstractLaneChangeModel::StateAndDist StateAndDist
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
bool continueChangeSublane(MSVehicle *vehicle, ChangerIt &from)
Continue a sublane-lane change maneuver and return whether the midpoint was passed in this step.
saves leader/follower vehicles and their distances relative to an ego vehicle
Definition: MSLeaderInfo.h:130
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77