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

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

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

pdrews gravatar image

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


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.

Ken_in_JAPAN gravatar image Ken_in_JAPAN  ( 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.

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

1 Answer

Sort by ยป oldest newest most voted

answered 2014-06-24 17:48:01 -0600

updated 2014-06-24 17:48:55 -0600

You can do that with a tf::Quaternion

tf::Quaternion q;
q.setRPY(from_degrees(roll), from_degrees(pitch), from_degrees(yaw));
edit flag offensive delete link more


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

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

Question Tools

1 follower


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

Seen: 901 times

Last updated: Jun 24 '14