The open source OpenXR runtime
0
fork

Configure Feed

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

d/steamvr_lh: Map TrackingResult to tracked 6DoF/3DoF

- Running_OK → tracked 6DoF:
ORIENTATION_TRACKED | POSITION_TRACKED |
ANGULAR_VELOCITY_VALID | LINEAR_VELOCITY_VALID.

- Fallback_RotationOnly and Running_OutOfRange → tracked 3DoF:
ORIENTATION_TRACKED | ANGULAR_VELOCITY_VALID.
(No POSITION_TRACKED; no LINEAR_VELOCITY_VALID.)

- Calibrating_* results are not marked TRACKED.

When poseIsValid, keep ORIENTATION_VALID and POSITION_VALID, but gate
TRACKED and velocity-valid flags on the SteamVR result to avoid treating
inferred poses as actively tracked and to reduce drift/jumps.

Refs:
- OpenVR Driver API: TrackingResult_* semantics
https://github.com/ValveSoftware/openvr/blob/master/docs/Driver_API_Documentation.md
- OpenXR: XrSpaceLocationFlagBits (valid vs tracked)
https://registry.khronos.org/OpenXR/specs/1.1/man/html/XrSpaceLocationFlagBits.html

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2574>

authored by

Trevor Kerby and committed by
Marge Bot
62013b74 c0c10fd3

+29 -12
+29 -12
src/xrt/drivers/steamvr_lh/device.cpp
··· 759 759 Device::update_pose(const vr::DriverPose_t &newPose) const 760 760 { 761 761 xrt_space_relation relation = {}; 762 - // These relation hookups are a bit seat of the pants however they produce good full body track results 763 - // especially when occluded from basestations linear drift off into space is minimized. 764 - if (newPose.deviceIsConnected) { 765 - relation.relation_flags |= xrt_space_relation_flags::XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | 766 - xrt_space_relation_flags::XRT_SPACE_RELATION_POSITION_TRACKED_BIT; 767 - } 762 + 768 763 if (newPose.poseIsValid) { 769 - relation.relation_flags |= xrt_space_relation_flags::XRT_SPACE_RELATION_LINEAR_VELOCITY_VALID_BIT | 770 - xrt_space_relation_flags::XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT; 771 - } 772 - if (newPose.result == vr::TrackingResult_Running_OK) { 773 - relation.relation_flags |= xrt_space_relation_flags::XRT_SPACE_RELATION_POSITION_VALID_BIT | 774 - xrt_space_relation_flags::XRT_SPACE_RELATION_ORIENTATION_VALID_BIT; 764 + // The pose is known to be valid but that alone is not enough to say whether the data comes from 765 + // inference or if it represents actively tracked position and orientation data. Furthermore we avoid 766 + // assumptions regarding the validity of time-derivatives until we know that they're based on tracked 767 + // data. This is a conservative strategy that should reduce concerns regarding drift. see 768 + // https://registry.khronos.org/OpenXR/specs/1.1/man/html/XrSpaceLocationFlagBits.html 769 + relation.relation_flags |= xrt_space_relation_flags::XRT_SPACE_RELATION_ORIENTATION_VALID_BIT | 770 + xrt_space_relation_flags::XRT_SPACE_RELATION_POSITION_VALID_BIT; 771 + 772 + switch (newPose.result) { 773 + // see https://github.com/ValveSoftware/openvr/blob/master/docs/Driver_API_Documentation.md 774 + case vr::TrackingResult_Running_OK: 775 + // If the tracker is running ok then we have actively tracked 6DoF data 776 + relation.relation_flags |= 777 + xrt_space_relation_flags::XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | 778 + xrt_space_relation_flags::XRT_SPACE_RELATION_POSITION_TRACKED_BIT | 779 + xrt_space_relation_flags::XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT | 780 + xrt_space_relation_flags::XRT_SPACE_RELATION_LINEAR_VELOCITY_VALID_BIT; 781 + break; 782 + case vr::TrackingResult_Fallback_RotationOnly: 783 + case vr::TrackingResult_Running_OutOfRange: 784 + // If the tracking is degraded we should still be able to assume that we still have tracked 3DoF 785 + // data 786 + relation.relation_flags |= 787 + xrt_space_relation_flags::XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | 788 + xrt_space_relation_flags::XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT; 789 + break; 790 + default: break; 791 + } 775 792 } 776 793 777 794 // The driver still outputs good pose data regardless of the pose results above