@@ -250,7 +250,7 @@ void OrientationFilterPassThru::update(const float delta_time, const PoseFilterP
250250void OrientationFilterMadgwickARG::resetState ()
251251{
252252 OrientationFilter::resetState ();
253- timeReset = std::chrono::high_resolution_clock::now () ;
253+ m_reset = true ;
254254}
255255
256256// -- OrientationFilterMadgwickARG --
@@ -380,6 +380,12 @@ void OrientationFilterMadgwickARG::update(const float delta_time, const PoseFilt
380380 const float adaptive_falloff = clampf (filter_madgwick_apt_falloff, 0 .0f , 0 .999f );
381381
382382 std::chrono::time_point<std::chrono::high_resolution_clock> now = std::chrono::high_resolution_clock::now ();
383+ if (m_reset)
384+ {
385+ m_reset = false ;
386+ timeReset = now;
387+ }
388+
383389 std::chrono::duration<double , std::milli> resetDuration = now - timeReset;
384390
385391 if (resetDuration.count () < k_madgwick_reset_time)
@@ -445,7 +451,7 @@ void OrientationFilterMadgwickMARG::resetState()
445451{
446452 OrientationFilterMadgwickARG::resetState ();
447453 m_omega_bias_x= m_omega_bias_y= m_omega_bias_z= 0 .f ;
448- timeReset = std::chrono::high_resolution_clock::now () ;
454+ m_reset = true ;
449455}
450456
451457void OrientationFilterMadgwickMARG::update (const float delta_time, const PoseFilterPacket &packet)
@@ -619,6 +625,12 @@ void OrientationFilterMadgwickMARG::update(const float delta_time, const PoseFil
619625 const float adaptive_falloff = clampf (filter_madgwick_apt_falloff, 0 .0f , 0 .999f );
620626
621627 std::chrono::time_point<std::chrono::high_resolution_clock> now = std::chrono::high_resolution_clock::now ();
628+ if (m_reset)
629+ {
630+ m_reset = false ;
631+ timeReset = now;
632+ }
633+
622634 std::chrono::duration<double , std::milli> resetDuration = now - timeReset;
623635
624636 if (resetDuration.count () < k_madgwick_reset_time)
0 commit comments