YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FrameTransformSet_nwc_ros.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef YARP_DEV_FRAMETRANSFORMSETNWCROS_H
7#define YARP_DEV_FRAMETRANSFORMSETNWCROS_H
8
9
10#include <yarp/os/Network.h>
11#include <yarp/os/Node.h>
13#include <yarp/os/Publisher.h>
14#include <yarp/os/Subscriber.h>
15
16#include <yarp/sig/Vector.h>
17
19#include <yarp/dev/PolyDriver.h>
21
23
24#include <yarp/rosmsg/geometry_msgs/TransformStamped.h>
25#include <yarp/rosmsg/tf2_msgs/TFMessage.h>
26
28#include <map>
29#include <mutex>
30
31#define ROSNODENAME "/tfNodeSet"
32#define ROSTOPICNAME_TF "/tf"
33#define ROSTOPICNAME_TF_STATIC "/tf_static"
34
74{
75public:
76 FrameTransformSet_nwc_ros(double tperiod=0.010);
78
79 //DeviceDriver
80 bool open(yarp::os::Searchable& config) override;
81 bool close() override;
82
83 //periodicThread
84 void run() override;
85
86 //IFrameTransformStorageSet interface
87 bool setTransforms(const std::vector<yarp::math::FrameTransform>& transforms) override;
88 bool setTransform(const yarp::math::FrameTransform& transform) override;
89 bool deleteTransform(std::string t1, std::string t2) override;
90 bool clearAll() override;
91
92 //own
93 void publishFrameTransforms(const std::vector<yarp::math::FrameTransform>& transforms);
94 void yarpTransformToROSTransform(const yarp::math::FrameTransform &input, yarp::rosmsg::geometry_msgs::TransformStamped& output);
95
96private:
97 mutable std::mutex m_trf_mutex;
98 std::string m_nodeName{ROSNODENAME};
99 std::string m_topic{ROSTOPICNAME_TF};
100 std::string m_topic_static{ROSTOPICNAME_TF_STATIC};
101 double m_period{0.01};
102 double m_refreshInterval{0.1};
103 bool m_asynchPub{true};
104 yarp::os::Node* m_rosNode{nullptr};
108};
109
110#endif // YARP_DEV_FRAMETRANSFORMSETNWCROS_H
#define ROSNODENAME
#define ROSTOPICNAME_TF
#define ROSTOPICNAME_TF_STATIC
contains the definition of a Vector type
frameTransformSet_nwc_ros: A network wrapper client which publishes the transforms received on the ya...
~FrameTransformSet_nwc_ros()=default
bool close() override
Close the DeviceDriver.
bool clearAll() override
Delete all transforms in a storage.
void publishFrameTransforms(const std::vector< yarp::math::FrameTransform > &transforms)
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
void run() override
Loop function.
bool setTransform(const yarp::math::FrameTransform &transform) override
Save a frame transform in a storage.
bool setTransforms(const std::vector< yarp::math::FrameTransform > &transforms) override
Save some frame transforms in a storage.
bool deleteTransform(std::string t1, std::string t2) override
Delete a single transform in the storage.
void yarpTransformToROSTransform(const yarp::math::FrameTransform &input, yarp::rosmsg::geometry_msgs::TransformStamped &output)
Interface implemented by all device drivers.
FrameTransformContainer: A class that contains a vector of frame transformations and exposes yarp::de...
A mini-server for performing network communication in the background.
The Node class.
Definition Node.h:23
An abstraction for a periodic thread.
A base class for nested structures that can be searched.
Definition Searchable.h:31