The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

aux/binding: Implement optional "steamvr_controllertypes" for SteamVR input bindings

Add an optional switch -s or --steamvr to steamvr_profiles.py, which enables
a different naming scheme for the "controller_type" field in the generated
SteamVR profile json files.

If the switch is provided and an interaction profile in bindings.json
provides the optional new property "steamvr_controllertype", that property
will be used for the "controller_type" field of the written out .json,
instead of the regular auto-generated name.

This allows to generate json files which use controller_type names normally
used by SteamVR, so Monado provided controllers are mapped to the same
OpenXR interaction profiles that SteamVR would normally map them to.
E.g., the standard controller_type for Oculus touch controllers used by
SteamVR is "oculus_touch" instead of Monado's "monado_oculus_touch_controller".

That in turn allows OpenXR clients to use the SteamVR/OpenXR runtime to
access controllers provided by Monado's SteamVR driver plugin. Without such
compatible json files, only standard OpenVR clients can use controllers
exposed by Monado's SteamVR driver by default, but not OpenXR clients.

Tested with an Oculus Rift CV-1, and shown to now enable OpenXR clients
to make full use of the Oculus touch controllers.

The mappings for controllers other than Oculus Touch are derived from
SteamVR log output, but not actually tested due to lack of suitable hw.

Per discussion for the merge request, we enable this '-s' flag by
default in the make file for SteamVR style naming scheme.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>

authored by

Mario Kleiner and committed by
Christoph Haag
887b770f d3893c22

+20 -2
+7
src/xrt/auxiliary/bindings/bindings.json
··· 3 3 "/interaction_profiles/khr/simple_controller": { 4 4 "title": "Khronos Simple Controller", 5 5 "type": "tracked_controller", 6 + "steamvr_controllertype": "khr_simple_controller", 6 7 "monado_device": "XRT_DEVICE_SIMPLE_CONTROLLER", 7 8 "subaction_paths": [ 8 9 "/user/hand/left", ··· 106 107 "/interaction_profiles/htc/vive_controller": { 107 108 "title": "HTC Vive Controller", 108 109 "type": "tracked_controller", 110 + "steamvr_controllertype": "vive_controller", 109 111 "monado_device": "XRT_DEVICE_VIVE_WAND", 110 112 "subaction_paths": [ 111 113 "/user/hand/left", ··· 191 193 "/interaction_profiles/htc/vive_pro": { 192 194 "title": "HTC Vive Pro", 193 195 "type": "tracked_hmd", 196 + "steamvr_controllertype": "vive_pro", 194 197 "monado_device": "XRT_DEVICE_VIVE_PRO", 195 198 "subaction_paths": [ 196 199 "/user/head" ··· 234 237 "/interaction_profiles/microsoft/motion_controller": { 235 238 "title": "Microsoft Mixed Reality Motion Controller", 236 239 "type": "tracked_controller", 240 + "steamvr_controllertype": "holographic_controller", 237 241 "monado_device": "XRT_DEVICE_WMR_CONTROLLER", 238 242 "subaction_paths": [ 239 243 "/user/hand/left", ··· 322 326 "/interaction_profiles/microsoft/xbox_controller": { 323 327 "title": "Microsoft Xbox Controller", 324 328 "type": "untracked_controller", 329 + "steamvr_controllertype": "gamepad", 325 330 "monado_device": "XRT_DEVICE_XBOX_CONTROLLER", 326 331 "subaction_paths": [ 327 332 "/user/gamepad" ··· 570 575 "/interaction_profiles/oculus/touch_controller": { 571 576 "title": "Oculus Touch Controller", 572 577 "type": "tracked_controller", 578 + "steamvr_controllertype": "oculus_touch", 573 579 "monado_device": "XRT_DEVICE_TOUCH_CONTROLLER", 574 580 "subaction_paths": [ 575 581 "/user/hand/left", ··· 703 709 "/interaction_profiles/valve/index_controller": { 704 710 "title": "Valve Index Controller", 705 711 "type": "tracked_controller", 712 + "steamvr_controllertype": "knuckles", 706 713 "monado_device": "XRT_DEVICE_INDEX_CONTROLLER", 707 714 "subaction_paths": [ 708 715 "/user/hand/left",
+4
src/xrt/auxiliary/bindings/bindings.py
··· 273 273 self.validation_func_name = profile_name.replace("/interaction_profiles/", "").replace("/", "_") 274 274 self.identifiers = Identifer.parse_identifiers(json_profile) 275 275 276 + self.steamvr_controller_type = None 277 + if "steamvr_controllertype" in json_profile: 278 + self.steamvr_controller_type = json_profile["steamvr_controllertype"] 279 + 276 280 self.components = [] 277 281 for identifier in self.identifiers: 278 282 for component in identifier.components:
+8 -1
src/xrt/auxiliary/bindings/steamvr_profiles.py
··· 54 54 'bindings', help='Bindings file to use') 55 55 parser.add_argument( 56 56 'output', type=str, help='Output directory') 57 + parser.add_argument( 58 + '-s', '--steamvr', action='store_true', 59 + help='Use SteamVR standard controller type names') 57 60 args = parser.parse_args() 58 61 59 62 bindings = Bindings.load_and_parse(args.bindings) ··· 69 72 70 73 profile_type, vendor_name, fname = names(p) 71 74 75 + controller_type = "monado_" + vendor_name + "_" + profile_type 76 + if args.steamvr == True and p.steamvr_controller_type is not None: 77 + controller_type = p.steamvr_controller_type 78 + 72 79 input_source = {} 73 80 74 81 component: Component ··· 86 93 87 94 j = { 88 95 "json_id": "input_profile", 89 - "controller_type": "monado_" + vendor_name + "_" + profile_type, 96 + "controller_type": controller_type, 90 97 "device_class": device_class, 91 98 "resource_root": "steamvr-monado", 92 99 "driver_name": "monado",
+1 -1
src/xrt/targets/steamvr_drv/CMakeLists.txt
··· 9 9 OUTPUT "${INPUT_PROFILES_OUTPUT_DIR}" 10 10 COMMAND 11 11 ${PYTHON_EXECUTABLE} ${INPUT_PROFILES_INPUT_DIR}/steamvr_profiles.py 12 - ${INPUT_PROFILES_INPUT_DIR}/bindings.json "${INPUT_PROFILES_OUTPUT_DIR}" 12 + ${INPUT_PROFILES_INPUT_DIR}/bindings.json "${INPUT_PROFILES_OUTPUT_DIR}" "-s" 13 13 DEPENDS ${INPUT_PROFILES_INPUT_DIR}/bindings.py ${INPUT_PROFILES_INPUT_DIR}/bindings.json 14 14 COMMENT "Generating SteamVR input profiles to ${INPUT_PROFILES_OUTPUT_DIR}" 15 15 )