Monado OpenXR Runtime
rs_prober.c File Reference

Realsense prober code. More...

#include <stdio.h>
#include <stdlib.h>
#include "xrt/xrt_config_build.h"
#include "xrt/xrt_config_have.h"
#include "xrt/xrt_prober.h"
#include "util/u_misc.h"
#include "util/u_debug.h"
#include "rs_driver.h"
#include <librealsense2/rs.h>
Include dependency graph for rs_prober.c:

Data Structures

struct  rs_prober
 

Macros

#define INFO(...)   U_LOG(U_LOGGING_INFO, __VA_ARGS__);
 
#define WARN(...)   U_LOG(U_LOGGING_WARN, __VA_ARGS__);
 
#define ERROR(...)   U_LOG(U_LOGGING_ERROR, __VA_ARGS__);
 
#define DO(call, ...)
 Utility for realsense API calls that can produce errors. More...
 

Functions

static bool check_error (rs2_error *e, const char *file, int line)
 Specifies which realsense tracking to use -1 for DISABLED, will not create any RealSense device 0 for UNSPECIFIED, will decide based on what's available 1 for DEVICE_SLAM, will only try to use in-device SLAM tracking 2 for HOST_SLAM, will only try to use external SLAM tracking. More...
 
static void check_slam_capabilities (rs2_device_list *device_list, int dev_idx, bool *out_hslam, bool *out_dslam)
 Explores a realsense device to see what SLAM capabilities it supports. More...
 
static bool supports_host_slam (rs2_device_list *device_list, int index)
 
static bool supports_device_slam (rs2_device_list *device_list, int index)
 
static int find_capable_device (int capability, rs2_device_list *device_list)
 
static struct xrt_devicecreate_tracked_rs_device (struct xrt_prober *xp)
 Implements the conditional flow to decide on how to pick which tracking to use. More...
 
struct xrt_devicers_create_tracked_device_internal_slam (void)
 Basically just for T265. More...
 
struct xrt_auto_proberrs_create_auto_prober (void)
 Create a auto prober for rs devices. More...
 

Detailed Description

Macro Definition Documentation

◆ DO

#define DO (   call,
  ... 
)
Value:
call(__VA_ARGS__, &e); \
check_error(e, __FILE__, __LINE__);

Utility for realsense API calls that can produce errors.

Function Documentation

◆ check_error()

static bool check_error ( rs2_error *  e,
const char *  file,
int  line 
)
static

Specifies which realsense tracking to use -1 for DISABLED, will not create any RealSense device 0 for UNSPECIFIED, will decide based on what's available 1 for DEVICE_SLAM, will only try to use in-device SLAM tracking 2 for HOST_SLAM, will only try to use external SLAM tracking.

◆ check_slam_capabilities()

static void check_slam_capabilities ( rs2_device_list *  device_list,
int  dev_idx,
bool *  out_hslam,
bool *  out_dslam 
)
static

Explores a realsense device to see what SLAM capabilities it supports.

Parameters
device_listList in which the device resides.
dev_idxIndex of the device in device_list.
[out]out_hslamWhether it supports host-SLAM tracking (Has camera-imu streams)
[out]out_dslamWhether it supports device-SLAM tracking (T26x)
Todo:
Consider adding the sensors list to the rs_container

References DO.

◆ create_tracked_rs_device()

static struct xrt_device* create_tracked_rs_device ( struct xrt_prober xp)
static

Implements the conditional flow to decide on how to pick which tracking to use.

References rs_container::context, rs_container::device_count, rs_container::device_list, and DO.

◆ find_capable_device()

static int find_capable_device ( int  capability,
rs2_device_list *  device_list 
)
static
Returns
index of the first device in device_list that has the requested capability or -1 if none.

References DO.

Referenced by rs_create_tracked_device_internal_slam().

◆ rs_create_tracked_device_internal_slam()

struct xrt_device* rs_create_tracked_device_internal_slam ( void  )

Basically just for T265.

Creates an xrt_device that exposes the onboard tracking of a Realsense device (ie.

References rs_container::context, rs_container::device_count, rs_container::device_list, DO, and find_capable_device().