The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/wmr: Correct hand tracking pose

Now the tracked hand appears roughly in the same spot as your real hand and
the tracking works a bit better.

+15 -9
+13 -5
src/xrt/drivers/wmr/wmr_hmd.c
··· 53 53 #endif 54 54 55 55 #ifdef XRT_BUILD_DRIVER_HANDTRACKING 56 + #include "../multi_wrapper/multi.h" 56 57 #include "../drivers/ht/ht_interface.h" 57 58 #endif 58 59 ··· 1429 1430 1430 1431 #ifdef XRT_BUILD_DRIVER_HANDTRACKING 1431 1432 1432 - int create_status = ht_device_create(&wh->tracking.xfctx, // 1433 - stereo_calib, // 1434 - HT_OUTPUT_SPACE_CENTER_OF_STEREO_CAMERA, // 1435 - HT_ALGORITHM_MERCURY, // 1436 - &sinks, // 1433 + int create_status = ht_device_create(&wh->tracking.xfctx, // 1434 + stereo_calib, // 1435 + HT_OUTPUT_SPACE_LEFT_CAMERA, // 1436 + HT_ALGORITHM_MERCURY, // 1437 + &sinks, // 1437 1438 &device); 1438 1439 if (create_status != 0) { 1439 1440 return create_status; 1440 1441 } 1442 + 1443 + device = multi_create_tracking_override(XRT_TRACKING_OVERRIDE_ATTACHED, device, &wh->base, 1444 + XRT_INPUT_GENERIC_HEAD_POSE, &wh->P_ht0_me); 1441 1445 1442 1446 WMR_DEBUG(wh, "WMR HMD hand tracker successfully created"); 1443 1447 #endif ··· 1638 1642 struct xrt_pose P_me_gyr = {0}; 1639 1643 struct xrt_pose P_ht0_me = {0}; 1640 1644 struct xrt_pose P_acc_me = {0}; 1645 + struct xrt_pose P_oxr_ht0_me = {0}; // P_ht0_me in OpenXR coordinates 1641 1646 struct xrt_pose P_oxr_acc_me = {0}; // P_acc_me in OpenXR coordinates 1642 1647 1643 1648 // All of the observed headsets have reported a zero translation for its gyro ··· 1658 1663 // Express P_*_me pose in OpenXR coordinates through sandwich products. 1659 1664 math_pose_transform(&P_acc_me, &P_wmr_oxr, &P_oxr_acc_me); 1660 1665 math_pose_transform(&P_oxr_wmr, &P_oxr_acc_me, &P_oxr_acc_me); 1666 + math_pose_transform(&P_ht0_me, &P_wmr_oxr, &P_oxr_ht0_me); 1667 + math_pose_transform(&P_oxr_wmr, &P_oxr_ht0_me, &P_oxr_ht0_me); 1661 1668 1662 1669 // Save transforms 1663 1670 math_pose_transform(&P_oxr_wmr, &P_me_acc, &wh->P_oxr_acc); 1664 1671 math_pose_transform(&P_oxr_wmr, &P_me_gyr, &wh->P_oxr_gyr); 1672 + wh->P_ht0_me = P_oxr_ht0_me; 1665 1673 wh->P_imu_me = P_oxr_acc_me; // Assume accel pose is IMU pose 1666 1674 } 1667 1675
+1
src/xrt/drivers/wmr/wmr_hmd.h
··· 119 119 //! Precomputed transforms, @see precompute_sensor_transforms. 120 120 struct xrt_pose P_oxr_acc; //!< Converts accel samples into OpenXR coordinates 121 121 struct xrt_pose P_oxr_gyr; //!< Converts gyro samples into OpenXR coordinates 122 + struct xrt_pose P_ht0_me; //!< ME="middle of the eyes". HT0-to-ME transform but in OpenXR coordinates 122 123 struct xrt_pose P_imu_me; //!< IMU=accel. IMU-to-ME transform but in OpenXR coordinates 123 124 124 125 struct hololens_sensors_packet packet;
+1 -4
src/xrt/drivers/wmr/wmr_prober.c
··· 216 216 217 217 #ifdef XRT_BUILD_DRIVER_HANDTRACKING 218 218 if (ht != NULL) { // Create hand-tracked controllers 219 - struct xrt_pose pose = XRT_POSE_IDENTITY; 220 - struct xrt_device *wrap = multi_create_tracking_override(XRT_TRACKING_OVERRIDE_ATTACHED, ht, hmd, 221 - XRT_INPUT_GENERIC_HEAD_POSE, &pose); 222 219 struct xrt_device *two_hands[2]; 223 - cemu_devices_create(hmd, wrap, two_hands); 220 + cemu_devices_create(hmd, ht, two_hands); 224 221 225 222 out_xdev[out_idx++] = two_hands[0]; 226 223 out_xdev[out_idx++] = two_hands[1];