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

About quaternion to euler rotation #2

Open
milkcat0904 opened this issue Aug 13, 2018 · 4 comments
Open

About quaternion to euler rotation #2

milkcat0904 opened this issue Aug 13, 2018 · 4 comments

Comments

@milkcat0904
Copy link

hello, thx for your code, i'm doing something just similar with your project. I have encountered some problems that need your help.

I have each joint quaternion and location data and i need to get the CHANNEL of BVH file.
I found that the HIERARCHY of BVH file i download from website are all the same,so i just copy HIERARCHY part and write MOTION data.

I did the following things with Pyrhon:
1.calculate relative quaternion between current joint and parent joint
q_relative = q_current * inverse(q_parent)
2.calculate euler rotation ZXY(my BVH file all the CHANNEL is Z-X-Y rotation)
'''
y1 = 2*(orientationXorientationY - orientationWorientationZ)
y2 = orientationWorientationW - orientationXorientationX + orientationY+orientationY - orientationZ*orientationZ

x = 2*(orientationY*orientationZ + orientationW*orientationX)
x = +1 if x > +1 else x
x = -1 if x < -1 else x

z1 = 2*(orientationX*orientationZ - orientationW*orientationY)
z2 = orientationW*orientationW - orientationX*orientationX - orientationY+orientationY + orientationZ*orientationZ

rotationZ = math.degrees(math.atan2(z1, z2))
rotationX = math.degrees(math.asin(x))
rotationY = math.degrees(math.atan2(y1, y2))

euler_rotation = [rotationZ, rotationX, rotationY]

'''

After the visualization, the movement is wrong.
This problem has been bothering me for a long time, I need your help.

@meshonline
Copy link
Owner

meshonline commented Aug 15, 2018 via email

@c4b4d4
Copy link

c4b4d4 commented Jan 22, 2019

Hi, did you manage to solve this?

@meshonline
Copy link
Owner

meshonline commented Jan 23, 2019 via email

@c4b4d4
Copy link

c4b4d4 commented Jan 23, 2019

I need to do everything in real-time, not over recorded files. I'm doing a virtual character control but the rotations seem to be so wrongly done.

This is what I'm facing: Stack Overflow Question

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

3 participants