openvr icon indicating copy to clipboard operation
openvr copied to clipboard

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

Open Recialhot opened this issue 1 year ago • 1 comments

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]

Recialhot avatar Jan 13 '24 04:01 Recialhot

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.

Rectus avatar Jan 27 '24 18:01 Rectus