ros2_control - rolling
Loading...
Searching...
No Matches
state_interfaces_broadcaster.hpp
1// Copyright (c) 2025, PAL Robotics
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 STATE_INTERFACES_BROADCASTER__STATE_INTERFACES_BROADCASTER_HPP_
16#define STATE_INTERFACES_BROADCASTER__STATE_INTERFACES_BROADCASTER_HPP_
17
18#include <memory>
19#include <string>
20#include <vector>
21
22#include "control_msgs/msg/float64_values.hpp"
23#include "control_msgs/msg/keys.hpp"
24#include "controller_interface/controller_interface.hpp"
25#include "realtime_tools/realtime_publisher.hpp"
26
27// auto-generated by generate_parameter_library
28#include "state_interfaces_broadcaster/state_interfaces_broadcaster_parameters.hpp"
29
30namespace state_interfaces_broadcaster
31{
48{
49public:
51
53
55
56 controller_interface::return_type update(
57 const rclcpp::Time & time, const rclcpp::Duration & period) override;
58
59 controller_interface::CallbackReturn on_init() override;
60
61 controller_interface::CallbackReturn on_configure(
62 const rclcpp_lifecycle::State & previous_state) override;
63
64 controller_interface::CallbackReturn on_activate(
65 const rclcpp_lifecycle::State & previous_state) override;
66
67protected:
68 // Optional parameters
69 std::shared_ptr<ParamListener> param_listener_;
70 Params params_;
71
72 // publishers and messages
73 std::shared_ptr<rclcpp::Publisher<control_msgs::msg::Keys>> names_publisher_;
74 std::shared_ptr<rclcpp::Publisher<control_msgs::msg::Float64Values>> values_publisher_;
75 std::shared_ptr<realtime_tools::RealtimePublisher<control_msgs::msg::Float64Values>>
76 realtime_values_publisher_;
77 control_msgs::msg::Keys names_msg_;
78 control_msgs::msg::Float64Values values_msg_;
79};
80
81} // namespace state_interfaces_broadcaster
82
83#endif // STATE_INTERFACES_BROADCASTER__STATE_INTERFACES_BROADCASTER_HPP_
Definition controller_interface.hpp:27
State Interfaces Broadcaster for selected state interfaces in a ros2_control system.
Definition state_interfaces_broadcaster.hpp:48
controller_interface::InterfaceConfiguration state_interface_configuration() const override
Get configuration for controller's required state interfaces.
Definition state_interfaces_broadcaster.cpp:56
controller_interface::return_type update(const rclcpp::Time &time, const rclcpp::Duration &period) override
Definition state_interfaces_broadcaster.cpp:109
controller_interface::InterfaceConfiguration command_interface_configuration() const override
Get configuration for controller's required command interfaces.
Definition state_interfaces_broadcaster.cpp:49
controller_interface::CallbackReturn on_init() override
Extending interface with initialization method which is individual for each controller.
Definition state_interfaces_broadcaster.cpp:32
Configuring what command/state interfaces to claim.
Definition controller_interface_base.hpp:68