mherb / kalman

Header-only C++11 Kalman Filtering Library (EKF, UKF) based on Eigen3
MIT License
1.33k stars 383 forks source link

Failing unit test: SquareRootUnscentedKalmanFilter.computeCovarianceSquareRootFromSigmaPoints #1

Closed nocnokneo closed 9 years ago

nocnokneo commented 9 years ago

Seems like the epsilon threshold just needs to be increased for this test. Here the details of what I'm seeing:

$ mkdir build
$ cd build
$ cmake ..
-- Found Eigen3 
-- Found PythonInterp: /usr/bin/python (found version "2.7.9") 
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tbraunjones/git/kalman/build
$ make
Scanning dependencies of target gtest
Scanning dependencies of target example_robot1
[ 12%] Building CXX object external/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
[ 25%] Building CXX object CMakeFiles/example_robot1.dir/examples/Robot1/main.cpp.o
Linking CXX static library libgtest.a
[ 25%] Built target gtest
Scanning dependencies of target gtest_main
[ 37%] Building CXX object external/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
Linking CXX static library libgtest_main.a
[ 37%] Built target gtest_main
Scanning dependencies of target kalman_test
[ 62%] [ 62%] [ 75%] [ 87%] [100%] Building CXX object CMakeFiles/kalman_test.dir/test/UnscentedKalmanFilterBase.cpp.o
Building CXX object CMakeFiles/kalman_test.dir/test/ExtendedKalmanFilter.cpp.o
Building CXX object CMakeFiles/kalman_test.dir/test/SquareRootUnscentedKalmanFilter.cpp.o
Building CXX object CMakeFiles/kalman_test.dir/test/Matrix.cpp.o
Building CXX object CMakeFiles/kalman_test.dir/test/UnscentedKalmanFilter.cpp.o
Linking CXX executable example_robot1
[100%] Built target example_robot1
Linking CXX executable kalman_test
[100%] Built target kalman_test
$ ./kalman_test 
Running main() from gtest_main.cc
[==========] Running 18 tests from 6 test cases.
[----------] Global test environment set-up.
[----------] 1 test from ExtendedKalmanFilter
[ RUN      ] ExtendedKalmanFilter.init
[       OK ] ExtendedKalmanFilter.init (0 ms)
[----------] 1 test from ExtendedKalmanFilter (0 ms total)

[----------] 5 tests from UnscentedKalmanFilterBase
[ RUN      ] UnscentedKalmanFilterBase.init
[       OK ] UnscentedKalmanFilterBase.init (0 ms)
[ RUN      ] UnscentedKalmanFilterBase.computeSigmaWeights
[       OK ] UnscentedKalmanFilterBase.computeSigmaWeights (0 ms)
[ RUN      ] UnscentedKalmanFilterBase.computeSigmaPointTransition
[       OK ] UnscentedKalmanFilterBase.computeSigmaPointTransition (0 ms)
[ RUN      ] UnscentedKalmanFilterBase.computeSigmaPointMeasurements
[       OK ] UnscentedKalmanFilterBase.computeSigmaPointMeasurements (0 ms)
[ RUN      ] UnscentedKalmanFilterBase.computePredictionFromSigmaPoints
[       OK ] UnscentedKalmanFilterBase.computePredictionFromSigmaPoints (0 ms)
[----------] 5 tests from UnscentedKalmanFilterBase (0 ms total)

[----------] 5 tests from UnscentedKalmanFilter
[ RUN      ] UnscentedKalmanFilter.init
[       OK ] UnscentedKalmanFilter.init (0 ms)
[ RUN      ] UnscentedKalmanFilter.computeSigmaPoints
[       OK ] UnscentedKalmanFilter.computeSigmaPoints (0 ms)
[ RUN      ] UnscentedKalmanFilter.computeCovarianceSquareRootFromSigmaPoints
[       OK ] UnscentedKalmanFilter.computeCovarianceSquareRootFromSigmaPoints (0 ms)
[ RUN      ] UnscentedKalmanFilter.computeKalmanGain
[       OK ] UnscentedKalmanFilter.computeKalmanGain (0 ms)
[ RUN      ] UnscentedKalmanFilter.updateStateCovariance
[       OK ] UnscentedKalmanFilter.updateStateCovariance (0 ms)
[----------] 5 tests from UnscentedKalmanFilter (0 ms total)

[----------] 5 tests from SquareRootUnscentedKalmanFilter
[ RUN      ] SquareRootUnscentedKalmanFilter.init
[       OK ] SquareRootUnscentedKalmanFilter.init (0 ms)
[ RUN      ] SquareRootUnscentedKalmanFilter.computeSigmaPoints
[       OK ] SquareRootUnscentedKalmanFilter.computeSigmaPoints (1 ms)
[ RUN      ] SquareRootUnscentedKalmanFilter.computeCovarianceSquareRootFromSigmaPoints
/home/tbraunjones/git/kalman/test/SquareRootUnscentedKalmanFilter.cpp:91: Failure
The difference between P(i,j) and Ssquared(i,j) is 3.0517578125e-05, which exceeds 2.5e-5, where
P(i,j) evaluates to 228,
Ssquared(i,j) evaluates to 228.00003051757812, and
2.5e-5 evaluates to 2.5000000000000001e-05.
[  FAILED  ] SquareRootUnscentedKalmanFilter.computeCovarianceSquareRootFromSigmaPoints (0 ms)
[ RUN      ] SquareRootUnscentedKalmanFilter.computeKalmanGain
[       OK ] SquareRootUnscentedKalmanFilter.computeKalmanGain (0 ms)
[ RUN      ] SquareRootUnscentedKalmanFilter.updateStateCovariance
[       OK ] SquareRootUnscentedKalmanFilter.updateStateCovariance (0 ms)
[----------] 5 tests from SquareRootUnscentedKalmanFilter (1 ms total)

[----------] 1 test from Cholesky
[ RUN      ] Cholesky.solve
[       OK ] Cholesky.solve (0 ms)
[----------] 1 test from Cholesky (0 ms total)

[----------] 1 test from QR
[ RUN      ] QR.compute
[       OK ] QR.compute (0 ms)
[----------] 1 test from QR (0 ms total)

[----------] Global test environment tear-down
[==========] 18 tests from 6 test cases ran. (1 ms total)
[  PASSED  ] 17 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] SquareRootUnscentedKalmanFilter.computeCovarianceSquareRootFromSigmaPoints

 1 FAILED TEST
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 15.04
Release:    15.04
Codename:   vivid
$ gcc --version
gcc (Ubuntu 4.9.2-10ubuntu13) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
mherb commented 9 years ago

Thanks a lot for pointing this out! Works fine using Eigen 3.2.5 and Clang (on OS X) thus I didn't notice..