Skip to content

Refactor transform tracking to support OpenXR #122

@jcfr

Description

@jcfr

OpenVR

Transforms for controllers, HMD, and trackers can optionally be created and added to the scene.

The update of the transform is done using the following API:

void updateTransformNodeWithControllerPose(vtkEventDataDevice device);
void updateTransformNodeWithHMDPose();
void updateTransformNodesWithTrackerPoses();
void updateTransformNodeWithPose(vtkMRMLTransformNode* node, vr::TrackedDevicePose_t* tdPose);

all transform nodes have the following attributes in common:

VirtualReality.PoseValid  (`True` or `False`)
VirtualReality.PoseStatus (`Uninitialized`, `CalibratingInProgress`, `CalibratingOutOfRange`, `RunningOk`, `RunningOutOfRange`)

Controllers

Based on the state of the controller, the following MRML attributes are set:

VirtualReality.ControllerActive
VirtualReality.ControllerConnected

Additionally, the position of each controller is updated leveraging the OpenVR specific API vtkOpenVRRenderWindow::GetOpenVRPose()

HMD

Based on the retrieve state, the attribute VirtualReality.HMDActive is set:

if (tdPose == nullptr || tdPose->eTrackingResult != vr::TrackingResult_Running_OK)
{
node->SetAttribute("VirtualReality.HMDActive", "0");
}
else
{
node->SetAttribute("VirtualReality.HMDActive", "1");
}

Generic trackers

In additional of the common attributes, the transform nodes for the generic trackers are named "VirtualReality.GenericTracker" and set with these attributes:

VirtualReality.VRDeviceID
VirtualReality.TrackerActive

Related issues:

OpenXR

Since the vtkRenderingOpenXR API (and by extension the OpenXR specification ?) does not provide a way to get the state of the controllers & trackers:

  • can the validity of the pose be inferred from the associated transform ?
  • or do we need to improve vtkRenderingOpenXR API ?

To help answer, here are few observations:

  • VirtualReality.TrackerActive, VirtualReality.HMDActive and VirtualReality.ControllerActive are set but not used (in SlicerVirtualReality extension)
  • VirtualReality.PoseStatus is used in qMRMLVirtualRealityTransformWidget::updateWidgetFromMRML to exit if there are no change compared to the last status, or update the the icon representing the status of each trackers (including HMD and controllers)
  • VirtualReality.VRDeviceID is set but not used (in SlicerVirtualReality extension)

Optionally, to improve the user experience, it would be nice to still have a way to report the status of each controllers & trackers.

Based on the observations, the critical information we need to have available through OpenXR are the controllers and trackers transforms.

cc: @LucasGandel @lassoan @cpinter @adamrankin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions