Commit 3c7770cc authored by Christoph Haag's avatar Christoph Haag
Browse files

st/oxr: Implement binding vive tracker pose from config

parent b675160d
Pipeline #598977 passed with stage
in 4 minutes and 58 seconds
......@@ -475,6 +475,62 @@ oxr_binding_destroy_all(struct oxr_logger *log, struct oxr_instance *inst)
*
*/
static bool
vive_tracker_input_name_from_config(struct oxr_logger *log,
struct oxr_instance *inst,
enum oxr_subaction_path subaction_path,
enum xrt_input_name input_name,
enum xrt_input_name *out_name)
{
if (input_name != XRT_INPUT_VIVE_TRACKER_GRIP_POSE) {
return false;
}
switch (subaction_path) {
case OXR_SUB_ACTION_PATH_VIVE_TRACKER_HANDHELD_OBJECT:
*out_name = inst->system.xsysd->roles.vive_tracker_handheld_object_input;
break;
case OXR_SUB_ACTION_PATH_VIVE_TRACKER_LEFT_FOOT:
*out_name = inst->system.xsysd->roles.vive_tracker_left_foot_input;
break;
case OXR_SUB_ACTION_PATH_VIVE_TRACKER_RIGHT_FOOT:
*out_name = inst->system.xsysd->roles.vive_tracker_right_foot_input;
break;
case OXR_SUB_ACTION_PATH_VIVE_TRACKER_LEFT_SHOULDER:
*out_name = inst->system.xsysd->roles.vive_tracker_left_shoulder_input;
break;
case OXR_SUB_ACTION_PATH_VIVE_TRACKER_RIGHT_SHOULDER:
*out_name = inst->system.xsysd->roles.vive_tracker_right_shoulder_input;
break;
case OXR_SUB_ACTION_PATH_VIVE_TRACKER_LEFT_ELBOW:
*out_name = inst->system.xsysd->roles.vive_tracker_left_elbow_input;
break;
case OXR_SUB_ACTION_PATH_VIVE_TRACKER_RIGHT_ELBOW:
*out_name = inst->system.xsysd->roles.vive_tracker_right_elbow_input;
break;
case OXR_SUB_ACTION_PATH_VIVE_TRACKER_LEFT_KNEE:
*out_name = inst->system.xsysd->roles.vive_tracker_left_knee_input;
break;
case OXR_SUB_ACTION_PATH_VIVE_TRACKER_RIGHT_KNEE:
*out_name = inst->system.xsysd->roles.vive_tracker_right_knee_input;
break;
case OXR_SUB_ACTION_PATH_VIVE_TRACKER_WAIST:
*out_name = inst->system.xsysd->roles.vive_tracker_waist_input;
break;
case OXR_SUB_ACTION_PATH_VIVE_TRACKER_CHEST:
*out_name = inst->system.xsysd->roles.vive_tracker_chest_input;
break;
case OXR_SUB_ACTION_PATH_VIVE_TRACKER_CAMERA:
*out_name = inst->system.xsysd->roles.vive_tracker_camera_input;
break;
case OXR_SUB_ACTION_PATH_VIVE_TRACKER_KEYBOARD:
*out_name = inst->system.xsysd->roles.vive_tracker_keyboard_input;
break;
default: return false;
}
return true;
}
XrResult
oxr_action_suggest_interaction_profile_bindings(struct oxr_logger *log,
struct oxr_instance *inst,
......@@ -504,6 +560,26 @@ oxr_action_suggest_interaction_profile_bindings(struct oxr_logger *log,
add_key_to_matching_bindings(bindings, binding_count, s->binding, act->act_key);
}
/*!
* The vive tracker default bindings bind all input/grip actions to XRT_INPUT_VIVE_TRACKER_GRIP_POSE.
* We support choosing any input device with a selectable input pose as a vive tracker.
* This includes tracker-only devices in monado which are not expected to expose more than
* XRT_INPUT_GENERIC_TRACKER_POSE.
*
* Here we check inst->system.xsysd->roles.vive_tracker* for input names that are read from the config file.
*
* @todo: Integrate vive tracker pose config at a more appropriate place.
*/
for (uint32_t i = 0; i < binding_count; i++) {
struct oxr_binding *binding = &bindings[i];
enum xrt_input_name input_from_config;
if (vive_tracker_input_name_from_config(log, inst, binding->subaction_path, binding->input,
&input_from_config)) {
binding->input = input_from_config;
}
}
return XR_SUCCESS;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment