Don't return valid data if too far from know times
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
#include <Eigen/Core>
|
#include <Eigen/Core>
|
||||||
#include <Eigen/QR>
|
#include <Eigen/QR>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cassert>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
@@ -175,6 +176,10 @@ public:
|
|||||||
if (not closest->y)
|
if (not closest->y)
|
||||||
return *closest;
|
return *closest;
|
||||||
|
|
||||||
|
// Avoid returning obviously wrong data
|
||||||
|
if (std::abs(closest->timestamp - timestamp) > 1'000'000'000)
|
||||||
|
return {};
|
||||||
|
|
||||||
// Not enough data to extrapolate
|
// Not enough data to extrapolate
|
||||||
if (row < 2)
|
if (row < 2)
|
||||||
{
|
{
|
||||||
@@ -194,6 +199,14 @@ public:
|
|||||||
else
|
else
|
||||||
sol = (Aprime.transpose() * Aprime).ldlt().solve(Aprime.transpose() * bprime).transpose();
|
sol = (Aprime.transpose() * Aprime).ldlt().solve(Aprime.transpose() * bprime).transpose();
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
if constexpr (quaternion)
|
||||||
|
{
|
||||||
|
float norm = sol.template block<N, 1>(0, 0).norm();
|
||||||
|
assert(norm > 0.9);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return sample{
|
return sample{
|
||||||
.production_timestamp = production_timestamp,
|
.production_timestamp = production_timestamp,
|
||||||
.timestamp = timestamp,
|
.timestamp = timestamp,
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "wivrn_hmd.h"
|
#include "wivrn_hmd.h"
|
||||||
|
#include "math/m_api.h"
|
||||||
#include "os/os_time.h"
|
#include "os/os_time.h"
|
||||||
#include "wivrn_config.h"
|
#include "wivrn_config.h"
|
||||||
#include "wivrn_session.h"
|
#include "wivrn_session.h"
|
||||||
@@ -188,6 +189,8 @@ xrt_result_t wivrn_hmd::get_view_poses(const xrt_vec3 * default_eye_relation,
|
|||||||
view.relation.relation_flags = (xrt_space_relation_flags)flags;
|
view.relation.relation_flags = (xrt_space_relation_flags)flags;
|
||||||
*out_head_relation = view.relation;
|
*out_head_relation = view.relation;
|
||||||
|
|
||||||
|
assert((out_head_relation->relation_flags & XRT_SPACE_RELATION_ORIENTATION_VALID_BIT) == 0 or math_quat_ensure_normalized(&out_head_relation->pose.orientation));
|
||||||
|
|
||||||
assert(view_count == 2);
|
assert(view_count == 2);
|
||||||
for (size_t eye = 0; eye < 2; ++eye)
|
for (size_t eye = 0; eye < 2; ++eye)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user