Eclipse SUMO - Simulation of Urban MObility
MSDevice_DriverState.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 /****************************************************************************/
23 /****************************************************************************/
24 #pragma once
25 #include <config.h>
26 
27 #include "MSVehicleDevice.h"
28 #include <utils/common/SUMOTime.h>
30 
31 
32 // ===========================================================================
33 // class declarations
34 // ===========================================================================
35 class SUMOVehicle;
36 class MSVehicle;
38 
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
53 public:
57  static void insertOptions(OptionsCont& oc);
58 
59 
70  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSVehicleDevice*>& into);
71 
73  void update();
74 
76  inline std::shared_ptr<MSSimpleDriverState> getDriverState() const {
77  return myDriverState;
78  }
79 
80 private:
83  static double getMinAwareness(const SUMOVehicle& v, const OptionsCont& oc);
84  static double getInitialAwareness(const SUMOVehicle& v, const OptionsCont& oc);
85  static double getErrorTimeScaleCoefficient(const SUMOVehicle& v, const OptionsCont& oc);
86  static double getErrorNoiseIntensityCoefficient(const SUMOVehicle& v, const OptionsCont& oc);
87  static double getSpeedDifferenceErrorCoefficient(const SUMOVehicle& v, const OptionsCont& oc);
88  static double getSpeedDifferenceChangePerceptionThreshold(const SUMOVehicle& v, const OptionsCont& oc);
89  static double getHeadwayChangePerceptionThreshold(const SUMOVehicle& v, const OptionsCont& oc);
90  static double getHeadwayErrorCoefficient(const SUMOVehicle& v, const OptionsCont& oc);
91  static double getFreeSpeedErrorCoefficient(const SUMOVehicle& v, const OptionsCont& oc);
92  static double getMaximalReactionTime(const SUMOVehicle& v, const OptionsCont& oc);
94 
95 
96 public:
99 
101  const std::string deviceName() const {
102  return "driverstate";
103  }
104 
106  std::string getParameter(const std::string& key) const;
107 
109  void setParameter(const std::string& key, const std::string& value);
110 
111 
112 private:
118  MSDevice_DriverState(SUMOVehicle& holder, const std::string& id,
119  double minAwareness,
120  double initialAwareness,
121  double errorTimeScaleCoefficient,
122  double errorNoiseIntensityCoefficient,
123  double speedDifferenceErrorCoefficient,
124  double speedDifferenceChangePerceptionThreshold,
125  double headwayChangePerceptionThreshold,
126  double headwayErrorCoefficient,
127  double freeSpeedErrorCoefficient,
128  double maximalReactionTime);
129 
131  void initDriverState();
132 
133 private:
136 
151 
153  std::shared_ptr<MSSimpleDriverState> myDriverState;
154 
155 private:
158 
161 
162 };
The ToC Device controls transition of control between automated and manual driving.
std::shared_ptr< MSSimpleDriverState > getDriverState() const
return internal state
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
MSVehicle * myHolderMS
The holder vehicle casted to MSVehicle*.
static double getSpeedDifferenceChangePerceptionThreshold(const SUMOVehicle &v, const OptionsCont &oc)
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_DriverState-options.
MSDevice_DriverState(const MSDevice_DriverState &)
Invalidated copy constructor.
MSDevice_DriverState(SUMOVehicle &holder, const std::string &id, double minAwareness, double initialAwareness, double errorTimeScaleCoefficient, double errorNoiseIntensityCoefficient, double speedDifferenceErrorCoefficient, double speedDifferenceChangePerceptionThreshold, double headwayChangePerceptionThreshold, double headwayErrorCoefficient, double freeSpeedErrorCoefficient, double maximalReactionTime)
Constructor.
static double getErrorTimeScaleCoefficient(const SUMOVehicle &v, const OptionsCont &oc)
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key
static double getHeadwayErrorCoefficient(const SUMOVehicle &v, const OptionsCont &oc)
const std::string deviceName() const
return the name for this type of device
void initDriverState()
Initializeses the driver state parameters.
~MSDevice_DriverState()
Destructor.
static double getSpeedDifferenceErrorCoefficient(const SUMOVehicle &v, const OptionsCont &oc)
static double getFreeSpeedErrorCoefficient(const SUMOVehicle &v, const OptionsCont &oc)
static double getMaximalReactionTime(const SUMOVehicle &v, const OptionsCont &oc)
double mySpeedDifferenceChangePerceptionThreshold
std::shared_ptr< MSSimpleDriverState > myDriverState
The driver state of the holder.
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key
static double getMinAwareness(const SUMOVehicle &v, const OptionsCont &oc)
void update()
update internal state
static double getHeadwayChangePerceptionThreshold(const SUMOVehicle &v, const OptionsCont &oc)
static double getErrorNoiseIntensityCoefficient(const SUMOVehicle &v, const OptionsCont &oc)
static double getInitialAwareness(const SUMOVehicle &v, const OptionsCont &oc)
MSDevice_DriverState & operator=(const MSDevice_DriverState &)
Invalidated assignment operator.
Provides an interface to an error whose fluctuation is controlled via the driver's 'awareness',...
Abstract in-vehicle device.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
A storage for options typed value containers)
Definition: OptionsCont.h:89
Representation of a vehicle.
Definition: SUMOVehicle.h:60