$darkmode
gearbox_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 
24 #include <cloe/component/actuator.hpp> // for Actuator
25 #include <fable/json.hpp> // for Json
26 
27 namespace cloe {
28 
30  /*
31  * Holds the requested gear selector position.
32  *
33  * The sign of this field is linked to the mode of the gear
34  * - positive: driving forward (e.g. a value of 3 means to request the third gear in driving forward mode)
35  * - 0: means that the gear lever is requested to be in neutral position
36  * - negative: reverse mode (e.g. a value of -1 means the first gear in reverse mode is requested)
37  * - int8_t max: means that the transmission is in parking position (can be accessed via std::numeric_limits<int8_t>::max())
38  */
39  int8_t gear_selector{0};
40 
41  friend void to_json(fable::Json& j, const GearboxRequest& g) {
42  j = fable::Json{{"gear_selector", g.gear_selector}};
43  }
44 };
45 
46 class GearboxActuator : public Actuator<GearboxRequest> {
47  public:
48  using Actuator::Actuator;
49  GearboxActuator() : Actuator("gearbox_actuator") {}
50  virtual ~GearboxActuator() noexcept = default;
51 };
52 
53 } // namespace cloe
Definition: actuator.hpp:32
Definition: gearbox_actuator.hpp:46
nlohmann::json Json
Definition: fable_fwd.hpp:35
Definition: gearbox_actuator.hpp:29