$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 
25 #include <string> // for string
26 
27 #include <boost/optional.hpp> // for optional<>
28 #include <fable/fable_fwd.hpp> // for Json
29 
30 #include <cloe/core.hpp> // for Duration
31 #include <cloe/utility/actuation_level.hpp> // for ActuationLevel
32 #include <cloe/utility/statistics.hpp> // for Accumulator
33 
34 namespace cloe {
35 namespace utility {
36 
40 
42  uint64_t step{0};
43 
45  bool aeb_active{false};
46 
48  ActuationLevel fct_control{ActuationLevel::None};
49 
51  boost::optional<double> fct_set_speed;
52 
54  boost::optional<double> fct_time_gap;
55 
57  boost::optional<double> fct_speed_limiter_velocity;
58 
61 
63  boost::optional<double> acceleration;
64 
66  boost::optional<double> steering_angle;
67 
69  boost::optional<double> steering_torque;
70 
72  bool is_aeb_active() const { return aeb_active; }
73 
75  bool is_fct_active() const;
76 
78  bool is_active() const { return is_aeb_active() || is_fct_active(); }
79 
88  bool is_consistent() const;
89 
90  friend void to_json(fable::Json& j, const ActuationState& s);
91 };
92 
94  Accumulator active;
95  Accumulator consistent;
96  Accumulator aeb_active;
97  Pie<ActuationLevel::Enum> fct_control;
98  Accumulator fct_active;
99  Accumulator fct_set_speed;
100  Accumulator fct_time_gap;
101  Accumulator acceleration;
102  Accumulator steering_angle;
103  Accumulator steering_torque;
104 
105  void push_back(const ActuationState& s);
106  void reset();
107 
108  friend void to_json(fable::Json& j, const ActuationStatistics& s);
109 };
110 
111 } // namespace utility
112 } // namespace cloe
Definition: statistics.hpp:110
Definition: actuation_level.hpp:48
std::chrono::nanoseconds Duration
Definition: cloe_fwd.hpp:36
nlohmann::json Json
Definition: fable_fwd.hpp:35
Definition: actuation_state.hpp:37
bool is_aeb_active() const
Returns true if the AEB is reported active.
Definition: actuation_state.hpp:72
boost::optional< double > steering_angle
The steering angle request of the controller in [rad].
Definition: actuation_state.hpp:66
bool is_fct_active() const
Returns true if the controller reports to have control.
Definition: actuation_state.cpp:34
boost::optional< double > steering_torque
The steering torque request of the controller in [Nm].
Definition: actuation_state.hpp:69
boost::optional< double > fct_set_speed
The desired set speed of the controller [m/s].
Definition: actuation_state.hpp:51
bool aeb_active
Whether AEB is currently triggered.
Definition: actuation_state.hpp:45
bool is_consistent() const
Definition: actuation_state.cpp:36
int fct_speed_limiter_state
The desired speed limiter velocity of the controller [m/s].
Definition: actuation_state.hpp:60
Duration time
The simulation time that the rest of the struct describes.
Definition: actuation_state.hpp:39
boost::optional< double > fct_time_gap
The desired time gap of the controller [s].
Definition: actuation_state.hpp:54
bool is_active() const
Returns true if either AEB or FCT is reported active.
Definition: actuation_state.hpp:78
ActuationLevel fct_control
The official state of control that the actuator should have.
Definition: actuation_state.hpp:48
uint64_t step
The simulation step 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:63
boost::optional< double > fct_speed_limiter_velocity
The desired speed limiter velocity of the controller [m/s].
Definition: actuation_state.hpp:57
Definition: actuation_state.hpp:93