summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-10-16 21:38:44 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-10-16 21:38:44 +0200
commitf314ef0afb4f9f5eb2a3bbd7f49d23fc77728330 (patch)
tree9a45106597b27cb69cb45edfec6d85972a1cbe1b
parent95f542365f6f1cd043c7b3090a67d269d6dde58b (diff)
accela: also filter out NaNs on tracking start
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.cpp10
1 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 81ef3948..3e049eb0 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp
+++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
@@ -64,9 +64,13 @@ void FTNoIR_Filter::filter(const double* input, double *output)
{
for (int i = 0; i < 6; i++)
{
- output[i] = input[i];
- last_output[i] = input[i];
- smoothed_input[i] = input[i];
+ const bool drop = std::isnan(input[i]) || std::isinf(input[i]);
+ double f = input[i];
+ if (drop)
+ f = 0;
+ output[i] = f;
+ last_output[i] = f;
+ smoothed_input[i] = f;
}
first_run = false;
t.start();