Monado OpenXR Runtime
|
PlayStation Move motion controller prober and driver code. More...
#include "xrt/xrt_prober.h"
#include "xrt/xrt_tracking.h"
#include "os/os_threading.h"
#include "os/os_hid.h"
#include "os/os_time.h"
#include "math/m_api.h"
#include "math/m_imu_pre.h"
#include "math/m_space.h"
#include "tracking/t_imu.h"
#include "util/u_var.h"
#include "util/u_time.h"
#include "util/u_misc.h"
#include "util/u_debug.h"
#include "util/u_device.h"
#include "util/u_logging.h"
#include "util/u_trace_marker.h"
#include "psmv_interface.h"
#include "math/m_mathinclude.h"
#include <stdio.h>
#include <assert.h>
Data Structures | |
struct | psmv_set_led |
Led setting packet. More... | |
struct | psmv_f32_wire |
Wire encoding of a single 32 bit float, "little" endian. More... | |
struct | psmv_vec3_f32_wire |
Wire encoding of three 32 bit float, "little" endian. More... | |
struct | psmv_u16_wire |
Wire encoding of a single 16 bit integer, little endian. More... | |
struct | psmv_vec3_u16_wire |
Wire encoding of three 16 bit integers, little endian. More... | |
struct | psmv_i16_wire |
Wire encoding of a single 16 bit integer, little endian. More... | |
struct | psmv_vec3_i16_wire |
Wire encoding of three 16 bit integers, little endian. More... | |
struct | psmv_calibration_part |
Part of a calibration data, multiple packets make up a single data packet. More... | |
struct | psmv_calibration_zcm1 |
Calibration data, multiple packets goes into this. More... | |
struct | psmv_parsed_calibration_zcm1 |
Parsed calibration data from a ZCM1 device. More... | |
struct | psmv_calibration_zcm2 |
Calibration data, multiple packets goes into this. More... | |
struct | psmv_parsed_calibration_zcm2 |
Parsed calibration data from a ZCM2 device. More... | |
struct | psmv_input_zcm1 |
Input package for ZCM1. More... | |
struct | psmv_input_zcm2 |
Input package for ZCM2. More... | |
struct | psmv_parsed_sample |
A parsed sample of accel and gyro. More... | |
struct | psmv_parsed_input |
A parsed input packet. More... | |
struct | psmv_device |
A single PlayStation Move Controller. More... | |
Macros | |
#define | PSMV_BALL_DIAMETER_M 0.045 |
#define | PSMV_BALL_FROM_IMU_Y_M 0.09 |
#define | PSMV_TRACE(p, ...) U_LOG_XDEV_IFL_T(&p->base, p->log_level, __VA_ARGS__) |
#define | PSMV_DEBUG(p, ...) U_LOG_XDEV_IFL_D(&p->base, p->log_level, __VA_ARGS__) |
#define | PSMV_ERROR(p, ...) U_LOG_XDEV_IFL_E(&p->base, p->log_level, __VA_ARGS__) |
#define | SET_INPUT(NAME) (psmv->base.inputs[PSMV_INDEX_##NAME].name = XRT_INPUT_PSMV_##NAME) |
Enumerations | |
enum | psmv_input_index { PSMV_INDEX_PS_CLICK , PSMV_INDEX_MOVE_CLICK , PSMV_INDEX_START_CLICK , PSMV_INDEX_SELECT_CLICK , PSMV_INDEX_SQUARE_CLICK , PSMV_INDEX_CROSS_CLICK , PSMV_INDEX_CIRCLE_CLICK , PSMV_INDEX_TRIANGLE_CLICK , PSMV_INDEX_TRIGGER_VALUE , PSMV_INDEX_GRIP_POSE , PSMV_INDEX_AIM_POSE , PSMV_INDEX_BODY_CENTER_POSE , PSMV_INDEX_BALL_CENTER_POSE } |
Indices where each input is in the input list. More... | |
enum | psmv_button_bit { PSMV_BUTTON_BIT_MOVE_F2 = (1 << 6) , PSMV_BUTTON_BIT_TRIGGER_F2 = (1 << 7) , PSMV_BUTTON_BIT_PS = (1 << 8) , PSMV_BUTTON_BIT_MOVE_F1 = (1 << 11) , PSMV_BUTTON_BIT_TRIGGER_F1 = (1 << 12) , PSMV_BUTTON_BIT_TRIANGLE = (1 << 20) , PSMV_BUTTON_BIT_CIRCLE = (1 << 21) , PSMV_BUTTON_BIT_CROSS = (1 << 22) , PSMV_BUTTON_BIT_SQUARE = (1 << 23) , PSMV_BUTTON_BIT_START = (1 << 27) , PSMV_BUTTON_BIT_SELECT = (1 << 24) , PSMV_BUTTON_BIT_MOVE_ANY , PSMV_BUTTON_BIT_TRIGGER_ANY } |
Mask for the button in the button uint32_t. More... | |
Functions | |
static int | psmv_get_calibration (struct psmv_device *psmv) |
static int | psmv_parse_input (struct psmv_device *psmv, void *data, struct psmv_parsed_input *input) |
static struct psmv_device * | psmv_device (struct xrt_device *xdev) |
static uint32_t | psmv_calc_delta_and_handle_rollover (uint32_t next, uint32_t last) |
static uint8_t | psmv_clamp_zero_to_one_float_to_u8 (float v) |
static void | psmv_update_input_click (struct psmv_device *psmv, int index, int64_t when_ns, uint32_t bit) |
static void | psmv_update_trigger_value (struct psmv_device *psmv, int index, int64_t when_ns) |
static int | psmv_send_led_control_locked (volatile struct psmv_device *psmv, uint8_t red, uint8_t green, uint8_t blue, uint8_t rumble) |
Does the actual sending of the led control package to the device. More... | |
static void | psmv_led_and_trigger_update_locked (volatile struct psmv_device *psmv, int64_t time) |
static void | psmv_led_and_trigger_update (struct psmv_device *psmv, int64_t time) |
static void | update_fusion (struct psmv_device *psmv, struct psmv_parsed_sample *sample, timepoint_ns timestamp_ns, time_duration_ns delta_ns) |
static bool | psmv_read_one_packet (struct psmv_device *psmv, uint8_t *buffer, size_t size) |
Reads one packet from the device, handles time out, locking and checking if the thread has been told to shut down. More... | |
static void * | psmv_run_thread (void *ptr) |
static void | psmv_get_fusion_pose (struct psmv_device *psmv, enum xrt_input_name name, timepoint_ns when, struct xrt_space_relation *out_relation) |
static void | psmv_device_destroy (struct xrt_device *xdev) |
static xrt_result_t | psmv_device_update_inputs (struct xrt_device *xdev) |
static xrt_result_t | psmv_device_get_tracked_pose (struct xrt_device *xdev, enum xrt_input_name name, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation) |
static float | amp_scale (struct psmv_device *psmv, float amp) |
static void | psmv_device_set_output (struct xrt_device *xdev, enum xrt_output_name name, const union xrt_output_value *value) |
int | psmv_found (struct xrt_prober *xp, struct xrt_prober_device **devices, size_t device_count, size_t index, cJSON *attached_data, struct xrt_device **out_xdevs) |
Probing function for the PS Move devices. More... | |
struct xrt_device * | psmv_device_create (struct xrt_prober *xp, struct xrt_prober_device *xpdev, struct xrt_tracked_psmv *tracker) |
Function to create a PSMV device. More... | |
static void | psmv_i32_from_u16_wire (int32_t *to, const struct psmv_u16_wire *from) |
static void | psmv_i32_from_i16_wire (int32_t *to, const struct psmv_i16_wire *from) |
static void | psmv_from_vec3_u16_wire (struct xrt_vec3_i32 *to, const struct psmv_vec3_u16_wire *from) |
static void | psmv_from_vec3_i16_wire (struct xrt_vec3_i32 *to, const struct psmv_vec3_i16_wire *from) |
static void | psmv_f32_from_wire (float *to, const struct psmv_f32_wire *from) |
static void | psmv_from_vec3_f32_wire (struct xrt_vec3 *to, const struct psmv_vec3_f32_wire *from) |
static int | psmv_get_calibration_zcm1 (struct psmv_device *psmv) |
static int | psmv_parse_input_zcm1 (struct psmv_device *psmv, struct psmv_input_zcm1 *data, struct psmv_parsed_input *input) |
static int | psmv_get_calibration_zcm2 (struct psmv_device *psmv) |
static int | psmv_parse_input_zcm2 (struct psmv_device *psmv, struct psmv_input_zcm2 *data, struct psmv_parsed_input *input) |
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] |
PlayStation Move motion controller prober and driver code.