Monado OpenXR Runtime
qwerty_device.c File Reference

Implementation of qwerty_device related methods. More...

#include "xrt/xrt_device.h"
#include "math/m_api.h"
#include "math/m_space.h"
#include "math/m_mathinclude.h"
#include "util/u_device.h"
#include "util/u_distortion_mesh.h"
#include "util/u_var.h"
#include "util/u_logging.h"
#include "util/u_time.h"
#include "util/u_misc.h"
#include "os/os_time.h"
#include "qwerty_device.h"
#include <stdio.h>
#include <assert.h>
Include dependency graph for qwerty_device.c:

Macros

#define QWERTY_HMD_INITIAL_MOVEMENT_SPEED   0.002f
 
#define QWERTY_HMD_INITIAL_LOOK_SPEED   0.02f
 
#define QWERTY_CONTROLLER_INITIAL_MOVEMENT_SPEED   0.005f
 
#define QWERTY_CONTROLLER_INITIAL_LOOK_SPEED   0.05f
 
#define MOVEMENT_SPEED_STEP   1.25f
 
#define SPRINT_STEPS   5
 
#define QWERTY_HMD_INITIAL_POS   (struct xrt_vec3){0, 1.6f, 0}
 
#define QWERTY_CONTROLLER_INITIAL_POS(is_left)   (struct xrt_vec3){(is_left) ? -0.2f : 0.2f, -0.3f, -0.5f}
 
#define QWERTY_TRIGGER   0
 
#define QWERTY_MENU   1
 
#define QWERTY_SQUEEZE   2
 
#define QWERTY_SYSTEM   3
 
#define QWERTY_THUMBSTICK   4
 
#define QWERTY_THUMBSTICK_CLICK   5
 
#define QWERTY_TRACKPAD   6
 
#define QWERTY_TRACKPAD_TOUCH   7
 
#define QWERTY_TRACKPAD_CLICK   8
 
#define QWERTY_GRIP   9
 
#define QWERTY_AIM   10
 
#define QWERTY_VIBRATION   0
 
#define QWERTY_TRACE(qd, ...)   U_LOG_XDEV_IFL_T(&qd->base, qd->sys->log_level, __VA_ARGS__)
 
#define QWERTY_DEBUG(qd, ...)   U_LOG_XDEV_IFL_D(&qd->base, qd->sys->log_level, __VA_ARGS__)
 
#define QWERTY_INFO(qd, ...)   U_LOG_XDEV_IFL_I(&qd->base, qd->sys->log_level, __VA_ARGS__)
 
#define QWERTY_WARN(qd, ...)   U_LOG_XDEV_IFL_W(&qd->base, qd->sys->log_level, __VA_ARGS__)
 
#define QWERTY_ERROR(qd, ...)   U_LOG_XDEV_IFL_E(&qd->base, qd->sys->log_level, __VA_ARGS__)
 

Functions

static void qwerty_system_remove (struct qwerty_system *qs, struct qwerty_device *qd)
 
static void qwerty_system_destroy (struct qwerty_system *qs)
 
static bool eq (void *a, void *b)
 
struct qwerty_deviceqwerty_device (struct xrt_device *xd)
 
struct qwerty_hmdqwerty_hmd (struct xrt_device *xd)
 
struct qwerty_controllerqwerty_controller (struct xrt_device *xd)
 
static xrt_result_t qwerty_update_inputs (struct xrt_device *xd)
 
static void qwerty_set_output (struct xrt_device *xd, enum xrt_output_name name, const union xrt_output_value *value)
 
static xrt_result_t qwerty_get_tracked_pose (struct xrt_device *xd, enum xrt_input_name name, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
 
static void qwerty_destroy (struct xrt_device *xd)
 
struct qwerty_hmdqwerty_hmd_create (void)
 
struct qwerty_controllerqwerty_controller_create (bool is_left, struct qwerty_hmd *qhmd)
 
static void qwerty_setup_var_tracking (struct qwerty_system *qs)
 
struct qwerty_systemqwerty_system_create (struct qwerty_hmd *qhmd, struct qwerty_controller *qleft, struct qwerty_controller *qright, enum u_logging_level log_level)
 
void qwerty_press_left (struct qwerty_device *qd)
 
void qwerty_release_left (struct qwerty_device *qd)
 
void qwerty_press_right (struct qwerty_device *qd)
 
void qwerty_release_right (struct qwerty_device *qd)
 
void qwerty_press_forward (struct qwerty_device *qd)
 
void qwerty_release_forward (struct qwerty_device *qd)
 
void qwerty_press_backward (struct qwerty_device *qd)
 
void qwerty_release_backward (struct qwerty_device *qd)
 
void qwerty_press_up (struct qwerty_device *qd)
 
void qwerty_release_up (struct qwerty_device *qd)
 
void qwerty_press_down (struct qwerty_device *qd)
 
void qwerty_release_down (struct qwerty_device *qd)
 
void qwerty_press_look_left (struct qwerty_device *qd)
 
void qwerty_release_look_left (struct qwerty_device *qd)
 
void qwerty_press_look_right (struct qwerty_device *qd)
 
void qwerty_release_look_right (struct qwerty_device *qd)
 
void qwerty_press_look_up (struct qwerty_device *qd)
 
void qwerty_release_look_up (struct qwerty_device *qd)
 
void qwerty_press_look_down (struct qwerty_device *qd)
 
void qwerty_release_look_down (struct qwerty_device *qd)
 
void qwerty_press_sprint (struct qwerty_device *qd)
 
void qwerty_release_sprint (struct qwerty_device *qd)
 
void qwerty_add_look_delta (struct qwerty_device *qd, float yaw, float pitch)
 
void qwerty_change_movement_speed (struct qwerty_device *qd, float steps)
 
void qwerty_release_all (struct qwerty_device *qd)
 
void qwerty_press_trigger (struct qwerty_controller *qc)
 
void qwerty_release_trigger (struct qwerty_controller *qc)
 
void qwerty_press_menu (struct qwerty_controller *qc)
 
void qwerty_release_menu (struct qwerty_controller *qc)
 
void qwerty_press_squeeze (struct qwerty_controller *qc)
 
void qwerty_release_squeeze (struct qwerty_controller *qc)
 
void qwerty_press_system (struct qwerty_controller *qc)
 
void qwerty_release_system (struct qwerty_controller *qc)
 
void qwerty_press_thumbstick_left (struct qwerty_controller *qc)
 
void qwerty_release_thumbstick_left (struct qwerty_controller *qc)
 
void qwerty_press_thumbstick_right (struct qwerty_controller *qc)
 
void qwerty_release_thumbstick_right (struct qwerty_controller *qc)
 
void qwerty_press_thumbstick_up (struct qwerty_controller *qc)
 
void qwerty_release_thumbstick_up (struct qwerty_controller *qc)
 
void qwerty_press_thumbstick_down (struct qwerty_controller *qc)
 
void qwerty_release_thumbstick_down (struct qwerty_controller *qc)
 
void qwerty_press_thumbstick_click (struct qwerty_controller *qc)
 
void qwerty_release_thumbstick_click (struct qwerty_controller *qc)
 
void qwerty_press_trackpad_left (struct qwerty_controller *qc)
 
void qwerty_release_trackpad_left (struct qwerty_controller *qc)
 
void qwerty_press_trackpad_right (struct qwerty_controller *qc)
 
void qwerty_release_trackpad_right (struct qwerty_controller *qc)
 
void qwerty_press_trackpad_up (struct qwerty_controller *qc)
 
void qwerty_release_trackpad_up (struct qwerty_controller *qc)
 
void qwerty_press_trackpad_down (struct qwerty_controller *qc)
 
void qwerty_release_trackpad_down (struct qwerty_controller *qc)
 
void qwerty_press_trackpad_click (struct qwerty_controller *qc)
 
void qwerty_release_trackpad_click (struct qwerty_controller *qc)
 
void qwerty_follow_hmd (struct qwerty_controller *qc, bool follow)
 
void qwerty_reset_controller_pose (struct qwerty_controller *qc)
 

Variables

static struct xrt_binding_input_pair simple_inputs [4]
 
static struct xrt_binding_output_pair simple_outputs [1]
 
static struct xrt_binding_profile binding_profiles [1]
 

Detailed Description

Implementation of qwerty_device related methods.

Author
Mateo de Mayo mateo.nosp@m.dema.nosp@m.yo@gm.nosp@m.ail..nosp@m.com

Function Documentation

◆ qwerty_controller_create()

struct qwerty_controller * qwerty_controller_create ( bool  is_left,
struct qwerty_hmd qhmd 
)

<

Todo:
: aim input offset not implemented, equal to grip pose

Variable Documentation

◆ binding_profiles

struct xrt_binding_profile binding_profiles[1]
static
Initial value:
= {
{
.name = XRT_DEVICE_SIMPLE_CONTROLLER,
.inputs = simple_inputs,
.input_count = ARRAY_SIZE(simple_inputs),
.outputs = simple_outputs,
.output_count = ARRAY_SIZE(simple_outputs),
},
}
#define ARRAY_SIZE(a)
Array size helper.
Definition: xrt_compiler.h:30

◆ simple_inputs

struct xrt_binding_input_pair simple_inputs[4]
static
Initial value:
= {
{XRT_INPUT_SIMPLE_SELECT_CLICK, XRT_INPUT_WMR_TRIGGER_VALUE},
{XRT_INPUT_SIMPLE_MENU_CLICK, XRT_INPUT_WMR_MENU_CLICK},
{XRT_INPUT_SIMPLE_GRIP_POSE, XRT_INPUT_WMR_GRIP_POSE},
{XRT_INPUT_SIMPLE_AIM_POSE, XRT_INPUT_WMR_AIM_POSE},
}

◆ simple_outputs

struct xrt_binding_output_pair simple_outputs[1]
static
Initial value:
= {
{XRT_OUTPUT_NAME_SIMPLE_VIBRATION, XRT_OUTPUT_NAME_WMR_HAPTIC},
}