From e8c6ac7c501796b653352e8afd16c4a5fe2350a7 Mon Sep 17 00:00:00 2001 From: Jake Drahos <j@kedrahos.com> Date: Mon, 31 Oct 2016 16:20:51 -0500 Subject: [PATCH] Added constructor for TrackerData --- groundStation/Makefile | 2 +- groundStation/src/vrpn_tracker.cpp | 23 +++++++++-------------- groundStation/src/vrpn_tracker.hpp | 3 +++ 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/groundStation/Makefile b/groundStation/Makefile index 91b61ceb4..4938bc19f 100644 --- a/groundStation/Makefile +++ b/groundStation/Makefile @@ -2,7 +2,7 @@ GCC=gcc GXX=g++ CFLAGS= -Wall -Wpedantic -Wextra -Werror -std=c99 -g -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-variable -CXXFLAGS= -Wall -Wno-reorder -std=c++0x -g +CXXFLAGS= -Wall -Wpedantic -Wextra -Werror -Wno-reorder -Wno-unused-variable -std=c++0x -g INCLUDES = $(foreach dir, $(INCDIR), -I$(dir)) # Directories diff --git a/groundStation/src/vrpn_tracker.cpp b/groundStation/src/vrpn_tracker.cpp index 49cbaed12..ed71ca151 100644 --- a/groundStation/src/vrpn_tracker.cpp +++ b/groundStation/src/vrpn_tracker.cpp @@ -9,6 +9,13 @@ namespace microcart { static void VRPN_CALLBACK vrpn_cb(void * param, const vrpn_TRACKERCB t); + + TrackerData::TrackerData() : + x(0.0), y(0.0), z(0.0), + pitch(0.0), roll(0.0), yaw(0.0), + fps(0.0), timestamp() + { + } Tracker::Tracker(std::string server) : Tracker(server.c_str()) { @@ -17,20 +24,7 @@ namespace microcart Tracker::Tracker(const char * server) : remote(server), stop_flag(0), - trackerData({ - .x = 0.0, - .y = 0.0, - .z = 0.0, - .pitch = 0.0, - .roll = 0.0, - .yaw = 0.0, - .fps = 0.0, - .timestamp = { - .tv_sec = 0, - .tv_usec = 0 - } - }) - + trackerData() { remote.register_change_handler(this, vrpn_cb); @@ -123,6 +117,7 @@ extern "C" try { auto inst = new struct ucart_vrpn_tracker; inst->t = new microcart::Tracker(server); + return inst; } catch(...) { return NULL; } diff --git a/groundStation/src/vrpn_tracker.hpp b/groundStation/src/vrpn_tracker.hpp index ebd217551..d10ad6e79 100644 --- a/groundStation/src/vrpn_tracker.hpp +++ b/groundStation/src/vrpn_tracker.hpp @@ -54,6 +54,7 @@ extern "C" namespace microcart { struct TrackerData { + public: double x; double y; double z; @@ -64,6 +65,8 @@ namespace microcart double fps; timeval timestamp; + + TrackerData(); }; class Tracker { -- GitLab