-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathrtt_tf-component.hpp
95 lines (70 loc) · 2.73 KB
/
rtt_tf-component.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef OROCOS_RTT_TF_COMPONENT_HPP
#define OROCOS_RTT_TF_COMPONENT_HPP
#include <rtt/RTT.hpp>
#include <tf2_msgs/TFMessage.h>
#include <tf2/buffer_core.h>
#include <tf2_ros/transform_listener.h>
#include <boost/shared_ptr.hpp>
namespace rtt_tf
{
// Inherit from TaskContext and Transformer, the second is required in order to use tf_prefix
class RTT_TF: public RTT::TaskContext, protected tf2::BufferCore
{
typedef boost::shared_ptr<RTT::OutputPort<geometry_msgs::TransformStamped> > OutputPortGeometryTransfromStampedPtr;
typedef boost::shared_ptr<tf2_ros::TransformListener> TransformListenerPtr;
typedef boost::shared_ptr<tf2::BufferCore> BufferCorePtr;
static const int DEFAULT_BUFFER_SIZE = 100;
double prop_cache_time;
double prop_buffer_size;
std::string prop_tf_prefix;
RTT::InputPort<tf2_msgs::TFMessage> port_tf_in;
RTT::InputPort<tf2_msgs::TFMessage> port_tf_static_in;
RTT::OutputPort<tf2_msgs::TFMessage> port_tf_out;
RTT::OutputPort<tf2_msgs::TFMessage> port_tf_static_out;
std::map<std::pair<std::string, std::string>, OutputPortGeometryTransfromStampedPtr> ports_trackers;
BufferCorePtr buffer_core;
TransformListenerPtr transform_listener;
void internalUpdate(
tf2_msgs::TFMessage& msg,
RTT::InputPort<tf2_msgs::TFMessage>& port,
bool is_static);
ros::Time getLatestCommonTime(
const std::string& target,
const std::string& source) const;
bool canTransform(
const std::string& target,
const std::string& source) const;
bool canTransformAtTime(
const std::string& target,
const std::string& source,
const ros::Time& common_time) const;
geometry_msgs::TransformStamped lookupTransform(
const std::string& target,
const std::string& source) const;
geometry_msgs::TransformStamped lookupTransformAtTime(
const std::string& target,
const std::string& source,
const ros::Time& common_time) const;
void broadcastTransform(
const geometry_msgs::TransformStamped &tform);
void broadcastTransforms(
const std::vector<geometry_msgs::TransformStamped> &tforms);
void broadcastStaticTransform(
const geometry_msgs::TransformStamped &tform);
void broadcastStaticTransforms(
const std::vector<geometry_msgs::TransformStamped> &tforms);
void addTFOperations(RTT::Service::shared_ptr service);
bool subscribeTransfrom(
const std::string& target,
const std::string& source);
void listTrackers();
public:
RTT_TF(std::string const& name);
bool configureHook();
bool startHook();
void updateHook();
void stopHook();
void cleanupHook();
};
}//namespace rtt_tf
#endif