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

get_pose_euler() doesn't return the correct angle if it surpasses 90/-90 degree #5

Open
kazoo-kmt opened this issue Jul 3, 2017 · 7 comments

Comments

@kazoo-kmt
Copy link

When the controller's angle exceeds 90 degree, get_pose_euler() method doesn't return the correct angle value. For example, when it surpasses 1 degree, it returns 89 degree instead of 91 degree.

@kazoo-kmt
Copy link
Author

For example, you can implement like this:

cosine_for_pitch = math.sqrt(pose_mat[0][0] ** 2 + pose_mat[1][0] ** 2)
is_singular = cosine_for_pitch < 10**-6
if not is_singular:
    yaw = math.atan2(pose_mat[1][0], pose_mat[0][0])
    pitch = math.atan2(-pose_mat[2][0], cosine_for_pitch)
    roll = math.atan2(pose_mat[2][1], pose_mat[2][2])
else:
    yaw = math.atan2(-pose_mat[1][2], pose_mat[1][1])
    pitch = math.atan2(-pose_mat[2][0], cosine_for_pitch)
    roll = 0

Also, it might be easier to use transforms3d package.

@pgambardella
Copy link

hello @kazoo-kmt. Thank you for your comment, it was really useful for an issue I had with Vive Tracker. Do you have tried this on vive tracker? I don't get why rotation axis change, it is different from controllers.

@lgbeno
Copy link
Collaborator

lgbeno commented Oct 11, 2018

Regarding changes to the angle calculations, pull requests are welcome!

@pgambardella
Copy link

you got one! :)

@pgambardella
Copy link

nope, sorry, that didn't work.

@kazoo-kmt
Copy link
Author

@paologambardella I only tried with Vive Controller.

@lvgeng
Copy link

lvgeng commented Jan 7, 2019

It appears that this problem is still not solved yet. Using the pure openvr might be a reliable solution.

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

4 participants