From b93af7454f3cb654620a73f4bfb60c8c3bfcc71e Mon Sep 17 00:00:00 2001 From: Martin Miller Date: Fri, 31 Mar 2017 15:49:17 -0500 Subject: filter class testing--not complete --- tests/Makefile | 9 ++++++++- tests/test_filter.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 tests/test_filter.cpp 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 + +#include "filter.h" +using std::cout; +using std::endl; + +int main(int argc, char **argv) +{ + Matrix b; + Matrix 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; +} + -- cgit v1.1