ros2_control - galactic
sensor.hpp
1 // Copyright 2020 - 2021 ros2_control Development Team
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef HARDWARE_INTERFACE__SENSOR_HPP_
16 #define HARDWARE_INTERFACE__SENSOR_HPP_
17 
18 #include <memory>
19 #include <string>
20 #include <utility>
21 #include <vector>
22 
23 #include "hardware_interface/handle.hpp"
24 #include "hardware_interface/hardware_info.hpp"
25 #include "hardware_interface/types/hardware_interface_return_values.hpp"
26 #include "hardware_interface/visibility_control.h"
27 #include "rclcpp_lifecycle/state.hpp"
28 
29 namespace hardware_interface
30 {
31 class SensorInterface;
32 
33 class Sensor final
34 {
35 public:
36  Sensor() = default;
37 
38  HARDWARE_INTERFACE_PUBLIC
39  explicit Sensor(std::unique_ptr<SensorInterface> impl);
40 
41  Sensor(Sensor && other) = default;
42 
43  ~Sensor() = default;
44 
45  HARDWARE_INTERFACE_PUBLIC
46  const rclcpp_lifecycle::State & initialize(const HardwareInfo & sensor_info);
47 
48  HARDWARE_INTERFACE_PUBLIC
49  const rclcpp_lifecycle::State & configure();
50 
51  HARDWARE_INTERFACE_PUBLIC
52  const rclcpp_lifecycle::State & cleanup();
53 
54  HARDWARE_INTERFACE_PUBLIC
55  const rclcpp_lifecycle::State & shutdown();
56 
57  HARDWARE_INTERFACE_PUBLIC
58  const rclcpp_lifecycle::State & activate();
59 
60  HARDWARE_INTERFACE_PUBLIC
61  const rclcpp_lifecycle::State & deactivate();
62 
63  HARDWARE_INTERFACE_PUBLIC
64  const rclcpp_lifecycle::State & error();
65 
66  HARDWARE_INTERFACE_PUBLIC
67  std::vector<StateInterface> export_state_interfaces();
68 
69  HARDWARE_INTERFACE_PUBLIC
70  std::string get_name() const;
71 
72  HARDWARE_INTERFACE_PUBLIC
73  const rclcpp_lifecycle::State & get_state() const;
74 
75  HARDWARE_INTERFACE_PUBLIC
76  return_type read();
77 
78 private:
79  std::unique_ptr<SensorInterface> impl_;
80 };
81 
82 } // namespace hardware_interface
83 #endif // HARDWARE_INTERFACE__SENSOR_HPP_
Definition: sensor.hpp:34
Definition: actuator.hpp:29
This structure stores information about hardware defined in a robot's URDF.
Definition: hardware_info.hpp:101