The open source OpenXR runtime
0
fork

Configure Feed

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

d/wmr: Correct SLAM-tracked IMU pose to middle of the eyes

+16
+12
src/xrt/drivers/wmr/wmr_hmd.c
··· 1003 1003 #endif 1004 1004 } 1005 1005 1006 + if (wh->tracking.imu2me) { 1007 + math_pose_transform(&wh->pose, &wh->P_imu_me, &wh->pose); 1008 + } 1009 + 1006 1010 out_relation->pose = wh->pose; 1007 1011 out_relation->relation_flags = (enum xrt_space_relation_flags)( 1008 1012 XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | XRT_SPACE_RELATION_POSITION_VALID_BIT | ··· 1463 1467 1464 1468 u_var_add_gui_header(wh, NULL, "SLAM Tracking"); 1465 1469 u_var_add_ro_text(wh, wh->gui.slam_status, "Tracker status"); 1470 + u_var_add_bool(wh, &wh->tracking.imu2me, "Correct IMU pose to middle of eyes"); 1466 1471 1467 1472 u_var_add_gui_header(wh, NULL, "Hand Tracking"); 1468 1473 u_var_add_ro_text(wh, wh->gui.hand_status, "Tracker status"); ··· 1524 1529 1525 1530 wh->tracking.slam_enabled = slam_enabled; 1526 1531 wh->tracking.hand_enabled = hand_enabled; 1532 + wh->tracking.imu2me = true; 1527 1533 1528 1534 wh->slam_over_3dof = slam_enabled; // We prefer SLAM over 3dof tracking if possible 1529 1535 ··· 1632 1638 struct xrt_pose P_me_gyr = {0}; 1633 1639 struct xrt_pose P_ht0_me = {0}; 1634 1640 struct xrt_pose P_acc_me = {0}; 1641 + struct xrt_pose P_oxr_acc_me = {0}; // P_acc_me in OpenXR coordinates 1635 1642 1636 1643 // All of the observed headsets have reported a zero translation for its gyro 1637 1644 assert(m_vec3_equal_exact(P_gyr_ht0.position, (struct xrt_vec3){0, 0, 0})); ··· 1648 1655 math_pose_invert(&P_me_ht0, &P_ht0_me); 1649 1656 math_pose_invert(&P_me_acc, &P_acc_me); 1650 1657 1658 + // Express P_*_me pose in OpenXR coordinates through sandwich products. 1659 + math_pose_transform(&P_acc_me, &P_wmr_oxr, &P_oxr_acc_me); 1660 + math_pose_transform(&P_oxr_wmr, &P_oxr_acc_me, &P_oxr_acc_me); 1661 + 1651 1662 // Save transforms 1652 1663 math_pose_transform(&P_oxr_wmr, &P_me_acc, &wh->P_oxr_acc); 1653 1664 math_pose_transform(&P_oxr_wmr, &P_me_gyr, &wh->P_oxr_gyr); 1665 + wh->P_imu_me = P_oxr_acc_me; // Assume accel pose is IMU pose 1654 1666 } 1655 1667 1656 1668 void
+4
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_imu_me; //!< IMU=accel. IMU-to-ME transform but in OpenXR coordinates 122 123 123 124 struct hololens_sensors_packet packet; 124 125 ··· 157 158 158 159 //! Set at start. Whether the hand tracker was initialized. 159 160 bool hand_enabled; 161 + 162 + //! SLAM systems track the IMU pose, enabling this corrects it to middle of the eyes 163 + bool imu2me; 160 164 } tracking; 161 165 162 166 //! Whether to track the HMD with 6dof SLAM or fallback to the `fusion` 3dof tracker