ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Ok.... huh...
I just was trying to implement this, when I saw your question. So I will try to help you, or at least show you my solution which seams to work. It is done in C++.
So you need following headers:
#include <tf2_ros/transform_listener.h>
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
Than initialise all variables:
tf2_ros::Buffer tfBuffer;
tf2_ros::TransformListener tfListener(tfBuffer);
geometry_msgs::TransformStamped transform;
Ant than the magic line:
try{
transform = tfBuffer.lookupTransform("base_link", frame_id, ros::Time(0));
}
catch (tf2::TransformException ex ){
ROS_ERROR("%s",ex.what());
}
To this solution I came by searching code of geometry_experimental stack on GitHub.