ros2_control - humble
Loading...
Searching...
No Matches
forward_controllers_base.hpp
1// Copyright 2021 Stogl Robotics Consulting UG (haftungsbescrhänkt)
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 FORWARD_COMMAND_CONTROLLER__FORWARD_CONTROLLERS_BASE_HPP_
16#define FORWARD_COMMAND_CONTROLLER__FORWARD_CONTROLLERS_BASE_HPP_
17
18#include <memory>
19#include <string>
20#include <vector>
21
22#include "controller_interface/controller_interface.hpp"
23#include "forward_command_controller/visibility_control.h"
24#include "rclcpp/subscription.hpp"
25#include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp"
26#include "rclcpp_lifecycle/state.hpp"
27#include "realtime_tools/realtime_buffer.hpp"
28#include "std_msgs/msg/float64_multi_array.hpp"
29
30namespace forward_command_controller
31{
32using CmdType = std_msgs::msg::Float64MultiArray;
33
43{
44public:
45 FORWARD_COMMAND_CONTROLLER_PUBLIC
47
48 FORWARD_COMMAND_CONTROLLER_PUBLIC
49 ~ForwardControllersBase() = default;
50
51 FORWARD_COMMAND_CONTROLLER_PUBLIC
53
54 FORWARD_COMMAND_CONTROLLER_PUBLIC
56
57 FORWARD_COMMAND_CONTROLLER_PUBLIC
58 controller_interface::CallbackReturn on_init() override;
59
60 FORWARD_COMMAND_CONTROLLER_PUBLIC
61 controller_interface::CallbackReturn on_configure(
62 const rclcpp_lifecycle::State & previous_state) override;
63
64 FORWARD_COMMAND_CONTROLLER_PUBLIC
65 controller_interface::CallbackReturn on_activate(
66 const rclcpp_lifecycle::State & previous_state) override;
67
68 FORWARD_COMMAND_CONTROLLER_PUBLIC
69 controller_interface::CallbackReturn on_deactivate(
70 const rclcpp_lifecycle::State & previous_state) override;
71
72 FORWARD_COMMAND_CONTROLLER_PUBLIC
73 controller_interface::return_type update(
74 const rclcpp::Time & time, const rclcpp::Duration & period) override;
75
76protected:
81 virtual void declare_parameters() = 0;
82
93 virtual controller_interface::CallbackReturn read_parameters() = 0;
94
95 std::vector<std::string> joint_names_;
96 std::string interface_name_;
97
98 std::vector<std::string> command_interface_types_;
99
101 rclcpp::Subscription<CmdType>::SharedPtr joints_command_subscriber_;
102};
103
104} // namespace forward_command_controller
105
106#endif // FORWARD_COMMAND_CONTROLLER__FORWARD_CONTROLLERS_BASE_HPP_
Definition controller_interface.hpp:29
Forward command controller for a set of joints and interfaces.
Definition forward_controllers_base.hpp:43
FORWARD_COMMAND_CONTROLLER_PUBLIC controller_interface::InterfaceConfiguration command_interface_configuration() const override
Get configuration for controller's required command interfaces.
Definition forward_controllers_base.cpp:70
FORWARD_COMMAND_CONTROLLER_PUBLIC controller_interface::CallbackReturn on_init() override
Extending interface with initialization method which is individual for each controller.
Definition forward_controllers_base.cpp:37
FORWARD_COMMAND_CONTROLLER_PUBLIC controller_interface::return_type update(const rclcpp::Time &time, const rclcpp::Duration &period) override
Definition forward_controllers_base.cpp:120
FORWARD_COMMAND_CONTROLLER_PUBLIC controller_interface::InterfaceConfiguration state_interface_configuration() const override
Get configuration for controller's required state interfaces.
Definition forward_controllers_base.cpp:79
virtual controller_interface::CallbackReturn read_parameters()=0
Definition realtime_buffer.hpp:44
Configuring what command/state interfaces to claim.
Definition controller_interface_base.hpp:56