0
$\begingroup$

Rosanswers logo

Hi, I'm trying to get the XYZ position of the odom frame. In particular I just want the xy position, not fussed about height change (z). As you can see in the picture, only one of the values is close, the others are quite off.

image description

The code I'm using to get the XYZ seen in the console (only relevant lines):

tf_listener = tf.TransformListener()
try:
    (trans, rot) = tf_listener.lookupTransform('/imu_link', '/odom', rospy.Time(0))
except (tf.LookupException, tf.ConnectivityException, tf.ExtrapolationException):
    continue
rospy.loginfo(trans)

Also RVIZ Global Fixed Frame was set to Velodyne (Using a Husky with Velodyne sensor).

I'm sure it can't be too difficult but if anyone could show me ow to exactly get the odom-position information that RVIZ is showing, that'd be great

Using Ubuntu 16.04, Kinetic.


Originally posted by JAWDAY on ROS Answers with karma: 43 on 2019-01-31

Post score: 0


Original comments

Comment by matheusns on 2019-01-31:
All right, could you, please, send us the rqt_graph screenshot of your application? This to see if what are the available transformations and "who" is providing the odom transform.

Comment by JAWDAY on 2019-01-31:
Here is the rqt_graph screenshot, and also output of rosrun tf view_frames here.

Comment by mgruhler on 2019-02-01:
Not 100% sure, but I guess rviz is showing the positions w.r.t. the fixed_frame. Thus, if you want to have the same transforms, maybe try to change the fixed_frame to imu_link to check if the positions then match.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

@mgruhler is correct, the values your seeing in RVIZ are the location of the odom frame with respect to the current fixed frame in RVIZ. There is no such thing as an absolute position in the TF system, locations are only described relative to each other, so when you say you want to know the XY position of odom it's important to know what frame you need to know that position in.

For example if you want to know the location of odom in the world frame then you would look up the odom->world transform. This is slightly non-intuitive, because the TF systems returns the transformation between points in the child to parent frame, NOT the pose of the child frame in the parent frame. These two are actually the inverse of each other.

Hope this makes sense.


Originally posted by PeteBlackerThe3rd with karma: 9529 on 2019-02-01

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by JAWDAY on 2019-02-01:
Awesome, I changed the fixed frame in RVIZ to be imu_link and they returned the same values. Strange, could have sworn I had tried it. Subsequently my code seems to be running as expected now. Thanks all

Comment by PeteBlackerThe3rd on 2019-02-01:
glad you got it fixed.

$\endgroup$

Your Answer

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