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