Ask Your Question
0

does tf.TransformListener.lookupTransform return quaternion & position, or translation and rotation?

asked 2017-03-07 05:56:20 -0500

Will Chamberlain gravatar image

updated 2017-03-07 05:57:06 -0500

Does tf.TransformListener.lookupTransform return quaternion & position, or translation and rotation?

The Using Python tf tutorial and the Indigo Python API give

position, quaternion = self.tf.lookupTransform("/base_link", "/map", rospy.Time())

and

lookupTransform(target_frame, source_frame, time) -> (position, quaternion)

, but the Writing a tf listener (Python)) tutorial gives

(trans,rot) = listener.lookupTransform('/turtle2', '/turtle1', rospy.Time())

Is there a change between Indigo and Jade or Kinetic from (quat,pos) to (trans,rot)?
Also - where is the source code; can't find it in https://github.com/ros/geometry/tree/...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2017-03-07 08:32:19 -0500

updated 2017-03-07 08:35:58 -0500

All examples you posted are saying the same thing it's just in the first two they use the position variable to store the translational part of the transform and quaternion to store the rotational part of the transform (which is indeed expressed as a quaternion). In the third example they instead use trans and rot for variable names, but the meaning of the data is unchanged. The function is always returning two arguments --- the first is a 3-length tuple of double values representing the x-y-z translation, and the second is a 4-length tuple of doubles representing the rotation as a quaternion (x-y-z-w).

There is official API documentation of tf in Python here. You might also want to look into the tf2 tutorials, specifically the Python listener tutorial. Under the hood, the tf functions now use tf2, and you could be using it directly. During the migration from tf to tf2 there were many behind-the-scenes changes, but I'm unaware of any API changes to tf.

You may have had trouble finding the source code because the Python TransformerROS class inherits from a C++ class compiled with Python.h. In other words, the Python API lookupTransform function is actually located in the pytf.cpp C++ code.

edit flag offensive delete link more

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-03-07 05:56:20 -0500

Seen: 1,725 times

Last updated: Mar 07 '17