Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to transform a PointStamped from a frame to another?

Hi,

I get a PoseStamped in a specific frame and I want to transform it to the coordinates of the point in my base_link frame. I tried to use the tf::Transformer::transformPoint. Is it correct? I still have errors when trying to use it because of the types of the inputs. So I used tf::pointStampedMsgToTF but it still not compile.

tf::Stamped<tf::Point> tf_point_stamped_in, tf_point_stamped_out;
tf::pointStampedMsgToTF(goal_stamped,*tf_point_stamped_in);

if (!tf::Transformer::transformPoint ("base_link", tf_point_stamped_in, tf_point_stamped_out))
{
    ROS_ERROR_STREAM ("Error converting stamped point from frame "<<goal_stamped->header.frame_id<<"to base_link");
    return;
}
tf::pointStampedTFToMsg(tf_point_stamped_out, goal_stamped_);

What is wrong? Thanks!