Skip to content

Commit

Permalink
Add lowpass_filter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmout committed Aug 2, 2018
1 parent 3bd47dc commit d3e616e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/lowpass_filter_tests.cpp
@@ -0,0 +1,23 @@
// Copyright (c) 2018 Franka Emika GmbH
// Use of this source code is governed by the Apache-2.0 license, see LICENSE

#include <gtest/gtest.h>
#include <Eigen/Dense>

#include <franka/lowpass_filter.h>

using namespace franka;

const double kNoLimit{std::numeric_limits<double>::max()};

TEST(LowpassFilter, KeepsValueIfNoChange) {
EXPECT_NEAR(lowpassFilter(0.001, 1.0, 1.0, 100.0), 1.0, 1e-6);
EXPECT_NEAR(lowpassFilter(0.001, 1.0, 1.0, 500.0), 1.0, 1e-6);
EXPECT_NEAR(lowpassFilter(0.001, 1.0, 1.0, 1000.0), 1.0, 1e-6);
}

TEST(LowpassFilter, DoesFilter) {
EXPECT_NEAR(lowpassFilter(0.001, 1.0, 0.0, 100.0), 0.3859, 1e-4);
EXPECT_NEAR(lowpassFilter(0.001, 1.0, 0.0, 500.0), 0.7585, 1e-4);
EXPECT_NEAR(lowpassFilter(0.001, 1.0, 0.0, 900.0), 0.8497, 1e-4);
}

0 comments on commit d3e616e

Please sign in to comment.