Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor transform tracking to support OpenXR #122

Open
jcfr opened this issue Aug 28, 2023 · 0 comments
Open

Refactor transform tracking to support OpenXR #122

jcfr opened this issue Aug 28, 2023 · 0 comments

Comments

@jcfr
Copy link
Contributor

jcfr commented Aug 28, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant