Monado OpenXR Runtime
wmr_config.c File Reference

Driver code to read WMR config blocks. More...

#include "math/m_api.h"
#include "util/u_debug.h"
#include "util/u_misc.h"
#include "util/u_json.h"
#include "wmr_config.h"
#include <assert.h>
#include <string.h>
Include dependency graph for wmr_config.c:

Macros

#define WMR_TRACE(log_level, ...)   U_LOG_IFL_T(log_level, __VA_ARGS__)
 
#define WMR_DEBUG(log_level, ...)   U_LOG_IFL_D(log_level, __VA_ARGS__)
 
#define WMR_INFO(log_level, ...)   U_LOG_IFL_I(log_level, __VA_ARGS__)
 
#define WMR_WARN(log_level, ...)   U_LOG_IFL_W(log_level, __VA_ARGS__)
 
#define WMR_ERROR(log_level, ...)   U_LOG_IFL_E(log_level, __VA_ARGS__)
 
#define JSON_INT(a, b, c)   u_json_get_int(u_json_get(a, b), c)
 
#define JSON_FLOAT(a, b, c)   u_json_get_float(u_json_get(a, b), c)
 
#define JSON_DOUBLE(a, b, c)   u_json_get_double(u_json_get(a, b), c)
 
#define JSON_VEC3(a, b, c)   u_json_get_vec3_array(u_json_get(a, b), c)
 
#define JSON_MATRIX_3X3(a, b, c)   u_json_get_matrix_3x3(u_json_get(a, b), c)
 
#define JSON_STRING(a, b, c)   u_json_get_string_into_array(u_json_get(a, b), c, sizeof(c))
 

Functions

static void wmr_hmd_config_init_defaults (struct wmr_hmd_config *c)
 Specifies the maximum number of cameras to use for SLAM tracking. More...
 
static struct xrt_pose pose_from_rt (const struct xrt_matrix_3x3 rotation_rm, const struct xrt_vec3 translation)
 
static bool wmr_config_parse_display (struct wmr_hmd_config *c, cJSON *display, enum u_logging_level log_level)
 
static bool wmr_inertial_sensor_config_parse (struct wmr_inertial_sensor_config *c, cJSON *sensor, enum u_logging_level log_level)
 
static bool wmr_inertial_sensors_config_parse (struct wmr_inertial_sensors_config *c, cJSON *sensor, enum u_logging_level log_level)
 
static bool wmr_config_parse_camera_config (struct wmr_hmd_config *c, cJSON *camera, enum u_logging_level log_level)
 
static bool wmr_config_parse_calibration (struct wmr_hmd_config *c, cJSON *calib_info, enum u_logging_level log_level)
 
static bool wmr_controller_led_config_parse (struct wmr_led_config *l, int index, const cJSON *led_json, enum u_logging_level log_level)
 
bool wmr_hmd_config_parse (struct wmr_hmd_config *c, char *json_string, enum u_logging_level log_level)
 
static void wmr_controller_config_init_defaults (struct wmr_controller_config *c)
 
bool wmr_controller_config_parse (struct wmr_controller_config *c, char *json_string, enum u_logging_level log_level)
 
void wmr_config_precompute_transforms (struct wmr_inertial_sensors_config *sensors, struct wmr_distortion_eye_config *eye_params)
 Precompute transforms to convert between OpenXR and WMR coordinate systems. More...
 

Detailed Description

Driver code to read WMR config blocks.

Author
Jan Schmidt jan@c.nosp@m.entr.nosp@m.icula.nosp@m.r.co.nosp@m.m

Function Documentation

◆ wmr_config_precompute_transforms()

void wmr_config_precompute_transforms ( struct wmr_inertial_sensors_config sensors,
struct wmr_distortion_eye_config eye_params 
)

Precompute transforms to convert between OpenXR and WMR coordinate systems.

OpenXR: X: Right, Y: Up, Z: Backward WMR: X: Right, Y: Down, Z: Forward ┌────────────────────┐ │ OXR WMR │ │ │ │ ▲ y │ │ │ ▲ z │ │ │ x │ x │ │ ├──────► ├──────► │ │ │ │ │ │ ▼ z │ │ │ ▼ y │ └────────────────────┘

References wmr_inertial_sensor_config::pose, and xrt_vec3::XRT_VEC3_ZERO.

◆ wmr_hmd_config_init_defaults()

static void wmr_hmd_config_init_defaults ( struct wmr_hmd_config c)
static

Specifies the maximum number of cameras to use for SLAM tracking.

References math_matrix_3x3_identity(), xrt_pose::math_pose_identity(), wmr_distortion_eye_config::pose, and wmr_inertial_sensor_config::pose.