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-2022 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"
30
31
32// ===========================================================================
33// class declarations
34// ===========================================================================
35class SUMOVehicle;
36class MSVehicle;
38
39
40// ===========================================================================
41// class definitions
42// ===========================================================================
53public:
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
80private:
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);
89 static double getHeadwayChangePerceptionThreshold(const SUMOVehicle& v, const OptionsCont& oc);
90 static double getHeadwayErrorCoefficient(const SUMOVehicle& v, const OptionsCont& oc);
91 static double getMaximalReactionTime(const SUMOVehicle& v, const OptionsCont& oc);
93
94
95public:
98
100 const std::string deviceName() const {
101 return "driverstate";
102 }
103
105 std::string getParameter(const std::string& key) const;
106
108 void setParameter(const std::string& key, const std::string& value);
109
110
111private:
117 MSDevice_DriverState(SUMOVehicle& holder, const std::string& id,
118 double minAwareness,
119 double initialAwareness,
120 double errorTimeScaleCoefficient,
121 double errorNoiseIntensityCoefficient,
122 double speedDifferenceErrorCoefficient,
123 double speedDifferenceChangePerceptionThreshold,
124 double headwayChangePerceptionThreshold,
125 double headwayErrorCoefficient,
126 double maximalReactionTime);
127
129 void initDriverState();
130
131private:
134
148
150 std::shared_ptr<MSSimpleDriverState> myDriverState;
151
152private:
155
158
159};
The ToC Device controls transition of control between automated and manual driving.
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.
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.
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
std::shared_ptr< MSSimpleDriverState > getDriverState() const
return internal state
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 getMaximalReactionTime(const SUMOVehicle &v, const OptionsCont &oc)
double mySpeedDifferenceChangePerceptionThreshold
std::shared_ptr< MSSimpleDriverState > myDriverState
The driver state of the holder.
MSDevice_DriverState & operator=(const MSDevice_DriverState &)
Invalidated assignment operator.
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)
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