Skip to content

FIX: Trackedposedriver stops tracking (ISXB-1555) #2189

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

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from

Conversation

ritamerkl
Copy link
Collaborator

@ritamerkl ritamerkl commented Jun 3, 2025

Description

This PR fixes HUP bug ISXB-1555, where the TrackedPoseDriver will not update the position of a gameobject when no tracking action is assigned to the TrackedPoseDriver.
This issue was caused by a change which allowed stopping the tracking when no device is connected.
The fix is to not just disable the tracking once on setup of the TrackedPoseDriver, but adjust the tracking state whenever a device changed and potentially the tracking can be enabled again.

Testing status & QA

No testing yet.

Overall Product Risks

Please rate the potential complexity and halo effect from low to high for the reviewers. Note down potential risks to specific Editor branches if any.

  • Complexity: Low
  • Halo Effect: Low

Comments to reviewers

Please describe any additional information such as what to focus on, or historical info for the reviewers.

Checklist

Before review:

  • Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • JIRA ticket linked, example (case %%). If it is a private issue, just add the case ID without a link.
    • Jira port for the next release set as "Resolved".
  • Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

After merge:

  • Create forward/backward port if needed. If you are blocked from creating a forward port now please add a task to ISX-1444.

@ritamerkl ritamerkl requested review from ekcoh and Pauliusd01 June 3, 2025 09:10
@Pauliusd01
Copy link
Collaborator

I have no XR expertise or devices, will look for an XR QA to add

@codecov-github-com
Copy link

codecov-github-com bot commented Jun 3, 2025

Codecov Report

Attention: Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...system/InputSystem/Plugins/XR/TrackedPoseDriver.cs 92.00% 2 Missing ⚠️
@@             Coverage Diff             @@
##           develop    #2189      +/-   ##
===========================================
+ Coverage    67.80%   67.81%   +0.01%     
===========================================
  Files          367      367              
  Lines        53513    53526      +13     
===========================================
+ Hits         36282    36301      +19     
+ Misses       17231    17225       -6     
Flag Coverage Δ
mac_2021.3_pkg 5.41% <0.00%> (-0.01%) ⬇️
mac_2021.3_project 70.43% <92.00%> (+<0.01%) ⬆️
mac_2022.3_pkg 5.19% <0.00%> (-0.01%) ⬇️
mac_2022.3_project 65.30% <92.00%> (+<0.01%) ⬆️
mac_6000.0_pkg 5.20% <0.00%> (-0.01%) ⬇️
mac_6000.0_project 67.72% <92.00%> (+<0.01%) ⬆️
mac_6000.1_pkg 5.20% <0.00%> (-0.01%) ⬇️
mac_6000.1_project 67.73% <92.00%> (+0.01%) ⬆️
mac_6000.2_pkg 5.20% <0.00%> (-0.01%) ⬇️
mac_6000.2_project 67.71% <92.00%> (+<0.01%) ⬆️
mac_trunk_pkg 5.19% <0.00%> (-0.01%) ⬇️
win_2021.3_pkg 5.42% <0.00%> (-0.01%) ⬇️
win_2021.3_project 70.50% <92.00%> (+<0.01%) ⬆️
win_2022.3_pkg 5.19% <0.00%> (-0.01%) ⬇️
win_2022.3_project 65.37% <92.00%> (+<0.01%) ⬆️
win_6000.0_pkg 5.20% <0.00%> (-0.01%) ⬇️
win_6000.0_project 67.79% <92.00%> (+0.10%) ⬆️
win_6000.1_pkg 5.20% <0.00%> (-0.01%) ⬇️
win_6000.1_project 67.69% <92.00%> (-0.10%) ⬇️
win_6000.2_pkg 5.20% <0.00%> (-0.01%) ⬇️
win_6000.2_project 67.79% <92.00%> (+<0.01%) ⬆️
win_trunk_pkg 5.20% <0.00%> (-0.01%) ⬇️
win_trunk_project 67.78% <92.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...system/InputSystem/Plugins/XR/TrackedPoseDriver.cs 85.42% <92.00%> (+0.67%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Pauliusd01
Copy link
Collaborator

Added @evelinastaniulyte , she's on a hackweek right now but will be able to help us out next week

@Pauliusd01 Pauliusd01 removed their request for review June 3, 2025 12:29
@@ -629,6 +631,54 @@ public void Components_TrackedPoseDriver_DoesNotEnableOrDisableReferenceActions(
Assert.That(trackingStateInput.action.enabled, Is.False);
}

[UnityTest]
[Category("Components")]
public IEnumerator CanUseTrackedPoseDriverWithoutTrackingAction()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this test.

@@ -432,6 +432,7 @@ protected virtual void Awake()
protected void OnEnable()
{
InputSystem.onAfterUpdate += UpdateCallback;
InputSystem.onDeviceChange += OnDeviceChanged;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing I am thinking around this one if it truly captures what would drive an action resolve (or might cause unnecessary checking)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come (before my regression of this) it worked then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tracking was never set to None, but always kept at Position & Rotation when no tracking action was assigned. Like that there was no need to reevaluate the tracking state.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will be some amount of unnecessary checking for sure, if any (not trackable) device is connected/disconnected for instance. But I am wondering if that's so critical, it probably depends on how frequently deviceChange events happen.

Copy link
Collaborator

@ekcoh ekcoh Jun 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a HUP I think we would be fine with this and see it as an optimization if it could be reduced in the future.

Copy link
Collaborator

@ekcoh ekcoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like there are regressions in functional tests of tracked pose driver. I think these needs to be fixed.

@ritamerkl
Copy link
Collaborator Author

Seems like there are regressions in functional tests of tracked pose driver. I think these needs to be fixed.

yes, it caught a case where the device was added before the initialisation of the TrackedPoseDriver started, that's handled now.

@ritamerkl ritamerkl requested a review from ekcoh June 6, 2025 11:30
@evelinastaniulyte
Copy link

Was any dev testing done? It’s not mentioned in the description

@vrdave-unity vrdave-unity requested a review from chris-massie June 9, 2025 16:18
@ritamerkl
Copy link
Collaborator Author

ritamerkl commented Jun 10, 2025

Was any dev testing done? It’s not mentioned in the description

No. I wasn't able to test on the device unfortunately.
The repro project attached to the ticket was built windowed on my Quest2.

Copy link
Collaborator

@ekcoh ekcoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DennisDeRykeUnity
Copy link

@ritamerkl When an app runs in the HMD as non-XR, it is usually because of missing XR Plugin Management settings. Could you try testing against the repro project in ISXB-155 after following the setup steps here?

@evelinastaniulyte In addition to Rita verifying the user's project, could you pick one of the XR templates to test with this? If so, then tell me which template you pick so that I can test with a different one.

@ritamerkl Do these code changes affect screen space input? If so then Evelina or I should test with AR Mobile Template.

@ritamerkl
Copy link
Collaborator Author

@ritamerkl When an app runs in the HMD as non-XR, it is usually because of missing XR Plugin Management settings. Could you try testing against the repro project in ISXB-155 after following the setup steps here?

Unfortunately I do not have access to a Quest device today and I will be on PTO next week. Does someone in the XR team have the opportunity to test on a device? That would be awesome, since it's a HUP and great to land this rather sooner than later.
Otherwise I can try it once I am back.

@ritamerkl Do these code changes affect screen space input? If so then Evelina or I should test with AR Mobile Template.

No, screen space input should not directly be affected.

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

Successfully merging this pull request may close these issues.

6 participants