The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/twrap: Correct axis assignments for poses provided by basalt slam.

Testing with a Luxonis Oak-D Pro with basalt slam tracking on a simulated
Northstar suggests the returned axis from basalt vit are wrong wrt. to
the OpenXR reference frame.

Invert assigned y and z axis, similar to what is done for poses returned
by basalt slam for other HMD drivers, e.g., the drivers for Rift-S, Valve
Index / Vive, WMR and Realsense, in various *_correct_pose_from_basalt()
functions.

While we are at it, also make sure the dx->pre_rotate enable flag and
debug UI checkbox actually has an effect on operation.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2228>

authored by

Mario Kleiner and committed by
Marge Bot
be55dec1 09273292

+17 -3
+17 -3
src/xrt/drivers/twrap/twrap_slam.c
··· 72 72 return (struct slam_device *)xdev; 73 73 } 74 74 75 + static struct xrt_pose 76 + twrap_hmd_correct_pose_from_basalt(struct xrt_pose pose) 77 + { 78 + pose.position.y = -pose.position.y; 79 + pose.position.z = -pose.position.z; 80 + pose.orientation.y = -pose.orientation.y; 81 + pose.orientation.z = -pose.orientation.z; 82 + return pose; 83 + } 84 + 75 85 static void 76 86 twrap_slam_get_tracked_pose(struct xrt_device *xdev, 77 87 enum xrt_input_name name, ··· 100 110 return; 101 111 } 102 112 113 + basalt_rel.pose = twrap_hmd_correct_pose_from_basalt(basalt_rel.pose); 114 + 103 115 struct xrt_relation_chain xrc = {0}; 104 116 105 117 m_relation_chain_push_relation(&xrc, &basalt_rel); 106 118 107 119 108 120 109 - struct xrt_pose pre = {0}; 110 - math_quat_from_plus_x_z(&dx->pre_rotate_x, &dx->pre_rotate_z, &pre.orientation); 111 - m_relation_chain_push_pose(&xrc, &pre); 121 + if (dx->pre_rotate) { 122 + struct xrt_pose pre = {0}; 123 + math_quat_from_plus_x_z(&dx->pre_rotate_x, &dx->pre_rotate_z, &pre.orientation); 124 + m_relation_chain_push_pose(&xrc, &pre); 125 + } 112 126 113 127 m_relation_chain_resolve(&xrc, out_relation); 114 128 return;