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

tf::transformPoint cannot find frame

asked 2012-06-27 09:24:34 -0500

Mayank gravatar image

updated 2012-06-27 09:52:05 -0500

Hi All,

I am trying to convert PointStamped values from the narrow_stereo_link frame to the base_link frame using tf::TransformListener::transformPoint. However, I keep getting:

terminate called after throwing an instance of 'tf::LookupException'

what(): Frame id / does not exist!

In my code I have the following function call,

mTransformListener.waitForTransform("/narrow_stereo_link", "/base_link", ros::Time::now(), ros::Duration(5.0)); mTransformListener.transformPoint("/base_link", min_in, min_res);

On executing

rosrun tf tf_echo narrow_stereo_link base_link

on the terminal, I get the following output :

At time 1340824941.479

  • Translation: [0.152, -0.117, -1.386]
  • Rotation: in Quaternion [-0.110, 0.061, 0.869, -0.479]

        in RPY [0.214, 0.133, -2.119]
    

which means that the two are connected in the tf_tree, which is also seen in the frames.pdf generated by

rosrun tf view_frames

Can anyone help me with this?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
2

answered 2012-06-27 22:05:46 -0500

Lorenz gravatar image

In your call to waitForTransform, don't use ros::Time::now() but your point's time stamp and don't hard-code the frame id but use your point's frame id. Don't forget to check for the return value to be true. If the 5 seconds timeout pass without the transform becoming valid, waitForTransform will return and the following call to transformPoint will throw an exception.

edit flag offensive delete link more

Comments

Thanks for your answer. I edited the code following your advice, but it still doesn't seem to work. I've posted the details below.

Mayank gravatar image Mayank  ( 2012-06-28 08:33:19 -0500 )edit
1

answered 2012-06-27 10:13:27 -0500

DimitriProsser gravatar image

My first guess would be that the input point "min_in" does not have a frame_id set. You have to make sure that the input point is in its correct frame by specifying its header.frame_id. It looks to me like this field is blank in your code.

edit flag offensive delete link more

Comments

Thanks for your answer. I can't post a long comment, so please read my question posted below!

Mayank gravatar image Mayank  ( 2012-06-27 15:09:10 -0500 )edit
0

answered 2012-06-28 08:38:21 -0500

Mayank gravatar image

updated 2012-06-28 08:40:18 -0500

Instead of trying to transform individual points, I am now transforming the entire point cloud to another frame. The code is as follows,

void Convert::convertCallback(const sensor_msgs::PointCloud2 &inputCloud){

    sensor_msgs::PointCloud2 outCloud;
    bool val = mTransformListener->waitForTransform("/base_link", inputCloud.header.frame_id, inputCloud.header.stamp, ros::Duration(10.0));
    pcl_ros::transformPointCloud("/base_link", inputCloud, outCloud, *mTransformListener);
    /* Process the point cloud */
}

It initially worked for the first time, and I could transform the Point Cloud, however, now I am getting a strange error,

[ERROR] [1340908167.092985478]: Lookup would require extrapolation into the past.  

Requested time 1340908154.777419783 but the earliest data is at time 1340908155.041740035, when looking up transform from frame [/narrow_stereo_optical_frame] to frame [/base_link]
Failed to find a field named: 'x'. Cannot convert message to PCL type.
terminate called after throwing an instance of 'pcl::InvalidConversionException'
  what():  Failed to find a field named: 'x'. Cannot convert message to PCL type.
Aborted

Can anyone tell me what's wrong?

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-06-27 09:24:34 -0500

Seen: 1,435 times

Last updated: Jun 28 '12