Skip to content

Conversation

@curoviyxru
Copy link
Contributor

@curoviyxru curoviyxru commented Feb 18, 2025

Works fine but I'm not sure about binding trackers to body joints.

Copy link
Member

@zmerp zmerp left a comment

Choose a reason for hiding this comment

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

Is this code able to track individual trackers or only for let tracking when wore? If the latter, what is the advantage over XR_BD_body_tracking?

@curoviyxru
Copy link
Contributor Author

curoviyxru commented Feb 19, 2025

Is this code able to track individual trackers or only for let tracking when wore?

First. Pico Motion Trackers have two modes: body tracking and object tracking. While body tracking uses some prediction model and gives body joints positions, object tracking allows to get position of each tracker.

At first I wanted to add mode switch in ALVR settings but then I found being able to switch tracker mode on the fly is pretty great.

@0JXI0
Copy link

0JXI0 commented Feb 19, 2025

Hey, just built this, and when I turn on the full-body option in the server the game render time spikes up and causes a constant stutter in the headset.
image

@curoviyxru curoviyxru changed the title feat: PMT object tracking support feat: Pico Motion Trackers object tracking support Feb 23, 2025
Copy link
Member

@zmerp zmerp left a comment

Choose a reason for hiding this comment

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

Apart from a couple of nits I forgot to mention before, the PR looks good architecture and style-wise. I'm worried a bit about @0JXI0 's performance issues

transform_draw(&mut pass, view_proj * transform, 4);
}

fn draw_crosshair(
Copy link
Member

@zmerp zmerp Feb 25, 2025

Choose a reason for hiding this comment

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

Should be "crossair" without "h". Actually it should be cross-air, but when there is a hyphenated word i usually remove the space in between when using snake_case

Copy link
Collaborator

Choose a reason for hiding this comment

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

What's a 'cross-air'? Crosshair would actually make sense, tho perhaps not the best word?

Copy link
Member

Choose a reason for hiding this comment

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

Oh damn, you're right. it's actually a single word, not cross-hair lol. @curoviyxru let's revert this back to crosshair

Copy link
Member

Choose a reason for hiding this comment

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

The etymology is actually correct for "hair", where hair, spiderwebs or wires were used for the scopes

@curoviyxru
Copy link
Contributor Author

It should be better with latest commit I think. @0JXI0, could you test it again, please?

@0JXI0
Copy link

0JXI0 commented Feb 25, 2025

@curoviyxru Sorry for not responding sooner. I've built this with the latest commits you've added and the performance is better but it's still around 10-15ms (30ms before) on the game render when it should be around 4-6ms.

@0JXI0
Copy link

0JXI0 commented Feb 25, 2025

Oh forgot to mention, the performance is fine when the object tracker mode in ALVR is disabled

@curoviyxru
Copy link
Contributor Author

curoviyxru commented Feb 27, 2025

It was slow xrGetMotionTrackerModeBD so I've added switch for body/object tracking mode.

@curoviyxru curoviyxru requested a review from zmerp February 27, 2025 14:56
@zmerp
Copy link
Member

zmerp commented Feb 28, 2025

@curoviyxru Your solution doesn't work. The pico trackers shouldn't be handled on the c++ code. in alvr_server_openvr, in tracking.rs, add a funnction to map client trackers with SteamVR vive trackers. Currently we just pass them straight to the c++ code, and we are using the same paths for client and SteamVR, but we should now add the mapping step. So using the mapping system, we don't always enable all SteamVR trackers. We should enable a SteamVR tracker only if it is mapped to a client tracker path, because I don't think it would be useful to create an unmapped tracker. Furthermore, we should allow a SteamVR tracker to be mapped to multiple client tracker paths, so it will work for Pico, Meta and HTC.

The mapping setting should have type Vec<(String, Vec<String>)> which will translate to a Dictionary of Vectors

Copy link
Member

@zmerp zmerp left a comment

Choose a reason for hiding this comment

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

You haven't implemented the tracker remapping system but the solution to default to hips and feet is fine to me

enabled: true,
content: BodyTrackingBDConfigDefault {
body_tracking: true,
object_tracking: false,
Copy link
Member

Choose a reason for hiding this comment

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

Object tracking should default to true, like body_tracking. You said that you select which to enable in the system settings, and they are mutually exclusive. I might be still misunderstanding things, but doesn't either body tracking or object tracking fail to initialize or to poll tracking data because it is disabled in the system settings? so if we attempt to use both we have the certainty that at least one works

Copy link
Contributor Author

@curoviyxru curoviyxru Mar 4, 2025

Choose a reason for hiding this comment

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

get_motion_tracker_locations works anyway ignoring current mode setting in Motion Tracker app.

Copy link
Member

@zmerp zmerp Mar 5, 2025

Choose a reason for hiding this comment

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

Oh hm. But what do you mean with "works"? Can you poll the data but it would be null if the user sets body tracking mode, or polling always returns valid data regardless of the user setting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It always returns valid data regardless of the user setting, yeah.

Copy link
Member

Choose a reason for hiding this comment

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

In that case, let's go back to your idea of having mutually exclusive body and object tracking, using an enum. Sorry for the confusion.

{
let mut joints = Vec::<(u64, DeviceMotion)>::with_capacity(3);

let joints_ids = [*BODY_LEFT_FOOT_ID, *BODY_RIGHT_FOOT_ID, *BODY_HIPS_ID];
Copy link
Member

Choose a reason for hiding this comment

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

The order I wold use as default is first hips, then left and right feet. This is because of games like VRchat, where the minimum tracker configuration is only hips, then you can add feet.

@curoviyxru
Copy link
Contributor Author

Yeah, it is not an implementation of remapping system.

I don't have a full understanding how this system should work and how it should be implemented so I've just pushed things that are unrelated to it.

@curoviyxru curoviyxru requested a review from zmerp March 5, 2025 15:19
@zmerp
Copy link
Member

zmerp commented Mar 5, 2025

Sorry for going back and forth on this, but let's leave out the tracker mapping system for now. I think the solution of exposing hips then left and right feet is alright. Don't throw away your code, you can make a separate PR with the tracker mapping system after we merge this PR.

@curoviyxru curoviyxru force-pushed the pico-object-tracking branch from 29c114d to be52c8b Compare March 5, 2025 23:00
Copy link
Member

@zmerp zmerp left a comment

Choose a reason for hiding this comment

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

Overall looks good to me. Only one last thing: add a help string for the body_tracking_bd setting saying that it's recommended to set trackers mode as body tracking in the system settings (use precise name), since that will allow both body and object tracking in ALVR, depending on the choice on the dashboard.

Copy link
Member

@zmerp zmerp left a comment

Choose a reason for hiding this comment

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

Time to merge, finally :)

@zmerp zmerp merged commit d632b50 into alvr-org:master Mar 9, 2025
9 checks passed
zmerp pushed a commit that referenced this pull request Mar 9, 2025
* feat: Pico object motion tracking

* style: uses formatting

* refactor: Make draw_crosshair function

* feat: Add velocity for object tracking

* style: Match Bytedance official naming

* refactor: Store Session instead of Instance

* refactor: Implement MotionTrackerBD

* refactor: Split body skeleton data back

* chore: Allow clippy's `too_many_arguments`

* chore: Expect clippy's `too_many_arguments`

* refactor: Body and object tracking mode switch

* fix: Reset MotionTrackingBD to None

* refactor: Flatten BodyTrackingBDConfig

* refactor: Make trackers order predictable

* refactor: Add separate trackers for objects

Also fixes full body tracking if body_tracking_fb is disabled.

* refactor: Revert Add separate trackers for objects

* refactor: Capacity change, fullbody fix, crosshair

* refactor: Correct addressed issues

* refactor: Bring back BodyTrackingBDConfig enum

* chore: Add help strings for body tracking options

* Add help string about tracking mode selection
@zmerp zmerp mentioned this pull request Mar 9, 2025
zmerp pushed a commit that referenced this pull request Mar 11, 2025
* feat: Pico object motion tracking

* style: uses formatting

* refactor: Make draw_crosshair function

* feat: Add velocity for object tracking

* style: Match Bytedance official naming

* refactor: Store Session instead of Instance

* refactor: Implement MotionTrackerBD

* refactor: Split body skeleton data back

* chore: Allow clippy's `too_many_arguments`

* chore: Expect clippy's `too_many_arguments`

* refactor: Body and object tracking mode switch

* fix: Reset MotionTrackingBD to None

* refactor: Flatten BodyTrackingBDConfig

* refactor: Make trackers order predictable

* refactor: Add separate trackers for objects

Also fixes full body tracking if body_tracking_fb is disabled.

* refactor: Revert Add separate trackers for objects

* refactor: Capacity change, fullbody fix, crosshair

* refactor: Correct addressed issues

* refactor: Bring back BodyTrackingBDConfig enum

* chore: Add help strings for body tracking options

* Add help string about tracking mode selection
@curoviyxru curoviyxru deleted the pico-object-tracking branch March 20, 2025 21:46
@AwdHanPeng
Copy link

Hi, i want to know how to use the object tracking mode.
i have some trouble, see #3014
thanks so much.

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.

5 participants