The open source OpenXR runtime
0
fork

Configure Feed

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

d/wmr: Make WMR to OpenXR coordinate transform explicit

Instead of negating Y and Z readings from the IMU when
parsing, parse the native values, then apply the rotation
using the centerline transform before fusion.

+14 -5
+10 -1
src/xrt/drivers/wmr/wmr_hmd.c
··· 984 984 u_var_add_gui_header(wh, &wh->gui.misc, "Misc"); 985 985 u_var_add_log_level(wh, &wh->log_level, "log_level"); 986 986 987 - // Compute centerline in the HMD's calibration coordinate space as the average of the two display poses 987 + // Compute centerline in the HMD's calibration coordinate space as the average of the two display poses, 988 + // then rotate around the X axis to convert coordinate system from WMR (X right, Y down, Z away) 989 + // to OpenXR (X right, Y up, Z towards) 988 990 math_quat_slerp(&wh->config.eye_params[0].pose.orientation, &wh->config.eye_params[1].pose.orientation, 0.5f, 989 991 &wh->centerline.orientation); 990 992 wh->centerline.position.x = ··· 993 995 (wh->config.eye_params[0].pose.position.y + wh->config.eye_params[1].pose.position.y) * 0.5f; 994 996 wh->centerline.position.z = 995 997 (wh->config.eye_params[0].pose.position.z + wh->config.eye_params[1].pose.position.z) * 0.5f; 998 + 999 + struct xrt_pose wmr_to_openxr_xform = { 1000 + .position = {0.0, 0.0, 0.0}, 1001 + .orientation = {.x = 1.0, .y = 0.0, .z = 0.0, .w = 0.0}, 1002 + }; 1003 + 1004 + math_pose_transform(&wmr_to_openxr_xform, &wh->centerline, &wh->centerline); 996 1005 997 1006 // Compute display and sensor offsets relative to the centerline 998 1007 for (int dIdx = 0; dIdx < 2; ++dIdx) {
+4 -4
src/xrt/drivers/wmr/wmr_protocol.c
··· 23 23 vec3_from_hololens_accel(int32_t sample[3][4], int i, struct xrt_vec3 *out_vec) 24 24 { 25 25 out_vec->x = (float)sample[0][i] * 0.001f * 1.0f; 26 - out_vec->y = (float)sample[1][i] * 0.001f * -1.0f; 27 - out_vec->z = (float)sample[2][i] * 0.001f * -1.0f; 26 + out_vec->y = (float)sample[1][i] * 0.001f * 1.0f; 27 + out_vec->z = (float)sample[2][i] * 0.001f * 1.0f; 28 28 } 29 29 30 30 void ··· 47 47 sample[1][8 * i + 5] + // 48 48 sample[1][8 * i + 6] + // 49 49 sample[1][8 * i + 7]) * 50 - 0.001f * -0.125f; 50 + 0.001f * 0.125f; 51 51 out_vec->z = (float)(sample[2][8 * i + 0] + // 52 52 sample[2][8 * i + 1] + // 53 53 sample[2][8 * i + 2] + // ··· 56 56 sample[2][8 * i + 5] + // 57 57 sample[2][8 * i + 6] + // 58 58 sample[2][8 * i + 7]) * 59 - 0.001f * -0.125f; 59 + 0.001f * 0.125f; 60 60 }