ros2_control - humble
actuator.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__ACTUATOR_HPP_
16 #define HARDWARE_INTERFACE__ACTUATOR_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/visibility_control.h"
26 #include "rclcpp/duration.hpp"
27 #include "rclcpp/time.hpp"
28 #include "rclcpp_lifecycle/state.hpp"
29 
31 {
32 class ActuatorInterface;
33 
34 class Actuator final
35 {
36 public:
37  Actuator() = default;
38 
39  HARDWARE_INTERFACE_PUBLIC
40  explicit Actuator(std::unique_ptr<ActuatorInterface> impl);
41 
42  Actuator(Actuator && other) = default;
43 
44  ~Actuator() = default;
45 
46  HARDWARE_INTERFACE_PUBLIC
47  const rclcpp_lifecycle::State & initialize(const HardwareInfo & actuator_info);
48 
49  HARDWARE_INTERFACE_PUBLIC
50  const rclcpp_lifecycle::State & configure();
51 
52  HARDWARE_INTERFACE_PUBLIC
53  const rclcpp_lifecycle::State & cleanup();
54 
55  HARDWARE_INTERFACE_PUBLIC
56  const rclcpp_lifecycle::State & shutdown();
57 
58  HARDWARE_INTERFACE_PUBLIC
59  const rclcpp_lifecycle::State & activate();
60 
61  HARDWARE_INTERFACE_PUBLIC
62  const rclcpp_lifecycle::State & deactivate();
63 
64  HARDWARE_INTERFACE_PUBLIC
65  const rclcpp_lifecycle::State & error();
66 
67  HARDWARE_INTERFACE_PUBLIC
68  std::vector<StateInterface> export_state_interfaces();
69 
70  HARDWARE_INTERFACE_PUBLIC
71  std::vector<CommandInterface> export_command_interfaces();
72 
73  HARDWARE_INTERFACE_PUBLIC
74  return_type prepare_command_mode_switch(
75  const std::vector<std::string> & start_interfaces,
76  const std::vector<std::string> & stop_interfaces);
77 
78  HARDWARE_INTERFACE_PUBLIC
79  return_type perform_command_mode_switch(
80  const std::vector<std::string> & start_interfaces,
81  const std::vector<std::string> & stop_interfaces);
82 
83  HARDWARE_INTERFACE_PUBLIC
84  std::string get_name() const;
85 
86  HARDWARE_INTERFACE_PUBLIC
87  const rclcpp_lifecycle::State & get_state() const;
88 
89  HARDWARE_INTERFACE_PUBLIC
90  return_type read(const rclcpp::Time & time, const rclcpp::Duration & period);
91 
92  HARDWARE_INTERFACE_PUBLIC
93  return_type write(const rclcpp::Time & time, const rclcpp::Duration & period);
94 
95 private:
96  std::unique_ptr<ActuatorInterface> impl_;
97 };
98 
99 } // namespace hardware_interface
100 #endif // HARDWARE_INTERFACE__ACTUATOR_HPP_
Definition: actuator_interface.hpp:72
Definition: actuator.hpp:35
Definition: actuator.hpp:31
This structure stores information about hardware defined in a robot's URDF.
Definition: hardware_info.hpp:106