Monado OpenXR Runtime
depthai_driver.cpp File Reference

DepthAI frameserver implementation. More...

#include "xrt/xrt_tracking.h"
#include "os/os_time.h"
#include "os/os_threading.h"
#include "math/m_api.h"
#include "math/m_vec3.h"
#include "util/u_sink.h"
#include "util/u_var.h"
#include "util/u_misc.h"
#include "util/u_debug.h"
#include "util/u_frame.h"
#include "util/u_format.h"
#include "util/u_logging.h"
#include "util/u_trace_marker.h"
#include "util/u_linux.h"
#include "tracking/t_tracking.h"
#include "depthai_interface.h"
#include "depthai/depthai.hpp"
#include <stdio.h>
#include <assert.h>
#include <unistd.h>
#include <pthread.h>
#include <memory>
#include <sstream>
Include dependency graph for depthai_driver.cpp:

Data Structures

class  DepthAIFrameWrapper
 Manage dai::ImgFrame life-time. More...
 
struct  depthai_fs
 DepthAI frameserver support the Luxonis Oak devices. More...
 

Macros

#define DEPTHAI_TRACE(d, ...)   U_LOG_IFL_T(d->log_level, __VA_ARGS__)
 
#define DEPTHAI_DEBUG(d, ...)   U_LOG_IFL_D(d->log_level, __VA_ARGS__)
 
#define DEPTHAI_INFO(d, ...)   U_LOG_IFL_I(d->log_level, __VA_ARGS__)
 
#define DEPTHAI_WARN(d, ...)   U_LOG_IFL_W(d->log_level, __VA_ARGS__)
 
#define DEPTHAI_ERROR(d, ...)   U_LOG_IFL_E(d->log_level, __VA_ARGS__)
 

Enumerations

enum  depthai_camera_type {
  RGB_IMX_378 , RGB_OV_9782 , GRAY_OV_9282_L , GRAY_OV_9282_R ,
  GRAY_OV_7251_L , GRAY_OV_7251_R
}
 

Functions

void depthai_frame_wrapper_destroy (struct xrt_frame *xf)
 
static bool depthai_get_gray_cameras_calibration (struct depthai_fs *depthai, struct t_stereo_camera_calibration **c_ptr)
 
void depthai_guess_ir_drivers (struct depthai_fs *depthai)
 
static void depthai_guess_camera_type (struct depthai_fs *depthai)
 
static void depthai_print_calib (struct depthai_fs *depthai)
 
static void depthai_do_one_frame (struct depthai_fs *depthai)
 
static void depthai_maybe_send_exposure_command (struct depthai_fs *depthai)
 
static void depthai_maybe_send_floodlight_command (struct depthai_fs *depthai)
 
static void * depthai_mainloop (void *ptr)
 
int64_t dai_ts_to_monado_ts (dai::Timestamp &in)
 
static void depthai_do_one_imu_frame (struct depthai_fs *depthai)
 
static void * depthai_imu_mainloop (void *ptr)
 
static bool depthai_destroy (struct depthai_fs *depthai)
 
static void depthai_setup_monocular_pipeline (struct depthai_fs *depthai, enum depthai_camera_type camera_type)
 
static void depthai_setup_stereo_grayscale_pipeline (struct depthai_fs *depthai)
 
static struct depthai_fsdepthai_fs (struct xrt_fs *xfs)
 Cast to derived type. More...
 
static bool depthai_fs_enumerate_modes (struct xrt_fs *xfs, struct xrt_fs_mode **out_modes, uint32_t *out_count)
 
static bool depthai_fs_configure_capture (struct xrt_fs *xfs, struct xrt_fs_capture_parameters *cp)
 
static bool depthai_fs_stream_start (struct xrt_fs *xfs, struct xrt_frame_sink *xs, enum xrt_fs_capture_type capture_type, uint32_t descriptor_index)
 
static bool depthai_fs_slam_stream_start (struct xrt_fs *xfs, struct xrt_slam_sinks *sinks)
 
static bool depthai_fs_stream_stop (struct xrt_fs *xfs)
 
static bool depthai_fs_is_running (struct xrt_fs *xfs)
 
static void depthai_fs_node_break_apart (struct xrt_frame_node *node)
 
static void depthai_fs_node_destroy (struct xrt_frame_node *node)
 
static struct depthai_fsdepthai_create_and_do_minimal_setup (void)
 
struct xrt_fsdepthai_fs_monocular_rgb (struct xrt_frame_context *xfctx)
 Create a DepthAI frameserver using a single RGB camera. More...
 
struct xrt_fsdepthai_fs_slam (struct xrt_frame_context *xfctx, struct depthai_slam_startup_settings *settings)
 Create a DepthAI frameserver using two gray cameras. More...
 
struct xrt_fsdepthai_fs_stereo_grayscale_and_imu (struct xrt_frame_context *xfctx)
 
struct xrt_fsdepthai_fs_just_imu (struct xrt_frame_context *xfctx)
 
bool depthai_fs_get_stereo_calibration (struct xrt_fs *xfs, struct t_stereo_camera_calibration **c_ptr)
 Get the stereo calibration from a depthAI frameserver. More...
 

Detailed Description

DepthAI frameserver implementation.

Author
Moses Turner moses.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m
Jakob Bornecrantz jakob.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m

Function Documentation

◆ depthai_fs()

static struct depthai_fs * depthai_fs ( struct xrt_fs xfs)
inlinestatic

Cast to derived type.

Referenced by depthai_fs_get_stereo_calibration().

◆ depthai_guess_ir_drivers()

void depthai_guess_ir_drivers ( struct depthai_fs depthai)
Todo:
this function will look slightly different for an OAK-D Pro with dot projectors - mine only has floodlights

◆ depthai_setup_stereo_grayscale_pipeline()

static void depthai_setup_stereo_grayscale_pipeline ( struct depthai_fs depthai)
static
Todo:
This code will turn the exposure time down, but you may not want it. Or we may want to rework Monado's AEG code to control the IR floodlight brightness in concert with the exposure time. For now, disable.