Ask Your Question
0

Transform listener can't find base_link

asked 2014-03-09 11:49:15 -0500

SpiderRico gravatar image

updated 2016-10-24 09:02:41 -0500

ngrennan gravatar image

Hello all,

I'm trying to read values from base_link frame in order to get my robot's coordinates with the following code:

tf::TransformListener listener;
tf::StampedTransform transform;
try {
        listener.lookupTransform("/base_link", "/odom", ros::Time(0),
                transform);
    } catch (tf::TransformException ex) {
        ROS_ERROR("%s", ex.what());
    }

However, all I get is an error.

[ERROR] [1394401426.907398394, 36.516000000]: Frame id /base_link does not exist! Frames (1)

I can visualize base_link in rviz or read it's values on terminal using rostopic echo so I'm pretty sure it exists.

Any help is much appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-03-09 12:03:51 -0500

SpiderRico gravatar image

Adding this line solved the problem:

listener.waitForTransform("base_link", "odom", ros::Time(0),
            ros::Duration(3.0));

so the final code is:

try {

    listener.waitForTransform("base_link", "odom", ros::Time(0),
            ros::Duration(3.0));
    listener.lookupTransform("/base_link", "/odom", ros::Time(0),
            transform);
} catch (tf::TransformException ex) {
    ROS_ERROR("%s", ex.what());
}
edit flag offensive delete link more

Comments

Please mark your own answer as correct if it is.

BennyRe gravatar image BennyRe  ( 2014-03-09 21:22:47 -0500 )edit

It says I need more than 25 points for that.

SpiderRico gravatar image SpiderRico  ( 2014-03-11 04:08:21 -0500 )edit

Now you have 25 karma.

BennyRe gravatar image BennyRe  ( 2014-03-11 04:31:22 -0500 )edit

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

Stats

Asked: 2014-03-09 11:49:15 -0500

Seen: 589 times

Last updated: Mar 09 '14