ros2_control - galactic
Loading...
Searching...
No Matches
forward_command_controller.hpp
1// Copyright 2020 PAL Robotics S.L.
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_COMMAND_CONTROLLER_HPP_
16#define FORWARD_COMMAND_CONTROLLER__FORWARD_COMMAND_CONTROLLER_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.h"
28#include "std_msgs/msg/float64_multi_array.hpp"
29
30namespace forward_command_controller
31{
32using CmdType = std_msgs::msg::Float64MultiArray;
33using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
34
48{
49public:
50 FORWARD_COMMAND_CONTROLLER_PUBLIC
52
53 FORWARD_COMMAND_CONTROLLER_PUBLIC
54 controller_interface::InterfaceConfiguration command_interface_configuration() const override;
55
56 FORWARD_COMMAND_CONTROLLER_PUBLIC
57 controller_interface::InterfaceConfiguration state_interface_configuration() const override;
58
59 FORWARD_COMMAND_CONTROLLER_PUBLIC
60 CallbackReturn on_init() override;
61
62 FORWARD_COMMAND_CONTROLLER_PUBLIC
63 CallbackReturn on_configure(const rclcpp_lifecycle::State & previous_state) override;
64
65 FORWARD_COMMAND_CONTROLLER_PUBLIC
66 CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override;
67
68 FORWARD_COMMAND_CONTROLLER_PUBLIC
69 CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;
70
71 FORWARD_COMMAND_CONTROLLER_PUBLIC
72 controller_interface::return_type update(
73 const rclcpp::Time & time, const rclcpp::Duration & period) override;
74
75protected:
76 std::vector<std::string> joint_names_;
77 std::string interface_name_;
78
80 rclcpp::Subscription<CmdType>::SharedPtr joints_command_subscriber_;
81
82 std::string logger_name_;
83};
84
85} // namespace forward_command_controller
86
87#endif // FORWARD_COMMAND_CONTROLLER__FORWARD_COMMAND_CONTROLLER_HPP_
Definition controller_interface.hpp:69
Forward command controller for a set of joints.
Definition forward_command_controller.hpp:48
Definition realtime_buffer.hpp:44
Configuring what command/state interfaces to claim.
Definition controller_interface.hpp:63