Ask Your Question
0

Access tf Vector3 values

asked 2017-06-04 07:03:29 -0600

JulianR gravatar image

Hello,

I would like to get the z position value of my robot in gazebo. My Robot is using a skid steering plugin publishing on the "/player0/odom" topic and the "/tf" topic with "player0/frame" as it's frame id.

I do know how to get the x and y values by using the odom topic, but to get the z value it seems I have to use tf. However, the tf data confuses me.

If I echo the /tf topic, I get:

transforms:

header: 
  seq: 0
  stamp: 
    secs: 8
    nsecs: 402000000
  frame_id: player0/frame
child_frame_id: root
transform: 
  translation: 
    x: -2.00000384203
    y: -0.000426774126042
    z: 0.400000377264
  rotation: 
    x: -4.57302626635e-07
    y: 9.54536038539e-08
    z: -0.00161574482528
    w: 0.999998694683

How can I get the z: 0.4...value and store it into a variable?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-06-04 11:48:03 -0600

tfoote gravatar image

You should use a TransformListener to get transform information. Please see the tf2 tutorials: http://wiki.ros.org/tf2/Tutorials

edit flag offensive delete link more

Comments

Thanks you, I did look at those tutorials, but I still had some questions. What really helped me understand the /tf access was looking at the tf_echo.cpp source file.

JulianR gravatar imageJulianR ( 2017-06-05 07:48:01 -0600 )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

2 followers

Stats

Asked: 2017-06-04 07:03:29 -0600

Seen: 460 times

Last updated: Jun 04 '17