d/rift_s: Fix controllers reporting generic tracker pose

Allow the constellation tracker to retrieve the generic tracker
pose for it to match LEDs against
This commit is contained in:
Jan Schmidt committed 2026-03-25 17:50:34 +11:00
1 parent 70753635bd
commit a69e3a4e2b
2 files changed
+16 -9

No files matched your search

+13 -9
View File
@@ -539,21 +539,17 @@ rift_s_controller_get_tracked_pose(struct xrt_device *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 &&
name != XRT_INPUT_GENERIC_TRACKER_POSE) {
U_LOG_XDEV_UNSUPPORTED_INPUT(&ctrl->base, rift_s_log_level, name);
return XRT_ERROR_INPUT_UNSUPPORTED;
}
struct xrt_relation_chain xrc = {0};
struct xrt_pose pose_correction = {0};
/* Rotate the grip/aim pose up by 40 degrees around the X axis */
struct xrt_vec3 axis = {1.0, 0, 0};
math_quat_from_angle_vector(DEG_TO_RAD(40), &axis, &pose_correction.orientation);
m_relation_chain_push_pose(&xrc, &pose_correction);
if (name == XRT_INPUT_TOUCH_GRIP_POSE) {
m_relation_chain_push_pose(&xrc, &ctrl->P_aim_grip);
}
/* Apply the fusion rotation */
struct xrt_space_relation *rel = m_relation_chain_reserve(&xrc);
@@ -562,6 +558,8 @@ rift_s_controller_get_tracked_pose(struct xrt_device *xdev,
rift_s_controller_get_fusion_pose(ctrl, name, at_timestamp_ns, rel);
if (ctrl->last_tracked_pose_ts != 0) {
rel->pose.position = ctrl->last_tracked_pose.position;
rel->relation_flags |= (enum xrt_space_relation_flags)(XRT_SPACE_RELATION_POSITION_VALID_BIT |
XRT_SPACE_RELATION_POSITION_TRACKED_BIT);
}
os_mutex_unlock(&ctrl->mutex);
@@ -699,6 +697,12 @@ rift_s_controller_create(struct rift_s_system *sys, enum xrt_device_type device_
os_mutex_init(&ctrl->mutex);
/* Default grip pose up by 40° degrees around the X axis */
struct xrt_vec3 translation = {0.0, 0, 0.0};
struct xrt_vec3 axis = {1.0, 0, 0};
math_quat_from_angle_vector(DEG_TO_RAD(40), &axis, &ctrl->P_aim_grip.orientation);
ctrl->P_aim_grip.position = translation;
u_device_populate_function_pointers(&ctrl->base, rift_s_controller_get_tracked_pose, rift_s_controller_destroy);
ctrl->base.update_inputs = rift_s_controller_update_inputs;
ctrl->base.get_view_poses = u_device_get_view_poses;
@@ -83,6 +83,9 @@ struct rift_s_controller
struct xrt_vec3 mag;
struct m_imu_3dof fusion;
//! Offset for grip pose
struct xrt_pose P_aim_grip;
/* Controls / buttons state */
timepoint_ns last_controls_local_time_ns;