YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FrameTransformGet_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_FRAMETRANSFORMGETNWCROS_H
7#define YARP_DEV_FRAMETRANSFORMGETNWCROS_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 "/tfNodeGet"
32#define ROSTOPICNAME_TF "/tf"
33#define ROSTOPICNAME_TF_STATIC "/tf_static"
34
72{
73public:
74 FrameTransformGet_nwc_ros(double tperiod=0.010);
76
77 //DeviceDriver
78 bool open(yarp::os::Searchable& config) override;
79 bool close() override;
80
81 //periodicThread
82 void run() override;
83
84 //IFrameTransformStorageGet interface
85 bool getTransforms(std::vector<yarp::math::FrameTransform>& transforms) const override;
86
87 //own
89 void rosTransformToYARPTransform(const yarp::rosmsg::geometry_msgs::TransformStamped &input, yarp::math::FrameTransform &output, bool isStatic);
90 double yarpStampFromROS(const yarp::rosmsg::TickTime& rosTime);
91
92private:
93 mutable std::mutex m_trf_mutex;
94 std::string m_nodeName{ROSNODENAME};
95 std::string m_topic{ROSTOPICNAME_TF};
96 std::string m_topic_static{ROSTOPICNAME_TF_STATIC};
97 double m_period{0.01};
98 double m_refreshInterval{0.1};
99 yarp::os::Node* m_rosNode{nullptr};
103};
104
105#endif // YARP_DEV_FRAMETRANSFORMGETNWCROS_H
#define ROSNODENAME
#define ROSTOPICNAME_TF
#define ROSTOPICNAME_TF_STATIC
contains the definition of a Vector type
frameTransformGet_nwc_ros: A ros network wrapper client that receives frame transforms from a ros top...
~FrameTransformGet_nwc_ros()=default
bool getTransforms(std::vector< yarp::math::FrameTransform > &transforms) const override
Obtains all frame transforms saved in a storage.
void rosTransformToYARPTransform(const yarp::rosmsg::geometry_msgs::TransformStamped &input, yarp::math::FrameTransform &output, bool isStatic)
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool close() override
Close the DeviceDriver.
double yarpStampFromROS(const yarp::rosmsg::TickTime &rosTime)
void run() override
Loop function.
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