diff --git a/server/driver/hand_joints_list.cpp b/server/driver/hand_joints_list.cpp index 4789b848..9e997b48 100644 --- a/server/driver/hand_joints_list.cpp +++ b/server/driver/hand_joints_list.cpp @@ -120,14 +120,13 @@ static xrt_hand_joint_set convert_joints(const std::optional #include #include @@ -40,21 +40,15 @@ class history std::array data{}; std::mutex mutex; - XrTime last_request; protected: - history() : - last_request(os_monotonic_get_ns()) {} - // return true if object is active (last request is not too old) - bool add_sample(XrTime produced_timestamp, XrTime timestamp, const Data & sample, const clock_offset & offset) + void add_sample(XrTime produced_timestamp, XrTime timestamp, const Data & sample, const clock_offset & offset) { XrTime produced = offset.from_headset(produced_timestamp); XrTime t = offset.from_headset(timestamp); std::lock_guard lock(mutex); - bool active = produced - last_request < 1'000'000'000; - TimedData * target = data.data(); if (offset) { @@ -62,7 +56,7 @@ protected: { // Discard reordered packets if (item.produced_timestamp > produced) - return active; + return; if (std::abs(item.at_timestamp_ns - t) < 2'000'000) { @@ -75,7 +69,6 @@ protected: } } *target = TimedData(sample, produced, t); - return active; } public: @@ -83,8 +76,6 @@ public: { std::lock_guard lock(mutex); - last_request = os_monotonic_get_ns(); - TimedData * before = nullptr; TimedData * after = nullptr; @@ -133,7 +124,6 @@ public: { std::lock_guard lock(mutex); data.fill({}); - last_request = os_monotonic_get_ns(); } }; } // namespace wivrn diff --git a/server/driver/pose_list.cpp b/server/driver/pose_list.cpp index 9258e473..74c7f155 100644 --- a/server/driver/pose_list.cpp +++ b/server/driver/pose_list.cpp @@ -24,7 +24,6 @@ #include "math/m_eigen_interop.hpp" #include "math/m_space.h" #include "math/m_vec3.h" -#include "os/os_time.h" #include "xrt/xrt_defines.h" #include #include @@ -91,10 +90,10 @@ xrt_space_relation pose_list::extrapolate(const xrt_space_relation & a, const xr return res; } -bool pose_list::update_tracking(const from_headset::tracking & tracking, const clock_offset & offset) +void pose_list::update_tracking(const from_headset::tracking & tracking, const clock_offset & offset) { if (source) - return false; + return; for (const auto & pose: tracking.device_poses) { @@ -103,7 +102,6 @@ bool pose_list::update_tracking(const from_headset::tracking & tracking, const c return add_sample(tracking.production_timestamp, tracking.timestamp, pose, offset); } - return true; } void pose_list::set_derived(pose_list * source, xrt_pose offset, bool force) @@ -143,10 +141,9 @@ void pose_list::reset() std::lock_guard lock(mutex); positions.reset(); orientations.reset(); - last_request = os_monotonic_get_ns(); } -bool pose_list::add_sample(XrTime production_timestamp, XrTime timestamp, const from_headset::tracking::pose & pose, const clock_offset & offset) +void pose_list::add_sample(XrTime production_timestamp, XrTime timestamp, const from_headset::tracking::pose & pose, const clock_offset & offset) { production_timestamp = offset.from_headset(production_timestamp); timestamp = offset.from_headset(timestamp); @@ -195,15 +192,12 @@ bool pose_list::add_sample(XrTime production_timestamp, XrTime timestamp, const std::lock_guard lock(mutex); positions.add_sample(position); orientations.add_sample(orientation); - return timestamp - last_request < 1'000'000'000; } std::pair pose_list::get_at(XrTime at_timestamp_ns) { std::lock_guard lock(mutex); - last_request = os_monotonic_get_ns(); - xrt_space_relation ret{}; auto flags = [&](int f) { ret.relation_flags = xrt_space_relation_flags(int(ret.relation_flags) | f); diff --git a/server/driver/pose_list.h b/server/driver/pose_list.h index 0c20fdf0..b3664510 100644 --- a/server/driver/pose_list.h +++ b/server/driver/pose_list.h @@ -35,7 +35,6 @@ class pose_list xrt_pose offset; std::atomic_bool derive_forced = false; std::mutex mutex; - XrTime last_request; polynomial_interpolator<3> positions; polynomial_interpolator<4, true> orientations; @@ -49,7 +48,7 @@ public: pose_list(wivrn::device_id id) : device(id) {} - bool update_tracking(const wivrn::from_headset::tracking &, const clock_offset & offset); + void update_tracking(const wivrn::from_headset::tracking &, const clock_offset & offset); void set_derived(pose_list * source, xrt_pose offset, bool force = false); std::tuple get_pose_at(XrTime at_timestamp_ns); @@ -58,6 +57,6 @@ public: std::pair get_at(XrTime at_timestamp_ns); private: - bool add_sample(XrTime production_timestamp, XrTime timestamp, const from_headset::tracking::pose & pose, const clock_offset & offset); + void add_sample(XrTime production_timestamp, XrTime timestamp, const from_headset::tracking::pose & pose, const clock_offset & offset); }; } // namespace wivrn diff --git a/server/driver/view_list.cpp b/server/driver/view_list.cpp index a39ee6cc..f7a2039c 100644 --- a/server/driver/view_list.cpp +++ b/server/driver/view_list.cpp @@ -23,10 +23,10 @@ namespace wivrn { -bool view_list::update_tracking(const from_headset::tracking & tracking, const clock_offset & offset) +void view_list::update_tracking(const from_headset::tracking & tracking, const clock_offset & offset) { if (not std::ranges::contains(tracking.device_poses, device_id::HEAD, &from_headset::tracking::pose::device)) - return true; + return; std::lock_guard lock(mutex); flags = tracking.view_flags; @@ -37,7 +37,7 @@ bool view_list::update_tracking(const from_headset::tracking & tracking, const c fovs[eye] = xrt_cast(tracking.views[eye].fov); } - return head_poses.update_tracking(tracking, offset); + head_poses.update_tracking(tracking, offset); } std::pair view_list::get_at(XrTime at_timestamp_ns) diff --git a/server/driver/view_list.h b/server/driver/view_list.h index 09da09f2..7f2c5ead 100644 --- a/server/driver/view_list.h +++ b/server/driver/view_list.h @@ -44,7 +44,7 @@ class view_list std::array fovs; public: - bool update_tracking(const from_headset::tracking & tracking, const clock_offset & offset); + void update_tracking(const from_headset::tracking & tracking, const clock_offset & offset); std::pair get_at(XrTime at_timestamp_ns); }; } // namespace wivrn diff --git a/server/driver/wivrn_android_face_tracker.h b/server/driver/wivrn_android_face_tracker.h index 6c273e24..36148e44 100644 --- a/server/driver/wivrn_android_face_tracker.h +++ b/server/driver/wivrn_android_face_tracker.h @@ -75,9 +75,9 @@ public: return result; } - bool update_tracking(const XrTime & production_timestamp, const XrTime & timestamp, const wivrn_android_face_data & data, const clock_offset & offset) + void update_tracking(const XrTime & production_timestamp, const XrTime & timestamp, const wivrn_android_face_data & data, const clock_offset & offset) { - return this->add_sample(production_timestamp, timestamp, data, offset); + add_sample(production_timestamp, timestamp, data, offset); } }; diff --git a/server/driver/wivrn_controller.cpp b/server/driver/wivrn_controller.cpp index dac5f211..a2adb4ac 100644 --- a/server/driver/wivrn_controller.cpp +++ b/server/driver/wivrn_controller.cpp @@ -26,6 +26,7 @@ #include "wivrn_config.h" #include "wivrn_session.h" +#include "os/os_time.h" #include "util/u_logging.h" #include #include diff --git a/server/driver/wivrn_fb_face2_tracker.h b/server/driver/wivrn_fb_face2_tracker.h index 94c8b9df..0dc34309 100644 --- a/server/driver/wivrn_fb_face2_tracker.h +++ b/server/driver/wivrn_fb_face2_tracker.h @@ -80,9 +80,9 @@ public: return result; } - bool update_tracking(const XrTime & production_timestamp, const XrTime & timestamp, const wivrn_fb_face2_data & data, const clock_offset & offset) + void update_tracking(const XrTime & production_timestamp, const XrTime & timestamp, const wivrn_fb_face2_data & data, const clock_offset & offset) { - return this->add_sample(production_timestamp, timestamp, data, offset); + add_sample(production_timestamp, timestamp, data, offset); } }; diff --git a/server/driver/wivrn_generic_tracker.cpp b/server/driver/wivrn_generic_tracker.cpp index aecea1e4..66dd1159 100644 --- a/server/driver/wivrn_generic_tracker.cpp +++ b/server/driver/wivrn_generic_tracker.cpp @@ -70,9 +70,9 @@ xrt_space_relation tracker_pose_list::extrapolate(const xrt_space_relation & a, return res; } -bool tracker_pose_list::update_tracking(XrTime produced_timestamp, XrTime timestamp, const from_headset::body_tracking::pose & pose, const clock_offset & offset) +void tracker_pose_list::update_tracking(XrTime produced_timestamp, XrTime timestamp, const from_headset::body_tracking::pose & pose, const clock_offset & offset) { - return add_sample(produced_timestamp, timestamp, convert_pose(pose), offset); + add_sample(produced_timestamp, timestamp, convert_pose(pose), offset); } static xrt_space_relation_flags convert_flags(uint8_t flags) diff --git a/server/driver/wivrn_generic_tracker.h b/server/driver/wivrn_generic_tracker.h index 4ef7ec85..713e7752 100644 --- a/server/driver/wivrn_generic_tracker.h +++ b/server/driver/wivrn_generic_tracker.h @@ -34,7 +34,7 @@ public: tracker_pose_list() = default; - bool update_tracking(XrTime produced_timestamp, XrTime timestamp, const from_headset::body_tracking::pose & pose, const clock_offset & offset); + void update_tracking(XrTime produced_timestamp, XrTime timestamp, const from_headset::body_tracking::pose & pose, const clock_offset & offset); static xrt_space_relation convert_pose(const wivrn::from_headset::body_tracking::pose &); }; diff --git a/server/driver/wivrn_htc_face_tracker.h b/server/driver/wivrn_htc_face_tracker.h index 1d095e87..3ac806ad 100644 --- a/server/driver/wivrn_htc_face_tracker.h +++ b/server/driver/wivrn_htc_face_tracker.h @@ -93,9 +93,9 @@ public: return result; } - bool update_tracking(const XrTime & production_timestamp, const XrTime & timestamp, const wivrn_htc_face_data & data, const clock_offset & offset) + void update_tracking(const XrTime & production_timestamp, const XrTime & timestamp, const wivrn_htc_face_data & data, const clock_offset & offset) { - return this->add_sample(production_timestamp, timestamp, data, offset); + add_sample(production_timestamp, timestamp, data, offset); } };