$darkmode
models.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  */
22 #pragma once
23 
24 #include <string> // for string
25 
26 #include <fable/enum.hpp> // for ENUM_SERIALIZATION
27 
28 namespace cloe {
29 
30 enum class CloeComponent {
31  // Groundtruth sensors should never be modified/replaced.
32  GROUNDTRUTH_EGO_SENSOR,
33  GROUNDTRUTH_POWERTRAIN_SENSOR,
34  GROUNDTRUTH_BRAKE_SENSOR,
35  GROUNDTRUTH_WHEEL_SENSOR,
36  GROUNDTRUTH_STEERING_SENSOR,
37  GROUNDTRUTH_WORLD_SENSOR,
38  GROUNDTRUTH_LANE_SENSOR,
39  GROUNDTRUTH_TRAFFIC_SIGN_SENSOR,
40 
41  // Default sensors are initially the same as the ground truth sensors
42  DEFAULT_EGO_SENSOR,
43  DEFAULT_POWERTRAIN_SENSOR,
44  DEFAULT_BRAKE_SENSOR,
45  DEFAULT_WHEEL_SENSOR,
46  DEFAULT_STEERING_SENSOR,
47  DEFAULT_WORLD_SENSOR,
48  DEFAULT_LANE_SENSOR,
49  DEFAULT_TRAFFIC_SIGN_SENSOR,
50 
51  // Actuators are split into longitudinal and lateral controls
52  // Groundtruth actuators should never be modified/replaced.
53  GROUNDTRUTH_LONG_ACTUATOR,
54  GROUNDTRUTH_LAT_ACTUATOR,
55  GROUNDTRUTH_LATLONG_ACTUATOR,
56 
57  DEFAULT_LONG_ACTUATOR,
58  DEFAULT_LAT_ACTUATOR,
59  DEFAULT_LATLONG_ACTUATOR,
60  DEFAULT_GEARBOX_ACTUATOR,
61  DEFAULT_PEDAL_ACTUATOR,
62  DEFAULT_STEERING_ACTUATOR,
63 };
64 
65 // clang-format off
66 ENUM_SERIALIZATION(CloeComponent, ({
67  // Groundtruth sensors
68  {CloeComponent::GROUNDTRUTH_EGO_SENSOR, "cloe::gndtruth_ego_sensor"},
69  {CloeComponent::GROUNDTRUTH_POWERTRAIN_SENSOR, "cloe::gndtruth_powertrain_sensor"},
70  {CloeComponent::GROUNDTRUTH_BRAKE_SENSOR, "cloe::gndtruth_brake_sensor"},
71  {CloeComponent::GROUNDTRUTH_WHEEL_SENSOR, "cloe::gndtruth_wheel_sensor"},
72  {CloeComponent::GROUNDTRUTH_STEERING_SENSOR, "cloe::gndtruth_steering_sensor"},
73  {CloeComponent::GROUNDTRUTH_WORLD_SENSOR, "cloe::gndtruth_world_sensor"},
74  {CloeComponent::GROUNDTRUTH_LANE_SENSOR, "cloe::gndtruth_lane_sensor"},
75 
76  // Default sensors
77  {CloeComponent::DEFAULT_EGO_SENSOR, "cloe::default_ego_sensor"},
78  {CloeComponent::DEFAULT_POWERTRAIN_SENSOR, "cloe::default_powertrain_sensor"},
79  {CloeComponent::DEFAULT_BRAKE_SENSOR, "cloe::default_brake_sensor"},
80  {CloeComponent::DEFAULT_WHEEL_SENSOR, "cloe::default_wheel_sensor"},
81  {CloeComponent::DEFAULT_STEERING_SENSOR, "cloe::default_steering_sensor"},
82  {CloeComponent::DEFAULT_WORLD_SENSOR, "cloe::default_world_sensor"},
83  {CloeComponent::DEFAULT_LANE_SENSOR, "cloe::default_lane_sensor"},
84 
85  // Groundturht actuators
86  {CloeComponent::GROUNDTRUTH_LONG_ACTUATOR, "cloe::gndtruth_long_actuator"},
87  {CloeComponent::GROUNDTRUTH_LAT_ACTUATOR, "cloe::gndtruth_lat_actuator"},
88  {CloeComponent::GROUNDTRUTH_LATLONG_ACTUATOR, "cloe::gndtruth_latlong_actuator"},
89 
90  // Default actuators
91  {CloeComponent::DEFAULT_LONG_ACTUATOR, "cloe::default_long_actuator"},
92  {CloeComponent::DEFAULT_LAT_ACTUATOR, "cloe::default_lat_actuator"},
93  {CloeComponent::DEFAULT_LATLONG_ACTUATOR, "cloe::default_latlong_actuator"},
94  {CloeComponent::DEFAULT_GEARBOX_ACTUATOR, "cloe::default_gearbox_actuator"},
95  {CloeComponent::DEFAULT_PEDAL_ACTUATOR, "cloe::default_pedal_actuator"},
96  {CloeComponent::DEFAULT_STEERING_ACTUATOR, "cloe::default_steering_actuator"},
97 }))
98 // clang-format on
99 
100 // to_string is necessary in order to be used by Vehicle's templated methods
101 inline std::string to_string(CloeComponent c) { return enum_serialization(c).at(c); }
102 
103 } // namespace cloe
#define ENUM_SERIALIZATION(xType, xMap)
Definition: enum.hpp:51