Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -540,9 +540,11 @@ wivrn_controller::wivrn_controller(int hand_id,
|
||||
.binding_profile_count = std::size(wivrn_binding_profiles),
|
||||
.binding_profiles = wivrn_binding_profiles,
|
||||
.input_count = WIVRN_CONTROLLER_INPUT_COUNT,
|
||||
.orientation_tracking_supported = true,
|
||||
.position_tracking_supported = true,
|
||||
.hand_tracking_supported = cnx->get_info().hand_tracking,
|
||||
.supported = {
|
||||
.orientation_tracking = true,
|
||||
.position_tracking = true,
|
||||
.hand_tracking = cnx->get_info().hand_tracking,
|
||||
},
|
||||
.update_inputs = method_pointer<&wivrn_controller::update_inputs>,
|
||||
.get_tracked_pose = method_pointer<&wivrn_controller::get_tracked_pose>,
|
||||
.get_hand_tracking = method_pointer<&wivrn_controller::get_hand_tracking>,
|
||||
@@ -767,7 +769,7 @@ xrt_result_t wivrn_controller::get_tracked_pose(xrt_input_name name, int64_t at_
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
void wivrn_controller::get_hand_tracking(xrt_input_name name, int64_t desired_timestamp_ns, xrt_hand_joint_set * out_value, int64_t * out_timestamp_ns)
|
||||
xrt_result_t wivrn_controller::get_hand_tracking(xrt_input_name name, int64_t desired_timestamp_ns, xrt_hand_joint_set * out_value, int64_t * out_timestamp_ns)
|
||||
{
|
||||
switch (name)
|
||||
{
|
||||
@@ -778,12 +780,13 @@ void wivrn_controller::get_hand_tracking(xrt_input_name name, int64_t desired_ti
|
||||
std::tie(extrapolation_time, *out_value) = joints.get_at(desired_timestamp_ns);
|
||||
cnx->add_predict_offset(extrapolation_time);
|
||||
cnx->set_enabled(joints.hand_id == 0 ? to_headset::tracking_control::id::left_hand : to_headset::tracking_control::id::right_hand, true);
|
||||
return;
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
default:
|
||||
U_LOG_W("Unknown input name requested %d", int(name));
|
||||
}
|
||||
return XRT_ERROR_INPUT_UNSUPPORTED;
|
||||
}
|
||||
|
||||
void wivrn_controller::set_derived_pose(const from_headset::derived_pose & derived)
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
xrt_result_t update_inputs();
|
||||
|
||||
xrt_result_t get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns, xrt_space_relation * out_relation);
|
||||
void get_hand_tracking(xrt_input_name name, int64_t desired_timestamp_ns, xrt_hand_joint_set * out_value, int64_t * out_timestamp_ns);
|
||||
xrt_result_t get_hand_tracking(xrt_input_name name, int64_t desired_timestamp_ns, xrt_hand_joint_set * out_value, int64_t * out_timestamp_ns);
|
||||
|
||||
void set_output(xrt_output_name name, const xrt_output_value * value);
|
||||
|
||||
|
||||
@@ -52,28 +52,27 @@ static xrt_result_t wivrn_eye_tracker_get_tracked_pose(xrt_device * xdev,
|
||||
}
|
||||
|
||||
wivrn_eye_tracker::wivrn_eye_tracker(xrt_device * hmd) :
|
||||
xrt_device{}, gaze(device_id::EYE_GAZE)
|
||||
xrt_device{
|
||||
.name = XRT_DEVICE_EYE_GAZE_INTERACTION,
|
||||
.device_type = XRT_DEVICE_TYPE_EYE_TRACKER,
|
||||
.str = "WiVRn Eye Tracker",
|
||||
.serial = "WiVRn Eye Tracker",
|
||||
.tracking_origin = hmd->tracking_origin,
|
||||
.input_count = 1,
|
||||
.inputs = &gaze_input,
|
||||
.supported = {
|
||||
.eye_gaze = true,
|
||||
},
|
||||
.update_inputs = wivrn_eye_tracker_update_inputs,
|
||||
.get_tracked_pose = wivrn_eye_tracker_get_tracked_pose,
|
||||
.destroy = wivrn_eye_tracker_destroy,
|
||||
},
|
||||
gaze_input{
|
||||
.active = true,
|
||||
.name = XRT_INPUT_GENERIC_EYE_GAZE_POSE,
|
||||
},
|
||||
gaze(device_id::EYE_GAZE)
|
||||
{
|
||||
xrt_device * base = this;
|
||||
base->tracking_origin = hmd->tracking_origin;
|
||||
|
||||
base->update_inputs = wivrn_eye_tracker_update_inputs;
|
||||
base->get_tracked_pose = wivrn_eye_tracker_get_tracked_pose;
|
||||
base->destroy = wivrn_eye_tracker_destroy;
|
||||
name = XRT_DEVICE_EYE_GAZE_INTERACTION;
|
||||
device_type = XRT_DEVICE_TYPE_EYE_TRACKER;
|
||||
eye_gaze_supported = true;
|
||||
|
||||
// Print name.
|
||||
strcpy(str, "WiVRn Eye Tracker");
|
||||
strcpy(serial, "WiVRn Eye Tracker");
|
||||
|
||||
gaze_input.active = true;
|
||||
gaze_input.name = XRT_INPUT_GENERIC_EYE_GAZE_POSE;
|
||||
|
||||
// Setup input.
|
||||
inputs = &gaze_input;
|
||||
input_count = 1;
|
||||
}
|
||||
|
||||
void wivrn_eye_tracker::update_inputs()
|
||||
|
||||
@@ -45,18 +45,21 @@ wivrn_fb_face2_tracker::wivrn_fb_face2_tracker(xrt_device * hmd,
|
||||
.str = "WiVRn FB v2 Face Tracker",
|
||||
.serial = "WiVRn FB v2 Face Tracker",
|
||||
.tracking_origin = hmd->tracking_origin,
|
||||
.face_tracking_supported = true,
|
||||
.input_count = 1,
|
||||
.inputs = &face_input,
|
||||
.supported = {
|
||||
.face_tracking = true,
|
||||
},
|
||||
.update_inputs = method_pointer<&wivrn_fb_face2_tracker::update_inputs>,
|
||||
.get_face_tracking = method_pointer<&wivrn_fb_face2_tracker::get_face_tracking>,
|
||||
.destroy = [](xrt_device *) {},
|
||||
},
|
||||
face_input{
|
||||
.active = true,
|
||||
.name = XRT_INPUT_FB_FACE_TRACKING2_VISUAL,
|
||||
},
|
||||
cnx(cnx)
|
||||
{
|
||||
// Setup input.
|
||||
face_input.name = XRT_INPUT_FB_FACE_TRACKING2_VISUAL;
|
||||
face_input.active = true;
|
||||
inputs = &face_input;
|
||||
input_count = 1;
|
||||
}
|
||||
|
||||
xrt_result_t wivrn_fb_face2_tracker::update_inputs()
|
||||
|
||||
@@ -113,8 +113,10 @@ wivrn_generic_tracker::wivrn_generic_tracker(int index, xrt_device * hmd, wivrn_
|
||||
.device_type = XRT_DEVICE_TYPE_GENERIC_TRACKER,
|
||||
.hmd = nullptr,
|
||||
.tracking_origin = hmd->tracking_origin,
|
||||
.orientation_tracking_supported = true,
|
||||
.position_tracking_supported = true,
|
||||
.supported = {
|
||||
.orientation_tracking = true,
|
||||
.position_tracking = true,
|
||||
},
|
||||
.update_inputs = method_pointer<&wivrn_generic_tracker::update_inputs>,
|
||||
.get_tracked_pose = method_pointer<&wivrn_generic_tracker::get_tracked_pose>,
|
||||
.destroy = [](xrt_device *) {},
|
||||
@@ -173,4 +175,4 @@ void wivrn_generic_tracker::update_tracking(const from_headset::body_tracking &
|
||||
if (!poses.update_tracking(tracking.production_timestamp, tracking.timestamp, pose, offset))
|
||||
cnx.set_tracker_enabled(index, false);
|
||||
}
|
||||
} // namespace wivrn
|
||||
} // namespace wivrn
|
||||
|
||||
@@ -73,9 +73,11 @@ wivrn_hmd::wivrn_hmd(wivrn::wivrn_session * cnx,
|
||||
.tracking_origin = &tracking_origin,
|
||||
.input_count = 1,
|
||||
.inputs = &pose_input,
|
||||
.orientation_tracking_supported = true,
|
||||
.position_tracking_supported = true,
|
||||
.battery_status_supported = true,
|
||||
.supported = {
|
||||
.orientation_tracking = true,
|
||||
.position_tracking = true,
|
||||
.battery_status = true,
|
||||
},
|
||||
.update_inputs = [](xrt_device *) { return XRT_SUCCESS; },
|
||||
.get_tracked_pose = method_pointer<&wivrn_hmd::get_tracked_pose>,
|
||||
.get_view_poses = method_pointer<&wivrn_hmd::get_view_poses>,
|
||||
@@ -145,12 +147,12 @@ void wivrn_hmd::update_battery(const from_headset::battery & new_battery)
|
||||
battery = new_battery;
|
||||
}
|
||||
|
||||
void wivrn_hmd::get_view_poses(const xrt_vec3 * default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
uint32_t view_count,
|
||||
xrt_space_relation * out_head_relation,
|
||||
xrt_fov * out_fovs,
|
||||
xrt_pose * out_poses)
|
||||
xrt_result_t wivrn_hmd::get_view_poses(const xrt_vec3 * default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
uint32_t view_count,
|
||||
xrt_space_relation * out_head_relation,
|
||||
xrt_fov * out_fovs,
|
||||
xrt_pose * out_poses)
|
||||
{
|
||||
auto [extrapolation_time, view] = views.get_at(at_timestamp_ns);
|
||||
cnx->add_predict_offset(extrapolation_time);
|
||||
@@ -178,6 +180,7 @@ void wivrn_hmd::get_view_poses(const xrt_vec3 * default_eye_relation,
|
||||
out_fovs[eye] = view.fovs[eye];
|
||||
out_poses[eye] = view.poses[eye];
|
||||
}
|
||||
return XRT_SUCCESS;
|
||||
}
|
||||
|
||||
xrt_result_t wivrn_hmd::get_battery_status(bool * out_present,
|
||||
|
||||
@@ -69,12 +69,12 @@ public:
|
||||
void set_foveated_size(uint32_t width, uint32_t height);
|
||||
|
||||
xrt_result_t get_tracked_pose(xrt_input_name name, int64_t at_timestamp_ns, xrt_space_relation *);
|
||||
void get_view_poses(const xrt_vec3 * default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
uint32_t view_count,
|
||||
xrt_space_relation * out_head_relation,
|
||||
xrt_fov * out_fovs,
|
||||
xrt_pose * out_poses);
|
||||
xrt_result_t get_view_poses(const xrt_vec3 * default_eye_relation,
|
||||
int64_t at_timestamp_ns,
|
||||
uint32_t view_count,
|
||||
xrt_space_relation * out_head_relation,
|
||||
xrt_fov * out_fovs,
|
||||
xrt_pose * out_poses);
|
||||
xrt_result_t get_battery_status(bool * out_present,
|
||||
bool * out_charging,
|
||||
float * out_charge);
|
||||
|
||||
@@ -45,20 +45,27 @@ wivrn_htc_face_tracker::wivrn_htc_face_tracker(xrt_device * hmd,
|
||||
.str = "WiVRn HTC Face Tracker",
|
||||
.serial = "WiVRn HTC Face Tracker",
|
||||
.tracking_origin = hmd->tracking_origin,
|
||||
.face_tracking_supported = true,
|
||||
.supported = {
|
||||
.face_tracking = true,
|
||||
},
|
||||
.update_inputs = method_pointer<&wivrn_htc_face_tracker::update_inputs>,
|
||||
.get_face_tracking = method_pointer<&wivrn_htc_face_tracker::get_face_tracking>,
|
||||
.destroy = [](xrt_device *) {},
|
||||
},
|
||||
inputs_array{
|
||||
{
|
||||
{
|
||||
.active = true,
|
||||
.name = XRT_INPUT_HTC_EYE_FACE_TRACKING,
|
||||
},
|
||||
{
|
||||
.active = true,
|
||||
.name = XRT_INPUT_HTC_LIP_FACE_TRACKING,
|
||||
},
|
||||
},
|
||||
},
|
||||
cnx(cnx)
|
||||
{
|
||||
// Setup input.
|
||||
inputs_array[0].name = XRT_INPUT_HTC_EYE_FACE_TRACKING;
|
||||
inputs_array[0].active = true;
|
||||
|
||||
inputs_array[1].name = XRT_INPUT_HTC_LIP_FACE_TRACKING;
|
||||
inputs_array[1].active = true;
|
||||
|
||||
inputs = inputs_array.data();
|
||||
input_count = inputs_array.size();
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection
|
||||
|
||||
static_roles.head = xdevs[xdev_count++] = &hmd;
|
||||
|
||||
if (hmd.face_tracking_supported)
|
||||
if (hmd.supported.face_tracking)
|
||||
static_roles.face = &hmd;
|
||||
|
||||
roles.left = xdev_count;
|
||||
|
||||
Reference in New Issue
Block a user