# where's the carrot in tf tutorial?

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 close merge delete

Sort by » oldest newest most voted

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
3. make sure that the checkboxes "show Names" and "Frames -> all Enabled" are ticked
4. in "Global Options -> fixed frame" select world
more

hiya,

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.

Dave

more