summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Miller2017-03-31 15:49:17 -0500
committerMartin Miller2017-03-31 15:49:17 -0500
commitb93af7454f3cb654620a73f4bfb60c8c3bfcc71e (patch)
tree0cf240560edaf3e8dee9c2fe17c2eafc28daa7d5 /tests
parent118c14ed88ed76b892071638156dcb10cc69fd42 (diff)
downloadrefslam-b93af7454f3cb654620a73f4bfb60c8c3bfcc71e.zip
refslam-b93af7454f3cb654620a73f4bfb60c8c3bfcc71e.tar.gz
filter class testing--not complete
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile9
-rw-r--r--tests/test_filter.cpp43
2 files changed, 51 insertions, 1 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 37d1687..06e42ae 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -6,16 +6,23 @@ CXXFLAGS+=$(shell pkg-config --cflags eigen3 yaml-cpp)
LIBS+=$(shell pkg-config --libs eigen3 yaml-cpp)
#LIBS+=$(shell pkg-config --libs opencv)
+.PHONY: all
+
+all: test_camera test_feature test_filter
+
test_camera: test_camera.o ../src/camera.o
$(CXX) -o $@ $^ $(CXXFLAGS) ${LIBS}
test_feature: ${OBJECT}
$(CXX) -o $@ $^ $(CXXFLAGS) ${LIBS}
+test_filter: test_filter.o ../src/filter.o
+ $(CXX) -o $@ $^ $(CXXFLAGS) ${LIBS}
+
.cpp.o:
$(CXX) $(CXXFLAGS) ${LIBS} -c $< -o $@
.PHONY: clean
clean:
- rm -f test_camera test_feature *.o src/*.o
+ rm -f test_filter test_camera test_feature *.o src/*.o
diff --git a/tests/test_filter.cpp b/tests/test_filter.cpp
new file mode 100644
index 0000000..403d3d4
--- /dev/null
+++ b/tests/test_filter.cpp
@@ -0,0 +1,43 @@
+/*
+ * =====================================================================================
+ *
+ * Filename: test_filter.cpp
+ *
+ * Description: Tests the filter class
+ *
+ * Version: 1.0
+ * Created: 03/31/2017 03:13:54 PM
+ * Revision: none
+ * Compiler: gcc
+ *
+ * Author: Martin Miller (MHM), miller7@illinois.edu
+ * Organization: Aerospace Robotics and Controls Lab (ARC)
+ *
+ * =====================================================================================
+ */
+
+
+#include <iostream>
+
+#include "filter.h"
+using std::cout;
+using std::endl;
+
+int main(int argc, char **argv)
+{
+ Matrix<double,4,1> b;
+ Matrix<double,3,1> a;
+ b << 0.00289819, 0.00869458, 0.00869458, 0.00289819;
+ a << -2.37409474, 1.92935567, -0.53207537;
+ a/a[0];
+ Filter H(b,a);
+ double x,y,z;
+ while (scanf("%lf,%lf,%lf", &x, &y, &z)!=EOF) {
+ Vector3d X, Y;
+ X << x,y,z;
+ Y = H.update(X);
+ cout << "X: " << X.transpose() << " Y: " << Y.transpose() << endl;
+ }
+ return 0;
+}
+