GenericTracker class evaluates position and rotation data of HMD device
Hi, I'm fairly new to openvr, so forgive me for my inexperience.
I'm trying to extract data from my HTC Vive setup consisting of 2 controller, a HMD headset and a additional HTC Vive tracker 3.0. I'm using openvr and c++, I'm using the following example: https://www.codeproject.com/Articles/1171122/How-to-Get-Raw-Positional-Data-from-HTC-Vive
All devices are recognized in steamvr and are (I think) properly connected. I'm using the dongle for the additional tracker. Extracting data from the controllers works fine with the command: GetControllerStateWithPose().
I extinguish each device by looking at the different classes. The classes that are recognized are as follows:
- 1x TrackedDeviceClass_HMD = 1, // Head-Mounted Displays
- 2x TrackedDeviceClass_Controller = 2, // Tracked controllers
- 1x TrackedDeviceClass_GenericTracker = 3, // Generic trackers, similar to controllers
- 2x TrackedDeviceClass_TrackingReference = 4, // Camera and base stations that serve as tracking reference points
So by using the following code I try to extract the data from the tracker: (this runs inside a for loop to detect all devices)
if(trackedDeviceClass==vr::ETrackedDeviceClass::TrackedDeviceClass_GenericTracker ) {
vr_pointer->GetDeviceToAbsoluteTrackingPose(vr::TrackingUniverseStanding, id, &trackedDevicePose,1);
Mat = trackedDevicePose.mDeviceToAbsoluteTracking;
VelT = trackedDevicePose.vVelocity;
VelR = trackedDevicePose.vAngularVelocity;
q_tracktracker = {Mat.m[0][0], Mat.m[0][1], Mat.m[0][2], Mat.m[0][3], // Rxx Rxy Rxz Tx
Mat.m[1][0], Mat.m[1][1], Mat.m[1][2], Mat.m[1][3], // Ryx Ryy Ryz Ty
Mat.m[2][0], Mat.m[2][1], Mat.m[2][2], Mat.m[2][3], // Rzx Rzy Rzz Tz
VelT.v[0],VelT.v[1],VelT.v[2], // Vx Vy Vz
VelR.v[0],VelR.v[1],VelR.v[2], // Vrx Vry Vrz
};
}
However the data I'm getting from this is the position and orientation from the HMD device and not from the Vive tracker 3.0. I've tried to print all data and it recognizes all different classes, but provides the data from the HMD device twice for both different classes.
This seems like an easy fix but I can't get my head around it. So any help would be much appreciated!
Thanks in advance!