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

where's the carrot in tf tutorial?

asked 2011-03-20 08:37:23 -0500

dan gravatar image

updated 2011-03-21 08:24:00 -0500

mmwise gravatar image

I am following the tf tutorial and am a little stuck on the broadcast frame page: tf/tutorials/adding a frame

I am able to get it to run, but only see turtle1 and turtle2, no carrot. This makes sense to me, since I see where turtle2 is spawned (in the listener code) and no place where a carrot is spawned. It wouldn't really matter, except turtle2's behavior looks not correct-- it is not going to a spot 2m in front of turtle1 (where the carrot should be), but is doing something close to that, so I'd like to get the visual indicator for that.

I get that there may not be a drawing of a carrot, so I'm fine with just using a third turtle or some other visual indicator of the target.

I think that somehow I need to spawn the carrot, either in the broadcast frame code or in the listener code. Suggestions?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2011-04-22 02:17:32 -0500

Yes, both of you are right. The carrot is two meters to the left of turtle1. This might not be what you expect, but the tutorial just states that

"The carrot1 frame is 2 meters offset from the turtle1 frame."

I have edited the Wiki page to make that more clear. If you look at the code, this is exactly what we stated:

transform.setOrigin( tf::Vector3(0.0, 2.0, 0.0) );

The three values are (x, y, z), and by convention, x is forward, y is left and z is up (not used for a 2D turtle). If you want the carrot to be two meters in front of the first turtle, change that line to:

transform.setOrigin( tf::Vector3(2.0, 0.0, 0.0) );

To answer your original question: @davo is right, for visualization, the best option is to do the following while the turtlesim is running:

  1. start RViz: rosrun rviz rviz
  2. click "Add -> TF"
  3. make sure that the checkboxes "show Names" and "Frames -> all Enabled" are ticked
  4. in "Global Options -> fixed frame" select world
edit flag offensive delete link more

answered 2011-04-21 23:41:31 -0500

davo gravatar image


same issue seen here, however if you launch rviz

rosrun rviz rviz

you do get three moving objects/frames.....the third one carrot I guess is glued to 2M to the 90 degree left of the turtle(1?) heading

turtle(2?) moves onto carrot.


edit flag offensive delete link more

Question Tools


Asked: 2011-03-20 08:37:23 -0500

Seen: 540 times

Last updated: Apr 22 '11