Enable pose extrapolation
This commit is contained in:
@@ -18,13 +18,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pose_list.h"
|
#include "pose_list.h"
|
||||||
#include "math/m_eigen_interop.hpp"
|
|
||||||
#include "math/m_space.h"
|
#include "math/m_space.h"
|
||||||
#include "math/m_vec3.h"
|
#include "math/m_vec3.h"
|
||||||
#include "xrt/xrt_defines.h"
|
#include "xrt/xrt_defines.h"
|
||||||
#include "xrt_cast.h"
|
#include "xrt_cast.h"
|
||||||
|
|
||||||
using namespace xrt::auxiliary::math;
|
|
||||||
using namespace xrt::drivers::wivrn;
|
using namespace xrt::drivers::wivrn;
|
||||||
|
|
||||||
xrt_space_relation pose_list::interpolate(const xrt_space_relation & a, const xrt_space_relation & b, float t)
|
xrt_space_relation pose_list::interpolate(const xrt_space_relation & a, const xrt_space_relation & b, float t)
|
||||||
@@ -40,28 +38,14 @@ xrt_space_relation pose_list::extrapolate(const xrt_space_relation & a, const xr
|
|||||||
if (t < ta)
|
if (t < ta)
|
||||||
return a;
|
return a;
|
||||||
|
|
||||||
if (t > tb)
|
xrt_space_relation res = b;
|
||||||
return b;
|
|
||||||
|
|
||||||
float h = (tb - ta) / 1.e9;
|
|
||||||
|
|
||||||
xrt_space_relation res;
|
|
||||||
res.relation_flags = b.relation_flags;
|
|
||||||
|
|
||||||
float dt = (t - tb) / 1.e9;
|
float dt = (t - tb) / 1.e9;
|
||||||
// if (dt > 0.2)
|
// if (dt > 0.2)
|
||||||
// dt = 0.2; // saturate dt to 200ms
|
// dt = 0.2; // saturate dt to 200ms
|
||||||
|
|
||||||
res.linear_velocity = b.linear_velocity;
|
|
||||||
res.pose.position = b.pose.position + b.linear_velocity * dt;
|
res.pose.position = b.pose.position + b.linear_velocity * dt;
|
||||||
|
|
||||||
res.angular_velocity = b.angular_velocity;
|
|
||||||
xrt_vec3 dtheta = b.angular_velocity * dt;
|
|
||||||
xrt_quat dq;
|
|
||||||
math_quat_exp(&dtheta, &dq);
|
|
||||||
|
|
||||||
map_quat(res.pose.orientation) = map_quat(b.pose.orientation) * map_quat(dq);
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user