From ee1e90c6e0eba92b69cdeb2dffb3a246d006dda1 Mon Sep 17 00:00:00 2001 From: Wim Vriend Date: Thu, 7 Apr 2011 17:42:45 +0000 Subject: PPJoy in DLL git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@63 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb --- FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'FTNoIR_Protocol_FG') diff --git a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp index 95c83958..3adfa8d4 100644 --- a/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp +++ b/FTNoIR_Protocol_FG/FTNoIR_Protocol_FG.cpp @@ -32,9 +32,11 @@ is called from run() of Tracker.cpp */ #include "ftnoir_protocol_fg.h" +#include // For Todd -//#define SEND_ASCII_DATA +//#define SEND_ASCII_DATA +//#define LOG_OUTPUT /** constructor **/ FTNoIR_Protocol_FG::FTNoIR_Protocol_FG() @@ -107,9 +109,9 @@ char data[100]; // // Copy the Raw measurements directly to the client. // - FlightData.x = headpose->position.x / 100.0f; - FlightData.y = headpose->position.y / 100.0f; - FlightData.z = headpose->position.z / 100.0f; + FlightData.x = headpose->position.x; + FlightData.y = headpose->position.y; + FlightData.z = headpose->position.z; FlightData.p = headpose->position.pitch; FlightData.h = headpose->position.yaw; FlightData.r = headpose->position.roll; @@ -120,7 +122,7 @@ char data[100]; // #ifdef SEND_ASCII_DATA - sprintf_s(data, "%.4f;%.4f;%.4f;%.2f;%.2f;%.2f\n\0", FlightData.x, FlightData.y, FlightData.z, FlightData.p, FlightData.h, FlightData.r); + sprintf_s(data, "%.2f;%.2f;%.2f;%.2f;%.2f;%.2f\n\0", FlightData.x, FlightData.y, FlightData.z, FlightData.p, FlightData.h, FlightData.r); if (outSocket != 0) { no_bytes = outSocket->writeDatagram((const char *) &data, strlen( data ), destIP, destPort); @@ -134,6 +136,15 @@ char data[100]; #endif + #ifdef LOG_OUTPUT + // Use this for some debug-output to file... + QFile datafile(QCoreApplication::applicationDirPath() + "\\FG_output.txt"); + if (datafile.open(QFile::WriteOnly | QFile::Append)) { + QTextStream out(&datafile); + out << "output:\t" << FlightData.x << "\t" << FlightData.y << "\t" << FlightData.z << "\t" << FlightData.p << "\t" << FlightData.h << "\t" << FlightData.r << '\n'; + } + #endif + #ifndef SEND_ASCII_DATA //! [1] // no_bytes = outSocket->writeDatagram((const char *) &FlightData, sizeof( FlightData ), QHostAddress::LocalHost, 5550); -- cgit v1.2.3