Ask Your Question
0

Can't get transform from /base_link to /odom although it's definitely there.

asked 2013-09-20 11:26:43 -0500

Hendrik Wiese gravatar image

updated 2013-09-21 00:10:08 -0500

Hi folks,

this is a very weird issue. I'm trying to post a goal to move_base but need a transform to get the right movement vector for my robot. That transform is definitely available. I can do this

$ rosrun tf tf_echo /base_link /odom
At time 1379711306.536
- Translation: [-0.281, -1.081, 0.000]
- Rotation: in Quaternion [0.000, 0.000, -0.004, 1.000]
        in RPY [0.000, 0.000, -0.008]

however when I try to get that transform from within a ROS node it's not available (timeout after a duration of 3 seconds). Here's the source code of my goal sending example node:

http://pastebin.com/Gvm6jcsC

And three seconds after rosrun'ing the node I get the error message "Transform /base_link /odom not found".

Here's the corresponding tf graph:

EDIT: image removed; faaaaar too huge!

Link to image

Can somebody help me figure out how and why this can happen?

EDIT 2: It is a time issue. After replacing all references to ros::Time::now() with ros::Time(0) it works. Does it have to be like that? Or is it just fighting symptomes of a different cause?

Thanks a lot!

Cheers, Hendrik

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-09-21 20:49:50 -0500

tfoote gravatar image

I believe that your problem is that you are picking a timestamp which is approximately at the startup time of your program, however you have not given the tf buffer time to fill prior to your query.

If you were to implement a loop with retrying you would find it would likely work. Or if you initialized the Listener long enough for the tf data to arrive it would likely work as well. Time zero works because it will return as soon as a set of transforms exists.

waitForTransform is only useful if your data is newer than the information in the buffer. You have the other case that your data is older than the buffer. Since old tf data is not republished waiting into the future is never going to work if your timestamp is older than the earliest data in the buffer.

edit flag offensive delete link more
0

answered 2013-09-20 18:54:06 -0500

fergs gravatar image

Are you running this on a remote machine from the actual robot/roscore? If so, make sure clocks are synchronized (chrony does a good job at this).

edit flag offensive delete link more

Comments

Nope. Everything is running on the same machine (aside from the simulator but that isn't running within the ROS scope and hence doesn't need time synchronization).

Hendrik Wiese gravatar image Hendrik Wiese  ( 2013-09-20 23:25:50 -0500 )edit

Simulator? Is it possible you need to set use_sim_time parameter on the parameter server to true?

fergs gravatar image fergs  ( 2013-09-21 13:30:45 -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: 2013-09-20 11:26:43 -0500

Seen: 342 times

Last updated: Sep 21 '13