Ask Your Question

What units does the IMU message use?

asked 2016-10-24 00:31:22 -0500

Cerin gravatar image

updated 2016-10-24 00:37:42 -0500

The docs list some of the units used for the Imu message, but not all.

For example, what units are used for orientation Quaternion? I've been setting these to the Euler angles, which I have in degrees, but it's rendering nonsensically in Rviz. Should these be radians? Does the orientation Quaternion represent Euler angles, or is it something else?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-10-24 01:03:20 -0500

alienmon gravatar image

updated 2016-10-24 01:20:13 -0500

Quaternion is different from euler angles, but as always you can convert between one another.

You can check here for sweet and short basic of quaternion. Let me quote from it:

A quaternion rotation is made up of 4 numbers, whose values all have a minimum of -1 and a maximum of 1, i.e (0, 0, 0, 1) is a quaternion rotation that is equivalent to 'no rotation' or a rotation of 0 around all axis.

Euler angle to Quaternion Given an Euler rotation (X, Y, Z) using orthogonal axes:

x = sin(Y)sin(Z)cos(X)+cos(Y)cos(Z)sin(X)

y = sin(Y)cos(Z)cos(X)+cos(Y)sin(Z)sin(X)

z = cos(Y)sin(Z)cos(X)-sin(Y)cos(Z)sin(X)

w = cos(Y)cos(Z)cos(X)-sin(Y)sin(Z)sin(X)

  • You don't need to implement those by yourself as there are also available functions in ROS api for converting from quaternion to euler and vice versa

You might also want to check :

edit flag offensive delete link more


Where are the functions for converting to/from quaternions?

Cerin gravatar image Cerin  ( 2016-10-24 11:07:01 -0500 )edit

When I use tf package: transform.getRotation() gives quaternion... tf::getYaw( quaternion) will give the yaw angle in radian given a quaternion input. You can just google on them.

alienmon gravatar image alienmon  ( 2016-10-24 20:12:57 -0500 )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

1 follower


Asked: 2016-10-24 00:31:22 -0500

Seen: 573 times

Last updated: Oct 24 '16