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.org/sumo
3 // Copyright (C) 2013-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 /****************************************************************************/
19 /****************************************************************************/
20 #ifndef MSDevice_DriverState_h
21 #define MSDevice_DriverState_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include "MSVehicleDevice.h"
30 #include <utils/common/SUMOTime.h>
32 
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 class SUMOVehicle;
38 class MSVehicle;
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
55 public:
59  static void insertOptions(OptionsCont& oc);
60 
61 
72  static void buildVehicleDevices(SUMOVehicle& v, std::vector<MSVehicleDevice*>& into);
73 
75  void update();
76 
78  inline std::shared_ptr<MSSimpleDriverState> getDriverState() const {
79  return myDriverState;
80  }
81 
82 private:
85  static double getMinAwareness(const SUMOVehicle& v, const OptionsCont& oc);
86  static double getInitialAwareness(const SUMOVehicle& v, const OptionsCont& oc);
87  static double getErrorTimeScaleCoefficient(const SUMOVehicle& v, const OptionsCont& oc);
88  static double getErrorNoiseIntensityCoefficient(const SUMOVehicle& v, const OptionsCont& oc);
89  static double getSpeedDifferenceErrorCoefficient(const SUMOVehicle& v, const OptionsCont& oc);
90  static double getSpeedDifferenceChangePerceptionThreshold(const SUMOVehicle& v, const OptionsCont& oc);
91  static double getHeadwayChangePerceptionThreshold(const SUMOVehicle& v, const OptionsCont& oc);
92  static double getHeadwayErrorCoefficient(const SUMOVehicle& v, const OptionsCont& oc);
93  static double getMaximalReactionTime(const SUMOVehicle& v, const OptionsCont& oc);
95 
96 
97 public:
100 
102  const std::string deviceName() const {
103  return "driverstate";
104  }
105 
107  std::string getParameter(const std::string& key) const;
108 
110  void setParameter(const std::string& key, const std::string& value);
111 
112 
113 private:
119  MSDevice_DriverState(SUMOVehicle& holder, const std::string& id,
120  double minAwareness,
121  double initialAwareness,
122  double errorTimeScaleCoefficient,
123  double errorNoiseIntensityCoefficient,
124  double speedDifferenceErrorCoefficient,
125  double speedDifferenceChangePerceptionThreshold,
126  double headwayChangePerceptionThreshold,
127  double headwayErrorCoefficient,
128  double maximalReactionTime);
129 
131  void initDriverState();
132 
133 private:
136 
150 
152  std::shared_ptr<MSSimpleDriverState> myDriverState;
153 
154 private:
157 
160 
161 };
162 
163 
164 #endif
165 
166 /****************************************************************************/
167 
MSDevice_DriverState::getHeadwayErrorCoefficient
static double getHeadwayErrorCoefficient(const SUMOVehicle &v, const OptionsCont &oc)
Definition: MSDevice_DriverState.cpp:145
SUMOTime.h
MSVehicleDevice.h
MSDevice_DriverState::getDriverState
std::shared_ptr< MSSimpleDriverState > getDriverState() const
return internal state
Definition: MSDevice_DriverState.h:78
MSDevice_DriverState::myHeadwayChangePerceptionThreshold
double myHeadwayChangePerceptionThreshold
Definition: MSDevice_DriverState.h:146
MSDevice_DriverState::myErrorTimeScaleCoefficient
double myErrorTimeScaleCoefficient
Definition: MSDevice_DriverState.h:142
WrappingCommand.h
MSSimpleDriverState
Provides an interface to an error whose fluctuation is controlled via the driver's 'awareness',...
Definition: MSDriverState.h:104
MSDevice_DriverState::myInitialAwareness
double myInitialAwareness
Definition: MSDevice_DriverState.h:141
SUMOVehicle
Representation of a vehicle.
Definition: SUMOVehicle.h:60
MSDevice_DriverState::mySpeedDifferenceErrorCoefficient
double mySpeedDifferenceErrorCoefficient
Definition: MSDevice_DriverState.h:144
MSDevice_DriverState::deviceName
const std::string deviceName() const
return the name for this type of device
Definition: MSDevice_DriverState.h:102
MSDevice_DriverState::getErrorTimeScaleCoefficient
static double getErrorTimeScaleCoefficient(const SUMOVehicle &v, const OptionsCont &oc)
Definition: MSDevice_DriverState.cpp:125
MSDevice_DriverState
The ToC Device controls transition of control between automated and manual driving.
Definition: MSDevice_DriverState.h:54
MSDevice_DriverState::insertOptions
static void insertOptions(OptionsCont &oc)
Inserts MSDevice_DriverState-options.
Definition: MSDevice_DriverState.cpp:62
MSDevice_DriverState::mySpeedDifferenceChangePerceptionThreshold
double mySpeedDifferenceChangePerceptionThreshold
Definition: MSDevice_DriverState.h:145
MSDevice_DriverState::getMinAwareness
static double getMinAwareness(const SUMOVehicle &v, const OptionsCont &oc)
Definition: MSDevice_DriverState.cpp:117
MSDevice_DriverState::myMinAwareness
double myMinAwareness
Definition: MSDevice_DriverState.h:140
MSDevice_DriverState::myMaximalReactionTime
double myMaximalReactionTime
Definition: MSDevice_DriverState.h:148
MSDevice_DriverState::getHeadwayChangePerceptionThreshold
static double getHeadwayChangePerceptionThreshold(const SUMOVehicle &v, const OptionsCont &oc)
Definition: MSDevice_DriverState.cpp:141
MSDevice_DriverState::setParameter
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key
Definition: MSDevice_DriverState.cpp:261
MSDevice_DriverState::myErrorNoiseIntensityCoefficient
double myErrorNoiseIntensityCoefficient
Definition: MSDevice_DriverState.h:143
MSDevice_DriverState::getMaximalReactionTime
static double getMaximalReactionTime(const SUMOVehicle &v, const OptionsCont &oc)
Definition: MSDevice_DriverState.cpp:149
MSDevice_DriverState::buildVehicleDevices
static void buildVehicleDevices(SUMOVehicle &v, std::vector< MSVehicleDevice * > &into)
Build devices for the given vehicle, if needed.
Definition: MSDevice_DriverState.cpp:87
OptionsCont
A storage for options typed value containers)
Definition: OptionsCont.h:89
MSDevice_DriverState::update
void update()
update internal state
Definition: MSDevice_DriverState.cpp:214
MSDevice_DriverState::MSDevice_DriverState
MSDevice_DriverState(const MSDevice_DriverState &)
Invalidated copy constructor.
MSDevice_DriverState::myHolderMS
MSVehicle * myHolderMS
The holder vehicle casted to MSVehicle*.
Definition: MSDevice_DriverState.h:135
MSDevice_DriverState::getSpeedDifferenceErrorCoefficient
static double getSpeedDifferenceErrorCoefficient(const SUMOVehicle &v, const OptionsCont &oc)
Definition: MSDevice_DriverState.cpp:133
MSDevice_DriverState::getInitialAwareness
static double getInitialAwareness(const SUMOVehicle &v, const OptionsCont &oc)
Definition: MSDevice_DriverState.cpp:121
MSDevice_DriverState::myDriverState
std::shared_ptr< MSSimpleDriverState > myDriverState
The driver state of the holder.
Definition: MSDevice_DriverState.h:152
MSDevice_DriverState::getErrorNoiseIntensityCoefficient
static double getErrorNoiseIntensityCoefficient(const SUMOVehicle &v, const OptionsCont &oc)
Definition: MSDevice_DriverState.cpp:129
config.h
MSDevice_DriverState::operator=
MSDevice_DriverState & operator=(const MSDevice_DriverState &)
Invalidated assignment operator.
MSDevice_DriverState::MSDevice_DriverState
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 maximalReactionTime)
Constructor.
Definition: MSDevice_DriverState.cpp:157
MSDevice_DriverState::initDriverState
void initDriverState()
Initializeses the driver state parameters.
Definition: MSDevice_DriverState.cpp:197
MSDevice_DriverState::myHeadwayErrorCoefficient
double myHeadwayErrorCoefficient
Definition: MSDevice_DriverState.h:147
MSDevice_DriverState::getSpeedDifferenceChangePerceptionThreshold
static double getSpeedDifferenceChangePerceptionThreshold(const SUMOVehicle &v, const OptionsCont &oc)
Definition: MSDevice_DriverState.cpp:137
MSDevice_DriverState::getParameter
std::string getParameter(const std::string &key) const
try to retrieve the given parameter from this device. Throw exception for unsupported key
Definition: MSDevice_DriverState.cpp:219
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79
MSDevice_DriverState::~MSDevice_DriverState
~MSDevice_DriverState()
Destructor.
Definition: MSDevice_DriverState.h:99
MSVehicleDevice
Abstract in-vehicle device.
Definition: MSVehicleDevice.h:54