YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
frameTransformGet_nwc_ros2.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef YARP_DEV_FRAMETRANSFORMGETNWCROS2_H
7#define YARP_DEV_FRAMETRANSFORMGETNWCROS2_H
8
9
10#include <yarp/os/Network.h>
12#include <yarp/sig/Vector.h>
13#include <Ros2Spinner.h>
14#include <yarp/dev/PolyDriver.h>
16#include <rclcpp/rclcpp.hpp>
17#include <tf2_msgs/msg/tf_message.hpp>
18#include <geometry_msgs/msg/quaternion.hpp>
19#include <geometry_msgs/msg/transform.hpp>
20#include <geometry_msgs/msg/vector3.hpp>
21#include <geometry_msgs/msg/transform_stamped.hpp>
22#include <std_msgs/msg/header.hpp>
24#include <Ros2Utils.h>
25#include <mutex>
26#include <map>
28
29#define ROS2NODENAME "tfNodeGet"
30#define ROS2TOPICNAME_TF "/tf"
31#define ROS2TOPICNAME_TF_STATIC "/tf_static"
32
33
34
65{
66public:
68
69 //DeviceDriver
70 bool open(yarp::os::Searchable& config) override;
71 bool close() override;
72
73 // Spinner
75
76 //IFrameTransformStorageGet interface
77 bool getTransforms(std::vector<yarp::math::FrameTransform>& transforms) const override;
78
79 //Subscription callback
80 void frameTransformTimedGet_callback(const tf2_msgs::msg::TFMessage::SharedPtr msg);
81 void frameTransformStaticGet_callback(const tf2_msgs::msg::TFMessage::SharedPtr msg);
82
83 //own
84 void ros2TransformToYARP(const geometry_msgs::msg::TransformStamped& input, yarp::math::FrameTransform& output, bool isStatic);
85 bool updateBuffer(const std::vector<geometry_msgs::msg::TransformStamped>& transforms, bool areStatic);
87
88private:
89 mutable std::mutex m_trf_mutex;
90 rclcpp::Subscription<tf2_msgs::msg::TFMessage>::SharedPtr m_subscriptionFtTimed;
91 rclcpp::Subscription<tf2_msgs::msg::TFMessage>::SharedPtr m_subscriptionFtStatic;
92 rclcpp::Node::SharedPtr m_node;
94};
95
96#endif // YARP_DEV_FRAMETRANSFORMGETNWCROS2_H
contains the definition of a Vector type
This class is the parameters parser for class FrameTransformGet_nwc_ros2.
frameTransformGet_nwc_ros2: A ros network wrapper client that receives frame transforms from a ros2 t...
~FrameTransformGet_nwc_ros2()=default
bool getTransforms(std::vector< yarp::math::FrameTransform > &transforms) const override
Obtains all frame transforms saved in a storage.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool updateBuffer(const std::vector< geometry_msgs::msg::TransformStamped > &transforms, bool areStatic)
void frameTransformTimedGet_callback(const tf2_msgs::msg::TFMessage::SharedPtr msg)
bool close() override
Close the DeviceDriver.
bool setTransform(const yarp::math::FrameTransform &transform)
void frameTransformStaticGet_callback(const tf2_msgs::msg::TFMessage::SharedPtr msg)
void ros2TransformToYARP(const geometry_msgs::msg::TransformStamped &input, yarp::math::FrameTransform &output, bool isStatic)
Interface implemented by all device drivers.
FrameTransformContainer: A class that contains a vector of frame transformations and exposes yarp::de...
A base class for nested structures that can be searched.
Definition Searchable.h:31