xrt: adapt driver to new get_tracked_pose api change

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2271>
This commit is contained in:
Simon Zeni 2024-07-03 13:36:16 -04:00
parent d13a36beec
commit 6a26019aba
39 changed files with 258 additions and 174 deletions

View file

@ -170,7 +170,7 @@ android_device_destroy(struct xrt_device *xdev)
free(android); free(android);
} }
static void static xrt_result_t
android_device_get_tracked_pose(struct xrt_device *xdev, android_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -189,6 +189,7 @@ android_device_get_tracked_pose(struct xrt_device *xdev,
XRT_SPACE_RELATION_POSITION_VALID_BIT); XRT_SPACE_RELATION_POSITION_VALID_BIT);
*out_relation = new_relation; *out_relation = new_relation;
return XRT_SUCCESS;
} }

View file

@ -273,7 +273,7 @@ arduino_run_thread(void *ptr)
* *
*/ */
static void static xrt_result_t
arduino_get_fusion_pose(struct arduino_device *ad, enum xrt_input_name name, struct xrt_space_relation *out_relation) arduino_get_fusion_pose(struct arduino_device *ad, enum xrt_input_name name, struct xrt_space_relation *out_relation)
{ {
out_relation->pose.orientation = ad->fusion.rot; out_relation->pose.orientation = ad->fusion.rot;
@ -281,6 +281,8 @@ arduino_get_fusion_pose(struct arduino_device *ad, enum xrt_input_name name, str
//! @todo assuming that orientation is actually currently tracked. //! @todo assuming that orientation is actually currently tracked.
out_relation->relation_flags = (enum xrt_space_relation_flags)(XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | out_relation->relation_flags = (enum xrt_space_relation_flags)(XRT_SPACE_RELATION_ORIENTATION_VALID_BIT |
XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT); XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT);
return XRT_SUCCESS;
} }
static void static void
@ -331,7 +333,7 @@ arduino_device_update_inputs(struct xrt_device *xdev)
return XRT_SUCCESS; return XRT_SUCCESS;
} }
static void static xrt_result_t
arduino_device_get_tracked_pose(struct xrt_device *xdev, arduino_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -340,7 +342,7 @@ arduino_device_get_tracked_pose(struct xrt_device *xdev,
struct arduino_device *ad = arduino_device(xdev); struct arduino_device *ad = arduino_device(xdev);
(void)at_timestamp_ns; (void)at_timestamp_ns;
arduino_get_fusion_pose(ad, name, out_relation); return arduino_get_fusion_pose(ad, name, out_relation);
} }

View file

@ -310,7 +310,7 @@ daydream_device_update_inputs(struct xrt_device *xdev)
return XRT_SUCCESS; return XRT_SUCCESS;
} }
static void static xrt_result_t
daydream_device_get_tracked_pose(struct xrt_device *xdev, daydream_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -320,6 +320,8 @@ daydream_device_get_tracked_pose(struct xrt_device *xdev,
(void)at_timestamp_ns; (void)at_timestamp_ns;
daydream_get_fusion_pose(daydream, name, out_relation); daydream_get_fusion_pose(daydream, name, out_relation);
return XRT_SUCCESS;
} }

View file

@ -102,7 +102,7 @@ euroc_device(struct xrt_device *xdev)
return (struct euroc_device *)xdev; return (struct euroc_device *)xdev;
} }
static void static xrt_result_t
euroc_device_get_tracked_pose(struct xrt_device *xdev, euroc_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -128,6 +128,8 @@ euroc_device_get_tracked_pose(struct xrt_device *xdev,
out_relation->relation_flags = (enum xrt_space_relation_flags)( out_relation->relation_flags = (enum xrt_space_relation_flags)(
XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | XRT_SPACE_RELATION_POSITION_VALID_BIT | XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | XRT_SPACE_RELATION_POSITION_VALID_BIT |
XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | XRT_SPACE_RELATION_POSITION_TRACKED_BIT); XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | XRT_SPACE_RELATION_POSITION_TRACKED_BIT);
return XRT_SUCCESS;
} }
static void static void

View file

@ -213,7 +213,7 @@ hdk_device_update(struct hdk_device *hd)
return 1; return 1;
} }
static void static xrt_result_t
hdk_device_get_tracked_pose(struct xrt_device *xdev, hdk_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t requested_timestamp_ns, int64_t requested_timestamp_ns,
@ -222,8 +222,8 @@ hdk_device_get_tracked_pose(struct xrt_device *xdev,
struct hdk_device *hd = hdk_device(xdev); struct hdk_device *hd = hdk_device(xdev);
if (name != XRT_INPUT_GENERIC_HEAD_POSE) { if (name != XRT_INPUT_GENERIC_HEAD_POSE) {
HDK_ERROR(hd, "unknown input name"); U_LOG_XDEV_UNSUPPORTED_INPUT(&hd->base, hd->log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
os_mutex_lock(&hd->lock); os_mutex_lock(&hd->lock);
@ -231,7 +231,7 @@ hdk_device_get_tracked_pose(struct xrt_device *xdev,
out_relation->relation_flags = XRT_SPACE_RELATION_BITMASK_NONE; out_relation->relation_flags = XRT_SPACE_RELATION_BITMASK_NONE;
HDK_TRACE(hd, "GET_TRACKED_POSE: No pose"); HDK_TRACE(hd, "GET_TRACKED_POSE: No pose");
os_mutex_unlock(&hd->lock); os_mutex_unlock(&hd->lock);
return; return XRT_SUCCESS;
} }
out_relation->pose.orientation = hd->quat; out_relation->pose.orientation = hd->quat;
@ -248,6 +248,7 @@ hdk_device_get_tracked_pose(struct xrt_device *xdev,
HDK_TRACE(hd, "GET_TRACKED_POSE (%f, %f, %f, %f) ANG_VEL (%f, %f, %f)", hd->quat.x, hd->quat.y, hd->quat.z, HDK_TRACE(hd, "GET_TRACKED_POSE (%f, %f, %f, %f) ANG_VEL (%f, %f, %f)", hd->quat.x, hd->quat.y, hd->quat.z,
hd->quat.w, hd->ang_vel_quat.x, hd->ang_vel_quat.y, hd->ang_vel_quat.z); hd->quat.w, hd->ang_vel_quat.x, hd->ang_vel_quat.y, hd->ang_vel_quat.z);
return XRT_SUCCESS;
} }
static void * static void *

View file

@ -175,7 +175,7 @@ joint_pose_global(xrt_hand_joint_set *joint_set, xrt_hand_joint joint)
return out_relation.pose; return out_relation.pose;
} }
static void static xrt_result_t
do_grip_pose(struct xrt_hand_joint_set *joint_set, do_grip_pose(struct xrt_hand_joint_set *joint_set,
struct xrt_space_relation *out_relation, struct xrt_space_relation *out_relation,
float grip_offset_from_palm, float grip_offset_from_palm,
@ -211,11 +211,13 @@ do_grip_pose(struct xrt_hand_joint_set *joint_set,
math_quat_from_plus_x_z(&plus_x, &plus_z, &out_relation->pose.orientation); math_quat_from_plus_x_z(&plus_x, &plus_z, &out_relation->pose.orientation);
out_relation->relation_flags = valid_flags; out_relation->relation_flags = valid_flags;
return XRT_SUCCESS;
} }
static void static xrt_result_t
get_other_two(struct cemu_device *dev, get_other_two(struct cemu_device *dev,
int64_t head_timestamp_ns, int64_t head_timestamp_ns,
int64_t hand_timestamp_ns, int64_t hand_timestamp_ns,
@ -223,7 +225,12 @@ get_other_two(struct cemu_device *dev,
xrt_hand_joint_set *out_secondary) xrt_hand_joint_set *out_secondary)
{ {
struct xrt_space_relation head_rel; struct xrt_space_relation head_rel;
xrt_result_t xret =
xrt_device_get_tracked_pose(dev->sys->in_head, XRT_INPUT_GENERIC_HEAD_POSE, head_timestamp_ns, &head_rel); xrt_device_get_tracked_pose(dev->sys->in_head, XRT_INPUT_GENERIC_HEAD_POSE, head_timestamp_ns, &head_rel);
if (xret != XRT_SUCCESS) {
return xret;
}
*out_head = head_rel.pose; *out_head = head_rel.pose;
int other; int other;
if (dev->hand_index == 0) { if (dev->hand_index == 0) {
@ -235,11 +242,13 @@ get_other_two(struct cemu_device *dev,
int64_t noop; int64_t noop;
xrt_device_get_hand_tracking(dev->sys->in_hand, dev->sys->out_hand[other]->ht_input_name, hand_timestamp_ns, xrt_device_get_hand_tracking(dev->sys->in_hand, dev->sys->out_hand[other]->ht_input_name, hand_timestamp_ns,
out_secondary, &noop); out_secondary, &noop);
return xret;
} }
// Mostly stolen from // Mostly stolen from
// https://github.com/maluoi/StereoKit/blob/048b689f71d080a67fde29838c0362a49b88b3d6/StereoKitC/systems/hand/hand_oxr_articulated.cpp#L149 // https://github.com/maluoi/StereoKit/blob/048b689f71d080a67fde29838c0362a49b88b3d6/StereoKitC/systems/hand/hand_oxr_articulated.cpp#L149
static void static xrt_result_t
do_aim_pose(struct cemu_device *dev, do_aim_pose(struct cemu_device *dev,
struct xrt_hand_joint_set *joint_set_primary, struct xrt_hand_joint_set *joint_set_primary,
int64_t head_timestamp_ns, int64_t head_timestamp_ns,
@ -251,12 +260,14 @@ do_aim_pose(struct cemu_device *dev,
struct xrt_hand_joint_set joint_set_secondary; struct xrt_hand_joint_set joint_set_secondary;
#if 0 #if 0
// "Jakob way" // "Jakob way"
get_other_two(dev, hand_timestamp_ns, hand_timestamp_ns, &head, &joint_set_secondary); xrt_result_t xret = get_other_two(dev, hand_timestamp_ns, hand_timestamp_ns, &head, &joint_set_secondary);
#else #else
// "Moses way" // "Moses way"
get_other_two(dev, head_timestamp_ns, hand_timestamp_ns, &head, &joint_set_secondary); xrt_result_t xret = get_other_two(dev, head_timestamp_ns, hand_timestamp_ns, &head, &joint_set_secondary);
#endif #endif
if (xret != XRT_SUCCESS) {
return xret;
}
// Average shoulder width for women:37cm, men:41cm, center of shoulder // Average shoulder width for women:37cm, men:41cm, center of shoulder
// joint is around 4cm inwards // joint is around 4cm inwards
@ -313,10 +324,12 @@ do_aim_pose(struct cemu_device *dev,
math_quat_from_plus_x_z(&out_x_vector, &ray_direction, &out_relation->pose.orientation); math_quat_from_plus_x_z(&out_x_vector, &ray_direction, &out_relation->pose.orientation);
out_relation->relation_flags = valid_flags; out_relation->relation_flags = valid_flags;
return xret;
} }
// Pose for controller emulation // Pose for controller emulation
static void static xrt_result_t
cemu_device_get_tracked_pose(struct xrt_device *xdev, cemu_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -326,8 +339,8 @@ cemu_device_get_tracked_pose(struct xrt_device *xdev,
struct cemu_system *sys = dev->sys; struct cemu_system *sys = dev->sys;
if (name != XRT_INPUT_SIMPLE_GRIP_POSE && name != XRT_INPUT_SIMPLE_AIM_POSE) { if (name != XRT_INPUT_SIMPLE_GRIP_POSE && name != XRT_INPUT_SIMPLE_AIM_POSE) {
CEMU_ERROR(dev, "unknown input name %d for controller pose", name); U_LOG_XDEV_UNSUPPORTED_INPUT(&dev->base, dev->sys->log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
static int64_t hand_timestamp_ns; static int64_t hand_timestamp_ns;
@ -337,24 +350,25 @@ cemu_device_get_tracked_pose(struct xrt_device *xdev,
if (joint_set.is_active == false) { if (joint_set.is_active == false) {
out_relation->relation_flags = XRT_SPACE_RELATION_BITMASK_NONE; out_relation->relation_flags = XRT_SPACE_RELATION_BITMASK_NONE;
return; return XRT_SUCCESS;
} }
xrt_result_t xret = XRT_SUCCESS;
switch (name) { switch (name) {
case XRT_INPUT_SIMPLE_GRIP_POSE: { case XRT_INPUT_SIMPLE_GRIP_POSE: {
do_grip_pose(&joint_set, out_relation, sys->grip_offset_from_palm, dev->hand_index); xret = do_grip_pose(&joint_set, out_relation, sys->grip_offset_from_palm, dev->hand_index);
break; break;
} }
case XRT_INPUT_SIMPLE_AIM_POSE: { case XRT_INPUT_SIMPLE_AIM_POSE: {
// Assume that now we're doing everything in the timestamp from the hand-tracker, so use // Assume that now we're doing everything in the timestamp from the hand-tracker, so use
// hand_timestamp_ns. This will cause the controller to lag behind but otherwise be correct // hand_timestamp_ns. This will cause the controller to lag behind but otherwise be correct
do_aim_pose(dev, &joint_set, at_timestamp_ns, hand_timestamp_ns, out_relation); xret = do_aim_pose(dev, &joint_set, at_timestamp_ns, hand_timestamp_ns, out_relation);
break; break;
} }
default: assert(false); default: assert(false);
} }
return xret;
} }
static void static void

View file

@ -482,7 +482,7 @@ hydra_device_update_inputs(struct xrt_device *xdev)
return XRT_SUCCESS; return XRT_SUCCESS;
} }
static void static xrt_result_t
hydra_device_get_tracked_pose(struct xrt_device *xdev, hydra_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -505,6 +505,8 @@ hydra_device_get_tracked_pose(struct xrt_device *xdev,
// HYDRA_SPEW(hd, "GET_TRACKED_POSE (%f, %f, %f) (%f, %f, %f, %f) ", // HYDRA_SPEW(hd, "GET_TRACKED_POSE (%f, %f, %f) (%f, %f, %f, %f) ",
// pos.x, // pos.x,
// pos.y, pos.z, quat.x, quat.y, quat.z, quat.w); // pos.y, pos.z, quat.x, quat.y, quat.z, quat.w);
return XRT_SUCCESS;
} }
static void static void

View file

@ -79,7 +79,7 @@ attached_override(struct multi_device *d,
m_relation_chain_resolve(&xrc, out_relation); m_relation_chain_resolve(&xrc, out_relation);
} }
static void static xrt_result_t
get_tracked_pose(struct xrt_device *xdev, get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -91,7 +91,11 @@ get_tracked_pose(struct xrt_device *xdev,
struct xrt_space_relation tracker_relation; struct xrt_space_relation tracker_relation;
xrt_result_t xret =
xrt_device_get_tracked_pose(tracker, tracker_input_name, at_timestamp_ns, &tracker_relation); xrt_device_get_tracked_pose(tracker, tracker_input_name, at_timestamp_ns, &tracker_relation);
if (xret != XRT_SUCCESS) {
return xret;
}
switch (d->override_type) { switch (d->override_type) {
case XRT_TRACKING_OVERRIDE_DIRECT: { case XRT_TRACKING_OVERRIDE_DIRECT: {
@ -101,8 +105,10 @@ get_tracked_pose(struct xrt_device *xdev,
struct xrt_device *target = d->tracking_override.target; struct xrt_device *target = d->tracking_override.target;
struct xrt_space_relation target_relation; struct xrt_space_relation target_relation;
xrt_device_get_tracked_pose(target, name, at_timestamp_ns, &target_relation); xret = xrt_device_get_tracked_pose(target, name, at_timestamp_ns, &target_relation);
if (xret != XRT_SUCCESS) {
break;
}
// just use the origin of the tracker space as reference frame // just use the origin of the tracker space as reference frame
struct xrt_space_relation in_target_space; struct xrt_space_relation in_target_space;
@ -116,6 +122,8 @@ get_tracked_pose(struct xrt_device *xdev,
&in_target_space, out_relation); &in_target_space, out_relation);
} break; } break;
} }
return xret;
} }
static void static void

View file

@ -367,7 +367,7 @@ ns_hmd_destroy(struct xrt_device *xdev)
u_device_free(&ns->base); u_device_free(&ns->base);
} }
static void static xrt_result_t
ns_hmd_get_tracked_pose(struct xrt_device *xdev, ns_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -377,11 +377,12 @@ ns_hmd_get_tracked_pose(struct xrt_device *xdev,
NS_DEBUG(ns, "Called!"); NS_DEBUG(ns, "Called!");
if (name != XRT_INPUT_GENERIC_HEAD_POSE) { if (name != XRT_INPUT_GENERIC_HEAD_POSE) {
NS_ERROR(ns, "unknown input name"); U_LOG_XDEV_UNSUPPORTED_INPUT(&ns->base, ns->log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
*out_relation = ns->no_tracker_relation; // you can change this using the debug gui *out_relation = ns->no_tracker_relation; // you can change this using the debug gui
return XRT_SUCCESS;
} }
static void static void

View file

@ -373,7 +373,7 @@ check_tracker_pose(struct oh_device *ohd, enum xrt_input_name name)
return (ohd->ohmd_device_type == OPENHMD_GENERIC_TRACKER) && name == XRT_INPUT_GENERIC_TRACKER_POSE; return (ohd->ohmd_device_type == OPENHMD_GENERIC_TRACKER) && name == XRT_INPUT_GENERIC_TRACKER_POSE;
} }
static void static xrt_result_t
oh_device_get_tracked_pose(struct xrt_device *xdev, oh_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -384,8 +384,8 @@ oh_device_get_tracked_pose(struct xrt_device *xdev,
struct xrt_vec3 pos = XRT_VEC3_ZERO; struct xrt_vec3 pos = XRT_VEC3_ZERO;
if (!check_head_pose(ohd, name) && !check_controller_pose(ohd, name) && !check_tracker_pose(ohd, name)) { if (!check_head_pose(ohd, name) && !check_controller_pose(ohd, name) && !check_tracker_pose(ohd, name)) {
OHMD_ERROR(ohd, "unknown input name: %d", name); U_LOG_XDEV_UNSUPPORTED_INPUT(&ohd->base, ohd->log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
ohmd_ctx_update(ohd->ctx); ohmd_ctx_update(ohd->ctx);
@ -429,7 +429,7 @@ oh_device_get_tracked_pose(struct xrt_device *xdev,
*/ */
*out_relation = ohd->last_relation; *out_relation = ohd->last_relation;
OHMD_TRACE(ohd, "GET_TRACKED_POSE (%s) - no new data", ohd->base.str); OHMD_TRACE(ohd, "GET_TRACKED_POSE (%s) - no new data", ohd->base.str);
return; return XRT_SUCCESS;
} }
/*! /*!
@ -470,6 +470,8 @@ oh_device_get_tracked_pose(struct xrt_device *xdev,
// Update state within driver // Update state within driver
ohd->last_update = (int64_t)now; ohd->last_update = (int64_t)now;
ohd->last_relation = *out_relation; ohd->last_relation = *out_relation;
return XRT_SUCCESS;
} }

View file

@ -794,32 +794,6 @@ psmv_get_fusion_pose(struct psmv_device *psmv,
XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT | XRT_SPACE_RELATION_LINEAR_VELOCITY_VALID_BIT); XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT | XRT_SPACE_RELATION_LINEAR_VELOCITY_VALID_BIT);
} }
static void
psmv_push_pose_offset(enum xrt_input_name name, struct xrt_relation_chain *xrc)
{
/*
* Both the grip and aim pose needs adjustments, the grip is a rotated
* body center pose, while the aim pose needs to rotated and translated
* to the tip of the ball.
*/
if (name != XRT_INPUT_PSMV_AIM_POSE && name != XRT_INPUT_PSMV_GRIP_POSE) {
return;
}
float y = 0.0;
if (name == XRT_INPUT_PSMV_AIM_POSE) {
y += PSMV_BALL_FROM_IMU_Y_M;
y += PSMV_BALL_DIAMETER_M / 2.0;
}
struct xrt_pose pose = {
{0.7071068, 0, 0, 0.7071068},
{0, y, 0},
};
m_relation_chain_push_pose(xrc, &pose);
}
/* /*
* *
@ -888,16 +862,39 @@ psmv_device_update_inputs(struct xrt_device *xdev)
} }
static xrt_result_t static xrt_result_t
psmv_device_get_relation_chain(struct xrt_device *xdev, psmv_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
uint64_t at_timestamp_ns, int64_t at_timestamp_ns,
struct xrt_relation_chain *xrc) struct xrt_space_relation *out_relation)
{ {
struct psmv_device *psmv = psmv_device(xdev); struct psmv_device *psmv = psmv_device(xdev);
psmv_push_pose_offset(name, xrc); if (name != XRT_INPUT_PSMV_AIM_POSE && name != XRT_INPUT_PSMV_GRIP_POSE) {
U_LOG_XDEV_UNSUPPORTED_INPUT(&psmv->base, psmv->log_level, name);
return XRT_ERROR_INPUT_UNSUPPORTED;
}
struct xrt_space_relation *rel = m_relation_chain_reserve(xrc); /*
* Both the grip and aim pose needs adjustments, the grip is a rotated
* body center pose, while the aim pose needs to rotated and translated
* to the tip of the ball.
*/
float y = 0.0;
if (name == XRT_INPUT_PSMV_AIM_POSE) {
y += PSMV_BALL_FROM_IMU_Y_M;
y += PSMV_BALL_DIAMETER_M / 2.0;
}
struct xrt_pose pose = {
{0.7071068, 0, 0, 0.7071068},
{0, y, 0},
};
struct xrt_relation_chain xrc = {0};
m_relation_chain_push_pose(&xrc, &pose);
struct xrt_space_relation *rel = m_relation_chain_reserve(&xrc);
if (psmv->ball != NULL) { if (psmv->ball != NULL) {
xrt_tracked_psmv_get_tracked_pose(psmv->ball, name, at_timestamp_ns, rel); xrt_tracked_psmv_get_tracked_pose(psmv->ball, name, at_timestamp_ns, rel);
@ -905,20 +902,9 @@ psmv_device_get_relation_chain(struct xrt_device *xdev,
psmv_get_fusion_pose(psmv, name, at_timestamp_ns, rel); psmv_get_fusion_pose(psmv, name, at_timestamp_ns, rel);
} }
return XRT_SUCCESS;
}
static void
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)
{
struct xrt_relation_chain xrc = {0};
psmv_device_get_relation_chain(xdev, name, at_timestamp_ns, &xrc);
m_relation_chain_resolve(&xrc, out_relation); m_relation_chain_resolve(&xrc, out_relation);
return XRT_SUCCESS;
} }
static float static float

View file

@ -757,7 +757,7 @@ pssense_get_fusion_pose(struct pssense_device *pssense,
XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT | XRT_SPACE_RELATION_LINEAR_VELOCITY_VALID_BIT); XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT | XRT_SPACE_RELATION_LINEAR_VELOCITY_VALID_BIT);
} }
static void static xrt_result_t
pssense_get_tracked_pose(struct xrt_device *xdev, pssense_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -766,8 +766,8 @@ pssense_get_tracked_pose(struct xrt_device *xdev,
struct pssense_device *pssense = (struct pssense_device *)xdev; struct pssense_device *pssense = (struct pssense_device *)xdev;
if (name != XRT_INPUT_PSSENSE_AIM_POSE && name != XRT_INPUT_PSSENSE_GRIP_POSE) { if (name != XRT_INPUT_PSSENSE_AIM_POSE && name != XRT_INPUT_PSSENSE_GRIP_POSE) {
PSSENSE_ERROR(pssense, "Unknown pose name requested %u", name); U_LOG_XDEV_UNSUPPORTED_INPUT(&pssense->base, pssense->log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
struct xrt_relation_chain xrc = {0}; struct xrt_relation_chain xrc = {0};
@ -785,6 +785,8 @@ pssense_get_tracked_pose(struct xrt_device *xdev,
os_mutex_unlock(&pssense->lock); os_mutex_unlock(&pssense->lock);
m_relation_chain_resolve(&xrc, out_relation); m_relation_chain_resolve(&xrc, out_relation);
return XRT_SUCCESS;
} }
static xrt_result_t static xrt_result_t

View file

@ -957,7 +957,7 @@ psvr_device_update_inputs(struct xrt_device *xdev)
return XRT_SUCCESS; return XRT_SUCCESS;
} }
static void static xrt_result_t
psvr_device_get_tracked_pose(struct xrt_device *xdev, psvr_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -966,8 +966,8 @@ psvr_device_get_tracked_pose(struct xrt_device *xdev,
struct psvr_device *psvr = psvr_device(xdev); struct psvr_device *psvr = psvr_device(xdev);
if (name != XRT_INPUT_GENERIC_HEAD_POSE) { if (name != XRT_INPUT_GENERIC_HEAD_POSE) {
PSVR_ERROR(psvr, "unknown input name"); U_LOG_XDEV_UNSUPPORTED_INPUT(&psvr->base, psvr->log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
os_mutex_lock(&psvr->device_mutex); os_mutex_lock(&psvr->device_mutex);
@ -993,6 +993,8 @@ psvr_device_get_tracked_pose(struct xrt_device *xdev,
//! @todo Move this to the tracker. //! @todo Move this to the tracker.
// Make sure that the orientation is valid. // Make sure that the orientation is valid.
math_quat_normalize(&out_relation->pose.orientation); math_quat_normalize(&out_relation->pose.orientation);
return XRT_SUCCESS;
} }
static void static void

View file

@ -136,7 +136,7 @@ qwerty_set_output(struct xrt_device *xd, enum xrt_output_name name, const union
} }
} }
static void static xrt_result_t
qwerty_get_tracked_pose(struct xrt_device *xd, qwerty_get_tracked_pose(struct xrt_device *xd,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -146,8 +146,8 @@ qwerty_get_tracked_pose(struct xrt_device *xd,
if (name != XRT_INPUT_GENERIC_HEAD_POSE && name != XRT_INPUT_SIMPLE_GRIP_POSE && if (name != XRT_INPUT_GENERIC_HEAD_POSE && name != XRT_INPUT_SIMPLE_GRIP_POSE &&
name != XRT_INPUT_SIMPLE_AIM_POSE) { name != XRT_INPUT_SIMPLE_AIM_POSE) {
QWERTY_ERROR(qd, "Unexpected input name = 0x%04X", name >> 8); U_LOG_XDEV_UNSUPPORTED_INPUT(&qd->base, qd->sys->log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
// Position // Position
@ -201,6 +201,8 @@ qwerty_get_tracked_pose(struct xrt_device *xd,
out_relation->relation_flags = out_relation->relation_flags =
XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | XRT_SPACE_RELATION_POSITION_VALID_BIT | XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | XRT_SPACE_RELATION_POSITION_VALID_BIT |
XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | XRT_SPACE_RELATION_POSITION_TRACKED_BIT; XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | XRT_SPACE_RELATION_POSITION_TRACKED_BIT;
return XRT_SUCCESS;
} }
static void static void

View file

@ -388,7 +388,7 @@ load_config(struct rs_ddev *rs)
* *
*/ */
static void static xrt_result_t
rs_ddev_get_tracked_pose(struct xrt_device *xdev, rs_ddev_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -397,11 +397,12 @@ rs_ddev_get_tracked_pose(struct xrt_device *xdev,
struct rs_ddev *rs = rs_ddev(xdev); struct rs_ddev *rs = rs_ddev(xdev);
if (name != XRT_INPUT_GENERIC_TRACKER_POSE) { if (name != XRT_INPUT_GENERIC_TRACKER_POSE) {
U_LOG_E("unknown input name"); U_LOG_XDEV_UNSUPPORTED_INPUT(&rs->base, u_log_get_global_level(), name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
m_relation_history_get(rs->relation_hist, at_timestamp_ns, out_relation); m_relation_history_get(rs->relation_hist, at_timestamp_ns, out_relation);
return XRT_SUCCESS;
} }
static void static void

View file

@ -273,7 +273,7 @@ rs_hdev_correct_pose_from_basalt(struct xrt_pose pose)
return out_relation.pose; return out_relation.pose;
} }
static void static xrt_result_t
rs_hdev_get_tracked_pose(struct xrt_device *xdev, rs_hdev_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -305,6 +305,8 @@ rs_hdev_get_tracked_pose(struct xrt_device *xdev,
out_relation->relation_flags = (enum xrt_space_relation_flags)( out_relation->relation_flags = (enum xrt_space_relation_flags)(
XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | XRT_SPACE_RELATION_POSITION_VALID_BIT | XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | XRT_SPACE_RELATION_POSITION_VALID_BIT |
XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | XRT_SPACE_RELATION_POSITION_TRACKED_BIT); XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | XRT_SPACE_RELATION_POSITION_TRACKED_BIT);
return XRT_SUCCESS;
} }
static void static void

View file

@ -97,7 +97,7 @@ r_device_update_inputs(struct xrt_device *xdev)
return XRT_SUCCESS; return XRT_SUCCESS;
} }
static void static xrt_result_t
r_device_get_tracked_pose(struct xrt_device *xdev, r_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -108,8 +108,8 @@ r_device_get_tracked_pose(struct xrt_device *xdev,
if (name != XRT_INPUT_INDEX_AIM_POSE && name != XRT_INPUT_INDEX_GRIP_POSE && if (name != XRT_INPUT_INDEX_AIM_POSE && name != XRT_INPUT_INDEX_GRIP_POSE &&
name != XRT_INPUT_GENERIC_PALM_POSE) { name != XRT_INPUT_GENERIC_PALM_POSE) {
U_LOG_E("Unknown input name: 0x%0x", name); U_LOG_XDEV_UNSUPPORTED_INPUT(&rd->base, u_log_get_global_level(), name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
struct r_remote_controller_data *latest = rd->is_left ? &r->latest.left : &r->latest.right; struct r_remote_controller_data *latest = rd->is_left ? &r->latest.left : &r->latest.right;
@ -133,6 +133,8 @@ r_device_get_tracked_pose(struct xrt_device *xdev,
} else { } else {
out_relation->relation_flags = 0; out_relation->relation_flags = 0;
} }
return XRT_SUCCESS;
} }
static void static void

View file

@ -56,7 +56,7 @@ r_hmd_destroy(struct xrt_device *xdev)
u_device_free(&rh->base); u_device_free(&rh->base);
} }
static void static xrt_result_t
r_hmd_get_tracked_pose(struct xrt_device *xdev, r_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -66,8 +66,12 @@ r_hmd_get_tracked_pose(struct xrt_device *xdev,
switch (name) { switch (name) {
case XRT_INPUT_GENERIC_HEAD_POSE: copy_head_center_to_relation(rh, out_relation); break; case XRT_INPUT_GENERIC_HEAD_POSE: copy_head_center_to_relation(rh, out_relation); break;
default: U_LOG_E("Unknown input name"); break; default:
U_LOG_XDEV_UNSUPPORTED_INPUT(&rh->base, u_log_get_global_level(), name);
return XRT_ERROR_INPUT_UNSUPPORTED;
} }
return XRT_SUCCESS;
} }
static void static void

View file

@ -539,7 +539,7 @@ rift_s_controller_get_fusion_pose(struct rift_s_controller *ctrl,
XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT | XRT_SPACE_RELATION_LINEAR_VELOCITY_VALID_BIT); XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT | XRT_SPACE_RELATION_LINEAR_VELOCITY_VALID_BIT);
} }
static void static xrt_result_t
rift_s_controller_get_tracked_pose(struct xrt_device *xdev, rift_s_controller_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -548,8 +548,8 @@ rift_s_controller_get_tracked_pose(struct xrt_device *xdev,
struct rift_s_controller *ctrl = (struct rift_s_controller *)(xdev); struct rift_s_controller *ctrl = (struct rift_s_controller *)(xdev);
if (name != XRT_INPUT_TOUCH_AIM_POSE && name != XRT_INPUT_TOUCH_GRIP_POSE) { if (name != XRT_INPUT_TOUCH_AIM_POSE && name != XRT_INPUT_TOUCH_GRIP_POSE) {
RIFT_S_ERROR("unknown pose name requested"); U_LOG_XDEV_UNSUPPORTED_INPUT(&ctrl->base, rift_s_log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
struct xrt_relation_chain xrc = {0}; struct xrt_relation_chain xrc = {0};
@ -571,6 +571,8 @@ rift_s_controller_get_tracked_pose(struct xrt_device *xdev,
os_mutex_unlock(&ctrl->mutex); os_mutex_unlock(&ctrl->mutex);
m_relation_chain_resolve(&xrc, out_relation); m_relation_chain_resolve(&xrc, out_relation);
return XRT_SUCCESS;
} }
static void static void

View file

@ -43,7 +43,7 @@
#define DEG_TO_RAD(D) ((D)*M_PI / 180.) #define DEG_TO_RAD(D) ((D)*M_PI / 180.)
static void static xrt_result_t
rift_s_get_tracked_pose(struct xrt_device *xdev, rift_s_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -52,13 +52,14 @@ rift_s_get_tracked_pose(struct xrt_device *xdev,
struct rift_s_hmd *hmd = (struct rift_s_hmd *)(xdev); struct rift_s_hmd *hmd = (struct rift_s_hmd *)(xdev);
if (name != XRT_INPUT_GENERIC_HEAD_POSE) { if (name != XRT_INPUT_GENERIC_HEAD_POSE) {
RIFT_S_ERROR("Unknown input name"); U_LOG_XDEV_UNSUPPORTED_INPUT(&hmd->base, rift_s_log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
U_ZERO(out_relation); U_ZERO(out_relation);
rift_s_tracker_get_tracked_pose(hmd->tracker, RIFT_S_TRACKER_POSE_DEVICE, at_timestamp_ns, out_relation); rift_s_tracker_get_tracked_pose(hmd->tracker, RIFT_S_TRACKER_POSE_DEVICE, at_timestamp_ns, out_relation);
return XRT_SUCCESS;
} }
void void

View file

@ -67,7 +67,7 @@ DEBUG_GET_ONCE_BOOL_OPTION(rift_s_slam, "RIFT_S_SLAM", true)
//! Specifies whether the user wants to use the hand tracker. //! Specifies whether the user wants to use the hand tracker.
DEBUG_GET_ONCE_BOOL_OPTION(rift_s_handtracking, "RIFT_S_HANDTRACKING", true) DEBUG_GET_ONCE_BOOL_OPTION(rift_s_handtracking, "RIFT_S_HANDTRACKING", true)
static void static xrt_result_t
rift_s_tracker_get_tracked_pose_imu(struct xrt_device *xdev, rift_s_tracker_get_tracked_pose_imu(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -608,16 +608,21 @@ rift_s_tracker_correct_pose_from_basalt(struct xrt_pose *pose)
math_quat_rotate_vec3(&q, &pose->position, &pose->position); math_quat_rotate_vec3(&q, &pose->position, &pose->position);
} }
static void static xrt_result_t
rift_s_tracker_get_tracked_pose_imu(struct xrt_device *xdev, rift_s_tracker_get_tracked_pose_imu(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation) struct xrt_space_relation *out_relation)
{ {
struct rift_s_tracker *tracker = (struct rift_s_tracker *)(xdev); struct rift_s_tracker *tracker = (struct rift_s_tracker *)(xdev);
assert(name == XRT_INPUT_GENERIC_TRACKER_POSE); if (name != XRT_INPUT_GENERIC_TRACKER_POSE) {
U_LOG_XDEV_UNSUPPORTED_INPUT(&tracker->base, rift_s_log_level, name);
return XRT_ERROR_INPUT_UNSUPPORTED;
}
rift_s_tracker_get_tracked_pose(tracker, RIFT_S_TRACKER_POSE_IMU, at_timestamp_ns, out_relation); rift_s_tracker_get_tracked_pose(tracker, RIFT_S_TRACKER_POSE_IMU, at_timestamp_ns, out_relation);
return XRT_SUCCESS;
} }
void void

View file

@ -430,7 +430,7 @@ rokid_hmd_destroy(struct xrt_device *xdev)
u_device_free(&rokid->base); u_device_free(&rokid->base);
} }
static void static xrt_result_t
rokid_hmd_get_tracked_pose(struct xrt_device *xdev, rokid_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -439,12 +439,14 @@ rokid_hmd_get_tracked_pose(struct xrt_device *xdev,
struct rokid_hmd *rokid = rokid_hmd(xdev); struct rokid_hmd *rokid = rokid_hmd(xdev);
if (name != XRT_INPUT_GENERIC_HEAD_POSE) { if (name != XRT_INPUT_GENERIC_HEAD_POSE) {
ROKID_ERROR(rokid, "unknown input name"); U_LOG_XDEV_UNSUPPORTED_INPUT(&rokid->base, rokid->log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
os_mutex_lock(&rokid->fusion.mutex); os_mutex_lock(&rokid->fusion.mutex);
rokid_fusion_get_pose(&rokid->fusion, at_timestamp_ns, out_relation); rokid_fusion_get_pose(&rokid->fusion, at_timestamp_ns, out_relation);
os_mutex_unlock(&rokid->fusion.mutex); os_mutex_unlock(&rokid->fusion.mutex);
return XRT_SUCCESS;
} }
static struct xrt_device * static struct xrt_device *

View file

@ -96,7 +96,7 @@ sample_hmd_update_inputs(struct xrt_device *xdev)
return XRT_SUCCESS; return XRT_SUCCESS;
} }
static void static xrt_result_t
sample_hmd_get_tracked_pose(struct xrt_device *xdev, sample_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -105,8 +105,8 @@ sample_hmd_get_tracked_pose(struct xrt_device *xdev,
struct sample_hmd *hmd = sample_hmd(xdev); struct sample_hmd *hmd = sample_hmd(xdev);
if (name != XRT_INPUT_GENERIC_HEAD_POSE) { if (name != XRT_INPUT_GENERIC_HEAD_POSE) {
HMD_ERROR(hmd, "unknown input name"); U_LOG_XDEV_UNSUPPORTED_INPUT(&hmd->base, hmd->log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
struct xrt_space_relation relation = XRT_SPACE_RELATION_ZERO; struct xrt_space_relation relation = XRT_SPACE_RELATION_ZERO;
@ -125,6 +125,7 @@ sample_hmd_get_tracked_pose(struct xrt_device *xdev,
} }
*out_relation = relation; *out_relation = relation;
return XRT_SUCCESS;
} }
static void static void

View file

@ -72,7 +72,7 @@ svr_hmd_destroy(struct xrt_device *xdev)
u_device_free(&ns->base); u_device_free(&ns->base);
} }
static void static xrt_result_t
svr_hmd_get_tracked_pose(struct xrt_device *xdev, svr_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -82,7 +82,8 @@ svr_hmd_get_tracked_pose(struct xrt_device *xdev,
if (name != XRT_INPUT_GENERIC_HEAD_POSE) { if (name != XRT_INPUT_GENERIC_HEAD_POSE) {
SVR_ERROR(ns, "unknown input name"); SVR_ERROR(ns, "unknown input name");
return; U_LOG_XDEV_UNSUPPORTED_INPUT(&ns->base, ns->log_level, name);
return XRT_ERROR_INPUT_UNSUPPORTED;
} }
@ -92,6 +93,8 @@ svr_hmd_get_tracked_pose(struct xrt_device *xdev,
(struct xrt_pose)XRT_POSE_IDENTITY; // This is so that tracking overrides/multi driver just transforms us by (struct xrt_pose)XRT_POSE_IDENTITY; // This is so that tracking overrides/multi driver just transforms us by
// the tracker + offset from the tracker. // the tracker + offset from the tracker.
out_relation->relation_flags = XRT_SPACE_RELATION_BITMASK_ALL; out_relation->relation_flags = XRT_SPACE_RELATION_BITMASK_ALL;
return XRT_SUCCESS;
} }
#define DEG_TO_RAD(DEG) (DEG * M_PI / 180.) #define DEG_TO_RAD(DEG) (DEG * M_PI / 180.)

View file

@ -46,8 +46,8 @@ struct simulated_device
#define CHECK_THAT_NAME_IS_AND_ERROR(NAME) \ #define CHECK_THAT_NAME_IS_AND_ERROR(NAME) \
do { \ do { \
if (sd->base.name != NAME) { \ if (sd->base.name != NAME) { \
U_LOG_E("Unknown input for controller %s 0x%02x", #NAME, name); \ U_LOG_XDEV_UNSUPPORTED_INPUT(&sd->base, u_log_get_global_level(), name); \
return; \ return XRT_ERROR_INPUT_UNSUPPORTED; \
} \ } \
} while (false) } while (false)
@ -118,7 +118,7 @@ simulated_device_update_inputs(struct xrt_device *xdev)
return XRT_SUCCESS; return XRT_SUCCESS;
} }
static void static xrt_result_t
simulated_device_get_tracked_pose(struct xrt_device *xdev, simulated_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -133,13 +133,15 @@ simulated_device_get_tracked_pose(struct xrt_device *xdev,
case XRT_INPUT_WMR_AIM_POSE: CHECK_THAT_NAME_IS_AND_ERROR(XRT_DEVICE_WMR_CONTROLLER); break; case XRT_INPUT_WMR_AIM_POSE: CHECK_THAT_NAME_IS_AND_ERROR(XRT_DEVICE_WMR_CONTROLLER); break;
case XRT_INPUT_ML2_CONTROLLER_GRIP_POSE: case XRT_INPUT_ML2_CONTROLLER_GRIP_POSE:
case XRT_INPUT_ML2_CONTROLLER_AIM_POSE: CHECK_THAT_NAME_IS_AND_ERROR(XRT_DEVICE_ML2_CONTROLLER); break; case XRT_INPUT_ML2_CONTROLLER_AIM_POSE: CHECK_THAT_NAME_IS_AND_ERROR(XRT_DEVICE_ML2_CONTROLLER); break;
default: U_LOG_E("Unknown input name: 0x%0x", name); return; default:
U_LOG_XDEV_UNSUPPORTED_INPUT(&sd->base, u_log_get_global_level(), name);
return XRT_ERROR_INPUT_UNSUPPORTED;
} }
if (!sd->active) { if (!sd->active) {
out_relation->pose = (struct xrt_pose)XRT_POSE_IDENTITY; out_relation->pose = (struct xrt_pose)XRT_POSE_IDENTITY;
out_relation->relation_flags = 0; out_relation->relation_flags = 0;
return; return XRT_SUCCESS;
} }
struct xrt_pose pose = sd->center; struct xrt_pose pose = sd->center;
@ -160,6 +162,8 @@ simulated_device_get_tracked_pose(struct xrt_device *xdev,
XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | XRT_SPACE_RELATION_POSITION_VALID_BIT | XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | XRT_SPACE_RELATION_POSITION_VALID_BIT |
XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | XRT_SPACE_RELATION_POSITION_TRACKED_BIT | XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | XRT_SPACE_RELATION_POSITION_TRACKED_BIT |
XRT_SPACE_RELATION_LINEAR_VELOCITY_VALID_BIT | XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT); XRT_SPACE_RELATION_LINEAR_VELOCITY_VALID_BIT | XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT);
return XRT_SUCCESS;
} }
static void static void

View file

@ -85,7 +85,7 @@ simulated_hmd_destroy(struct xrt_device *xdev)
u_device_free(&dh->base); u_device_free(&dh->base);
} }
static void static xrt_result_t
simulated_hmd_get_tracked_pose(struct xrt_device *xdev, simulated_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -94,8 +94,8 @@ simulated_hmd_get_tracked_pose(struct xrt_device *xdev,
struct simulated_hmd *hmd = simulated_hmd(xdev); struct simulated_hmd *hmd = simulated_hmd(xdev);
if (name != XRT_INPUT_GENERIC_HEAD_POSE) { if (name != XRT_INPUT_GENERIC_HEAD_POSE) {
HMD_ERROR(hmd, "unknown input name"); U_LOG_XDEV_UNSUPPORTED_INPUT(&hmd->base, hmd->log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
const double time_s = time_ns_to_s(at_timestamp_ns - hmd->created_ns); const double time_s = time_ns_to_s(at_timestamp_ns - hmd->created_ns);
@ -142,6 +142,8 @@ simulated_hmd_get_tracked_pose(struct xrt_device *xdev,
out_relation->relation_flags = (enum xrt_space_relation_flags)(XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | out_relation->relation_flags = (enum xrt_space_relation_flags)(XRT_SPACE_RELATION_ORIENTATION_VALID_BIT |
XRT_SPACE_RELATION_POSITION_VALID_BIT | XRT_SPACE_RELATION_POSITION_VALID_BIT |
XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT); XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT);
return XRT_SUCCESS;
} }
static xrt_result_t static xrt_result_t

View file

@ -426,16 +426,18 @@ Device::get_battery_status(bool *out_present, bool *out_charging, float *out_cha
return XRT_SUCCESS; return XRT_SUCCESS;
} }
void xrt_result_t
HmdDevice::get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns, xrt_space_relation *out_relation) HmdDevice::get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns, xrt_space_relation *out_relation)
{ {
switch (name) { switch (name) {
case XRT_INPUT_GENERIC_HEAD_POSE: Device::get_pose(at_timestamp_ns, out_relation); break; case XRT_INPUT_GENERIC_HEAD_POSE: Device::get_pose(at_timestamp_ns, out_relation); break;
default: U_LOG_W("steamvr_lh hmd: Requested pose for unknown name %u", name); break; default: U_LOG_XDEV_UNSUPPORTED_INPUT(this, ctx->log_level, name); return XRT_ERROR_INPUT_UNSUPPORTED;
}
} }
void return XRT_SUCCESS;
}
xrt_result_t
ControllerDevice::get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns, xrt_space_relation *out_relation) ControllerDevice::get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns, xrt_space_relation *out_relation)
{ {
xrt_space_relation rel = {}; xrt_space_relation rel = {};
@ -453,6 +455,8 @@ ControllerDevice::get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns
struct xrt_pose *p = &out_relation->pose; struct xrt_pose *p = &out_relation->pose;
DEV_DEBUG("controller %u: GET_POSITION (%f %f %f) GET_ORIENTATION (%f, %f, %f, %f)", name, p->position.x, DEV_DEBUG("controller %u: GET_POSITION (%f %f %f) GET_ORIENTATION (%f, %f, %f, %f)", name, p->position.x,
p->position.y, p->position.z, p->orientation.x, p->orientation.y, p->orientation.z, p->orientation.w); p->position.y, p->position.z, p->orientation.x, p->orientation.y, p->orientation.z, p->orientation.w);
return XRT_SUCCESS;
} }
void void

View file

@ -69,7 +69,7 @@ public:
handle_properties(const vr::PropertyWrite_t *batch, uint32_t count); handle_properties(const vr::PropertyWrite_t *batch, uint32_t count);
//! Maps to @ref xrt_device::get_tracked_pose. //! Maps to @ref xrt_device::get_tracked_pose.
virtual void virtual xrt_result_t
get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns, xrt_space_relation *out_relation) = 0; get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns, xrt_space_relation *out_relation) = 0;
xrt_result_t xrt_result_t
@ -116,7 +116,7 @@ public:
HmdDevice(const DeviceBuilder &builder); HmdDevice(const DeviceBuilder &builder);
void xrt_result_t
get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns, xrt_space_relation *out_relation) override; get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns, xrt_space_relation *out_relation) override;
void void
@ -168,7 +168,7 @@ public:
void void
set_haptic_handle(vr::VRInputComponentHandle_t handle); set_haptic_handle(vr::VRInputComponentHandle_t handle);
void xrt_result_t
get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns, xrt_space_relation *out_relation) override; get_tracked_pose(xrt_input_name name, uint64_t at_timestamp_ns, xrt_space_relation *out_relation) override;
IndexFingerInput * IndexFingerInput *

View file

@ -324,7 +324,7 @@ verify_device_name(struct survive_device *survive, enum xrt_input_name name)
return false; return false;
} }
static void static xrt_result_t
survive_device_get_tracked_pose(struct xrt_device *xdev, survive_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -332,13 +332,13 @@ survive_device_get_tracked_pose(struct xrt_device *xdev,
{ {
struct survive_device *survive = (struct survive_device *)xdev; struct survive_device *survive = (struct survive_device *)xdev;
if (!verify_device_name(survive, name)) { if (!verify_device_name(survive, name)) {
SURVIVE_ERROR(survive, "unknown input name"); U_LOG_XDEV_UNSUPPORTED_INPUT(&survive->base, survive->sys->log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
if (!survive->survive_obj) { if (!survive->survive_obj) {
// U_LOG_D("Obj not set for %p", (void*)survive); // U_LOG_D("Obj not set for %p", (void*)survive);
return; return XRT_SUCCESS;
} }
// We're pretty sure libsurvive is giving us the IMU pose here, so this works. // We're pretty sure libsurvive is giving us the IMU pose here, so this works.
@ -356,6 +356,7 @@ survive_device_get_tracked_pose(struct xrt_device *xdev,
struct xrt_pose *p = &out_relation->pose; struct xrt_pose *p = &out_relation->pose;
SURVIVE_TRACE(survive, "GET_POSITION (%f %f %f) GET_ORIENTATION (%f, %f, %f, %f)", p->position.x, p->position.y, SURVIVE_TRACE(survive, "GET_POSITION (%f %f %f) GET_ORIENTATION (%f, %f, %f, %f)", p->position.x, p->position.y,
p->position.z, p->orientation.x, p->orientation.y, p->orientation.z, p->orientation.w); p->position.z, p->orientation.x, p->orientation.y, p->orientation.z, p->orientation.w);
return XRT_SUCCESS;
} }
static xrt_result_t static xrt_result_t

View file

@ -84,7 +84,7 @@ twrap_hmd_correct_pose_from_basalt(struct xrt_pose pose)
} }
#endif #endif
static void static xrt_result_t
twrap_slam_get_tracked_pose(struct xrt_device *xdev, twrap_slam_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -93,8 +93,8 @@ twrap_slam_get_tracked_pose(struct xrt_device *xdev,
struct slam_device *dx = slam_device(xdev); struct slam_device *dx = slam_device(xdev);
if (name != XRT_INPUT_GENERIC_TRACKER_POSE) { if (name != XRT_INPUT_GENERIC_TRACKER_POSE) {
SLAM_ERROR(dx, "unknown input name %d", name); U_LOG_XDEV_UNSUPPORTED_INPUT(&dx->base, dx->log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
#ifdef XRT_FEATURE_SLAM #ifdef XRT_FEATURE_SLAM
if (!dx->use_3dof) { if (!dx->use_3dof) {
@ -109,7 +109,7 @@ twrap_slam_get_tracked_pose(struct xrt_device *xdev,
if (!pose_tracked) { if (!pose_tracked) {
U_ZERO(&out_relation->relation_flags); U_ZERO(&out_relation->relation_flags);
return; return XRT_SUCCESS;
} }
basalt_rel.pose = twrap_hmd_correct_pose_from_basalt(basalt_rel.pose); basalt_rel.pose = twrap_hmd_correct_pose_from_basalt(basalt_rel.pose);
@ -127,11 +127,12 @@ twrap_slam_get_tracked_pose(struct xrt_device *xdev,
} }
m_relation_chain_resolve(&xrc, out_relation); m_relation_chain_resolve(&xrc, out_relation);
return; return XRT_SUCCESS;
} }
#endif #endif
m_relation_history_get(dx->dof3->rh, at_timestamp_ns, out_relation); m_relation_history_get(dx->dof3->rh, at_timestamp_ns, out_relation);
return XRT_SUCCESS;
} }
static void static void

View file

@ -410,7 +410,7 @@ vive_controller_get_hand_tracking(struct xrt_device *xdev,
out_value->is_active = true; out_value->is_active = true;
} }
static void static xrt_result_t
vive_controller_device_get_tracked_pose(struct xrt_device *xdev, vive_controller_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -421,11 +421,13 @@ vive_controller_device_get_tracked_pose(struct xrt_device *xdev,
// U_LOG_D("input name %d %d", name, XRT_INPUT_VIVE_GRIP_POSE); // U_LOG_D("input name %d %d", name, XRT_INPUT_VIVE_GRIP_POSE);
if (name != XRT_INPUT_VIVE_AIM_POSE && name != XRT_INPUT_VIVE_GRIP_POSE && name != XRT_INPUT_INDEX_AIM_POSE && if (name != XRT_INPUT_VIVE_AIM_POSE && name != XRT_INPUT_VIVE_GRIP_POSE && name != XRT_INPUT_INDEX_AIM_POSE &&
name != XRT_INPUT_INDEX_GRIP_POSE) { name != XRT_INPUT_INDEX_GRIP_POSE) {
VIVE_ERROR(d, "unknown input name"); U_LOG_XDEV_UNSUPPORTED_INPUT(&d->base, d->log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
get_pose(d, name, at_timestamp_ns, out_relation); get_pose(d, name, at_timestamp_ns, out_relation);
return XRT_SUCCESS;
} }
static int static int

View file

@ -106,7 +106,7 @@ vive_device_update_inputs(struct xrt_device *xdev)
return XRT_SUCCESS; return XRT_SUCCESS;
} }
static void static xrt_result_t
vive_device_get_3dof_tracked_pose(struct xrt_device *xdev, vive_device_get_3dof_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
uint64_t at_timestamp_ns, uint64_t at_timestamp_ns,
@ -117,8 +117,8 @@ vive_device_get_3dof_tracked_pose(struct xrt_device *xdev,
struct vive_device *d = vive_device(xdev); struct vive_device *d = vive_device(xdev);
if (name != XRT_INPUT_GENERIC_HEAD_POSE) { if (name != XRT_INPUT_GENERIC_HEAD_POSE) {
U_LOG_E("unknown input name"); U_LOG_XDEV_UNSUPPORTED_INPUT(&d->base, u_log_get_global_level(), name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
struct xrt_space_relation relation = {0}; struct xrt_space_relation relation = {0};
@ -131,6 +131,8 @@ vive_device_get_3dof_tracked_pose(struct xrt_device *xdev,
*out_relation = relation; *out_relation = relation;
d->pose = out_relation->pose; d->pose = out_relation->pose;
return XRT_SUCCESS;
} }
//! Specific pose corrections for Basalt and a Valve Index headset //! Specific pose corrections for Basalt and a Valve Index headset
@ -179,7 +181,7 @@ vive_device_get_slam_tracked_pose(struct xrt_device *xdev,
XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | XRT_SPACE_RELATION_POSITION_TRACKED_BIT); XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | XRT_SPACE_RELATION_POSITION_TRACKED_BIT);
} }
static void static xrt_result_t
vive_device_get_tracked_pose(struct xrt_device *xdev, vive_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -192,14 +194,20 @@ vive_device_get_tracked_pose(struct xrt_device *xdev,
// Ajdust the timestamp with the offset. // Ajdust the timestamp with the offset.
at_timestamp_ns += (int64_t)(d->tracked_offset_ms.val * (double)U_TIME_1MS_IN_NS); at_timestamp_ns += (int64_t)(d->tracked_offset_ms.val * (double)U_TIME_1MS_IN_NS);
xrt_result_t xret = XRT_SUCCESS;
if (d->tracking.slam_enabled && d->slam_over_3dof) { if (d->tracking.slam_enabled && d->slam_over_3dof) {
vive_device_get_slam_tracked_pose(xdev, name, at_timestamp_ns, out_relation); vive_device_get_slam_tracked_pose(xdev, name, at_timestamp_ns, out_relation);
} else { } else {
vive_device_get_3dof_tracked_pose(xdev, name, at_timestamp_ns, out_relation); xret = vive_device_get_3dof_tracked_pose(xdev, name, at_timestamp_ns, out_relation);
} }
if (xret == XRT_SUCCESS) {
math_pose_transform(&d->offset, &out_relation->pose, &out_relation->pose); math_pose_transform(&d->offset, &out_relation->pose, &out_relation->pose);
} }
return xret;
}
static void static void
vive_device_get_view_poses(struct xrt_device *xdev, vive_device_get_view_poses(struct xrt_device *xdev,
const struct xrt_vec3 *default_eye_relation, const struct xrt_vec3 *default_eye_relation,

View file

@ -443,7 +443,7 @@ read_controller_config(struct wmr_controller_base *wcb)
return true; return true;
} }
static void static xrt_result_t
wmr_controller_base_get_tracked_pose(struct xrt_device *xdev, wmr_controller_base_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -479,13 +479,15 @@ wmr_controller_base_get_tracked_pose(struct xrt_device *xdev,
// No prediction needed. // No prediction needed.
if (at_timestamp_ns < last_imu_timestamp_ns) { if (at_timestamp_ns < last_imu_timestamp_ns) {
*out_relation = relation; *out_relation = relation;
return; return XRT_SUCCESS;
} }
int64_t prediction_ns = at_timestamp_ns - last_imu_timestamp_ns; int64_t prediction_ns = at_timestamp_ns - last_imu_timestamp_ns;
double prediction_s = time_ns_to_s(prediction_ns); double prediction_s = time_ns_to_s(prediction_ns);
m_predict_relation(&relation, prediction_s, out_relation); m_predict_relation(&relation, prediction_s, out_relation);
return XRT_SUCCESS;
} }
void void

View file

@ -1073,7 +1073,7 @@ wmr_read_config(struct wmr_hmd *wh)
* *
*/ */
static void static xrt_result_t
wmr_hmd_get_3dof_tracked_pose(struct xrt_device *xdev, wmr_hmd_get_3dof_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
uint64_t at_timestamp_ns, uint64_t at_timestamp_ns,
@ -1084,8 +1084,8 @@ wmr_hmd_get_3dof_tracked_pose(struct xrt_device *xdev,
struct wmr_hmd *wh = wmr_hmd(xdev); struct wmr_hmd *wh = wmr_hmd(xdev);
if (name != XRT_INPUT_GENERIC_HEAD_POSE) { if (name != XRT_INPUT_GENERIC_HEAD_POSE) {
WMR_ERROR(wh, "Unknown input name"); U_LOG_XDEV_UNSUPPORTED_INPUT(&wh->base, wh->log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
// Variables needed for prediction. // Variables needed for prediction.
@ -1105,7 +1105,7 @@ wmr_hmd_get_3dof_tracked_pose(struct xrt_device *xdev,
// No prediction needed. // No prediction needed.
if (at_timestamp_ns < last_imu_timestamp_ns) { if (at_timestamp_ns < last_imu_timestamp_ns) {
*out_relation = relation; *out_relation = relation;
return; return XRT_SUCCESS;
} }
uint64_t prediction_ns = at_timestamp_ns - last_imu_timestamp_ns; uint64_t prediction_ns = at_timestamp_ns - last_imu_timestamp_ns;
@ -1113,6 +1113,8 @@ wmr_hmd_get_3dof_tracked_pose(struct xrt_device *xdev,
m_predict_relation(&relation, prediction_s, out_relation); m_predict_relation(&relation, prediction_s, out_relation);
wh->pose = out_relation->pose; wh->pose = out_relation->pose;
return XRT_SUCCESS;
} }
//! Specific pose corrections for Basalt and a WMR headset //! Specific pose corrections for Basalt and a WMR headset
@ -1165,7 +1167,7 @@ wmr_hmd_get_slam_tracked_pose(struct xrt_device *xdev,
XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | XRT_SPACE_RELATION_POSITION_TRACKED_BIT); XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | XRT_SPACE_RELATION_POSITION_TRACKED_BIT);
} }
static void static xrt_result_t
wmr_hmd_get_tracked_pose(struct xrt_device *xdev, wmr_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -1177,14 +1179,20 @@ wmr_hmd_get_tracked_pose(struct xrt_device *xdev,
at_timestamp_ns += (int64_t)(wh->tracked_offset_ms.val * (double)U_TIME_1MS_IN_NS); at_timestamp_ns += (int64_t)(wh->tracked_offset_ms.val * (double)U_TIME_1MS_IN_NS);
xrt_result_t xret = XRT_SUCCESS;
if (wh->tracking.slam_enabled && wh->slam_over_3dof) { if (wh->tracking.slam_enabled && wh->slam_over_3dof) {
wmr_hmd_get_slam_tracked_pose(xdev, name, at_timestamp_ns, out_relation); wmr_hmd_get_slam_tracked_pose(xdev, name, at_timestamp_ns, out_relation);
} else { } else {
wmr_hmd_get_3dof_tracked_pose(xdev, name, at_timestamp_ns, out_relation); xret = wmr_hmd_get_3dof_tracked_pose(xdev, name, at_timestamp_ns, out_relation);
} }
if (xret == XRT_SUCCESS) {
math_pose_transform(&wh->offset, &out_relation->pose, &out_relation->pose); math_pose_transform(&wh->offset, &out_relation->pose, &out_relation->pose);
} }
return xret;
}
static void static void
wmr_hmd_destroy(struct xrt_device *xdev) wmr_hmd_destroy(struct xrt_device *xdev)
{ {

View file

@ -1049,7 +1049,7 @@ xreal_air_hmd_update_inputs(struct xrt_device *xdev)
return XRT_SUCCESS; return XRT_SUCCESS;
} }
static void static xrt_result_t
xreal_air_hmd_get_tracked_pose(struct xrt_device *xdev, xreal_air_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -1058,8 +1058,8 @@ xreal_air_hmd_get_tracked_pose(struct xrt_device *xdev,
struct xreal_air_hmd *hmd = xreal_air_hmd(xdev); struct xreal_air_hmd *hmd = xreal_air_hmd(xdev);
if (name != XRT_INPUT_GENERIC_HEAD_POSE) { if (name != XRT_INPUT_GENERIC_HEAD_POSE) {
XREAL_AIR_ERROR(hmd, "unknown input name"); U_LOG_XDEV_UNSUPPORTED_INPUT(&hmd->base, hmd->log_level, name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
const enum xrt_space_relation_flags flags = (enum xrt_space_relation_flags)( const enum xrt_space_relation_flags flags = (enum xrt_space_relation_flags)(
@ -1076,6 +1076,7 @@ xreal_air_hmd_get_tracked_pose(struct xrt_device *xdev,
// Make sure that the orientation is valid. // Make sure that the orientation is valid.
math_quat_normalize(&out_relation->pose.orientation); math_quat_normalize(&out_relation->pose.orientation);
return XRT_SUCCESS;
} }
static void static void

View file

@ -319,7 +319,7 @@ struct xrt_device
* *
* @see xrt_input_name * @see xrt_input_name
*/ */
void (*get_tracked_pose)(struct xrt_device *xdev, xrt_result_t (*get_tracked_pose)(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation); struct xrt_space_relation *out_relation);
@ -580,8 +580,7 @@ xrt_device_get_tracked_pose(struct xrt_device *xdev,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
struct xrt_space_relation *out_relation) struct xrt_space_relation *out_relation)
{ {
xdev->get_tracked_pose(xdev, name, at_timestamp_ns, out_relation); return xdev->get_tracked_pose(xdev, name, at_timestamp_ns, out_relation);
return XRT_SUCCESS;
} }
/*! /*!

View file

@ -82,7 +82,7 @@ ipc_client_device_update_inputs(struct xrt_device *xdev)
IPC_CHK_ALWAYS_RET(icd->ipc_c, xret, "ipc_call_device_update_input"); IPC_CHK_ALWAYS_RET(icd->ipc_c, xret, "ipc_call_device_update_input");
} }
static void static xrt_result_t
ipc_client_device_get_tracked_pose(struct xrt_device *xdev, ipc_client_device_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -96,7 +96,7 @@ ipc_client_device_get_tracked_pose(struct xrt_device *xdev,
name, // name, //
at_timestamp_ns, // at_timestamp_ns, //
out_relation); // out_relation); //
IPC_CHK_ONLY_PRINT(icd->ipc_c, xret, "ipc_call_device_get_tracked_pose"); IPC_CHK_ALWAYS_RET(icd->ipc_c, xret, "ipc_call_device_get_tracked_pose");
} }
static void static void

View file

@ -149,7 +149,7 @@ ipc_client_hmd_update_inputs(struct xrt_device *xdev)
IPC_CHK_ALWAYS_RET(ich->ipc_c, xret, "ipc_call_device_update_input"); IPC_CHK_ALWAYS_RET(ich->ipc_c, xret, "ipc_call_device_update_input");
} }
static void static xrt_result_t
ipc_client_hmd_get_tracked_pose(struct xrt_device *xdev, ipc_client_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -164,7 +164,7 @@ ipc_client_hmd_get_tracked_pose(struct xrt_device *xdev,
name, // name, //
at_timestamp_ns, // at_timestamp_ns, //
out_relation); // out_relation); //
IPC_CHK_ONLY_PRINT(ich->ipc_c, xret, "ipc_call_device_get_tracked_pose"); IPC_CHK_ALWAYS_RET(ich->ipc_c, xret, "ipc_call_device_get_tracked_pose");
} }
static void static void

View file

@ -14,7 +14,7 @@
#include "util/u_distortion_mesh.h" #include "util/u_distortion_mesh.h"
static void static xrt_result_t
sdl_hmd_get_tracked_pose(struct xrt_device *xdev, sdl_hmd_get_tracked_pose(struct xrt_device *xdev,
enum xrt_input_name name, enum xrt_input_name name,
int64_t at_timestamp_ns, int64_t at_timestamp_ns,
@ -23,8 +23,8 @@ sdl_hmd_get_tracked_pose(struct xrt_device *xdev,
struct sdl_program *sp = from_xdev(xdev); struct sdl_program *sp = from_xdev(xdev);
if (name != XRT_INPUT_GENERIC_HEAD_POSE) { if (name != XRT_INPUT_GENERIC_HEAD_POSE) {
U_LOG_E("Unknown input name"); U_LOG_XDEV_UNSUPPORTED_INPUT(&sp->xdev_base, u_log_get_global_level(), name);
return; return XRT_ERROR_INPUT_UNSUPPORTED;
} }
struct xrt_space_relation relation = XRT_SPACE_RELATION_ZERO; struct xrt_space_relation relation = XRT_SPACE_RELATION_ZERO;
@ -37,6 +37,8 @@ sdl_hmd_get_tracked_pose(struct xrt_device *xdev,
XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT; // XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT; //
*out_relation = relation; *out_relation = relation;
return XRT_SUCCESS;
} }
static void static void