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

matrix to euler: create new list and round to 0 if very small to prevent atan2 problems #46

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

aatb-ch
Copy link
Contributor

@aatb-ch aatb-ch commented Nov 24, 2023

While investigating pose rotations while implementing linear export for UR in #44 i stumbled upon very strange euler angles returned by euler_angles_by_matrix, traced it to Maya returning not 0 but very small values sometimes and feeding these almost 0 values to atan2 returns wild results.

def euler_angles_by_matrix(m):

I added a step to round down to 0 very small values to prevent that, seems to fix the issue.

Example matrix returned by Mimic/Maya:

[-5.715780062744253e-16, 1.0000000000000004, -4.998281860349651e-16]
[-3.8719027983802334e-15, 4.440892098500628e-16, 1.0]
[1.0000000000000004, 2.8899813360850883e-16, 3.6914915568786455e-15]

instead of the expected

[0,1,0]
[0,0,1]
[1,0,0]

which results in [-98.39746772339547 -90.0 -89.99999999999997] instead of the correct [-90,0,-90].

@AutodeskRoboticsLab AutodeskRoboticsLab deleted a comment from kiman2000 Nov 27, 2023
@AutodeskRoboticsLab AutodeskRoboticsLab deleted a comment from aatb-ch Nov 27, 2023
@AutodeskRoboticsLab AutodeskRoboticsLab deleted a comment from kiman2000 Nov 27, 2023
@AutodeskRoboticsLab AutodeskRoboticsLab deleted a comment from aatb-ch Nov 27, 2023
@AutodeskRoboticsLab AutodeskRoboticsLab deleted a comment from kiman2000 Nov 27, 2023
@evanatherton
Copy link
Member

Good catch - thanks @aatb-ch!

@evanatherton evanatherton merged commit db46003 into AutodeskRoboticsLab:master Nov 27, 2023
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

Successfully merging this pull request may close these issues.

2 participants