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