From c9301332dd43e93aaf699db11474e414868a1f87 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Sun, 7 Apr 2024 10:20:03 +0200 Subject: [PATCH] Avoid hand tracking packet fragmentation --- client/scenes/stream_tracking.cpp | 9 ++++++--- common/wivrn_packets.h | 14 ++++++++++---- server/driver/hand_joints_list.cpp | 13 +++++++------ 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/client/scenes/stream_tracking.cpp b/client/scenes/stream_tracking.cpp index 643eb5ed..ac595f1d 100644 --- a/client/scenes/stream_tracking.cpp +++ b/client/scenes/stream_tracking.cpp @@ -78,7 +78,7 @@ static std::optionalsend_stream(hands); + hands.hand = xrt::drivers::wivrn::from_headset::hand_tracking::right; + hands.joints = locate_hands(application::get_right_hand(), world_space, hands.timestamp); network_session->send_stream(hands); } } diff --git a/common/wivrn_packets.h b/common/wivrn_packets.h index 14afc719..d61bba17 100644 --- a/common/wivrn_packets.h +++ b/common/wivrn_packets.h @@ -160,20 +160,26 @@ struct hand_tracking orientation_tracked = 1 << 4, position_tracked = 1 << 5 }; - + enum hand_id : uint8_t + { + left, + right, + }; struct pose { XrPosef pose; XrVector3f linear_velocity; XrVector3f angular_velocity; - float radius; + // In order to avoid packet fragmentation + // use 2 less bytes for radius + uint16_t radius; // 10th of mm uint8_t flags; }; XrTime production_timestamp; XrTime timestamp; - std::optional> left; - std::optional> right; + hand_id hand; + std::optional> joints; }; struct inputs diff --git a/server/driver/hand_joints_list.cpp b/server/driver/hand_joints_list.cpp index 746e313c..4d1c8ecd 100644 --- a/server/driver/hand_joints_list.cpp +++ b/server/driver/hand_joints_list.cpp @@ -104,7 +104,7 @@ static xrt_hand_joint_set convert_joints(const std::optional