$darkmode
actuation_state.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2020 Robert Bosch GmbH
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * SPDX-License-Identifier: Apache-2.0
17  */
23 #pragma once
24 #ifndef CLOE_UTILITY_ACTUATION_STATE_HPP_
25 #define CLOE_UTILITY_ACTUATION_STATE_HPP_
26 
27 #include <string> // for string
28 
29 #include <boost/optional.hpp> // for optional<>
30 
31 #include <fable/json.hpp> // for Json
32 
33 #include <cloe/core.hpp> // for Duration
34 #include <cloe/utility/actuation_level.hpp> // for ActuationLevel
35 #include <cloe/utility/statistics.hpp> // for Accumulator
36 
37 namespace cloe {
38 namespace utility {
39 
43 
45  uint64_t step{0};
46 
48  bool aeb_active{false};
49 
51  ActuationLevel fct_control{ActuationLevel::None};
52 
54  boost::optional<double> fct_set_speed;
55 
57  boost::optional<double> fct_time_gap;
58 
60  boost::optional<double> fct_speed_limiter_velocity;
61 
64 
66  boost::optional<double> acceleration;
67 
69  boost::optional<double> steering_angle;
70 
72  boost::optional<double> steering_torque;
73 
75  bool is_aeb_active() const { return aeb_active; }
76 
78  bool is_fct_active() const;
79 
81  bool is_active() const { return is_aeb_active() || is_fct_active(); }
82 
91  bool is_consistent() const;
92 
93  friend void to_json(fable::Json& j, const ActuationState& s);
94 };
95 
97  Accumulator active;
98  Accumulator consistent;
101  Accumulator fct_active;
107 
108  void push_back(const ActuationState& s);
109  void reset();
110 
111  friend void to_json(fable::Json& j, const ActuationStatistics& s);
112 };
113 
114 } // namespace utility
115 } // namespace cloe
116 
117 #endif // CLOE_UTILITY_ACTUATION_STATE_HPP_
boost::optional< double > fct_set_speed
The desired set speed of the controller [m/s].
Definition: actuation_state.hpp:54
boost::optional< double > fct_speed_limiter_velocity
The desired speed limiter velocity of the controller [m/s].
Definition: actuation_state.hpp:60
Definition: actuation_state.hpp:96
bool is_aeb_active() const
Returns true if the AEB is reported active.
Definition: actuation_state.hpp:75
Definition: actuation_state.hpp:40
Duration time
The simulation time that the rest of the struct describes.
Definition: actuation_state.hpp:42
boost::optional< double > acceleration
The acceleration request of the controller in [m/s^2].
Definition: actuation_state.hpp:66
bool is_consistent() const
Definition: actuation_state.cpp:36
bool is_active() const
Returns true if either AEB or FCT is reported active.
Definition: actuation_state.hpp:81
nlohmann::json Json
Definition: json.hpp:62
Definition: coordinator.hpp:36
std::chrono::nanoseconds Duration
Definition: duration.hpp:45
bool is_fct_active() const
Returns true if the controller reports to have control.
Definition: actuation_state.cpp:34
boost::optional< double > fct_time_gap
The desired time gap of the controller [s].
Definition: actuation_state.hpp:57
boost::optional< double > steering_angle
The steering angle request of the controller in [rad].
Definition: actuation_state.hpp:69
ActuationLevel fct_control
The official state of control that the actuator should have.
Definition: actuation_state.hpp:51
int fct_speed_limiter_state
The desired speed limiter velocity of the controller [m/s].
Definition: actuation_state.hpp:63
Definition: actuation_level.hpp:50
Definition: statistics.hpp:112
boost::optional< double > steering_torque
The steering torque request of the controller in [Nm].
Definition: actuation_state.hpp:72
bool aeb_active
Whether AEB is currently triggered.
Definition: actuation_state.hpp:48
uint64_t step
The simulation step that the rest of the struct describes.
Definition: actuation_state.hpp:45