d/rs: Allow Realsense device to be created outside of normal target list

This commit is contained in:
Moses Turner 2022-09-11 23:00:08 -05:00 committed by Jakob Bornecrantz
parent 17acb376f9
commit cc62600972
2 changed files with 35 additions and 0 deletions

View file

@ -47,6 +47,14 @@ rs_create_auto_prober(void);
struct xrt_fs *
rs_source_create(struct xrt_frame_context *xfctx, int device_idx);
/*!
* Creates an xrt_device that exposes the onboard tracking of a Realsense device
* (ie. probably a T265)
* @return An xrt_device that you can call get_tracked_pose on with XRT_INPUT_GENERIC_TRACKER_POSE
*/
struct xrt_device *
rs_create_tracked_device_internal_slam();
/*!
* @dir drivers/realsense
*

View file

@ -223,6 +223,33 @@ create_tracked_rs_device(struct xrt_prober *xp)
return dev;
}
//! Basically just for T265
struct xrt_device *
rs_create_tracked_device_internal_slam()
{
rs2_error *e = NULL;
struct rs_container rsc = {0};
rsc.context = DO(rs2_create_context, RS2_API_VERSION);
rsc.device_list = DO(rs2_query_devices, rsc.context);
rsc.device_count = DO(rs2_get_device_count, rsc.device_list);
int ddev_idx = find_capable_device(RS_TRACKING_DEVICE_SLAM, rsc.device_list);
rs_container_cleanup(&rsc); // We got ddev_idx and hdev_idx, release realsense resources
struct xrt_device *dev = NULL;
dev = rs_ddev_create(ddev_idx);
return dev;
}
//! @public @memberof rs_prober
static int
rs_prober_autoprobe(struct xrt_auto_prober *xap,