Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orientation Data Format #8

Open
jaimovier opened this issue Jan 20, 2019 · 1 comment
Open

Orientation Data Format #8

jaimovier opened this issue Jan 20, 2019 · 1 comment

Comments

@jaimovier
Copy link

Orientation data is being sent with four values (i.e. /myo/orientation 1 -13912. 4767. -1452. 7074.)

It would be ideal to have this data formatted as the MyOSC application, with yaw, pitch and roll values.

@jaimovier
Copy link
Author

The quaternion to euler values is not working correctly. The values are fixed or have jumps between positions.

MyOSC does the following calculations:
https://github.com/benkuper/MyOSC/blob/e35961a54c19951e9c4569193b99501bb4deeec6/extension/debug/MyoController.ane/META-INF/ANE/MacOS-x86/MyoExtension/MyoExtension/MyoExtension.cpp

    // Calculate Euler angles (roll, pitch, and yaw) from the unit quaternion.
    double roll = atan2(2.0f * (quat.w() * quat.x() + quat.y() * quat.z()),
                        1.0f - 2.0f * (quat.x() * quat.x() + quat.y() * quat.y()));
    
    double pitch = asin(2.0f * (quat.w() * quat.y() - quat.z() * quat.x()));
    
    double yaw = atan2(2.0f * (quat.w() * quat.z() + quat.x() * quat.y()),
                       1.0f - 2.0f * (quat.y() * quat.y() + quat.z() * quat.z()));

myo-to-osc also makes this calculations:
https://github.com/cpmpercussion/myo-to-osc/blob/master/myo_to_osc.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant