aux/bindings: Add "features" to inputs in bindings.json

In our model we have a "subpath" for each hardware input like "/input/trackpad".
Each of these hardware inputs has "features" like "click", "touch", "position", "force".

Ideally each of these "features" is bound to some monado input in the "monado_bindings" dict
but this is not required. bindings.json will know about hardware features even if we don't bind them (yet).

For each of these features bindings.py generates a group of related paths for a single monado binding:
For a monado input XRT_INPUT_???_TRACKPAD these paths would be generated:
/user/hand/left/input/trackpad/x
/user/hand/left/input/trackpad/y
/user/hand/left/input/trackpad
This commit is contained in:
Christoph Haag 2021-01-12 19:54:29 +01:00
parent 46ec938f8a
commit f9c37d51bc
3 changed files with 260 additions and 335 deletions

View file

@ -12,8 +12,7 @@
"/input/select": {
"type": "button",
"localized_name": "Select",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_SIMPLE_SELECT_CLICK"
}
@ -21,8 +20,7 @@
"/input/menu": {
"type": "button",
"localized_name": "Menu",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_SIMPLE_MENU_CLICK"
}
@ -30,6 +28,7 @@
"/input/grip": {
"type": "pose",
"localized_name": "Grip",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_SIMPLE_GRIP_POSE"
}
@ -37,6 +36,7 @@
"/input/aim": {
"type": "pose",
"localized_name": "Aim",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_SIMPLE_AIM_POSE"
}
@ -44,6 +44,7 @@
"/output/haptic": {
"type": "vibration",
"localized_name": "Haptic",
"features": ["haptic"],
"monado_bindings": {
"haptic": "XRT_OUTPUT_NAME_SIMPLE_VIBRATION"
}
@ -63,8 +64,7 @@
"/input/select": {
"type": "button",
"localized_name": "Select",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_DAYDREAM_BAR_CLICK"
}
@ -72,9 +72,7 @@
"/input/trackpad": {
"type": "trackpad",
"localized_name": "Trackpad",
"force": false,
"touch": true,
"click": true,
"features": ["touch", "click", "position"],
"monado_bindings": {
"touch": "XRT_INPUT_DAYDREAM_TOUCHPAD_TOUCH",
"click": "XRT_INPUT_DAYDREAM_TOUCHPAD_CLICK",
@ -84,6 +82,7 @@
"/input/grip": {
"type": "pose",
"localized_name": "Grip",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_DAYDREAM_POSE"
}
@ -91,6 +90,7 @@
"/input/aim": {
"type": "pose",
"localized_name": "Aim",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_DAYDREAM_POSE"
}
@ -110,8 +110,7 @@
"/input/system": {
"type": "button",
"localized_name": "System",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_VIVE_SYSTEM_CLICK"
}
@ -119,8 +118,7 @@
"/input/squeeze": {
"type": "button",
"localized_name": "Squeeze",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_VIVE_SQUEEZE_CLICK"
}
@ -128,8 +126,7 @@
"/input/menu": {
"type": "button",
"localized_name": "Menu",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_VIVE_MENU_CLICK"
}
@ -137,9 +134,7 @@
"/input/trigger": {
"type": "trigger",
"localized_name": "Trigger",
"click": true,
"touch": false,
"value": true,
"features": ["click", "value"],
"monado_bindings": {
"click": "XRT_INPUT_VIVE_TRIGGER_CLICK",
"value": "XRT_INPUT_VIVE_TRIGGER_VALUE"
@ -148,9 +143,7 @@
"/input/trackpad": {
"type": "trackpad",
"localized_name": "Trackpad",
"force": false,
"touch": true,
"click": true,
"features": ["click", "touch", "position"],
"monado_bindings": {
"click": "XRT_INPUT_VIVE_TRACKPAD_CLICK",
"touch": "XRT_INPUT_VIVE_TRACKPAD_TOUCH",
@ -160,6 +153,7 @@
"/input/grip": {
"type": "pose",
"localized_name": "Grip",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_VIVE_GRIP_POSE"
}
@ -167,6 +161,7 @@
"/input/aim": {
"type": "pose",
"localized_name": "Aim",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_VIVE_AIM_POSE"
}
@ -174,6 +169,7 @@
"/output/haptic": {
"type": "vibration",
"localized_name": "Haptic",
"features": ["haptic"],
"monado_bindings": {
"haptic": "XRT_OUTPUT_NAME_VIVE_HAPTIC"
}
@ -192,8 +188,7 @@
"/input/system": {
"type": "button",
"localized_name": "System",
"click": "true",
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_VIVEPRO_SYSTEM_CLICK"
}
@ -201,8 +196,7 @@
"/input/volume_up": {
"type": "button",
"localized_name": "Volume Up",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_VIVEPRO_VOLUP_CLICK"
}
@ -210,8 +204,7 @@
"/input/volume_down": {
"type": "button",
"localized_name": "Volume Down",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_VIVEPRO_VOLDN_CLICK"
}
@ -219,8 +212,7 @@
"/input/mute_mic": {
"type": "button",
"localized_name": "Mute Microphone",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_VIVEPRO_MUTE_MIC_CLICK"
}
@ -240,8 +232,7 @@
"/input/menu": {
"type": "button",
"localized_name": "Menu",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_WMR_MENU_CLICK"
}
@ -249,8 +240,7 @@
"/input/squeeze": {
"type": "button",
"localized_name": "Squeeze",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_WMR_SQUEEZE_CLICK"
}
@ -258,9 +248,7 @@
"/input/trigger": {
"type": "trigger",
"localized_name": "Trigger",
"click": false,
"touch": false,
"value": true,
"features": ["value"],
"monado_bindings": {
"value": "XRT_INPUT_WMR_TRIGGER_VALUE"
}
@ -268,8 +256,7 @@
"/input/thumbstick": {
"type": "joystick",
"localized_name": "Thumbstick",
"click": true,
"touch": false,
"features": ["click", "position"],
"monado_bindings": {
"click": "XRT_INPUT_WMR_THUMBSTICK_CLICK",
"position": "XRT_INPUT_WMR_THUMBSTICK"
@ -278,9 +265,7 @@
"/input/trackpad": {
"type": "trackpad",
"localized_name": "Trackpad",
"force": false,
"click": true,
"touch": true,
"features": ["click", "touch", "position"],
"monado_bindings": {
"click": "XRT_INPUT_WMR_TRACKPAD_CLICK",
"touch": "XRT_INPUT_WMR_TRACKPAD_TOUCH",
@ -290,6 +275,7 @@
"/input/grip": {
"type": "pose",
"localized_name": "Grip",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_WMR_GRIP_POSE"
}
@ -297,6 +283,7 @@
"/input/aim": {
"type": "pose",
"localized_name": "Aim",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_WMR_AIM_POSE"
}
@ -304,6 +291,7 @@
"/output/haptic": {
"type": "vibration",
"localized_name": "Haptic",
"features": ["haptic"],
"monado_bindings": {
"haptic": "XRT_OUTPUT_NAME_WMR_HAPTIC"
}
@ -322,8 +310,7 @@
"/input/menu": {
"type": "button",
"localized_name": "Menu",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_XBOX_MENU_CLICK"
}
@ -331,8 +318,7 @@
"/input/view": {
"type": "button",
"localized_name": "View",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_XBOX_VIEW_CLICK"
}
@ -340,8 +326,7 @@
"/input/a": {
"type": "button",
"localized_name": "A",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_XBOX_A_CLICK"
}
@ -349,8 +334,7 @@
"/input/b": {
"type": "button",
"localized_name": "B",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_XBOX_B_CLICK"
}
@ -358,8 +342,7 @@
"/input/x": {
"type": "button",
"localized_name": "X",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_XBOX_X_CLICK"
}
@ -367,8 +350,7 @@
"/input/y": {
"type": "button",
"localized_name": "Y",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_XBOX_Y_CLICK"
}
@ -376,8 +358,7 @@
"/input/dpad_down": {
"type": "button",
"localized_name": "DPAD down",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_XBOX_DPAD_DOWN_CLICK"
}
@ -385,8 +366,7 @@
"/input/dpad_right": {
"type": "button",
"localized_name": "DPAD right",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_XBOX_DPAD_RIGHT_CLICK"
}
@ -394,8 +374,7 @@
"/input/dpad_up": {
"type": "button",
"localized_name": "DPAD up",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_XBOX_DPAD_UP_CLICK"
}
@ -403,8 +382,7 @@
"/input/dpad_left": {
"type": "button",
"localized_name": "DPAD left",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_XBOX_DPAD_LEFT_CLICK"
}
@ -412,8 +390,7 @@
"/input/shoulder_left": {
"type": "button",
"localized_name": "Shoulder left",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_XBOX_SHOULDER_LEFT_CLICK"
}
@ -421,8 +398,7 @@
"/input/shoulder_right": {
"type": "button",
"localized_name": "Shoulder right",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_XBOX_SHOULDER_RIGHT_CLICK"
}
@ -430,8 +406,7 @@
"/input/thumbstick_left": {
"type": "joystick",
"localized_name": "Left Thumbstick",
"click": true,
"touch": false,
"features": ["click", "position"],
"monado_bindings": {
"click": "XRT_INPUT_XBOX_THUMBSTICK_LEFT_CLICK",
"position": "XRT_INPUT_XBOX_THUMBSTICK_LEFT"
@ -440,8 +415,7 @@
"/input/thumbstick_right": {
"type": "joystick",
"localized_name": "Right Thumbstick",
"click": true,
"touch": false,
"features": ["click", "position"],
"monado_bindings": {
"click": "XRT_INPUT_XBOX_THUMBSTICK_RIGHT_CLICK",
"position": "XRT_INPUT_XBOX_THUMBSTICK_RIGHT"
@ -450,9 +424,7 @@
"/input/trigger_left": {
"type": "trigger",
"localized_name": "Left Trigger",
"click": false,
"touch": false,
"value": true,
"features": ["value"],
"monado_bindings": {
"value": "XRT_INPUT_XBOX_LEFT_TRIGGER_VALUE"
}
@ -460,9 +432,7 @@
"/input/trigger_right": {
"type": "trigger",
"localized_name": "Right Trigger",
"click": false,
"touch": false,
"value": true,
"features": ["value"],
"monado_bindings": {
"value": "XRT_INPUT_XBOX_RIGHT_TRIGGER_VALUE"
}
@ -470,6 +440,7 @@
"/output/haptic_left": {
"type": "vibration",
"localized_name": "Left Haptic",
"features": ["haptic"],
"monado_bindings": {
"haptic": "XRT_OUTPUT_NAME_XBOX_HAPTIC_LEFT"
}
@ -477,6 +448,7 @@
"/output/haptic_right": {
"type": "vibration",
"localized_name": "Right Haptic",
"features": ["haptic"],
"monado_bindings": {
"haptic": "XRT_OUTPUT_NAME_XBOX_HAPTIC_RIGHTT"
}
@ -484,6 +456,7 @@
"/output/haptic_left_trigger": {
"type": "vibration",
"localized_name": "Left Trigger Haptic",
"features": ["haptic"],
"monado_bindings": {
"haptic": "XRT_OUTPUT_NAME_XBOX_HAPTIC_LEFT_TRIGGER"
}
@ -491,6 +464,7 @@
"/output/haptic_right_trigger": {
"type": "vibration",
"localized_name": "Right Trigger Haptic",
"features": ["haptic"],
"monado_bindings": {
"haptic": "XRT_OUTPUT_NAME_XBOX_HAPTIC_RIGHT_TRIGGER"
}
@ -510,8 +484,7 @@
"/input/system": {
"type": "button",
"localized_name": "System",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_GO_SYSTEM_CLICK"
}
@ -519,8 +492,7 @@
"/input/trigger": {
"type": "button",
"localized_name": "Trigger",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_GO_TRIGGER_CLICK"
}
@ -528,8 +500,7 @@
"/input/back": {
"type": "button",
"localized_name": "Back",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_GO_BACK_CLICK"
}
@ -537,9 +508,7 @@
"/input/trackpad": {
"type": "trackpad",
"localized_name": "Trackpad",
"force": false,
"click": true,
"touch": true,
"features": ["click", "touch", "position"],
"monado_bindings": {
"click": "XRT_INPUT_GO_TRACKPAD_CLICK",
"touch": "XRT_INPUT_GO_TRACKPAD_TOUCH",
@ -549,6 +518,7 @@
"/input/grip": {
"type": "pose",
"localized_name": "Grip",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_GO_GRIP_POSE"
}
@ -556,6 +526,7 @@
"/input/aim": {
"type": "pose",
"localized_name": "Aim",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_GO_AIM_POSE"
}
@ -575,8 +546,7 @@
"/input/x": {
"type": "button",
"localized_name": "X",
"click": true,
"touch": true,
"features": ["click", "touch"],
"side": "left",
"monado_bindings": {
"click": "XRT_INPUT_TOUCH_X_CLICK",
@ -586,8 +556,7 @@
"/input/y": {
"type": "button",
"localized_name": "Y",
"click": true,
"touch": true,
"features": ["click", "touch"],
"side": "left",
"monado_bindings": {
"click": "XRT_INPUT_TOUCH_Y_CLICK",
@ -597,8 +566,7 @@
"/input/menu": {
"type": "button",
"localized_name": "Menu",
"click": true,
"touch": false,
"features": ["click"],
"side": "left",
"monado_bindings": {
"click": "XRT_INPUT_TOUCH_MENU_CLICK"
@ -607,8 +575,7 @@
"/input/a": {
"type": "button",
"localized_name": "A",
"click": true,
"touch": true,
"features": ["click", "touch"],
"side": "right",
"monado_bindings": {
"click": "XRT_INPUT_TOUCH_A_CLICK",
@ -618,8 +585,7 @@
"/input/b": {
"type": "button",
"localized_name": "B",
"click": true,
"touch": true,
"features": ["click", "touch"],
"side": "right",
"monado_bindings": {
"click": "XRT_INPUT_TOUCH_B_CLICK",
@ -629,8 +595,7 @@
"/input/system": {
"type": "button",
"localized_name": "System",
"click": true,
"touch": false,
"features": ["click"],
"side": "right",
"monado_bindings": {
"click": "XRT_INPUT_TOUCH_SYSTEM_CLICK"
@ -639,9 +604,7 @@
"/input/squeeze": {
"type": "trigger",
"localized_name": "Squeeze",
"click": false,
"touch": false,
"value": true,
"features": ["value"],
"monado_bindings": {
"value": "XRT_INPUT_TOUCH_SQUEEZE_VALUE"
}
@ -649,9 +612,7 @@
"/input/trigger": {
"type": "trigger",
"localized_name": "Trigger",
"click": false,
"touch": true,
"value": true,
"features": ["touch", "value"],
"monado_bindings": {
"touch": "XRT_INPUT_TOUCH_TRIGGER_TOUCH",
"value": "XRT_INPUT_TOUCH_TRIGGER_VALUE"
@ -660,8 +621,7 @@
"/input/thumbstick": {
"type": "joystick",
"localized_name": "Thumbstick",
"click": true,
"touch": true,
"features": ["click", "touch", "position"],
"monado_bindings": {
"click": "XRT_INPUT_TOUCH_THUMBSTICK_CLICK",
"touch": "XRT_INPUT_TOUCH_THUMBSTICK_TOUCH",
@ -671,8 +631,7 @@
"/input/thumbrest": {
"type": "button",
"localized_name": "Thumb Rest",
"click": false,
"touch": true,
"features": ["touch"],
"monado_bindings": {
"touch": "XRT_INPUT_TOUCH_THUMBREST_TOUCH"
}
@ -680,6 +639,7 @@
"/input/grip": {
"type": "pose",
"localized_name": "Grip",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_TOUCH_GRIP_POSE"
}
@ -687,6 +647,7 @@
"/input/aim": {
"type": "pose",
"localized_name": "Aim",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_TOUCH_AIM_POSE"
}
@ -694,6 +655,7 @@
"/output/haptic": {
"type": "vibration",
"localized_name": "Haptic",
"features": ["haptic"],
"monado_bindings": {
"haptic": "XRT_OUTPUT_NAME_TOUCH_HAPTIC"
}
@ -713,8 +675,7 @@
"/input/system": {
"type": "button",
"localized_name": "System",
"click": true,
"touch": true,
"features": ["click", "touch"],
"monado_bindings": {
"click": "XRT_INPUT_INDEX_SYSTEM_CLICK",
"touch": "XRT_INPUT_INDEX_SYSTEM_TOUCH"
@ -723,8 +684,7 @@
"/input/a": {
"type": "button",
"localized_name": "A",
"click": true,
"touch": true,
"features": ["click", "touch"],
"monado_bindings": {
"click": "XRT_INPUT_INDEX_A_CLICK",
"touch": "XRT_INPUT_INDEX_A_TOUCH"
@ -733,8 +693,7 @@
"/input/b": {
"type": "button",
"localized_name": "B",
"click": true,
"touch": true,
"features": ["click", "touch"],
"monado_bindings": {
"click": "XRT_INPUT_INDEX_B_CLICK",
"touch": "XRT_INPUT_INDEX_B_TOUCH"
@ -743,10 +702,7 @@
"/input/squeeze": {
"type": "trigger",
"localized_name": "Squeeze",
"force": true,
"value": true,
"touch": false,
"click": false,
"features": ["force", "value"],
"monado_bindings": {
"value": "XRT_INPUT_INDEX_SQUEEZE_VALUE",
"force": "XRT_INPUT_INDEX_SQUEEZE_FORCE"
@ -755,9 +711,7 @@
"/input/trigger": {
"type": "trigger",
"localized_name": "Trigger",
"click": true,
"touch": true,
"value": true,
"features": ["click", "touch", "value"],
"monado_bindings": {
"click": "XRT_INPUT_INDEX_TRIGGER_CLICK",
"touch": "XRT_INPUT_INDEX_TRIGGER_TOUCH",
@ -767,8 +721,7 @@
"/input/thumbstick": {
"type": "joystick",
"localized_name": "Thumbstick",
"click": true,
"touch": true,
"features": ["click", "touch", "position"],
"monado_bindings": {
"click": "XRT_INPUT_INDEX_THUMBSTICK_CLICK",
"touch": "XRT_INPUT_INDEX_THUMBSTICK_TOUCH",
@ -778,8 +731,7 @@
"/input/trackpad": {
"type": "trackpad",
"localized_name": "Trackpad",
"force": true,
"touch": true,
"features": ["touch", "force", "position"],
"monado_bindings": {
"force": "XRT_INPUT_INDEX_TRACKPAD_FORCE",
"touch": "XRT_INPUT_INDEX_TRACKPAD_TOUCH",
@ -789,6 +741,7 @@
"/input/grip": {
"type": "pose",
"localized_name": "Grip",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_INDEX_GRIP_POSE"
}
@ -796,6 +749,7 @@
"/input/aim": {
"type": "pose",
"localized_name": "Aim",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_INDEX_AIM_POSE"
}
@ -803,6 +757,7 @@
"/output/haptic": {
"type": "vibration",
"localized_name": "Haptic",
"features": ["haptic"],
"monado_bindings": {
"haptic": "XRT_OUTPUT_NAME_INDEX_HAPTIC"
}
@ -823,8 +778,7 @@
"/input/select": {
"type": "trigger",
"localized_name": "Select",
"value": true,
"touch": false,
"features": ["value"],
"monado_bindings": {
"value": "XRT_INPUT_HAND_SELECT_VALUE"
}
@ -832,8 +786,7 @@
"/input/squeeze": {
"type": "trigger",
"localized_name": "Squeeze",
"value": true,
"touch": false,
"features": ["value"],
"monado_bindings": {
"value": "XRT_INPUT_HAND_SQUEEZE_VALUE"
}
@ -841,6 +794,7 @@
"/input/grip": {
"type": "pose",
"localized_name": "Grip",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_HAND_GRIP_POSE"
}
@ -848,6 +802,7 @@
"/input/aim": {
"type": "pose",
"localized_name": "Aim",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_HAND_AIM_POSE"
}
@ -868,8 +823,7 @@
"/input/system": {
"type": "button",
"localized_name": "System",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_PSMV_PS_CLICK"
}
@ -877,8 +831,7 @@
"/input/menu": {
"type": "button",
"localized_name": "Menu",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_PSMV_MOVE_CLICK"
}
@ -886,8 +839,7 @@
"/input/start": {
"type": "button",
"localized_name": "Start",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_PSMV_START_CLICK"
}
@ -895,8 +847,7 @@
"/input/select": {
"type": "button",
"localized_name": "Select",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_PSMV_SELECT_CLICK"
}
@ -904,8 +855,7 @@
"/input/square_mndx": {
"type": "button",
"localized_name": "Square",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_PSMV_SQUARE_CLICK"
}
@ -913,8 +863,7 @@
"/input/cross_mndx": {
"type": "button",
"localized_name": "Cross",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_PSMV_CROSS_CLICK"
}
@ -922,8 +871,7 @@
"/input/circle_mndx": {
"type": "button",
"localized_name": "Circle",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_PSMV_CIRCLE_CLICK"
}
@ -931,8 +879,7 @@
"/input/triangle_mndx": {
"type": "button",
"localized_name": "Triangle",
"click": true,
"touch": false,
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_PSMV_TRIANGLE_CLICK"
}
@ -940,8 +887,7 @@
"/input/trigger": {
"type": "trigger",
"localized_name": "Trigger",
"value": true,
"touch": false,
"features": ["value"],
"monado_bindings": {
"value": "XRT_INPUT_PSMV_TRIGGER_VALUE"
}
@ -949,6 +895,7 @@
"/input/grip": {
"type": "pose",
"localized_name": "Grip",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_PSMV_GRIP_POSE"
}
@ -956,6 +903,7 @@
"/input/ball_mndx": {
"type": "pose",
"localized_name": "Ball",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_PSMV_BALL_CENTER_POSE"
}
@ -963,6 +911,7 @@
"/input/body_center_mndx": {
"type": "pose",
"localized_name": "Body Center",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_PSMV_BODY_CENTER_POSE"
}
@ -970,6 +919,7 @@
"/input/aim": {
"type": "pose",
"localized_name": "aim",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_PSMV_AIM_POSE"
}
@ -977,93 +927,88 @@
"/output/haptic": {
"type": "vibration",
"localized_name": "Haptic",
"features": ["haptic"],
"monado_bindings": {
"haptic": "XRT_OUTPUT_NAME_PSMV_RUMBLE_VIBRATION"
}
}
}
}
},
},
"/interaction_profiles/mndx/hydra": {
"title": "Monado Hydra Controller",
"type": "tracked_controller",
"monado_device": "XRT_DEVICE_HYDRA",
"extension": "XR_MNDX_hydra",
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
],
"subpaths": {
"/input/1": {
"type": "button",
"localized_name": "1",
"click": true,
"touch": false,
"monado_bindings": {
"click": "XRT_INPUT_HYDRA_1_CLICK"
}
},
"/input/2": {
"type": "button",
"localized_name": "2",
"click": true,
"touch": false,
"monado_bindings": {
"click": "XRT_INPUT_HYDRA_2_CLICK"
}
},
"/input/3": {
"type": "button",
"localized_name": "3",
"click": true,
"touch": false,
"monado_bindings": {
"click": "XRT_INPUT_HYDRA_3_CLICK"
}
},
"/input/4": {
"type": "button",
"localized_name": "4",
"click": true,
"touch": false,
"monado_bindings": {
"click": "XRT_INPUT_HYDRA_4_CLICK"
}
},
"/input/bumper": {
"type": "button",
"localized_name": "Bumper",
"click": true,
"touch": false,
"monado_bindings": {
"click": "XRT_INPUT_HYDRA_BUMPER_CLICK"
}
},
"/input/thumbstick": {
"type": "joystick",
"localized_name": "Thumbstick",
"click": true,
"touch": false,
"monado_bindings": {
"click": "XRT_INPUT_HYDRA_JOYSTICK_CLICK",
"position": "XRT_INPUT_HYDRA_JOYSTICK_VALUE"
}
},
"/input/trigger": {
"type": "trigger",
"localized_name": "Trigger",
"value": true,
"touch": false,
"monado_bindings": {
"value": "XRT_INPUT_HYDRA_TRIGGER_VALUE"
}
},
"/input/grip": {
"type": "pose",
"localized_name": "Grip",
"monado_bindings": {
"pose": "XRT_INPUT_HYDRA_POSE"
"/interaction_profiles/mndx/hydra": {
"title": "Monado Hydra Controller",
"type": "tracked_controller",
"monado_device": "XRT_DEVICE_HYDRA",
"extension": "XR_MNDX_hydra",
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
],
"subpaths": {
"/input/1": {
"type": "button",
"localized_name": "1",
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_HYDRA_1_CLICK"
}
},
"/input/2": {
"type": "button",
"localized_name": "2",
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_HYDRA_2_CLICK"
}
},
"/input/3": {
"type": "button",
"localized_name": "3",
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_HYDRA_3_CLICK"
}
},
"/input/4": {
"type": "button",
"localized_name": "4",
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_HYDRA_4_CLICK"
}
},
"/input/bumper": {
"type": "button",
"localized_name": "Bumper",
"features": ["click"],
"monado_bindings": {
"click": "XRT_INPUT_HYDRA_BUMPER_CLICK"
}
},
"/input/thumbstick": {
"type": "joystick",
"localized_name": "Thumbstick",
"features": ["click", "position"],
"monado_bindings": {
"click": "XRT_INPUT_HYDRA_JOYSTICK_CLICK",
"position": "XRT_INPUT_HYDRA_JOYSTICK_VALUE"
}
},
"/input/trigger": {
"type": "trigger",
"localized_name": "Trigger",
"features": ["value"],
"monado_bindings": {
"value": "XRT_INPUT_HYDRA_TRIGGER_VALUE"
}
},
"/input/grip": {
"type": "pose",
"localized_name": "Grip",
"features": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_HYDRA_POSE"
}
}
}
}

View file

@ -8,14 +8,7 @@ import json
import argparse
class BindingPath:
def __init__(self, subaction_path, path):
"""Construct an component."""
self.subaction_path = subaction_path
self.path = path
def handle_subpath(pathgroup_cls, pathgroup_list, subaction_path, sub_path_itm):
def handle_subpath(pathgroup_cls, feature_list, subaction_path, sub_path_itm):
sub_path_name = sub_path_itm[0]
sub_path_obj = sub_path_itm[1]
@ -23,88 +16,54 @@ def handle_subpath(pathgroup_cls, pathgroup_list, subaction_path, sub_path_itm):
if "side" in sub_path_obj and sub_path_obj["side"] not in subaction_path:
return
# path without the component, e.g. /user/hand/left/input/a, without /click
base_path = subaction_path + sub_path_name
# Add each component with a base path as a separate PathGroup, e.g.
# /user/hand/left/input/a/click and /user/hand/input/a map to the same a click.
# /user/hand/left/input/a/touch and /user/hand/input/a map to the same a touch.
# Code later will have to decide how /user/hand/input/a is actually bound
if sub_path_obj["type"] in ["button", "trigger", "trackpad", "joystick"]:
# Add component paths like /user/hand/left/input/a/touch
for component in ["click", "touch", "value", "force"]:
if component in sub_path_obj and sub_path_obj[component]:
binding_key = component
pathgroup = []
comp_path = base_path + "/" + component
pathgroup.append(BindingPath(subaction_path, comp_path))
# Add a base path like /user/hand/left/input/a with the same
# binding_key as the component
pathgroup.append(BindingPath(subaction_path, base_path))
pathgroup_list.append(pathgroup_cls(subaction_path, pathgroup, sub_path_itm, binding_key))
# same for joystick and trackpad, but with special x/y components
if sub_path_obj["type"] in ["joystick", "trackpad"]:
binding_key = "position"
pathgroup = []
pathgroup.append(BindingPath(subaction_path, base_path + "/x"))
pathgroup.append(BindingPath(subaction_path, base_path + "/y"))
# Add a base path like /user/hand/left/input/trackpad with the same binding_key as the /x and /y component
pathgroup.append(BindingPath(subaction_path, base_path))
pathgroup_list.append(pathgroup_cls(subaction_path, pathgroup, sub_path_itm, binding_key))
# pose inputs can be bound with or without pose component
if sub_path_obj["type"] == "pose":
binding_key = "pose"
pathgroup = []
pathgroup.append(BindingPath(subaction_path, base_path))
pathgroup.append(BindingPath(subaction_path, base_path + "/pose"))
pathgroup_list.append(pathgroup_cls(subaction_path, pathgroup, sub_path_itm, binding_key))
# haptic feedback only has a base path
if sub_path_obj["type"] == "vibration":
binding_key = "haptic"
pathgroup = []
pathgroup.append(BindingPath(subaction_path, base_path))
pathgroup_list.append(pathgroup_cls(subaction_path, pathgroup, sub_path_itm, binding_key))
for feature in sub_path_obj["features"]:
feature_list.append(Feature(subaction_path, sub_path_itm, feature))
class PathGroup:
"""Group of paths associated with a single input, for example
* /user/hand/left/input/trackpad
* /user/hand/left/input/trackpad/x
* /user/hand/left/input/trackpad/y
class Feature:
"""Features roughly correlate with data sources. For example a trackpad may
have several features: position, click, touch, force, ...
"""
@classmethod
def parse_paths(pathgroup_cls, subaction_paths, paths):
"""Turn a profile's input paths into an array of PathGroup objects.
Creates a PathGroup for each subaction_path and stripped subpaths.
"""
pathgroup_list = []
def parse_features(feature_cls, subaction_paths, paths):
"""Turn a profile's input paths into a list of Feature objects."""
feature_list = []
for subaction_path in subaction_paths:
for sub_path_itm in paths.items():
handle_subpath(pathgroup_cls, pathgroup_list, subaction_path, sub_path_itm)
return pathgroup_list
handle_subpath(feature_cls, feature_list, subaction_path, sub_path_itm)
return feature_list
def __init__(self, subaction_path, pathgroup, sub_path_itm, binding_key=None):
def __init__(self, subaction_path, sub_path_itm, feature_str):
self.sub_path_name = sub_path_itm[0]
self.sub_path_obj = sub_path_itm[1]
self.subaction_path = subaction_path
self.pathgroup = pathgroup
self.binding_key = binding_key
self.is_output = self.sub_path_obj["type"] == "vibration"
self.is_input = not self.is_output
self.feature_str = feature_str
"""A group of paths that derive from the same input.
For example .../thumbstick, .../thumbstick/x, .../thumbstick/y
"""
def to_monado_paths(self):
paths = []
basepath = self.subaction_path + "/" + self.sub_path_name
if self.feature_str == "position":
paths.append(basepath + "/" + "x")
paths.append(basepath + "/" + "y")
paths.append(basepath)
else:
paths.append(basepath + "/" + self.feature_str)
paths.append(basepath)
return paths
def is_input(self):
# only haptics is output so far, everythine else is input
return self.feature_str != "haptic"
def is_output(self):
return not self.is_input()
class Profile:
@ -115,18 +74,18 @@ class Profile:
self.monado_device = data["monado_device"]
self.title = data['title']
self.func = name[22:].replace("/", "_")
self.pathgroups = PathGroup.parse_paths(data["subaction_paths"],
data["subpaths"])
self.features = Feature.parse_features(data["subaction_paths"],
data["subpaths"])
self.hw_type = data["type"]
self.by_length = {}
for pathgroup in self.pathgroups:
for input_path in pathgroup.pathgroup:
length = len(input_path.path)
for feature in self.features:
for path in feature.to_monado_paths():
length = len(path)
if (length in self.by_length):
self.by_length[length].append(input_path)
self.by_length[length].append(path)
else:
self.by_length[length] = [input_path]
self.by_length[length] = [path]
class Bindings:
@ -187,8 +146,8 @@ def generate_bindings_c(file, p):
f.write(func_start.format(func=profile.func))
for length in profile.by_length:
f.write("\tcase " + str(length) + ":\n\t\t")
for component in profile.by_length[length]:
f.write(if_strcmp.format(check=component.path))
for path in profile.by_length[length]:
f.write(if_strcmp.format(check=path))
f.write("{\n\t\t\treturn false;\n\t\t}\n")
f.write("\tdefault:\n\t\treturn false;\n\t}\n}\n")
@ -199,7 +158,7 @@ def generate_bindings_c(file, p):
fname = vendor_name + "_" + hw_name + "_profile.json"
controller_type = "monado_" + vendor_name + "_" + hw_name
num_bindings = len(profile.pathgroups)
num_bindings = len(profile.features)
f.write(f'\t{{ // profile_template\n')
f.write(f'\t\t.name = {profile.monado_device},\n')
f.write(f'\t\t.path = "{profile.name}",\n')
@ -209,34 +168,41 @@ def generate_bindings_c(file, p):
f.write(f'\t\t.num_bindings = {num_bindings},\n')
f.write(f'\t\t.bindings = (struct binding_template[]){{ // array of binding_template\n')
pathgroup: PathGroup
for idx, pathgroup in enumerate(profile.pathgroups):
sp_obj = pathgroup.sub_path_obj
feature: Feature
for idx, feature in enumerate(profile.features):
sp_obj = feature.sub_path_obj
steamvr_path = pathgroup.sub_path_name
if pathgroup.binding_key in ["click", "touch", "force", "value"]:
steamvr_path += "/" + pathgroup.binding_key
steamvr_path = feature.sub_path_name
if feature.feature_str in ["click", "touch", "force", "value"]:
steamvr_path += "/" + feature.feature_str
f.write(f'\t\t\t{{ // binding_template {idx}\n')
f.write(f'\t\t\t\t.subaction_path = "{pathgroup.subaction_path}",\n')
f.write(f'\t\t\t\t.subaction_path = "{feature.subaction_path}",\n')
f.write(f'\t\t\t\t.steamvr_path = "{steamvr_path}",\n')
f.write(f'\t\t\t\t.localized_name = "{sp_obj["localized_name"]}",\n')
f.write('\t\t\t\t.paths = { // array of paths\n')
for input_path in pathgroup.pathgroup:
f.write(f'\t\t\t\t\t"{input_path.path}",\n')
for path in feature.to_monado_paths():
f.write(f'\t\t\t\t\t"{path}",\n')
f.write('\t\t\t\t\tNULL\n')
f.write('\t\t\t\t}, // /array of paths\n')
binding_key = pathgroup.binding_key
monado_binding = sp_obj["monado_bindings"][binding_key]
# print("feature", feature.__dict__)
if pathgroup.is_input and monado_binding is not None:
feature_str = feature.feature_str
# controllers can have input that we don't have bindings for'
if feature_str not in sp_obj["monado_bindings"]:
continue
monado_binding = sp_obj["monado_bindings"][feature_str]
if feature.is_input() and monado_binding is not None:
f.write(f'\t\t\t\t.input = {monado_binding},\n')
else:
f.write(f'\t\t\t\t.input = 0,\n')
if pathgroup.is_output and monado_binding is not None:
if feature.is_output() and monado_binding is not None:
f.write(f'\t\t\t\t.output = {monado_binding},\n')
else:
f.write(f'\t\t\t\t.output = 0,\n')

View file

@ -41,6 +41,20 @@ def steamvr_subpath_name(sub_path_name, sub_path_obj):
return sub_path_name
def get_required_features(path_type):
if path_type == "button":
return ["click", "touch"]
if path_type == "trigger":
return ["click", "touch", "value", "force"]
if path_type == "joystick":
return ["click", "touch"]
if path_type == "pose":
return []
if path_type == "vibration":
return []
return []
def main():
"""Handle command line and generate a file."""
parser = argparse.ArgumentParser(description='Bindings generator.')
@ -65,19 +79,19 @@ def main():
input_source = {}
pg: PathGroup
for idx, pg in enumerate(p.pathgroups):
sp_name = steamvr_subpath_name(pg.sub_path_name, pg.sub_path_obj)
sp = pg.sub_path_obj
feature: Feature
for idx, feature in enumerate(p.features):
sp_name = steamvr_subpath_name(feature.sub_path_name, feature.sub_path_obj)
sp = feature.sub_path_obj
input_source[sp_name] = {
"type": sp["type"],
"binding_image_point": [0, 0], # TODO
"order": idx
}
for component in ["click", "touch", "value", "force"]:
if component in sp:
input_source[sp_name][component] = sp[component]
for req in get_required_features(sp["type"]):
input_source[sp_name][req] = req in sp["features"]
j = {
"json_id": "input_profile",