YARP
Yet Another Robot Platform
transformServer.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: LGPL-2.1-or-later
4 */
5
6#ifndef YARP_DEV_FRAMETRANSFORMSERVER_FRAMETRANSFORMSERVER_H
7#define YARP_DEV_FRAMETRANSFORMSERVER_FRAMETRANSFORMSERVER_H
8
9#include <vector>
10#include <iostream>
11#include <string>
12#include <sstream>
13#include <mutex>
14
15#include <yarp/os/Network.h>
16#include <yarp/os/Port.h>
18#include <yarp/os/Bottle.h>
19#include <yarp/os/Time.h>
20#include <yarp/os/Property.h>
21
24#include <yarp/os/Stamp.h>
25#include <yarp/os/RpcServer.h>
26#include <yarp/sig/Vector.h>
27
28#include <yarp/dev/PolyDriver.h>
30#include <yarp/dev/api.h>
31#include <yarp/os/Publisher.h>
32#include <yarp/os/Subscriber.h>
33#include <yarp/os/Node.h>
35
37
40
41
42#define ROSNODENAME "/tfNode"
43#define ROSTOPICNAME_TF "/tf"
44#define ROSTOPICNAME_TF_STATIC "/tf_static"
45#define DEFAULT_THREAD_PERIOD 0.02 //s
46
48{
49private:
50 std::vector <yarp::math::FrameTransform> m_transforms;
51 std::mutex m_mutex;
52
53public:
57 bool delete_transform (int id);
58 bool delete_transform (std::string t1, std::string t2);
59 inline size_t size() { return m_transforms.size(); }
60 inline yarp::math::FrameTransform& operator[] (std::size_t idx) { return m_transforms[idx]; }
61 void clear ();
62};
63
73{
74public:
77
78 bool open(yarp::os::Searchable &params) override;
79 bool close() override;
81
82 bool threadInit() override;
83 void threadRelease() override;
84 void run() override;
85
86private:
87 std::mutex m_mutex;
88 std::string m_streamingPortName;
89 std::string m_rpcPortName;
90 yarp::os::Stamp m_lastStateStamp;
91 double m_period;
92 yarp::os::Node* m_rosNode;
93 bool m_enable_publish_ros_tf;
94 bool m_enable_subscribe_ros_tf;
95 Transforms_server_storage* m_ros_timed_transform_storage;
96 Transforms_server_storage* m_ros_static_transform_storage;
97 Transforms_server_storage* m_yarp_timed_transform_storage;
98 Transforms_server_storage* m_yarp_static_transform_storage;
99 double m_FrameTransformTimeout;
100
101 enum class show_transforms_in_diagram_t
102 {
103 do_not_show=0,
104 show_quaternion=1,
105 show_matrix=2,
106 show_rpy=3
107 };
108 show_transforms_in_diagram_t m_show_transforms_in_diagram= show_transforms_in_diagram_t::do_not_show;
109
110 yarp::os::RpcServer m_rpcPort;
116
117 bool read(yarp::os::ConnectionReader& connection) override;
118 inline void list_response(yarp::os::Bottle& out);
119 bool generate_view();
120 std::string get_matrix_as_text(Transforms_server_storage* storage, int i);
121 bool parseStartingTf(yarp::os::Searchable &config);
122};
123
124#endif // YARP_DEV_FRAMETRANSFORMSERVER_FRAMETRANSFORMSERVER_H
float t
contains the definition of a Vector type
transformServer deprecated: Documentation to be added
bool threadInit() override
Initialization method.
void run() override
Loop function.
bool open(yarp::os::Searchable &params) override
Open the DeviceDriver.
bool close() override
Close the DeviceDriver.
void threadRelease() override
Release method.
TransformServer()
TransformServer.
yarp::os::Bottle getOptions()
bool delete_transform(int id)
Transforms storage.
bool set_transform(const yarp::math::FrameTransform &t)
yarp::math::FrameTransform & operator[](std::size_t idx)
Interface implemented by all device drivers.
Definition: DeviceDriver.h:30
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:64
An interface for reading from a network connection.
The Node class.
Definition: Node.h:23
An abstraction for a periodic thread.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition: PortReader.h:24
A port that is specialized as an RPC server.
Definition: RpcServer.h:23
A base class for nested structures that can be searched.
Definition: Searchable.h:56
An abstraction for a time stamp and/or sequence number.
Definition: Stamp.h:21