ROS2 Control
sensor_interface.hpp
1 // Copyright 2020 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_INTERFACE_HPP_
16 #define HARDWARE_INTERFACE__SENSOR_INTERFACE_HPP_
17 
18 #include <memory>
19 #include <string>
20 #include <vector>
21 
22 #include "hardware_interface/handle.hpp"
23 #include "hardware_interface/hardware_info.hpp"
24 #include "hardware_interface/types/hardware_interface_return_values.hpp"
25 #include "hardware_interface/types/hardware_interface_status_values.hpp"
26 #include "hardware_interface/visibility_control.h"
27 
28 namespace hardware_interface
29 {
35 {
36 public:
37  SensorInterface() = default;
38 
39  virtual ~SensorInterface() = default;
40 
42 
47  virtual return_type configure(const HardwareInfo & sensor_info) = 0;
48 
50 
58  virtual std::vector<StateInterface> export_state_interfaces() = 0;
59 
61 
64  virtual return_type start() = 0;
65 
67 
70  virtual return_type stop() = 0;
71 
73 
76  virtual std::string get_name() const = 0;
77 
79 
82  virtual status get_status() const = 0;
83 
85 
92  virtual return_type read() = 0;
93 };
94 
95 } // namespace hardware_interface
96 #endif // HARDWARE_INTERFACE__SENSOR_INTERFACE_HPP_
virtual std::string get_name() const =0
Get name of the sensor hardware.
virtual return_type stop()=0
Stop exchange data with the hardware.
virtual return_type configure(const HardwareInfo &sensor_info)=0
Configuration of the sensor from data parsed from the robot&#39;s URDF.
Definition: actuator.hpp:28
virtual std::vector< StateInterface > export_state_interfaces()=0
Exports all state interfaces for this sensor.
virtual return_type read()=0
Read the current state values from the sensor.
This structure stores information about hardware defined in a robot&#39;s URDF.
Definition: hardware_info.hpp:100
virtual status get_status() const =0
Get current state of the sensor hardware.
virtual return_type start()=0
Start exchange data with the hardware.
Definition: sensor_interface.hpp:34