$darkmode
pedal_actuator.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2022 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_COMPONENT_PEDAL_ACTUATOR_HPP_
24 #define CLOE_COMPONENT_PEDAL_ACTUATOR_HPP_
25 
26 #include <cloe/component/actuator.hpp> // for Actuator
27 #include <fable/json.hpp> // for Json
28 
29 namespace cloe {
30 
31 struct PedalRequest {
32  /*
33  * Requested status of the gas pedal with no unit.
34  *
35  * The range goes from 0 (unpressed) to 1 (fully pressed).
36  */
37  double gas_pedal_position{0.0};
38 
39  /*
40  * Requested status of the brake pedal with no unit.
41  *
42  * The range goes from 0 (unpressed) to 1 (fully pressed).
43  */
44  double brake_pedal_position{0.0};
45 
46  friend void to_json(Json& j, const PedalRequest& p) {
47  j = Json{
48  {"gas_pedal_position", p.gas_pedal_position},
49  {"brake_pedal_position", p.brake_pedal_position},
50  };
51  }
52 };
53 
54 class PedalActuator : public Actuator<PedalRequest> {
55  public:
56  using Actuator::Actuator;
57  PedalActuator() : Actuator("pedal_actuator") {}
58  virtual ~PedalActuator() noexcept = default;
59 };
60 
61 } // namespace cloe
62 
63 #endif // CLOE_COMPONENT_PEDAL_ACTUATOR_HPP_
Definition: actuator.hpp:33
Definition: coordinator.hpp:36
Definition: pedal_actuator.hpp:31
Definition: pedal_actuator.hpp:54