The open source OpenXR runtime
0
fork

Configure Feed

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

d/ns: Use RealSense 6DOF for tracking if available

+30 -2
+1 -1
src/xrt/drivers/meson.build
··· 47 47 'north_star/ns_prober.c', 48 48 ), 49 49 include_directories: xrt_include, 50 - dependencies: [aux], 50 + dependencies: [aux, targets_enabled], 51 51 build_by_default: 'ns' in drivers, 52 52 ) 53 53
+29 -1
src/xrt/drivers/north_star/ns_hmd.c
··· 26 26 #include "util/u_time.h" 27 27 #include "util/u_distortion_mesh.h" 28 28 29 + #include "targets_enabled_drivers.h" 30 + #include "../realsense/rs_interface.h" 31 + 32 + 29 33 /* 30 34 * 31 35 * Structs and defines. ··· 35 39 struct ns_hmd 36 40 { 37 41 struct xrt_device base; 42 + 43 + struct xrt_device *tracker; 38 44 39 45 struct xrt_pose pose; 40 46 ··· 90 96 { 91 97 struct ns_hmd *ns = ns_hmd(xdev); 92 98 99 + if (ns->tracker != NULL) { 100 + ns->tracker->destroy(ns->tracker); 101 + ns->tracker = NULL; 102 + } 103 + 93 104 // Remove the variable tracking. 94 105 u_var_remove_root(ns); 95 106 ··· 99 110 static void 100 111 ns_hmd_update_inputs(struct xrt_device *xdev, struct time_state *timekeeping) 101 112 { 102 - // Empty 113 + struct ns_hmd *ns = ns_hmd(xdev); 114 + 115 + // Also update the tracking module if it is in use. 116 + if (ns->tracker != NULL) { 117 + ns->tracker->update_inputs(ns->tracker, timekeeping); 118 + } 103 119 } 104 120 105 121 static void ··· 110 126 struct xrt_space_relation *out_relation) 111 127 { 112 128 struct ns_hmd *ns = ns_hmd(xdev); 129 + 130 + // If the tracking device is created use it. 131 + if (ns->tracker != NULL) { 132 + ns->tracker->get_tracked_pose(ns->tracker, name, timekeeping, 133 + out_timestamp, out_relation); 134 + return; 135 + } 113 136 114 137 if (name != XRT_INPUT_GENERIC_HEAD_POSE) { 115 138 NS_ERROR(ns, "unknown input name"); ··· 228 251 ns_hmd_destroy(&ns->base); 229 252 return NULL; 230 253 } 254 + 255 + // If built, try to load the realsense tracker. 256 + #ifdef XRT_BUILD_DRIVER_RS 257 + ns->tracker = rs_6dof_create(); 258 + #endif 231 259 232 260 // Setup variable tracker. 233 261 u_var_add_root(ns, "North Star", true);