ros2_control - galactic
Loading...
Searching...
No Matches
force_torque_sensor_broadcaster.hpp
1// Copyright (c) 2021, Stogl Robotics Consulting UG (haftungsbeschrä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/*
16 * Authors: Subhas Das, Denis Stogl
17 */
18
19#ifndef FORCE_TORQUE_SENSOR_BROADCASTER__FORCE_TORQUE_SENSOR_BROADCASTER_HPP_
20#define FORCE_TORQUE_SENSOR_BROADCASTER__FORCE_TORQUE_SENSOR_BROADCASTER_HPP_
21
22#include <memory>
23#include <string>
24#include <vector>
25
26#include "controller_interface/controller_interface.hpp"
27#include "force_torque_sensor_broadcaster/visibility_control.h"
28#include "geometry_msgs/msg/wrench_stamped.hpp"
29#include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp"
30#include "rclcpp_lifecycle/state.hpp"
31#include "realtime_tools/realtime_publisher.h"
32#include "semantic_components/force_torque_sensor.hpp"
33
34namespace force_torque_sensor_broadcaster
35{
36using CallbackReturn = rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn;
37
39{
40public:
41 FORCE_TORQUE_SENSOR_BROADCASTER_PUBLIC
43
44 FORCE_TORQUE_SENSOR_BROADCASTER_PUBLIC
45 controller_interface::InterfaceConfiguration command_interface_configuration() const override;
46
47 FORCE_TORQUE_SENSOR_BROADCASTER_PUBLIC
48 controller_interface::InterfaceConfiguration state_interface_configuration() const override;
49
50 FORCE_TORQUE_SENSOR_BROADCASTER_PUBLIC CallbackReturn on_init() override;
51
52 FORCE_TORQUE_SENSOR_BROADCASTER_PUBLIC
53 CallbackReturn on_configure(const rclcpp_lifecycle::State & previous_state) override;
54
55 FORCE_TORQUE_SENSOR_BROADCASTER_PUBLIC
56 CallbackReturn on_activate(const rclcpp_lifecycle::State & previous_state) override;
57
58 FORCE_TORQUE_SENSOR_BROADCASTER_PUBLIC
59 CallbackReturn on_deactivate(const rclcpp_lifecycle::State & previous_state) override;
60
61 FORCE_TORQUE_SENSOR_BROADCASTER_PUBLIC
62 controller_interface::return_type update(
63 const rclcpp::Time & time, const rclcpp::Duration & period) override;
64
65protected:
66 std::string sensor_name_;
67 std::array<std::string, 6> interface_names_;
68 std::string frame_id_;
69
70 std::unique_ptr<semantic_components::ForceTorqueSensor> force_torque_sensor_;
71
73 rclcpp::Publisher<geometry_msgs::msg::WrenchStamped>::SharedPtr sensor_state_publisher_;
74 std::unique_ptr<StatePublisher> realtime_publisher_;
75};
76
77} // namespace force_torque_sensor_broadcaster
78
79#endif // FORCE_TORQUE_SENSOR_BROADCASTER__FORCE_TORQUE_SENSOR_BROADCASTER_HPP_
Definition controller_interface.hpp:69
Definition force_torque_sensor_broadcaster.hpp:39
Definition realtime_publisher.hpp:54
Configuring what command/state interfaces to claim.
Definition controller_interface.hpp:63