Ask Your Question

How to transform a PointStamped from a frame to another?

asked 2015-08-09 01:37:12 -0500

est_CEAR gravatar image


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;

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");
tf::pointStampedTFToMsg(tf_point_stamped_out, goal_stamped_);

What is wrong? Thanks!

edit retag flag offensive close merge delete


What error messages do you get? What are the expected parameters of your functions?

NEngelhard gravatar image NEngelhard  ( 2015-08-09 15:44:09 -0500 )edit

Hi, thanks for your answer! I finally fixed it.

est_CEAR gravatar image est_CEAR  ( 2015-08-10 01:46:24 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2015-08-10 01:45:50 -0500

est_CEAR gravatar image


I finally found an example of code and it works:

tf::TransformListener listener(ros::Duration(10));
listener.transformPoint("base_link", *goal_stamped, goal_stamped_);

where goal_stamped is a const geometry_msgs::PointStamped::constPtr (subscribed from a topic) and goal_stamped_ is the geometry_msg::PointStamped that I want to use in my code, with frame_id="base_link" (it is the output of the transformPoint function.

Sorry, I hope it will help others!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-08-09 01:37:12 -0500

Seen: 2,875 times

Last updated: Aug 10 '15