diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-07-03 09:45:03 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-07-03 09:45:03 +0200 |
commit | 2a6e869eda2f15e5166d649f3d7a51cbfec7371e (patch) | |
tree | 51e2e2fff174f0511231418248bee20bea92e004 /filter-kalman/kalman.cpp | |
parent | 21cb382c2a09405d9ca85e4193582bfd8ae00731 (diff) |
filter/kalman: don't need operator new overload anymore
MSVC 15.0+ supports correct alignment
Diffstat (limited to 'filter-kalman/kalman.cpp')
-rw-r--r-- | filter-kalman/kalman.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/filter-kalman/kalman.cpp b/filter-kalman/kalman.cpp index 83898853..472f01f0 100644 --- a/filter-kalman/kalman.cpp +++ b/filter-kalman/kalman.cpp @@ -76,6 +76,10 @@ void KalmanProcessNoiseScaler::update(KalmanFilter &kf, double dt) //qDebug() << "alpha = " << alpha; } +void DeadzoneFilter::reset() +{ + last_output = PoseVector::Zero(); +} PoseVector DeadzoneFilter::filter(const PoseVector &input) { @@ -151,7 +155,8 @@ PoseVector kalman::do_kalman_filter(const PoseVector &input, double dt, bool new -kalman::kalman() { +kalman::kalman() +{ reset(); } @@ -289,5 +294,31 @@ void dialog_kalman::doCancel() close(); } +double settings::map_slider_value(const slider_value& v_) +{ + const double v = v_; +#if 0 + //return std::pow(10., v * 4. - 3.); +#else + constexpr int min_log10 = -3; + constexpr int max_log10 = 1; + constexpr int num_divisions = max_log10 - min_log10; + /* ascii art representation of slider + // ----- // ------// ------// ------- // 4 divisions + -3 - 2 -1 0 1 power of 10 + | | + | f + left_side_log10 + | + left_side_log10 + */ + const int k = v * num_divisions; // in which division are we?! + const double f = v * num_divisions - k; // where in the division are we?! + const double ff = f * 9. + 1.; + const double multiplier = int(ff * 10.) / 10.; + const int left_side_log10 = min_log10 + k; + const double val = std::pow(10., left_side_log10) * multiplier; + return val; +#endif +} OPENTRACK_DECLARE_FILTER(kalman, dialog_kalman, kalmanDll) |