diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-01-16 19:16:29 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-01-16 19:16:29 +0100 |
commit | 3707b8d5fe085d47a02f71b0df9a98d6898d94c9 (patch) | |
tree | 2008b53e63551e5a3d65d56400bd3b18bef87384 /filter-accela | |
parent | 3094ef1089e117ca22c2ac1acc94698d240d28fe (diff) |
filter/accela: add commented out -180->180 delta logic
We can't use it (yet?) since the filter runs before any mapping is done.
Diffstat (limited to 'filter-accela')
-rw-r--r-- | filter-accela/ftnoir_filter_accela.cpp | 21 | ||||
-rw-r--r-- | filter-accela/ftnoir_filter_accela.h | 3 |
2 files changed, 22 insertions, 2 deletions
diff --git a/filter-accela/ftnoir_filter_accela.cpp b/filter-accela/ftnoir_filter_accela.cpp index 5d779402..955e6dd6 100644 --- a/filter-accela/ftnoir_filter_accela.cpp +++ b/filter-accela/ftnoir_filter_accela.cpp @@ -19,6 +19,21 @@ accela::accela() : first_run(true) s.make_splines(rot, trans); } +// can't use it since filtering's done before mapping +#if 0 +double accela::get_delta(double val, double prev) +{ + using std::fabs; + + const double a = fabs(val - prev), b = fabs(val + prev), c = fabs(val); + if (c < a && c < b) + return val; + if (b < a && b < c) + return val + prev; + return val - prev; +} +#endif + void accela::filter(const double* input, double *output) { if (first_run) @@ -55,7 +70,11 @@ void accela::filter(const double* input, double *output) const double in = smoothed_input[i]; +#if 0 + const double vec_ = get_delta(in, last_output[i]); +#else const double vec_ = in - last_output[i]; +#endif const double dz = i >= 3 ? rot_dz : trans_dz; const double vec = std::max(0., fabs(vec_) - dz); const double thres = i >= 3 ? rot_t : trans_t; @@ -76,8 +95,6 @@ void accela::filter(const double* input, double *output) } } - - void settings_accela::make_splines(spline& rot, spline& trans) { rot = spline(); diff --git a/filter-accela/ftnoir_filter_accela.h b/filter-accela/ftnoir_filter_accela.h index 2557dafc..3c35b5e3 100644 --- a/filter-accela/ftnoir_filter_accela.h +++ b/filter-accela/ftnoir_filter_accela.h @@ -27,6 +27,9 @@ private: double last_output[6]; double smoothed_input[6]; Timer t; +#if 0 + static double get_delta(double val, double prev); +#endif template <typename T> static inline int signum(T x) |