RealSense helper driver for in-device SLAM 6DOF tracking.
More...
#include "xrt/xrt_defines.h"
#include "xrt/xrt_device.h"
#include "math/m_api.h"
#include "math/m_space.h"
#include "math/m_predict.h"
#include "math/m_relation_history.h"
#include "os/os_time.h"
#include "os/os_threading.h"
#include "util/u_time.h"
#include "util/u_device.h"
#include "util/u_logging.h"
#include "util/u_json.h"
#include "util/u_config_json.h"
#include "rs_driver.h"
#include <librealsense2/rs.h>
#include <librealsense2/h/rs_pipeline.h>
#include <librealsense2/h/rs_option.h>
#include <librealsense2/h/rs_frame.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
|
struct | rs_ddev |
| Device-SLAM tracked RealSense device (T26X series). More...
|
|
|
static struct rs_ddev * | rs_ddev (struct xrt_device *xdev) |
| Helper to convert a xdev to a rs_ddev. More...
|
|
static int | check_error (struct rs_ddev *rs, rs2_error *e) |
| Simple helper to check and print error messages. More...
|
|
static void | close_ddev (struct rs_ddev *rs) |
| Frees all RealSense resources. More...
|
|
static int | create_ddev (struct rs_ddev *rs, int device_idx) |
| Create all RealSense resources needed for 6DOF tracking. More...
|
|
static void | process_frame (struct rs_ddev *rs, rs2_frame *frame) |
| Process a frame as 6DOF data, does not assume ownership of the frame. More...
|
|
static int | update (struct rs_ddev *rs) |
|
static void * | rs_run_thread (void *ptr) |
|
static bool | load_config (struct rs_ddev *rs) |
|
static xrt_result_t | rs_ddev_get_tracked_pose (struct xrt_device *xdev, enum xrt_input_name name, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation) |
|
static void | rs_ddev_get_view_poses (struct xrt_device *xdev, const struct xrt_vec3 *default_eye_relation, int64_t at_timestamp_ns, uint32_t view_count, struct xrt_space_relation *out_head_relation, struct xrt_fov *out_fovs, struct xrt_pose *out_poses) |
|
static void | rs_ddev_destroy (struct xrt_device *xdev) |
|
struct xrt_device * | rs_ddev_create (int device_idx) |
| Create a RealSense device tracked with device-SLAM (T26x). More...
|
|
◆ CHECK_RS2
Value: do { \
close_ddev(rs); \
return 1; \
} \
} while (0)
static int check_error(struct rs_ddev *rs, rs2_error *e)
Simple helper to check and print error messages.
Definition: rs_ddev.c:85
◆ print_pose
#define print_pose |
( |
|
msg, |
|
|
|
pose |
|
) |
| |
Value: U_LOG_E(msg
" %f %f %f %f %f %f %f", pose.position.x, pose.position.y, pose.position.z, pose.orientation.x, \
pose.orientation.y, pose.orientation.z, pose.orientation.w)
#define U_LOG_E(...)
Log a message at U_LOGGING_ERROR level, conditional on the global log level.
Definition: u_logging.h:304
Convenience macro to print out a pose, only used for debugging.
◆ check_error()
static int check_error |
( |
struct rs_ddev * |
rs, |
|
|
rs2_error * |
e |
|
) |
| |
|
static |
◆ close_ddev()
static void close_ddev |
( |
struct rs_ddev * |
rs | ) |
|
|
static |
◆ create_ddev()
static int create_ddev |
( |
struct rs_ddev * |
rs, |
|
|
int |
device_idx |
|
) |
| |
|
static |
Create all RealSense resources needed for 6DOF tracking.
- Todo:
- 0 index hardcoded, check device with RS2_EXTENSION_POSE_SENSOR or similar instead
References rs_container::context, and rs_ddev::rsc.
◆ process_frame()
static void process_frame |
( |
struct rs_ddev * |
rs, |
|
|
rs2_frame * |
frame |
|
) |
| |
|
static |
◆ rs_ddev()
Helper to convert a xdev to a rs_ddev.