Is there a discussion group about tf2? Quaternions?

asked 2020-04-11 14:34:21 -0500

Stephen Montgomery-Smith gravatar image

I am new to ROS, and I am having some difficulties with a lot of stuff, but in particular navigating the various discussion groups. One thing I think I do understand well are quaternions. This is what I would lie to discuss. Is this the right place?

  1. Unitary minus of a quaternion seems to be defined twice in Quaternion.h - on lines 282 and 354.

  2. Is there a function that figures out the result of a quaternion q applied to a vector v - this would look like qvq.inverse() and then throw away the w part.

  3. Can we have a conjugate operator that is the synonym of inverse? I like to represent angular velocities as quaternions. These have the w part equal to 0, and the x, y and z parts are exactly one half of the actual angular velocity. But then how do I find the conugate of this quaternion? From a code point of view, I could use inverse, because inverse assumes the quaternion is a unit quaternion, and then they are equivalent. But it looks odd in my code to use inverse when I really mean conjugate.

  4. tf2 doesn't have addition of matrices, nor multiplication by scalars. Nor multiplication of quaternions by scalars.

  5. In the comments in Matrix3x3, it says that it is only meant for orthogonal matrices. But the code for matrix inverse does not assume the matrix is orthogonal, and the Jacobi method for diagonalizing matrices only applies to symmetric matrices, and matrices that are both symmetric and orthogonal are rather specialized.

  6. Has anyone considered representing transforms by dual quaternions? Or at least adding dual quaternions to tf2? And I also like representing twists by dual quaternions. But the latter won't be unit dual quaternions

The reason I like to represent angular velocities as quaternions (or twists as dual quaternions) is that if one wants to apply an angular velocity w to an orientation represented by quaternion q over an infinitesimal time dt, you do it with

  • q = q + dtqw (if w is in q's frame of reference)
  • q = q + dtwq (if w is in fixed frame of reference).
edit retag flag offensive close merge delete

Comments

tf2 doesn't have addition of matrices, nor multiplication by scalars. Nor multiplication of quaternions by scalars.

A quick comment about this one: the suggested workflow is for users to convert ROS TF message types (and geometry_msgs types) to the linalg framework of their choosing/preference, perform the desired operations with that and then convert back to whichever messages are needed.

The rationale being there are quite a few different linalg frameworks, and many devs have different preferences for which they'd like to use. Instead of creating yet another one and then having to maintain it (and keep adding new functionality, such as what you are asking for), provide conversion functions to-and-from various frameworks and avoid all the extra development time.

There are conversions to-and-from Eigen, KDL and Bullet. Eigen probably has many of the functions you report as missing.

gvdhoorn gravatar image gvdhoorn  ( 2020-04-11 14:57:48 -0500 )edit

re: discussion: ROS Discourse is typically the recommended discussion platform instead of ROS Answers (which is more a Stack Overflow like Q&A forum).

You may want to post the discussion items in your question here on ROS Discourse. If that's not the right venue, members there will be able to point you to a better one.

gvdhoorn gravatar image gvdhoorn  ( 2020-04-11 15:03:12 -0500 )edit

re dual quaternions: yes, see this Discourse topic. The packages are pending release in rosdistro.

achille gravatar image achille  ( 2020-06-12 20:47:55 -0500 )edit