openvr icon indicating copy to clipboard operation
openvr copied to clipboard

Ways to identify the "active" controller and set it.

Open Camacazi opened this issue 3 years ago • 7 comments

I've been experimenting with using index controllers with a Q2 headset, and something I've noticed is if steamvr is started with the index controllers if I proceed to start/connect a quest 2 controller(required for calibration and initial menu interaction) sometimes it will become the active controller (able to interact with menus/recognised as the controller to be used in a game), and sometimes the previously connected index controllers will remain active.

So my question is is there anything in the API that allows me to see which devices specifically are the "active" ones, and possibly allow me to set which ones are active?

Camacazi avatar Jun 13 '22 11:06 Camacazi

There doesn't seem to be any way of doing it from the API. It is designed to be as controller agnostic as possible, and let SteamVR handle everything internally.

It is possible to set a priority in the driver for which controllers get picked. It is set with optional hand_priority key in the input profile. You can see an example of it set to lower the priority in: SteamVR\drivers\htc\resources\input\tracker\vive_tracker_handed_profile.json

Rectus avatar Jun 14 '22 08:06 Rectus

This seems to have partially resolved my issues, cheers! Experimenting with index_controller priority at 100 (setting touch to -1 or leaving as is didn't seem to make a difference) they consistently take over as active once steamvr has booted. Shutting them off and on again causes the same indetermination, but need to play around with it still, cheers!

Camacazi avatar Jun 14 '22 12:06 Camacazi

Hi @Camacazzi , did the hand_priority only take effect after re-booting SteamVR, or would they kick in instantly after the high priority controllers connect to SteamVR?

I want my controllers to take over the "active" controller role whenever they connect to SteamVR, but right now if there is another device seen as the "active" left/right controller the hand_priority doesn't seem to do anything. Am I misunderstanding how "hand_priority" is used?

These are the changes I made to my input profile files, as suggested by @Rectus :

  • Controller A is "active", but should have less priority: "hand_priority": -1,
  • Controller B to take over the "active" role when turned on: I tried both "hand_priority": 7002, and "hand_priority": 100,

Thanks in advance!

pili-zhangqiu avatar Sep 16 '22 10:09 pili-zhangqiu

@pili-zhangqiu For me I do not need to reboot SteamVR. I will explain my use case. I start up my Quest 2 and connect to SteamVR via Virtual Desktop using only my right controller (so as to not interfere with XSOverlay as it is in my left hand), and then connect my left Index controller (I then may do a space calibration at this point if the index controller is too far away to use the menus properly, and then I connect my right controller. The connecting of the right index controller takes over as the "active" right controller from the Quest 2 touch controller. I can still pick up the Q2 controller and move it around and use it with Space Calibration, but it cannot interact with any menus. However, if I turn off my right index controller, the control will revert back to the Quest 2 controller. From here if I turn my right knuckle back on, it will not take over as the active.

I have the index_controller.json with "hand_priority": 100 and touch_profile.json with "hand_priority" : -100.

Let me know if anything I've said doesn't make sense.

Camacazi avatar Sep 16 '22 11:09 Camacazi

@Camacazzi Thank you so much for the detailed information! Yes, that's the exact behaviour that we wanted for our controllers. However, the controller priority didn't kick in, even when we changed the hand_priority parameters to the same values you used.

May I ask, in your index_controller_profile.json, did you add the hand_priority setting as follows?

{
  "jsonid": "input_profile",
  "controller_type": "knuckles",
  "device_class" : "TrackedDeviceClass_Controller",
  "resource_root" : "indexcontroller",
  "driver_name" : "lighthouse",
  "legacy_binding" :  "{indexcontroller}/input/legacy_bindings_index_controller.json",
  "input_bindingui_mode" : "controller_handed",
  "hand_priority": 100,
  "should_show_binding_errors": true,
  "input_bindingui_left" :
  {
    "image": "{indexcontroller}/icons/indexcontroller_left.svg"
  },
  (file continues...)
 }

pili-zhangqiu avatar Sep 16 '22 13:09 pili-zhangqiu

@pili-zhangqiu Hi mate, sorry for the late reply. That is how I have it set yes. That's disappointing it's not working for you. The only other changes I have made from memory is allowing steamvr to run without a HMD, as described in this post: https://www.reddit.com/r/Vive/comments/6uo053/how_to_use_steamvr_tracked_devices_without_a_hmd/ . (Excluding the "forcedDriver": "null" part, which I do not seem to have used.).

I'm unsure of what else may be causing this to not work, I do use OVR Space Calibrator along with OVR Advanced Settings but I'm unsure if that would make a difference, since I've never set any special settings in them for it to work.

Camacazi avatar Sep 18 '22 13:09 Camacazi

@Camacazzi Hey, thanks for checking your settings!

I also use OVR Advanced Settings, and the OVR Space Calibrator plugin is also installed in the system. The settings for multiple drivers running is also enabled, although I have the HMD active as I am using the Index HMD.

I went back and re-read your message and realised something important from your explanation:

However, if I turn off my right index controller, the control will revert back to the Quest 2 controller. From here if I turn my right knuckle back on, it will not take over as the active.

This happens to me too. I initially have my preferred controllers in the "active" role, but then if those turn off, the secondary controllers take over the "active" controller role, after which my preferred controllers will be unable to take over the "active" role.

My preferred controllers already fulfilled their "hand_priority" role. I wonder if the priority setting disappears after the controller becomes the "active" controller once. This is just speculation, but I will continue browsing online.

In any case, thank you so much for your help! I will update you if I ever find a solution that might improve your experience too. Really appreciate it!

pili-zhangqiu avatar Sep 19 '22 00:09 pili-zhangqiu