0
$\begingroup$

Rosanswers logo

Hi all,

I am fairly new to ros and was going through the tf tutorials and stumbled upon a strange error. After fiddling around for an hour or so I'm still not able to understand the behavior. I'm doing everything exactly as stated in these tutorials, using C++. The code is exactly as stated there. I'm on fuerte, and ubuntu 12.04.

The problem is that the second turtle goes in circles instead of approaching the first one. The broadcaster works well, so, I would guess, that the issue is in the listener in the "lookupTransform" method. In the end the angular speed appears to be wrong.

I also attach the image of how the turtle moves. This happens on 2 different machines of the same configuration with fresh ros-fuerte installed.

image description

Any ideas what could explain such a behavior?


Originally posted by niosus on ROS Answers with karma: 386 on 2012-10-15

Post score: 4

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Hi,

I had the same problem and just changed the order of the arguments for the Quaterion in turtle_tf_broadcaster.cpp. Now it looks like this and works for me:

transform.setRotation(  tf::Quaternion(0, 0, msg->theta) );

Not sure, what reason causes this problem.


Originally posted by Tones with karma: 635 on 2012-11-08

This answer was ACCEPTED on the original site

Post score: 8


Original comments

Comment by thebyohazard on 2012-11-09:
Good find! I was looking at the listener. I'm guessing the API changed the order of the constructor parameters from RPY to YPR. Anyway, the Quaternion constructor w/Euler angles was deprecated since the tutorial was written. You should make the quaternion another way or use the setEulerZYX function.

Comment by niosus on 2012-11-16:
Thanks, worked for me too. Anyway, the tutorial should be changed, I guess...

Comment by 130s on 2012-12-28:
Very good catch! I've updated the tutorial http://www.ros.org/wiki/tf/Tutorials/Writing%20a%20tf%20broadcaster%20%28C%2B%2B%29. Review is appreciated! Also, relevant announcement about Bullet migration http://goo.gl/8gJOn

Comment by RafBerkvens on 2013-03-21:
The code in the tutorial is still faulty. Thanks for the answer!

Comment by wesleyc on 2013-08-06:
Thanks for the answer! There seems to be a discrepancy between the tutorial and the class reference on how lookupTransform works too. The tutorial says it gives the transform from the 1st arg to the 2nd arg, but the class reference says the exact opposite. The class reference seems to be correct.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.