Add support for palm_ext
This commit is contained in:
@@ -627,6 +627,15 @@ void application::initialize_actions()
|
|||||||
if (!profile.available)
|
if (!profile.available)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Patch profile to add palm_ext
|
||||||
|
if (utils::contains(xr_extensions, XR_EXT_PALM_POSE_EXTENSION_NAME) //
|
||||||
|
and utils::contains(profile.input_sources, "/user/hand/left/input/grip/pose") //
|
||||||
|
and not utils::contains(profile.input_sources, "/user/hand/left/palm_ext/pose"))
|
||||||
|
{
|
||||||
|
profile.input_sources.push_back("/user/hand/left/palm_ext/pose");
|
||||||
|
profile.input_sources.push_back("/user/hand/right/palm_ext/pose");
|
||||||
|
}
|
||||||
|
|
||||||
suggested_bindings.emplace(profile.profile_name, std::vector<XrActionSuggestedBinding>{});
|
suggested_bindings.emplace(profile.profile_name, std::vector<XrActionSuggestedBinding>{});
|
||||||
|
|
||||||
for (const std::string & source: profile.input_sources)
|
for (const std::string & source: profile.input_sources)
|
||||||
@@ -659,6 +668,10 @@ void application::initialize_actions()
|
|||||||
spaces[size_t(xr::spaces::aim_right)] = xr_session.create_action_space(a);
|
spaces[size_t(xr::spaces::aim_right)] = xr_session.create_action_space(a);
|
||||||
else if (name == "/user/eyes_ext/input/gaze_ext/pose")
|
else if (name == "/user/eyes_ext/input/gaze_ext/pose")
|
||||||
spaces[size_t(xr::spaces::eye_gaze)] = xr_session.create_action_space(a);
|
spaces[size_t(xr::spaces::eye_gaze)] = xr_session.create_action_space(a);
|
||||||
|
else if (name == "/user/hand/right/palm_ext/pose")
|
||||||
|
spaces[size_t(xr::spaces::palm_right)] = xr_session.create_action_space(a);
|
||||||
|
else if (name == "/user/hand/left/palm_ext/pose")
|
||||||
|
spaces[size_t(xr::spaces::palm_left)] = xr_session.create_action_space(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build an action set for each scene
|
// Build an action set for each scene
|
||||||
@@ -742,6 +755,7 @@ void application::initialize()
|
|||||||
opt_extensions.push_back(XR_FB_PASSTHROUGH_EXTENSION_NAME);
|
opt_extensions.push_back(XR_FB_PASSTHROUGH_EXTENSION_NAME);
|
||||||
opt_extensions.push_back(XR_HTC_PASSTHROUGH_EXTENSION_NAME);
|
opt_extensions.push_back(XR_HTC_PASSTHROUGH_EXTENSION_NAME);
|
||||||
opt_extensions.push_back(XR_FB_FACE_TRACKING2_EXTENSION_NAME);
|
opt_extensions.push_back(XR_FB_FACE_TRACKING2_EXTENSION_NAME);
|
||||||
|
opt_extensions.push_back(XR_EXT_PALM_POSE_EXTENSION_NAME);
|
||||||
|
|
||||||
for (const auto & i: interaction_profiles)
|
for (const auto & i: interaction_profiles)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
|||||||
info.hand_tracking = application::get_hand_tracking_supported();
|
info.hand_tracking = application::get_hand_tracking_supported();
|
||||||
info.eye_gaze = config.check_feature(feature::eye_gaze);
|
info.eye_gaze = config.check_feature(feature::eye_gaze);
|
||||||
info.face_tracking2_fb = config.check_feature(feature::face_tracking);
|
info.face_tracking2_fb = config.check_feature(feature::face_tracking);
|
||||||
|
info.palm_pose = application::space(xr::spaces::palm_left) or application::space(xr::spaces::palm_right);
|
||||||
|
|
||||||
audio::get_audio_description(info);
|
audio::get_audio_description(info);
|
||||||
if (not(config.check_feature(feature::microphone)))
|
if (not(config.check_feature(feature::microphone)))
|
||||||
|
|||||||
@@ -140,10 +140,14 @@ static bool enabled(const to_headset::tracking_control & control, device_id id)
|
|||||||
return control.enabled[size_t(tid::left_aim)];
|
return control.enabled[size_t(tid::left_aim)];
|
||||||
case device_id::LEFT_GRIP:
|
case device_id::LEFT_GRIP:
|
||||||
return control.enabled[size_t(tid::left_grip)];
|
return control.enabled[size_t(tid::left_grip)];
|
||||||
|
case device_id::LEFT_PALM:
|
||||||
|
return control.enabled[size_t(tid::left_palm)];
|
||||||
case device_id::RIGHT_AIM:
|
case device_id::RIGHT_AIM:
|
||||||
return control.enabled[size_t(tid::right_aim)];
|
return control.enabled[size_t(tid::right_aim)];
|
||||||
case device_id::RIGHT_GRIP:
|
case device_id::RIGHT_GRIP:
|
||||||
return control.enabled[size_t(tid::right_grip)];
|
return control.enabled[size_t(tid::right_grip)];
|
||||||
|
case device_id::RIGHT_PALM:
|
||||||
|
return control.enabled[size_t(tid::right_palm)];
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -182,6 +186,11 @@ void scenes::stream::tracking()
|
|||||||
{device_id::RIGHT_AIM, application::space(xr::spaces::aim_right)},
|
{device_id::RIGHT_AIM, application::space(xr::spaces::aim_right)},
|
||||||
{device_id::RIGHT_GRIP, application::space(xr::spaces::grip_right)}};
|
{device_id::RIGHT_GRIP, application::space(xr::spaces::grip_right)}};
|
||||||
|
|
||||||
|
if (XrSpace palm = application::space(xr::spaces::palm_left))
|
||||||
|
spaces.emplace_back(device_id::LEFT_PALM, palm);
|
||||||
|
if (XrSpace palm = application::space(xr::spaces::palm_right))
|
||||||
|
spaces.emplace_back(device_id::RIGHT_PALM, palm);
|
||||||
|
|
||||||
if (application::get_eye_gaze_supported())
|
if (application::get_eye_gaze_supported())
|
||||||
spaces.push_back({device_id::EYE_GAZE, application::space(xr::spaces::eye_gaze)});
|
spaces.push_back({device_id::EYE_GAZE, application::space(xr::spaces::eye_gaze)});
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ enum class spaces
|
|||||||
grip_right,
|
grip_right,
|
||||||
aim_left,
|
aim_left,
|
||||||
aim_right,
|
aim_right,
|
||||||
|
palm_left,
|
||||||
|
palm_right,
|
||||||
|
|
||||||
count
|
count
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,8 +45,10 @@ enum class device_id : uint8_t
|
|||||||
RIGHT_CONTROLLER_HAPTIC, // /user/hand/right/output/haptic
|
RIGHT_CONTROLLER_HAPTIC, // /user/hand/right/output/haptic
|
||||||
LEFT_GRIP, // /user/hand/left/input/grip/pose
|
LEFT_GRIP, // /user/hand/left/input/grip/pose
|
||||||
LEFT_AIM, // /user/hand/left/input/aim/pose
|
LEFT_AIM, // /user/hand/left/input/aim/pose
|
||||||
|
LEFT_PALM, // /user/hand/left/palm_ext/pose
|
||||||
RIGHT_GRIP, // /user/hand/right/input/grip/pose
|
RIGHT_GRIP, // /user/hand/right/input/grip/pose
|
||||||
RIGHT_AIM, // /user/hand/right/input/aim/pose
|
RIGHT_AIM, // /user/hand/right/input/aim/pose
|
||||||
|
RIGHT_PALM, // /user/hand/right/palm_ext/pose
|
||||||
X_CLICK, // /user/hand/left/input/x/click
|
X_CLICK, // /user/hand/left/input/x/click
|
||||||
X_TOUCH, // /user/hand/left/input/x/touch
|
X_TOUCH, // /user/hand/left/input/x/touch
|
||||||
Y_CLICK, // /user/hand/left/input/y/click
|
Y_CLICK, // /user/hand/left/input/y/click
|
||||||
@@ -111,6 +113,7 @@ struct headset_info_packet
|
|||||||
bool hand_tracking;
|
bool hand_tracking;
|
||||||
bool eye_gaze;
|
bool eye_gaze;
|
||||||
bool face_tracking2_fb;
|
bool face_tracking2_fb;
|
||||||
|
bool palm_pose;
|
||||||
std::vector<video_codec> supported_codecs; // from preferred to least preferred
|
std::vector<video_codec> supported_codecs; // from preferred to least preferred
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -373,8 +376,10 @@ struct tracking_control
|
|||||||
{
|
{
|
||||||
left_aim,
|
left_aim,
|
||||||
left_grip,
|
left_grip,
|
||||||
|
left_palm,
|
||||||
right_aim,
|
right_aim,
|
||||||
right_grip,
|
right_grip,
|
||||||
|
right_palm,
|
||||||
left_hand,
|
left_hand,
|
||||||
right_hand,
|
right_hand,
|
||||||
face,
|
face,
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ enum wivrn_controller_input_index
|
|||||||
WIVRN_CONTROLLER_AIM_POSE,
|
WIVRN_CONTROLLER_AIM_POSE,
|
||||||
WIVRN_CONTROLLER_GRIP_POSE,
|
WIVRN_CONTROLLER_GRIP_POSE,
|
||||||
WIVRN_CONTROLLER_HAND_TRACKER,
|
WIVRN_CONTROLLER_HAND_TRACKER,
|
||||||
|
WIVRN_CONTROLLER_PALM_POSE,
|
||||||
|
|
||||||
WIVRN_CONTROLLER_MENU_CLICK, // /user/hand/left/input/menu/click
|
WIVRN_CONTROLLER_MENU_CLICK, // /user/hand/left/input/menu/click
|
||||||
WIVRN_CONTROLLER_A_CLICK, // /user/hand/right/input/a/click
|
WIVRN_CONTROLLER_A_CLICK, // /user/hand/right/input/a/click
|
||||||
@@ -152,6 +153,7 @@ wivrn_controller::wivrn_controller(int hand_id,
|
|||||||
xrt_device{},
|
xrt_device{},
|
||||||
grip(hand_id == 0 ? device_id::LEFT_GRIP : device_id::RIGHT_GRIP),
|
grip(hand_id == 0 ? device_id::LEFT_GRIP : device_id::RIGHT_GRIP),
|
||||||
aim(hand_id == 0 ? device_id::LEFT_AIM : device_id::RIGHT_AIM),
|
aim(hand_id == 0 ? device_id::LEFT_AIM : device_id::RIGHT_AIM),
|
||||||
|
palm(hand_id == 0 ? device_id::LEFT_PALM : device_id::RIGHT_PALM),
|
||||||
joints(hand_id),
|
joints(hand_id),
|
||||||
cnx(cnx)
|
cnx(cnx)
|
||||||
{
|
{
|
||||||
@@ -172,7 +174,7 @@ wivrn_controller::wivrn_controller(int hand_id,
|
|||||||
|
|
||||||
inputs_array.resize(WIVRN_CONTROLLER_INPUT_COUNT);
|
inputs_array.resize(WIVRN_CONTROLLER_INPUT_COUNT);
|
||||||
inputs = inputs_array.data();
|
inputs = inputs_array.data();
|
||||||
input_count = WIVRN_CONTROLLER_INPUT_COUNT;
|
input_count = inputs_array.size();
|
||||||
|
|
||||||
// Setup input.
|
// Setup input.
|
||||||
#define SET_INPUT(NAME) \
|
#define SET_INPUT(NAME) \
|
||||||
@@ -210,6 +212,9 @@ wivrn_controller::wivrn_controller(int hand_id,
|
|||||||
inputs[WIVRN_CONTROLLER_HAND_TRACKER].name = hand_id == 0 ? XRT_INPUT_GENERIC_HAND_TRACKING_LEFT : XRT_INPUT_GENERIC_HAND_TRACKING_RIGHT;
|
inputs[WIVRN_CONTROLLER_HAND_TRACKER].name = hand_id == 0 ? XRT_INPUT_GENERIC_HAND_TRACKING_LEFT : XRT_INPUT_GENERIC_HAND_TRACKING_RIGHT;
|
||||||
inputs[WIVRN_CONTROLLER_HAND_TRACKER].active = true;
|
inputs[WIVRN_CONTROLLER_HAND_TRACKER].active = true;
|
||||||
|
|
||||||
|
inputs[WIVRN_CONTROLLER_PALM_POSE].name = XRT_INPUT_GENERIC_PALM_POSE;
|
||||||
|
inputs[WIVRN_CONTROLLER_PALM_POSE].active = cnx->get_info().palm_pose;
|
||||||
|
|
||||||
output_count = 1;
|
output_count = 1;
|
||||||
outputs = &haptic_output;
|
outputs = &haptic_output;
|
||||||
haptic_output.name = XRT_OUTPUT_NAME_TOUCH_HAPTIC;
|
haptic_output.name = XRT_OUTPUT_NAME_TOUCH_HAPTIC;
|
||||||
@@ -319,6 +324,10 @@ xrt_space_relation wivrn_controller::get_tracked_pose(xrt_input_name name, int64
|
|||||||
std::tie(extrapolation_time, res) = grip.get_at(at_timestamp_ns);
|
std::tie(extrapolation_time, res) = grip.get_at(at_timestamp_ns);
|
||||||
cnx->set_enabled(grip.device, true);
|
cnx->set_enabled(grip.device, true);
|
||||||
break;
|
break;
|
||||||
|
case XRT_INPUT_GENERIC_PALM_POSE:
|
||||||
|
std::tie(extrapolation_time, res) = palm.get_at(at_timestamp_ns);
|
||||||
|
cnx->set_enabled(palm.device, true);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
U_LOG_W("Unknown input name requested");
|
U_LOG_W("Unknown input name requested");
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ class wivrn_controller : public xrt_device
|
|||||||
|
|
||||||
pose_list grip;
|
pose_list grip;
|
||||||
pose_list aim;
|
pose_list aim;
|
||||||
|
pose_list palm;
|
||||||
hand_joints_list joints;
|
hand_joints_list joints;
|
||||||
|
|
||||||
std::vector<xrt_input> inputs_staging;
|
std::vector<xrt_input> inputs_staging;
|
||||||
|
|||||||
@@ -373,10 +373,14 @@ static auto to_tracking_control(device_id id)
|
|||||||
return tid::left_aim;
|
return tid::left_aim;
|
||||||
case device_id::LEFT_GRIP:
|
case device_id::LEFT_GRIP:
|
||||||
return tid::left_grip;
|
return tid::left_grip;
|
||||||
|
case device_id::LEFT_PALM:
|
||||||
|
return tid::left_palm;
|
||||||
case device_id::RIGHT_AIM:
|
case device_id::RIGHT_AIM:
|
||||||
return tid::right_aim;
|
return tid::right_aim;
|
||||||
case device_id::RIGHT_GRIP:
|
case device_id::RIGHT_GRIP:
|
||||||
return tid::right_grip;
|
return tid::right_grip;
|
||||||
|
case device_id::RIGHT_PALM:
|
||||||
|
return tid::right_palm;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user