Is this a question about the Bullet C++ API or the python API?
I ask because there is no
getEulerFromQuaternion() in the C++ API proper, but there is an implementation in
examples/SharedMemory/b3RobotSimulatorClientAPI_NoDirect.h. For all I know the python API supplies a method with a similar name.
The example implementation looks like this:
Code: Select all
btVector3 b3RobotSimulatorClientAPI_NoDirect::getEulerFromQuaternion(const btQuaternion& quat)
{
btScalar roll, pitch, yaw;
quat.getEulerZYX(yaw, pitch, roll);
btVector3 rpy2 = btVector3(roll, pitch, yaw);
return rpy2;
}
So the question becomes: What does
btQuaterion::getEulerZYX(yaw, pitch, roll) do?
I looked at the code and discovered... it is not clear! The comments do not say, and the reader would have to step through the math to figure it out. However, if I were to hazard a guess I would think the yaw-pitch-roll decomposition would be about the
local up-right-forward axes in that order. In other words, the directions of the various axes are locked in the local-frame and each rotation in the sequence moves those axes relative to the original world-frame, while the angles are always applied in the local frame. This is the decomposition that would make the most sense to someone with layman's grasp of how to formulate rotations: such as a pilot sitting in the local-frame of an airplane.
All that said, I would ask:
What do you really want to do? (In other words: Why do you think you need Euler angles?). I have come to the conclusion over the years that Euler angles suck and should be avoided when possible. It is better (e.g. less dangerous and fewer headaches) to store and supply rotations in quaternion format and to do rotation math to achieve what you want.