diff options
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.cpp | 7 | ||||
-rw-r--r-- | ftnoir_filter_accela/ftnoir_filter_accela.h | 3 |
2 files changed, 7 insertions, 3 deletions
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index 85975c87..42478963 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -35,6 +35,7 @@ void FTNoIR_Filter::filter(const double* input, double *output) last_output[i] = input[i]; } first_run = false; + timer.start(); return; } @@ -47,12 +48,14 @@ void FTNoIR_Filter::filter(const double* input, double *output) const double a_rot_minus = s_rot_minus/100. * a_rot_plus; const double a_trans = s.trans_smoothing/100.; - static constexpr double fast_alpha = Hz/(Hz + fast_alpha_seconds); + const double Hz = timer.elapsed() * 1e-9; + timer.start(); + double fast_alpha = Hz/(Hz + fast_alpha_seconds); for (int i = 0; i < 6; i++) { const double vec = input[i] - last_output[i]; - double datum = Hz * 64; + double datum = Hz * 16; if (i >= 3) { diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index eca2dfb4..ed008996 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -7,6 +7,7 @@ #include "opentrack/options.hpp" using namespace options; +#include "opentrack/timer.hpp" struct settings { pbundle b; @@ -34,7 +35,6 @@ public: FTNoIR_Filter(); void filter(const double* target_camera_position, double *new_camera_position); state_display state; - static constexpr double Hz = 3./1000; private: // moving average history amount static constexpr double fast_alpha_seconds = 0.7; @@ -44,6 +44,7 @@ private: bool first_run; double last_output[6]; double fast_state[3]; + Timer timer; }; class FilterControls: public IFilterDialog |