# What units does the IMU message use?

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 close merge delete

Sort by » oldest newest most voted

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 :

more

Where are the functions for converting to/from quaternions?

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.