From 3f783ceb0c0a72357f5814725ab8ac4409255037 Mon Sep 17 00:00:00 2001 From: Patrick Nicolas Date: Wed, 15 Nov 2023 21:04:25 +0100 Subject: [PATCH] Don't extrapolate controller positions --- server/driver/pose_list.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/server/driver/pose_list.cpp b/server/driver/pose_list.cpp index 47ea5fdc..96c69890 100644 --- a/server/driver/pose_list.cpp +++ b/server/driver/pose_list.cpp @@ -40,24 +40,23 @@ xrt_space_relation extrapolate(const xrt_space_relation & a, const xrt_space_rel if (t < ta) return a; + if (t > tb) + return b; + float h = (tb - ta) / 1.e9; xrt_space_relation res; res.relation_flags = b.relation_flags; - xrt_vec3 lin_acc = (b.linear_velocity - a.linear_velocity) / h; - xrt_vec3 ang_acc = (b.angular_velocity - a.angular_velocity) / h; - float dt = (t - tb) / 1.e9; // if (dt > 0.2) // dt = 0.2; // saturate dt to 200ms - float dt2_over_2 = dt * dt / 2; - res.linear_velocity = b.linear_velocity + lin_acc * dt; - res.pose.position = b.pose.position + b.linear_velocity * dt + lin_acc * dt2_over_2; + res.linear_velocity = b.linear_velocity; + res.pose.position = b.pose.position + b.linear_velocity * dt; - res.angular_velocity = b.angular_velocity + ang_acc * dt; - xrt_vec3 dtheta = b.angular_velocity * dt + ang_acc * dt2_over_2; + res.angular_velocity = b.angular_velocity; + xrt_vec3 dtheta = b.angular_velocity * dt; xrt_quat dq; math_quat_exp(&dtheta, &dq);