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 public:
83 
85  const std::string deviceName() const {
86  return "driverstate";
87  }
88 
90  std::string getParameter(const std::string& key) const;
91 
93  void setParameter(const std::string& key, const std::string& value);
94 
95 
96 private:
102  MSDevice_DriverState(SUMOVehicle& holder, const std::string& id,
103  double minAwareness,
104  double initialAwareness,
105  double errorTimeScaleCoefficient,
106  double errorNoiseIntensityCoefficient,
107  double speedDifferenceErrorCoefficient,
108  double speedDifferenceChangePerceptionThreshold,
109  double headwayChangePerceptionThreshold,
110  double headwayErrorCoefficient,
111  double freeSpeedErrorCoefficient,
112  double maximalReactionTime);
113 
115  void initDriverState();
116 
117 private:
120 
135 
137  std::shared_ptr<MSSimpleDriverState> myDriverState;
138 
139 private:
142 
145 
146 };
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 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.
void setParameter(const std::string &key, const std::string &value)
try to set the given parameter for this device. Throw exception for unsupported key
const std::string deviceName() const
return the name for this type of device
void initDriverState()
Initialises the driver state parameters.
~MSDevice_DriverState()
Destructor.
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
void update()
update internal state
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:62