Eclipse SUMO - Simulation of Urban MObility
MSLCHelper.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2013-2024 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 /****************************************************************************/
18 // Common functions for lane change models
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 #include <vector>
23 
24 // ===========================================================================
25 // class declarations
26 // ===========================================================================
27 class MSVehicle;
28 
29 
30 // ===========================================================================
31 // class definitions
32 // ===========================================================================
37 class MSLCHelper {
38 public:
39 
40  /* @brief Computes the artificial bonus distance for roundabout lanes
41  * this additional distance reduces the sense of urgency within
42  * roundabouts and thereby promotes the use of the inner roundabout
43  * lane in multi-lane roundabouts.
44  * @param[in] veh The ego vehicle
45  * @param[in] curr continuation info along veh's current lane
46  * @param[in] neigh continuation info along a neighboring lane (in MSLCM_2013::_wantsChange() the considered lane for a lanechange)
47  * @param[in] best continuation info along the strategicaly preferred lane
48  * @return the bonus distance for accepting a strategically-unfavourable roundabout-inside-lane
49  */
50  static double getRoundaboutDistBonus(const MSVehicle& veh,
51  double bonusParam,
52  const MSVehicle::LaneQ& curr,
53  const MSVehicle::LaneQ& neigh,
54  const MSVehicle::LaneQ& best);
55 
56 
57  /* @brief save space for vehicles which need to counter-lane-change in
58  * order to avoid avoid counter-lane-change-deadlock
59  *
60  * @param[in] veh The ego vehicle
61  * @param[in] blocker The vehicle which is blocked from lane changing
62  * @param[in] lcaCounter The lane change direction opposite to ego's current wish
63  * @param[in] leftSpace The remaining distance that can be driving without lane change
64  * @param[in,out] leadingBlockerLength: the length to reserve at the end of the lane
65  * @return Whether sufficient space has been reserved (by vehicle or blocker)
66  */
67  static bool updateBlockerLength(const MSVehicle& veh, MSVehicle* blocker, int lcaCounter, double leftSpace, bool reliefConnection, double& leadingBlockerLength);
68 
69  /* @brief return saveable space
70  * @param[in] requested The space that should be saved for another vehicle
71  * @param[in] leftSpace The remaining distance that can be driving without lane change
72  * @return Whether the requested space can be reserved
73  */
74  static bool canSaveBlockerLength(const MSVehicle& veh, double requested, double leftSpace);
75 
77  static bool divergentRoute(const MSVehicle& v1, const MSVehicle& v2);
78 
79  static double getSpeedPreservingSecureGap(const MSVehicle& leader, const MSVehicle& follower, double currentGap, double leaderPlannedSpeed);
80 
81  static bool isBidiLeader(const MSVehicle* leader, const std::vector<MSLane*>& cont);
82 
83  static bool isBidiFollower(const MSVehicle* ego, const MSVehicle* follower);
84 
85 };
A lane change model developed by J. Erdmann.
Definition: MSLCHelper.h:37
static bool isBidiFollower(const MSVehicle *ego, const MSVehicle *follower)
Definition: MSLCHelper.cpp:352
static bool canSaveBlockerLength(const MSVehicle &veh, double requested, double leftSpace)
Definition: MSLCHelper.cpp:290
static double getSpeedPreservingSecureGap(const MSVehicle &leader, const MSVehicle &follower, double currentGap, double leaderPlannedSpeed)
Definition: MSLCHelper.cpp:311
static double getRoundaboutDistBonus(const MSVehicle &veh, double bonusParam, const MSVehicle::LaneQ &curr, const MSVehicle::LaneQ &neigh, const MSVehicle::LaneQ &best)
Definition: MSLCHelper.cpp:43
static bool isBidiLeader(const MSVehicle *leader, const std::vector< MSLane * > &cont)
Definition: MSLCHelper.cpp:334
static bool updateBlockerLength(const MSVehicle &veh, MSVehicle *blocker, int lcaCounter, double leftSpace, bool reliefConnection, double &leadingBlockerLength)
Definition: MSLCHelper.cpp:225
static bool divergentRoute(const MSVehicle &v1, const MSVehicle &v2)
return whether the vehicles are on the same junction but on divergent paths
Definition: MSLCHelper.cpp:302
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
A structure representing the best lanes for continuing the current route starting at 'lane'.
Definition: MSVehicle.h:865