How to get right form of the Euler angle through collected quaternion?

NatNet, VRPN, TrackD, and Plugins
Post Reply
DarkKnight
Posts: 7
Joined: Sat May 15, 2021 10:41 am

How to get right form of the Euler angle through collected quaternion?

Post by DarkKnight » Thu Jun 03, 2021 10:13 am

Hello, everyone,

Currently I can get some pose data from Motive, including the position and quaternion data. I use the python sample client in the SDK3.1 to receive and record the pose data. According to the official documentation https://v22.wiki.optitrack.com/index.ph ... ate_System, we can know that the default coordinate of the Motive2.2.0(the version I am using now) is right-handed Y-up coordinate system, and the order is 'XYZ' order. But in the Motive, we can change it to the right-handed Z-up coordinate system(XYZ order), and this is also the setting that I am currently using.

However, when I use the following Matlab code to convert the quaternion to Euler Angle, the pitch and yaw is in the right form. The roll angle is is flipping between +3.14 to -3.14 rad, but the right value should be around 0 rad. Also, I tried to use the WinFormTestApp.exe to receive the data, and under this case, the roll angle is in the right form.

Code: Select all

[roll, pitch, yaw] = quat2angle(quat,'XYZ');
or

Code: Select all

RPY = quat2eul(quat,'XYZ')';
The Motive setting and orientation data is attached here. How can I get the right form of the roll angle(the right value should be around 0 rad)? any suggestion is helpful.
Attachments
1.png
1.png (18.66 KiB) Viewed 125 times

DarkKnight
Posts: 7
Joined: Sat May 15, 2021 10:41 am

Re: How to get right form of the Euler angle through collected quaternion?

Post by DarkKnight » Sun Jun 13, 2021 7:37 am

I have found the reason. In optitrack, the quaternion follows q=x*i+y*j+z*k+w; However, In matlab, the quaternion follows q=w+x*i+y*j+z*k. As long as I change the quaternion form from optitrack representation into matlab representation, then it works.

Post Reply