The open source OpenXR runtime
0
fork

Configure Feed

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

d/wmr: Wait until first IMU sample to send frames

In an Odyssey+, it seems that before the first IMU sample the frame timestamps
do not make sense and thus can make the SLAM system crash.

Also, this commit enables SLAM submission from start unless specified.
SLAM for WMR headsets now works "out of the box" :)

+10 -2
+6
src/xrt/drivers/wmr/wmr_hmd.c
··· 68 68 //! Specifies whether the user wants to use the hand tracker. 69 69 DEBUG_GET_ONCE_BOOL_OPTION(wmr_handtracking, "WMR_HANDTRACKING", true) 70 70 71 + //! Whether to submit samples to the SLAM tracker from the start. 72 + DEBUG_GET_ONCE_OPTION(slam_submit_from_start, "SLAM_SUBMIT_FROM_START", NULL) 73 + 71 74 static int 72 75 wmr_hmd_activate_reverb(struct wmr_hmd *wh); 73 76 static void ··· 1385 1388 config.stereo_calib = stereo_calib; // No need to do refcount here 1386 1389 config.imu_calib = imu_calib; 1387 1390 config.extra_calib = extra_calib; 1391 + if (debug_get_option_slam_submit_from_start() == NULL) { 1392 + config.submit_from_start = true; 1393 + } 1388 1394 1389 1395 int create_status = t_slam_create(&wh->tracking.xfctx, &config, &wh->tracking.slam, &sinks); 1390 1396 if (create_status != 0) {
+4 -2
src/xrt/drivers/wmr/wmr_source.c
··· 73 73 struct m_ff_vec3_f32 *accel_ff; //!< Queue of accelerometer data to display in UI 74 74 75 75 bool is_running; //!< Whether the device is streaming 76 + bool first_imu_received; //!< Don't send frames until first IMU sample 76 77 bool average_imus; //!< Average 4 IMU samples before sending them to the sinks 77 78 time_duration_ns hw2mono; //!< Estimated offset from IMU to monotonic clock 78 79 time_duration_ns cam_hw2mono; //!< Cache for hw2mono used in last left frame ··· 124 125 clock_cam_hw2mono(ws, xf, true); 125 126 WMR_TRACE(ws, "left img t=%ld source_t=%ld", xf->timestamp, xf->source_timestamp); 126 127 u_sink_debug_push_frame(&ws->ui_left_sink, xf); 127 - if (ws->out_sinks.left) { 128 + if (ws->out_sinks.left && ws->first_imu_received) { 128 129 xrt_sink_push_frame(ws->out_sinks.left, xf); 129 130 } 130 131 } ··· 136 137 clock_cam_hw2mono(ws, xf, false); 137 138 WMR_TRACE(ws, "right img t=%ld source_t=%ld", xf->timestamp, xf->source_timestamp); 138 139 u_sink_debug_push_frame(&ws->ui_right_sink, xf); 139 - if (ws->out_sinks.right) { 140 + if (ws->out_sinks.right && ws->first_imu_received) { 140 141 xrt_sink_push_frame(ws->out_sinks.right, xf); 141 142 } 142 143 } ··· 160 161 if (ws->out_sinks.imu) { 161 162 xrt_sink_push_imu(ws->out_sinks.imu, s); 162 163 } 164 + ws->first_imu_received = true; 163 165 } 164 166 165 167