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

OpenVR has an error in obtaining data for VR headsets and controllers #1810

Open
Recialhot opened this issue Jan 13, 2024 · 1 comment
Open

Comments

@Recialhot
Copy link

Recialhot commented Jan 13, 2024

when i run this,the z-coordinate of the positioning data is in the second position, and there is clearly an issue. Why is this?

code:

def convert_to_numpy(matrix):
    return np.array([[matrix.m[0][0], matrix.m[0][1], matrix.m[0][2], matrix.m[0][3]],
                     [matrix.m[1][0], matrix.m[1][1], matrix.m[1][2], matrix.m[1][3]],
                     [matrix.m[2][0], matrix.m[2][1], matrix.m[2][2], matrix.m[2][3]],
                     [0.0, 0.0, 0.0, 1.0]])

hmd_pose = get_device_pose(poses, openvr.k_unTrackedDeviceIndex_Hmd)
    if hmd_pose:
       
        hmd_matrix_np = convert_to_numpy(hmd_pose)

        position = hmd_matrix_np[:3, 3]
        rotation = hmd_matrix_np[:3, :3]
        print("Headset Pose:")
        print("Position: ", position)
        print("Rotation: ", rotation)

result:
Position: [-0.1273, 1.5742, 0.4805]

@Rectus
Copy link

Rectus commented Jan 27, 2024

What library are you using? AFAIK OpenVR doesn't come with Python bindings.

Also, what direction are you expecting the Z-axis to be in? OpenVR uses right-handed Y-up.

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