Jump to content

The axis of the attitude of the HMD acquired by the OpenVR SDK may change.


Recommended Posts

Hello,


I'm writing a program to work with VIVE pro using the OpenVR SDK.
Currently, there is a problem with the attitude information received from the HMD by GetDeviceToAbsoluteTrackingPose() or WaitGetPoses() of the OpenVR SDK.
Specifically, the axis of posture that can be taken with GetDeviceToAbsoluteTrackingPose() may change.
For example, the pitch angle may be inverted, or the pitch and roll may be swapped.
Even with the same source code, different phenomena occur depending on the execution environment.
Does anyone know the cause of these phenomena?

Development environment
GPU: NVIDIA GeForce GTX 1070 Ti
OS: Ubuntu 18.04.2 LTS
SteamVR: 1.16.10 (currently latest)
OpenVR: 1.14.15

The HMD rotation matrix in the absolute coordinate system is calculated as follows.

    // Get poses of devices
    vr::TrackedDevicePose_t all_poses[vr::k_unMaxTrackedDeviceCount];
    vr_system_->GetDeviceToAbsoluteTrackingPose(vr::ETrackingUniverseOrigin::TrackingUniverseStanding, 0, all_poses, vr::k_unMaxTrackedDeviceCount);
    vr::TrackedDevicePose_t hmd_pose = all_poses[vr::k_unTrackedDeviceIndex_Hmd];
    // Get pose of HMD (DeviceToAbsolute)
    vr::HmdMatrix34_t abs_tracking = hmd_pose.mDeviceToAbsoluteTracking;
    // Get rotation matrix of HMD (DeviceToAbsolute)
    cv::Mat rmat = (cv::Mat_<double>(3,3) << abs_tracking.m[0][0], abs_tracking.m[0][1], abs_tracking.m[0][2],
                                             abs_tracking.m[1][0], abs_tracking.m[1][1], abs_tracking.m[1][2],
                                             abs_tracking.m[2][0], abs_tracking.m[2][1], abs_tracking.m[2][2]);
    // Calculate rotation matrix of HMD (in Absolute coordinate system)
    cv::Mat rmat_inv = rmat.inv();

 

Link to post
Share on other sites

Please sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...