mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-02-03 12:28:07 +00:00
st/oxr: Optionally perform dynamic prediction.
This commit is contained in:
parent
f78509ba9b
commit
82f5a974e3
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
|
|
||||||
DEBUG_GET_ONCE_BOOL_OPTION(views, "OXR_DEBUG_VIEWS", false)
|
DEBUG_GET_ONCE_BOOL_OPTION(views, "OXR_DEBUG_VIEWS", false)
|
||||||
|
DEBUG_GET_ONCE_BOOL_OPTION(dynamic_prediction, "OXR_DYNAMIC_PREDICTION", false)
|
||||||
DEBUG_GET_ONCE_NUM_OPTION(ipd, "OXR_DEBUG_IPD_MM", 63)
|
DEBUG_GET_ONCE_NUM_OPTION(ipd, "OXR_DEBUG_IPD_MM", 63)
|
||||||
DEBUG_GET_ONCE_NUM_OPTION(prediction_ms, "OXR_DEBUG_PREDICTION_MS", 11)
|
DEBUG_GET_ONCE_NUM_OPTION(prediction_ms, "OXR_DEBUG_PREDICTION_MS", 11)
|
||||||
|
|
||||||
|
@ -161,19 +162,28 @@ oxr_session_get_view_pose_at(struct oxr_logger *log,
|
||||||
XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT) != 0) {
|
XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT) != 0) {
|
||||||
//! @todo Forcing a fixed amount of prediction for now since
|
//! @todo Forcing a fixed amount of prediction for now since
|
||||||
//! devices don't tell us timestamps yet.
|
//! devices don't tell us timestamps yet.
|
||||||
|
int64_t ns_diff = at_time - timestamp;
|
||||||
|
float interval;
|
||||||
|
if (debug_get_bool_option_dynamic_prediction()) {
|
||||||
|
interval =
|
||||||
|
time_ns_to_s(ns_diff) + sess->static_prediction_s;
|
||||||
|
} else {
|
||||||
|
interval = sess->static_prediction_s;
|
||||||
|
}
|
||||||
|
|
||||||
struct xrt_quat predicted;
|
struct xrt_quat predicted;
|
||||||
math_quat_integrate_velocity(
|
math_quat_integrate_velocity(&pose->orientation,
|
||||||
&pose->orientation, &relation.angular_velocity,
|
&relation.angular_velocity,
|
||||||
sess->static_prediction_s, &predicted);
|
interval, &predicted);
|
||||||
if (debug_get_bool_option_views()) {
|
if (debug_get_bool_option_views()) {
|
||||||
|
|
||||||
fprintf(
|
fprintf(stderr,
|
||||||
stderr,
|
"\toriginal quat = {%f, %f, %f, %f} "
|
||||||
"\toriginal quat = {%f, %f, %f, %f} predicted = "
|
"(time requested: %li, Interval %li nsec, with "
|
||||||
"{%f, %f, %f, %f}\n",
|
"static interval %f s)\n",
|
||||||
pose->orientation.x, pose->orientation.y,
|
pose->orientation.x, pose->orientation.y,
|
||||||
pose->orientation.z, pose->orientation.w,
|
pose->orientation.z, pose->orientation.w,
|
||||||
predicted.x, predicted.y, predicted.z, predicted.w);
|
at_time, ns_diff, interval);
|
||||||
}
|
}
|
||||||
pose->orientation = predicted;
|
pose->orientation = predicted;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue