The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/hydra: apply one-euro filter before estimating motion from relation history

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2495>

Simon Zeni 7fc5689d 209c4f48

+12 -3
+12 -3
src/xrt/drivers/hydra/hydra_driver.c
··· 25 25 #include "xrt/xrt_byte_order.h" 26 26 27 27 #include "math/m_api.h" 28 + #include "math/m_filter_one_euro.h" 28 29 #include "math/m_relation_history.h" 29 30 #include "math/m_space.h" 30 31 ··· 110 111 111 112 struct hydra_controller_state 112 113 { 113 - struct m_relation_history_filters motion_vector_filters; 114 114 struct m_relation_history *relation_history; 115 + struct 116 + { 117 + struct m_filter_euro_vec3 position; 118 + struct m_filter_euro_quat orientation; 119 + } motion_vector_filters; 115 120 116 121 struct xrt_vec2 js; 117 122 float trigger; ··· 331 336 pose.orientation = fixed; 332 337 333 338 struct xrt_space_relation space_relation = {0}; 334 - space_relation.pose = pose; 339 + m_filter_euro_vec3_run(&state->motion_vector_filters.position, now, &pose.position, 340 + &space_relation.pose.position); 341 + m_filter_euro_quat_run(&state->motion_vector_filters.orientation, now, &pose.orientation, 342 + &space_relation.pose.orientation); 343 + 335 344 space_relation.relation_flags = 336 345 (XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT | XRT_SPACE_RELATION_ORIENTATION_VALID_BIT) | 337 346 (XRT_SPACE_RELATION_POSITION_TRACKED_BIT | XRT_SPACE_RELATION_POSITION_VALID_BIT); ··· 818 827 m_filter_euro_vec3_init(&hd->state.motion_vector_filters.position, fc_min, fc_min_d, beta); 819 828 m_filter_euro_quat_init(&hd->state.motion_vector_filters.orientation, fc_min, fc_min_d, beta); 820 829 821 - m_relation_history_create(&hd->state.relation_history, &hd->state.motion_vector_filters); 830 + m_relation_history_create(&hd->state.relation_history); 822 831 823 832 hd->base.binding_profiles = binding_profiles; 824 833 hd->base.binding_profile_count = ARRAY_SIZE(binding_profiles);