ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
3

How to transform a PointStamped from a frame to another?

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

est_CEAR gravatar image

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!

edit retag flag offensive close merge delete

Comments

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
2

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

est_CEAR gravatar image

Hi,

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

Question Tools

1 follower

Stats

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

Seen: 3,783 times

Last updated: Aug 10 '15