0

Rosanswers logo

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?


Originally posted by Cerin on ROS Answers with karma: 940 on 2016-10-24

Post score: 0

1 Answers1

0

Rosanswers logo

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 :


Originally posted by alienmon with karma: 582 on 2016-10-24

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by Cerin on 2016-10-24:
Where are the functions for converting to/from quaternions?

Comment by alienmon on 2016-10-24:
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.