ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
8

What is the difference between geometry and tf quaternions?

asked 2011-07-19 04:35:18 -0600

updated 2014-01-28 17:10:03 -0600

ngrennan gravatar image

I am trying to create a geometry_msgs::Quaternion from two other (to create an Odometry message). I've found that tf::Quaternion is a btQuaternion but it is not a geometry_msgs one. I would like to know which is the difference and how can I work if I only have geometry_msgs::Quaternion inputs and outputs. Thanks!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
12

answered 2011-07-19 04:44:24 -0600

tfoote gravatar image

updated 2014-01-27 17:54:42 -0600

They represent the same data. There are different libraries which support native processing of each of them.

There are conversion methods such as to and from message datatypes for your convenience.

edit flag offensive delete link more

Comments

Thank you !
martimorta gravatar image martimorta  ( 2011-07-20 00:31:23 -0600 )edit

What's the method for the geometry classes in tf2? I found my way to [tf2::convert](http://docs.ros.org/api/tf2/html/convert_8h.html), but that doesn't seem to do quite the right thing.

mikepurvis gravatar image mikepurvis  ( 2013-11-14 16:08:57 -0600 )edit

Hi can you please update the broken links?

NickSpeal gravatar image NickSpeal  ( 2014-01-27 16:36:58 -0600 )edit
1

I've updated the links.

tfoote gravatar image tfoote  ( 2014-01-27 17:54:56 -0600 )edit
8

answered 2018-08-31 09:58:55 -0600

-LD- gravatar image

As a noob i always are happy if a "nice" answer is provided. One, that can be copy-pasted. Because most likely someone will find this question when searching for a solution for a similar problem. So, if i'm correct, this should do the required trick:

Both ways this is needed at the very beginning of the code:

#include <tf/transform_datatypes.h>

msg -> TF:

 quaternionMsgToTF(quat_msg , quat_tf);

tf -> msg

 quaternionTFToMsg(quat_tf , quat_msg);

Basically this is exactly what the answer above includes, just as a line of code for everyone who isn't (jet) able to read the code provided by the link.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2011-07-19 04:35:18 -0600

Seen: 14,950 times

Last updated: Aug 31 '18