ROS2 Control
actuator_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__ACTUATOR_INTERFACE_HPP_
16 #define HARDWARE_INTERFACE__ACTUATOR_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 
27 namespace hardware_interface
28 {
30 
34 {
35 public:
36  ActuatorInterface() = default;
37 
38  virtual ~ActuatorInterface() = default;
39 
41 
46  virtual return_type configure(const HardwareInfo & actuator_info) = 0;
47 
49 
57  virtual std::vector<StateInterface> export_state_interfaces() = 0;
58 
60 
68  virtual std::vector<CommandInterface> export_command_interfaces() = 0;
69 
71 
83  virtual return_type prepare_command_mode_switch(
84  const std::vector<std::string> & /*start_interfaces*/,
85  const std::vector<std::string> & /*stop_interfaces*/)
86  {
87  return return_type::OK;
88  }
89 
90  // Perform switching to the new command interface.
102  virtual return_type perform_command_mode_switch(
103  const std::vector<std::string> & /*start_interfaces*/,
104  const std::vector<std::string> & /*stop_interfaces*/)
105  {
106  return return_type::OK;
107  }
108 
110 
113  virtual return_type start() = 0;
114 
116 
119  virtual return_type stop() = 0;
120 
122 
125  virtual std::string get_name() const = 0;
126 
128 
131  virtual status get_status() const = 0;
132 
134 
141  virtual return_type read() = 0;
142 
144 
150  virtual return_type write() = 0;
151 };
152 
153 } // namespace hardware_interface
154 #endif // HARDWARE_INTERFACE__ACTUATOR_INTERFACE_HPP_
virtual status get_status() const =0
Get current state of the actuator hardware.
virtual return_type write()=0
Write the current command values to the actuator.
Definition: actuator.hpp:28
virtual return_type stop()=0
Stop exchange data with the hardware.
virtual std::string get_name() const =0
Get name of the actuator hardware.
Virtual Class to implement when integrating a 1 DoF actuator into ros2_control.
Definition: actuator_interface.hpp:33
This structure stores information about hardware defined in a robot&#39;s URDF.
Definition: hardware_info.hpp:100
virtual std::vector< CommandInterface > export_command_interfaces()=0
Exports all command interfaces for this actuator.
virtual return_type read()=0
Read the current state values from the actuator.
virtual return_type prepare_command_mode_switch(const std::vector< std::string > &, const std::vector< std::string > &)
Prepare for a new command interface switch.
Definition: actuator_interface.hpp:83
virtual return_type start()=0
Start exchange data with the hardware.
virtual return_type configure(const HardwareInfo &actuator_info)=0
Configuration of the actuator from data parsed from the robot&#39;s URDF.
virtual return_type perform_command_mode_switch(const std::vector< std::string > &, const std::vector< std::string > &)
Definition: actuator_interface.hpp:102
virtual std::vector< StateInterface > export_state_interfaces()=0
Exports all state interfaces for this actuator.