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

How do i get the Euler Angle of a joint? #92

Open
1234562123 opened this issue Jun 10, 2021 · 1 comment
Open

How do i get the Euler Angle of a joint? #92

1234562123 opened this issue Jun 10, 2021 · 1 comment

Comments

@1234562123
Copy link

I can currently get the 3D coordinates of the hand by following code
Self. X = joints [PyKinectV2. JointType_HandRight] Position. X
Self. Y = joints [PyKinectV2. JointType_HandRight] Position. Y
self.z = joints[PyKinectV2.JointType_HandRight].Position.z
But I also want to get the attitude of the hand joint and the Euler Angle, how do I code it?

@KonstantinosAng
Copy link

You can get the quaternions of a joint:

# Find Joint Quaternions of Wrist Right

qx = body.joint_orientations[PyKinectV2. JointType_HandRight].Orientation.x
qy = body.joint_orientations[PyKinectV2. JointType_HandRight].Orientation.y
qz = body.joint_orientations[PyKinectV2. JointType_HandRight].Orientation.z
qw = body.joint_orientations[PyKinectV2. JointType_HandRight].Orientation.w

where body is kinect.get_last_body_frame().bodies[bodyID]

and then you can use the transformations library to get the euler angles:

import transformations

(roll, pitch, yaw) = transformations.euler_from_quaternion([qx, qy, qz, qw])

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

2 participants