ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
 Ask Your Question

# What should we replace setEulerZYX with in the btQuaternion class (this method is now deprecated)?

We are using a Sparkfun Razor IMU, and it produces Euler angles in yaw,pitch,roll order. We need the setEulerZYX method to put this into a quaternion, but compiling this produces a warning that it is deprecated. I cannot find an equivalent function, do anyone have any suggestions for replacement?

edit retag close merge delete

## Comments

I use transform_datatypes.h to implement OMPL. The transform_datatypes.h includes createIdentityQuaternion() and createQuaternionFromRPY() and so on. There is the transform_datatypes.h in /opt/ros/***/include/tf/. It's my pleasure if my comment is useful for you.

( 2014-06-24 17:54:18 -0600 )edit

Unfortunately, this has the same problem as Dan's answer. All of these methods are rotations around fixed angles, instead of sequential Euler angle rotations. I agree that Euler angle implementation can be ambiguous, but euler rotations and fixed angle rotations don't seem to be equivalent.

( 2014-06-24 18:26:35 -0600 )edit

## 1 Answer

Sort by ยป oldest newest most voted

You can do that with a tf::Quaternion

tf::Quaternion q;
q.setRPY(from_degrees(roll), from_degrees(pitch), from_degrees(yaw));

more

## Comments

We are actually using tf::Quaternion, which is mostly derived from the bullet btQuaternion class. The problem is that q.setRPY and q.setEulerZYX are not equivalent. setRPY takes rotations around a fixed set of axes. setEulerZYX uses rotations relative to a frame that stays attached to the body (see the wikipedia article http://en.wikipedia.org/wiki/Euler_angles).

( 2014-06-24 18:13:54 -0600 )edit

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2014-06-24 17:16:32 -0600

Seen: 827 times

Last updated: Jun 24 '14