ValveSoftware / openvr

OpenVR SDK
http://steamvr.com
BSD 3-Clause "New" or "Revised" License
6.06k stars 1.27k forks source link

GetTrackedDeviceIndexForControllerRole can return a tracker as a hand when both hands have knuckles controllers #1037

Open TurtleSimos opened 5 years ago

TurtleSimos commented 5 years ago

Running Steam VR Beta 1.2.10, Unreal Engine 4.21.2 with some source changes to the SteamVR plugin (extended slightly to support knuckles). Using Knuckles EV3, with 3 Vive trackers.

The issue is that sometimes GetTrackedDeviceIndexForControllerRole(vr::TrackedControllerRole_LeftHand) or GetTrackedDeviceIndexForControllerRole(vr::TrackedControllerRole_RightHand) will return a device index for one of the trackers. Both knuckles controllers are registered and tracking fine at this time.

In the UE4 plugin this triggers DetectHandednessSwap which then assigns the tracker coming back as one of the hands from GetTrackedDeviceIndexForControllerRole. If I bring up the SteamVR menu all devices are still seen to be tracking.

I've worked around it by adding a check of GetTrackedDeviceClass inside DetectHandednessSwap int he UE4 plugin and rejecting anything that isn't TrackedDeviceClass_Controller.

Note, as you can see in my later comment, the root issue seems to be that sometimes a knuckles controller that is tracking will return TrackedControllerRole_Invalid from GetControllerRoleForTrackedDeviceIndex. When a knuckles controller is returning TrackedControllerRole_Invalid it always seems to - but the problem is intermittent. Sometimes it works fine.

TurtleSimos commented 5 years ago

This is the UE side verbose log from one occasion where the tracker tried to replace a knuckle controller.

LogSteamVRController: Verbose: Controller role for device 3 is 1 (invalid=0, left=1, right=2). LogSteamVRController: Verbose: Controller device 3 is being assigned unreal hand 0 (left=0, right=1), for player 0. LogSteamVRController: Verbose: Controller role for device 4 is 0 (invalid=0, left=1, right=2). LogSteamVRController: Verbose: Controller 4 was invalid, trying to figure out hand : Knuckles EV3.0 Right LogSteamVRController: Verbose: setting to TrackedControllerRole_RightHand LogSteamVRController: Verbose: Controller device 4 is being assigned unreal hand 1 (left=0, right=1), for player 0. LogSteamVRController: Tracker device 5 is being assigned unreal hand: Special 1, for player 0 LogSteamVRController: Tracker device 6 is being assigned unreal hand: Special 2, for player 0 LogSteamVRController: Tracker device 7 is being assigned unreal hand: Special 3, for player 0

TurtleSimos commented 5 years ago

Note, this bit: LogSteamVRController: Verbose: Controller 4 was invalid, trying to figure out hand : Knuckles EV3.0 Right LogSteamVRController: Verbose: setting to TrackedControllerRole_RightHand Is from a fix I've added. When a controller isn't registered as a hand, I check the device - if it is a knuckles controller, the name tells the hand. So, I've worked around the bug with the hand assignment there, but it's the same issue.