The open source OpenXR runtime
0
fork

Configure Feed

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

st/prober: Hook the realsense SLAM source into the prober

authored by

Mateo de Mayo and committed by
Jakob Bornecrantz
f4075362 f84629cc

+51
+16
src/xrt/state_trackers/prober/p_prober.c
··· 31 31 #include "euroc/euroc_interface.h" 32 32 #endif 33 33 34 + #ifdef XRT_BUILD_DRIVER_RS 35 + #include "realsense/rs_interface.h" 36 + #endif 37 + 34 38 #ifdef XRT_BUILD_DRIVER_REMOTE 35 39 #include "remote/r_interface.h" 36 40 #endif ··· 53 57 DEBUG_GET_ONCE_BOOL_OPTION(qwerty_combine, "QWERTY_COMBINE", false) 54 58 DEBUG_GET_ONCE_OPTION(vf_path, "VF_PATH", NULL) 55 59 DEBUG_GET_ONCE_OPTION(euroc_path, "EUROC_PATH", NULL) 60 + DEBUG_GET_ONCE_NUM_OPTION(rs_source_index, "RS_SOURCE_INDEX", -1) 56 61 57 62 58 63 /* ··· 996 1001 } 997 1002 #endif 998 1003 1004 + #if defined(XRT_BUILD_DRIVER_RS) 1005 + int rs_source_index = debug_get_num_option_rs_source_index(); 1006 + if (rs_source_index != -1) { 1007 + *out_xfs = rs_source_create(xfctx, rs_source_index); 1008 + return 0; 1009 + } 1010 + #endif 1011 + 999 1012 #if defined(XRT_HAVE_V4L2) 1000 1013 if (pdev->num_v4ls == 0) { 1001 1014 return -1; ··· 1022 1035 // Video sources from drivers (at most one will be listed) 1023 1036 const char *vf_path = debug_get_option_vf_path(); 1024 1037 const char *euroc_path = debug_get_option_euroc_path(); 1038 + int rs_source_index = debug_get_num_option_rs_source_index(); 1025 1039 1026 1040 if (vf_path != NULL) { 1027 1041 cb(xp, NULL, "Video File", "Collabora", vf_path, ptr); 1028 1042 } else if (euroc_path != NULL) { 1029 1043 cb(xp, NULL, "Euroc Dataset", "Collabora", euroc_path, ptr); 1044 + } else if (rs_source_index != -1) { 1045 + cb(xp, NULL, "RealSense Source", "Collabora", "", ptr); 1030 1046 } 1031 1047 1032 1048 // Video sources from video devices
+35
src/xrt/state_trackers/prober/p_tracking.c
··· 31 31 DEBUG_GET_ONCE_OPTION(euroc_path, "EUROC_PATH", NULL) 32 32 #endif 33 33 34 + #ifdef XRT_BUILD_DRIVER_RS 35 + #include "util/u_debug.h" 36 + DEBUG_GET_ONCE_NUM_OPTION(rs_source_index, "RS_SOURCE_INDEX", -1) 37 + #endif 38 + 34 39 /* 35 40 * 36 41 * Structs and defines. ··· 241 246 static bool 242 247 p_factory_ensure_slam_frameserver(struct p_factory *fact) 243 248 { 249 + //! @todo The check for (XRT_HAVE_SLAM && XRT_BUILD_DRIVER_* && 250 + //! debug_flag_is_correct) is getting duplicated in: p_open_video_device, 251 + //! p_list_video_devices, and p_factory_ensure_slam_frameserver (here) with 252 + //! small differences. Incorrectly modifying one will mess the others. 253 + 244 254 // Factory frameserver is already in use 245 255 if (fact->xfs != NULL) { 246 256 return false; ··· 263 273 } 264 274 #else 265 275 U_LOG_W("SLAM tracking support is disabled, the Euroc driver will not be tracked"); 276 + #endif 277 + 278 + xrt_fs_slam_stream_start(fact->xfs, sinks); 279 + 280 + return true; 281 + } 282 + #endif 283 + 284 + // SLAM tracker with RealSense frameserver 285 + 286 + #ifdef XRT_BUILD_DRIVER_RS 287 + if (debug_get_num_option_rs_source_index() != -1) { 288 + struct xrt_slam_sinks empty_sinks = {0}; 289 + struct xrt_slam_sinks *sinks = &empty_sinks; 290 + 291 + xrt_prober_open_video_device(&fact->p->base, NULL, &fact->xfctx, &fact->xfs); 292 + assert(fact->xfs->source_id == 0x2EA15E115E && "xfs is not RealSense, unsynced open_video_device?"); 293 + 294 + #ifdef XRT_HAVE_SLAM 295 + int ret = t_slam_create(&fact->xfctx, &fact->xts, &sinks); 296 + if (ret != 0) { 297 + U_LOG_W("Unable to initialize SLAM tracking, the RealSense driver will not be tracked"); 298 + } 299 + #else 300 + U_LOG_W("SLAM tracking support is disabled, the RealSense driver will not be tracked by host SLAM"); 266 301 #endif 267 302 268 303 xrt_fs_slam_stream_start(fact->xfs, sinks);