From f5c9765f76141840e411159933098c6f4bad7f33 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 8 Oct 2013 19:29:54 +0200 Subject: correct fgfs protocol bitrot Signed-off-by: Stanislaw Halik --- facetracknoir/clientfiles/FlightGear/Linux/usage.txt | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 facetracknoir/clientfiles/FlightGear/Linux/usage.txt (limited to 'facetracknoir/clientfiles') diff --git a/facetracknoir/clientfiles/FlightGear/Linux/usage.txt b/facetracknoir/clientfiles/FlightGear/Linux/usage.txt new file mode 100644 index 00000000..14c77ad0 --- /dev/null +++ b/facetracknoir/clientfiles/FlightGear/Linux/usage.txt @@ -0,0 +1,6 @@ +fgfs --generic=socket,in,25,localhost,5542,udp,headtracker ~/opt/fgdata/Nasal/headtracker.xml + +Adjust paths as necessary. + +cheers, +-sh 20131008 -- cgit v1.2.3 From d2ee21b36506009aa8faa6ac66d842c339d06dbe Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 8 Oct 2013 21:40:50 +0200 Subject: actually fix FG this time Signed-off-by: Stanislaw Halik --- .../clientfiles/FlightGear/Linux/usage.txt | 4 +- .../clientfiles/FlightGear/Nasal/headtracker.xml | 83 ------------ .../FlightGear/Protocol/headtracker.xml | 27 +--- ftnoir_protocol_fg/fgtypes.h | 2 +- ftnoir_protocol_fg/ftnoir_protocol_fg.cpp | 143 ++------------------- ftnoir_protocol_fg/ftnoir_protocol_fg.h | 12 +- 6 files changed, 21 insertions(+), 250 deletions(-) delete mode 100644 facetracknoir/clientfiles/FlightGear/Nasal/headtracker.xml (limited to 'facetracknoir/clientfiles') diff --git a/facetracknoir/clientfiles/FlightGear/Linux/usage.txt b/facetracknoir/clientfiles/FlightGear/Linux/usage.txt index 14c77ad0..48cee837 100644 --- a/facetracknoir/clientfiles/FlightGear/Linux/usage.txt +++ b/facetracknoir/clientfiles/FlightGear/Linux/usage.txt @@ -1,4 +1,6 @@ -fgfs --generic=socket,in,25,localhost,5542,udp,headtracker ~/opt/fgdata/Nasal/headtracker.xml +Copy Protocol/headtracker.xml to fgdata/Protocol/headtracker.xml + +$ fgfs --generic=socket,in,25,localhost,5542,udp,headtracker Adjust paths as necessary. diff --git a/facetracknoir/clientfiles/FlightGear/Nasal/headtracker.xml b/facetracknoir/clientfiles/FlightGear/Nasal/headtracker.xml deleted file mode 100644 index d8bd1d0a..00000000 --- a/facetracknoir/clientfiles/FlightGear/Nasal/headtracker.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - diff --git a/facetracknoir/clientfiles/FlightGear/Protocol/headtracker.xml b/facetracknoir/clientfiles/FlightGear/Protocol/headtracker.xml index cd1d0dad..8c14119a 100644 --- a/facetracknoir/clientfiles/FlightGear/Protocol/headtracker.xml +++ b/facetracknoir/clientfiles/FlightGear/Protocol/headtracker.xml @@ -11,57 +11,44 @@ x double - /sim/headtracker/x-m + /sim/current-view/x-offset-m y double - /sim/headtracker/y-m + /sim/current-view/y-offset-m z double - /sim/headtracker/z-m + /sim/current-view/z-offset-m heading double - /sim/headtracker/heading-deg + /sim/current-view/heading-offset-deg pitch double - /sim/headtracker/pitch-deg + /sim/current-view/pitch-offset-deg roll double - /sim/headtracker/roll-deg + /sim/current-view/roll-offset-deg status int - /sim/headtracker/status + /sim/current-view/headtracker-debug-status - - - true - none - host - 4 - - - control - int - /sim/headtracker/control - - diff --git a/ftnoir_protocol_fg/fgtypes.h b/ftnoir_protocol_fg/fgtypes.h index 049de318..0f29be3d 100644 --- a/ftnoir_protocol_fg/fgtypes.h +++ b/ftnoir_protocol_fg/fgtypes.h @@ -17,7 +17,7 @@ // // x,y,z position in metres, heading, pitch and roll in degrees... // -#pragma pack(push, 1) +#pragma pack(push, 2) struct TFlightGearData { double x, y, z, h, p, r; int status; diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp index 643f9dd5..5aa3487e 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.cpp @@ -31,33 +31,16 @@ #include // For Todd and Arda Kutlu -//#define SEND_ASCII_DATA -//#define LOG_OUTPUT -/** constructor **/ FTNoIR_Protocol::FTNoIR_Protocol() { - blnConnectionActive = false; - loadSettings(); + loadSettings(); } -/** destructor **/ FTNoIR_Protocol::~FTNoIR_Protocol() { - if (inSocket != 0) { - inSocket->close(); - delete inSocket; - } - - if (outSocket != 0) { - outSocket->close(); - delete outSocket; - } } -// -// Load the current Settings from the currently 'active' INI-file. -// void FTNoIR_Protocol::loadSettings() { QSettings settings("opentrack"); // Registry settings (in HK_USER) @@ -68,7 +51,7 @@ void FTNoIR_Protocol::loadSettings() { bool blnLocalPC = iniFile.value ( "LocalPCOnly", 1 ).toBool(); if (blnLocalPC) { - destIP = QHostAddress::LocalHost; + destIP = QHostAddress::LocalHost; } else { QString destAddr = iniFile.value ( "IP-1", 192 ).toString() + "." + iniFile.value ( "IP-2", 168 ).toString() + "." + iniFile.value ( "IP-3", 2 ).toString() + "." + iniFile.value ( "IP-4", 1 ).toString(); @@ -80,87 +63,19 @@ void FTNoIR_Protocol::loadSettings() { } -// -// Update Headpose in Game. -// void FTNoIR_Protocol::sendHeadposeToGame( double *headpose, double *rawheadpose ) { -int no_bytes; -QHostAddress sender; -quint16 senderPort; + int no_bytes; + QHostAddress sender; + quint16 senderPort; - // - // Copy the Raw measurements directly to the client. - // FlightData.x = headpose[TX] * 1e-2; FlightData.y = headpose[TY] * 1e-2; FlightData.z = headpose[TZ] * 1e-2; FlightData.p = headpose[Pitch]; FlightData.h = headpose[Yaw]; FlightData.r = headpose[Roll]; - FlightData.status = fg_cmd; - - // - // Try to send an UDP-message to the FlightGear - // - -#ifdef SEND_ASCII_DATA - 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); - if ( no_bytes > 0) { - qDebug() << "FGServer::writePendingDatagrams says: bytes send =" << data; - } - else { - qDebug() << "FGServer::writePendingDatagrams says: nothing sent!"; - } - } - -#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] - if (outSocket != 0) { - no_bytes = outSocket->writeDatagram((const char *) &FlightData, sizeof( FlightData ), destIP, destPort); - if ( no_bytes > 0) { - } - else { - qDebug() << "FGServer::writePendingDatagrams says: nothing sent!"; - } - } - #endif - - // - // FlightGear keeps sending data, so we must read that here. - // - if (inSocket != 0) { - while (inSocket->hasPendingDatagrams()) { - - QByteArray datagram; - datagram.resize(inSocket->pendingDatagramSize()); - - inSocket->readDatagram( (char * ) &cmd, sizeof(cmd), &sender, &senderPort); - - fg_cmd = cmd; // Let's just accept that command for now... - if ( cmd > 0 ) { - qDebug() << "FGServer::sendHeadposeToGame hasPendingDatagrams, cmd = " << cmd; -// headTracker->handleGameCommand ( cmd ); // Send it upstream, for the Tracker to handle - } - - if (!blnConnectionActive) { - blnConnectionActive = true; - } - } - } + FlightData.status = 1; + (void) outSocket.writeDatagram(reinterpret_cast(&FlightData), sizeof(FlightData), destIP, static_cast(destPort)); } // @@ -169,51 +84,9 @@ quint16 senderPort; // bool FTNoIR_Protocol::checkServerInstallationOK() { - // Init. the data - FlightData.x = 0.0f; - FlightData.y = 0.0f; - FlightData.z = 0.0f; - FlightData.h = 0.0f; - FlightData.p = 0.0f; - FlightData.r = 0.0f; - FlightData.status = 0; - fg_cmd = 1; - - inSocket = 0; - outSocket = 0; - - // - // Create UDP-sockets. - // - if (inSocket == 0) { - qDebug() << "FGServer::sendHeadposeToGame creating insocket"; - inSocket = new QUdpSocket(); - - // Connect the inSocket to the port, to receive messages - if (!inSocket->bind(QHostAddress::Any, destPort+1)) { - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to bind UDP-port",QMessageBox::Ok,QMessageBox::NoButton); - delete inSocket; - inSocket = 0; - return false; - } - } - - if (outSocket == 0) { - outSocket = new QUdpSocket(); - } - - return true; + return outSocket.bind(QHostAddress::Any, 0, QUdpSocket::ShareAddress | QUdpSocket::ReuseAddressHint); } -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Protocol object. - -// Export both decorated and undecorated names. -// GetProtocol - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetProtocol@0 - Common name decoration for __stdcall functions in C language. -//#pragma comment(linker, "/export:GetProtocol=_GetProtocol@0") - extern "C" FTNOIR_PROTOCOL_BASE_EXPORT IProtocol* CALLING_CONVENTION GetConstructor() { return new FTNoIR_Protocol; diff --git a/ftnoir_protocol_fg/ftnoir_protocol_fg.h b/ftnoir_protocol_fg/ftnoir_protocol_fg.h index 40a83384..f399904b 100644 --- a/ftnoir_protocol_fg/ftnoir_protocol_fg.h +++ b/ftnoir_protocol_fg/ftnoir_protocol_fg.h @@ -36,7 +36,6 @@ #include #include #include -#include #include "facetracknoir/global-settings.h" #define FT_PROGRAMID "FT_ProgramID" @@ -52,15 +51,8 @@ public: return "FlightGear"; } private: - - bool blnConnectionActive; - - // Tracker *headTracker; // For upstream messages... - TFlightGearData FlightData; - QUdpSocket *inSocket; // Receive from FligthGear - QUdpSocket *outSocket; // Send to FligthGear - qint32 cmd; - qint32 fg_cmd; // Command from FlightGear + TFlightGearData FlightData; + QUdpSocket outSocket; // Send to FligthGear QHostAddress destIP; // Destination IP-address int destPort; // Destination port-number void loadSettings(); -- cgit v1.2.3 From 41014a32a3597784f29e9718cb5e665511549e1c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 8 Oct 2013 21:41:45 +0200 Subject: update readme and other cruft Signed-off-by: Stanislaw Halik --- .../clientfiles/FlightGear/Linux/usage.txt | 8 ------- facetracknoir/clientfiles/FlightGear/readme.txt | 27 +++++++--------------- .../clientfiles/FlightGear/win32/start_fg.bat | 1 - 3 files changed, 8 insertions(+), 28 deletions(-) delete mode 100644 facetracknoir/clientfiles/FlightGear/Linux/usage.txt delete mode 100644 facetracknoir/clientfiles/FlightGear/win32/start_fg.bat (limited to 'facetracknoir/clientfiles') diff --git a/facetracknoir/clientfiles/FlightGear/Linux/usage.txt b/facetracknoir/clientfiles/FlightGear/Linux/usage.txt deleted file mode 100644 index 48cee837..00000000 --- a/facetracknoir/clientfiles/FlightGear/Linux/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ -Copy Protocol/headtracker.xml to fgdata/Protocol/headtracker.xml - -$ fgfs --generic=socket,in,25,localhost,5542,udp,headtracker - -Adjust paths as necessary. - -cheers, --sh 20131008 diff --git a/facetracknoir/clientfiles/FlightGear/readme.txt b/facetracknoir/clientfiles/FlightGear/readme.txt index 75cbbcd2..0b3d9dfe 100644 --- a/facetracknoir/clientfiles/FlightGear/readme.txt +++ b/facetracknoir/clientfiles/FlightGear/readme.txt @@ -1,19 +1,8 @@ -FaceTrackNoIR for FlightGear. - -FaceTrackNoIR was made compatible with FlightGear with the help of Melchior Franz, who initially made a Linux headtracker. FaceTrackNoIR sends UDP-packets to FlightGear which contain 6DOF-data. The script and protocol provided by Melchior take care of receiving the data and moving 'the head' in-game. - -To make the FlightGear script work, copy the files in the subfolders to the corresponding folders in the FlightGear installation folder. Start FlightGear with the batch-file 'start_fg.bat'. - - -Please let us know if you like the program, if you have ideas for improvements or any questions you might have. - - - -The FaceTrackNoIR team: - -Wim Vriend -Ron Hendriks - - - -Disclaimer: For usage of 3rd party software like FlightGear, the FaceTrackNoIR team is not responsible. Use it at your own risk. \ No newline at end of file +Copy Protocol/headtracker.xml to fgdata/Protocol/headtracker.xml + +$ fgfs --generic=socket,in,25,localhost,5542,udp,headtracker + +Adjust paths as necessary. + +cheers, +-sh 20131008 diff --git a/facetracknoir/clientfiles/FlightGear/win32/start_fg.bat b/facetracknoir/clientfiles/FlightGear/win32/start_fg.bat deleted file mode 100644 index cd9829b5..00000000 --- a/facetracknoir/clientfiles/FlightGear/win32/start_fg.bat +++ /dev/null @@ -1 +0,0 @@ -fgfs --generic=socket,in,25,localhost,5550,udp,headtracker --generic=socket,out,10,localhost,5551,udp,headtracker --prop:browser=/sim/headtracker "c:\Program Files\FlightGear\data\Nasal\headtracker.xml" \ No newline at end of file -- cgit v1.2.3 From c5051c176421282c8f5c3cd937711fbf01c59be8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 12 Oct 2013 16:13:34 +0200 Subject: add Crapple macam latest cvs snapshot Works with 32-bit apps, provided that quicktime is supported Signed-off-by: Stanislaw Halik --- .../clientfiles/macosx/macam-cvs-build-2009-09-25.zip | Bin 0 -> 3560122 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 facetracknoir/clientfiles/macosx/macam-cvs-build-2009-09-25.zip (limited to 'facetracknoir/clientfiles') diff --git a/facetracknoir/clientfiles/macosx/macam-cvs-build-2009-09-25.zip b/facetracknoir/clientfiles/macosx/macam-cvs-build-2009-09-25.zip new file mode 100644 index 00000000..79816779 Binary files /dev/null and b/facetracknoir/clientfiles/macosx/macam-cvs-build-2009-09-25.zip differ -- cgit v1.2.3 From 5f17327c0d9d5bd2da69139a324434d461519403 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 27 Nov 2013 01:33:53 +0100 Subject: initial import of hatire by Furax49 Signed-off-by: Stanislaw Halik --- CMakeLists.txt | 16 +- facetracknoir/clientfiles/HAT_100/HAT_100.ino | 389 +++++++ facetracknoir/clientfiles/HAT_100/README | 35 + ftnoir_tracker_hatire/ftnoir_arduino_type.h | 31 + ftnoir_tracker_hatire/ftnoir_hat.qrc | 6 + ftnoir_tracker_hatire/ftnoir_hatcontrols.ui | 1066 ++++++++++++++++++++ ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp | 304 ++++++ ftnoir_tracker_hatire/ftnoir_tracker_hat.h | 102 ++ ftnoir_tracker_hatire/ftnoir_tracker_hat.rc | 61 ++ .../ftnoir_tracker_hat_dialog.cpp | 299 ++++++ ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h | 78 ++ ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp | 79 ++ .../ftnoir_tracker_hat_settings.cpp | 102 ++ .../ftnoir_tracker_hat_settings.h | 44 + ftnoir_tracker_hatire/images/hat.ico | Bin 0 -> 1150 bytes ftnoir_tracker_hatire/images/hat_logo.png | Bin 0 -> 15210 bytes 16 files changed, 2611 insertions(+), 1 deletion(-) create mode 100644 facetracknoir/clientfiles/HAT_100/HAT_100.ino create mode 100644 facetracknoir/clientfiles/HAT_100/README create mode 100644 ftnoir_tracker_hatire/ftnoir_arduino_type.h create mode 100644 ftnoir_tracker_hatire/ftnoir_hat.qrc create mode 100644 ftnoir_tracker_hatire/ftnoir_hatcontrols.ui create mode 100644 ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp create mode 100644 ftnoir_tracker_hatire/ftnoir_tracker_hat.h create mode 100644 ftnoir_tracker_hatire/ftnoir_tracker_hat.rc create mode 100644 ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp create mode 100644 ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h create mode 100644 ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp create mode 100644 ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp create mode 100644 ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h create mode 100644 ftnoir_tracker_hatire/images/hat.ico create mode 100644 ftnoir_tracker_hatire/images/hat_logo.png (limited to 'facetracknoir/clientfiles') diff --git a/CMakeLists.txt b/CMakeLists.txt index 12c4cee0..307aeac4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,7 @@ if(MINGW) endif() find_package(OpenCV REQUIRED) - find_package(Qt5 REQUIRED COMPONENTS Core Xml Network Widgets Gui QUIET) + find_package(Qt5 REQUIRED COMPONENTS Core Xml Network Widgets Gui SerialPort QUIET) cmake_policy(SET CMP0020 NEW) include_directories(${Qt5Core_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS}) add_definitions(${Qt5Core_DEFINITIONS} ${Qt5Xml_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}) @@ -308,6 +308,13 @@ file(GLOB opentrack-tracker-hydra-rc "ftnoir_tracker_hydra/*.qrc") QT5_WRAP_UI(opentrack-tracker-hydra-uih ${opentrack-tracker-hydra-ui}) QT5_ADD_RESOURCES(opentrack-tracker-hydra-rcc ${opentrack-tracker-hydra-rc}) +file(GLOB opentrack-tracker-hatire-c "ftnoir_tracker_hatire/*.cpp") +file(GLOB opentrack-tracker-hatire-h "ftnoir_tracker_hatire/*.h") +file(GLOB opentrack-tracker-hatire-ui "ftnoir_tracker_hatire/*.ui") +file(GLOB opentrack-tracker-hatire-rc "ftnoir_tracker_hatire/*.qrc") +QT5_WRAP_UI(opentrack-tracker-hatire-uih ${opentrack-tracker-hatire-ui}) +QT5_ADD_RESOURCES(opentrack-tracker-hatire-rcc ${opentrack-tracker-hatire-rc}) + file(GLOB opentrack-csv-c "ftnoir_csv/*.cpp") # compat lib for POSIX/win32 @@ -524,6 +531,13 @@ if(SDK_ARUCO_LIBPATH) endif() endif() +add_library(opentrack-tracker-hatire SHARED ${opentrack-tracker-hatire-c} ${opentrack-tracker-hatire-h} ${opentrack-tracker-hatire-moc} ${opentrack-tracker-hatire-uih} ${opentrack-tracker-hatire-rcc}) +target_link_libraries(opentrack-tracker-hatire ${MY_QT_LIBS} Qt5SerialPort) +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) + SET_TARGET_PROPERTIES(opentrack-tracker-hatire + PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_SOURCE_DIR}/facetracknoir/posix-version-script.txt") +endif() + if(WIN32) target_link_libraries(opentrack-tracker-ht "${CMAKE_SOURCE_DIR}/dinput/dxguid.lib" diff --git a/facetracknoir/clientfiles/HAT_100/HAT_100.ino b/facetracknoir/clientfiles/HAT_100/HAT_100.ino new file mode 100644 index 00000000..f8644ffe --- /dev/null +++ b/facetracknoir/clientfiles/HAT_100/HAT_100.ino @@ -0,0 +1,389 @@ +// Arduino sketch for MPU6050 on NanoWII using DMP MotionApps v4.1 +// HAT 14/04/2013 by FuraX49 +// +// Head Arduino Tracker for FaceTrackNoIR +// http://facetracknoir.sourceforge.net/home/default.htm +// I2C device class (I2Cdev) +// https://github.com/jrowberg/i2cdevlib + + +#include +#include +#include "I2Cdev.h" +#include "MPU6050_9Axis_MotionApps41.h" + + +MPU6050 mpu; + + +typedef struct { + int16_t Begin ; // 2 Debut + uint16_t Cpt ; // 2 Compteur trame or Code info or error + float gyro[3]; // 12 [Y, P, R] gyro + float acc[3]; // 12 [x, y, z] Acc + int16_t End ; // 2 Fin +} _hatire; + +typedef struct { + int16_t Begin ; // 2 Debut + uint16_t Code ; // 2 Code info + char Msg[24]; // 24 Message + int16_t End ; // 2 Fin +} _msginfo; + +typedef struct +{ + byte rate; + double gyro_offset[3] ; + double acc_offset[3] ; +} _eprom_save; + + +// MPU control/status vars +bool dmpReady = false; // set true if DMP init was successful +bool dmpLoaded = false; // set true if DMP loaded successfuly +uint8_t mpuIntStatus; // holds actual interrupt status byte from MPU +uint8_t devStatus; // return status after each device operation (0 = success, !0 = error) +uint16_t packetSize; // expected DMP packet size (default is 42 bytes) +uint16_t fifoCount; // count of all bytes currently in FIFO +uint8_t fifoBuffer[64]; // FIFO storage buffer + +char Commande; +char Version[] = "HAT V 1.00"; + +// orientation/motion vars +Quaternion q; // [w, x, y, z] quaternion container +VectorInt16 aa; // [x, y, z] accel sensor measurements +VectorFloat gravity; // [x, y, z] gravity vector + +float Rad2Deg = (180/M_PI) ; + +// trame for message +_hatire hatire; +_msginfo msginfo; +_eprom_save eprom_save; + + +bool AskCalibrate = false; // set true when calibrating is ask +int CptCal = 0; +const int NbCal = 5; + + + + +// ================================================================ +// === INTERRUPT DETECTION ROUTINE === +// ================================================================ +volatile bool mpuInterrupt = false; // indicates whether MPU interrupt pin has gone high + +void dmpDataReady() { + mpuInterrupt = true; +} + +// ================================================================ +// === PRINT SERIAL FORMATTE === +// ================================================================ +void PrintCodeSerial(uint16_t code,char Msg[24],bool EOL ) { + msginfo.Code=code; + memset(msginfo.Msg,0x00,24); + strcpy(msginfo.Msg,Msg); + if (EOL) msginfo.Msg[23]=0x0A; + // Send HATIRE message to PC + Serial.write((byte*)&msginfo,30); +} + + +// ================================================================ +// === INITIAL SETUP === +// ================================================================ + +void setup() { + // join I2C bus (I2Cdev library doesn't do this automatically) + Wire.begin(); + + // initialize serial communication + while (!Serial); // wait for Leonardo enumeration, others continue immediately + + Serial.begin(115200); + PrintCodeSerial(2000,Version,true); + + hatire.Begin=0xAAAA; + hatire.Cpt=0; + hatire.End=0x5555; + + msginfo.Begin=0xAAAA; + msginfo.Code=0; + msginfo.End=0x5555; + + // initialize device + PrintCodeSerial(3001,"Initializing I2C",true); + mpu.initialize(); + + // verify connection + PrintCodeSerial(3002,"Testing connections",true); + + if (mpu.testConnection()){ + PrintCodeSerial(3003,"MPU6050 connection OK",true); + } else { + PrintCodeSerial(9007,"MPU6050 ERRROR CNX",true); + } + + while (Serial.available() && Serial.read()); // empty buffer + + // load and configure the DMP + PrintCodeSerial(3004,"Initializing DMP...",true); + devStatus = mpu.dmpInitialize(); + + // make sure it worked (returns 0 if so) + if (devStatus == 0) { + dmpLoaded=true; + + // Read Epprom saved params + PrintCodeSerial(3005,"Reading saved params...",true); + ReadParams(); + + // turn on the DMP, now that it's ready + PrintCodeSerial(3006,"Enabling DMP...",true); + mpu.setDMPEnabled(true); + + // enable Arduino interrupt detection + PrintCodeSerial(3007,"Enabling interrupt",true); + attachInterrupt(0, dmpDataReady, RISING); + mpuIntStatus = mpu.getIntStatus(); + + // set our DMP Ready flag so the main loop() function knows it's okay to use it + PrintCodeSerial(5000,"HAT BEGIN",true); + dmpReady = true; + // get expected DMP packet size for later comparison + packetSize = mpu.dmpGetFIFOPacketSize(); + // Empty FIFO + fifoCount = mpu.getFIFOCount(); + while (fifoCount > packetSize) { + fifoCount = mpu.getFIFOCount(); + mpu.getFIFOBytes(fifoBuffer, fifoCount); + } + } + else { + // ERROR! + // 1 = initial memory load failed + // 2 = DMP configuration updates failed + // (if it's going to break, usually the code will be 1) + dmpLoaded=false; + PrintCodeSerial(9000+devStatus,"DMP Initialization failed",true); + } +} + + +// ================================================================ +// === RAZ OFFSET === +// ================================================================ +void razoffset() { + eprom_save.gyro_offset[0] = 0; + eprom_save.gyro_offset[1] = 0; + eprom_save.gyro_offset[2] = 0; + eprom_save.acc_offset[0] = 0; + eprom_save.acc_offset[1] = 0; + eprom_save.acc_offset[2] = 0; +} + + +// ================================================================ +// === SAVE PARAMS === +// ================================================================ +void SaveParams() { + eeprom_write_block((const void*)&eprom_save, (void*) 0, sizeof(eprom_save)); +} + + + +// ================================================================ +// === READ PARAMS === +// ================================================================ +void ReadParams() { + eeprom_read_block( (void*)&eprom_save, (void*) 0, sizeof(eprom_save)); +} + + +// ================================================================ +// === Serial Command === +// ================================================================ +void serialEvent(){ + Commande = (char)Serial.read(); + switch (Commande) { + case 'S': + PrintCodeSerial(5001,"HAT START",true); + if (dmpLoaded==true) { + mpu.resetFIFO(); + hatire.Cpt=0; + attachInterrupt(0, dmpDataReady, RISING); + mpu.setDMPEnabled(true); + dmpReady = true; + } + else { + PrintCodeSerial(9011,"Error DMP not loaded",true); + } + break; + + case 's': + PrintCodeSerial(5002,"HAT STOP",true); + if (dmpReady==true) { + mpu.setDMPEnabled(false); + detachInterrupt(0); + dmpReady = false; + } + break; + + case 'R': + PrintCodeSerial(5003,"HAT RESET",true); + if (dmpLoaded==true) { + mpu.setDMPEnabled(false); + detachInterrupt(0); + mpu.resetFIFO(); + hatire.Cpt=0; + dmpReady = false; + setup(); + } + else { + PrintCodeSerial(9011,"Error DMP not loaded",true); + } + break; + + + case 'C': + CptCal=0; + razoffset(); + AskCalibrate=true; + break; + + case 'V': + PrintCodeSerial(2000,Version,true); + break; + + case 'I': + Serial.println(); + Serial.print("Version : \t"); + Serial.println(Version); + Serial.println("Gyroscopes offsets"); + for (int i=0; i <= 2; i++) { + Serial.print(i); + Serial.print(" : "); + Serial.print(eprom_save.gyro_offset[i]); + Serial.println(); + } + Serial.println("Accelerometers offsets"); + for (int i=0; i <= 2; i++) { + Serial.print(i); + Serial.print(" : "); + Serial.print(eprom_save.acc_offset[i]); + Serial.println(); + } + break; + + + default: + break; + } +} + + +// ================================================================ +// === MAIN PROGRAM LOOP === +// ================================================================ +void loop() { + // Leonardo BUG (simul Serial Event) + if(Serial.available() > 0) serialEvent(); + + + // if programming failed, don't try to do anything + if (dmpReady) { + + + while (!mpuInterrupt && fifoCount < packetSize) ; + + // reset interrupt flag and get INT_STATUS byte + mpuInterrupt = false; + mpuIntStatus = mpu.getIntStatus(); + + // get current FIFO count + fifoCount = mpu.getFIFOCount(); + + // check for overflow (this should never happen unless our code is too inefficient) + if ((mpuIntStatus & 0x10) || fifoCount == 1024) { + // reset so we can continue cleanly + mpu.resetFIFO(); + PrintCodeSerial(9010,"Overflow FIFO DMP",true); + hatire.Cpt=0; + + // otherwise, check for DMP data ready interrupt (this should happen frequently) + } + else if (mpuIntStatus & 0x02) { + // wait for correct available data length, should be a VERY short wait + while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount(); + + // read a packet from FIFO + mpu.getFIFOBytes(fifoBuffer, packetSize); + + // track FIFO count here in case there is > 1 packet available + // (this lets us immediately read more without waiting for an interrupt) + fifoCount -= packetSize; + + // Get Euler angles in degrees + mpu.dmpGetQuaternion(&q, fifoBuffer); + mpu.dmpGetGravity(&gravity, &q); + mpu.dmpGetYawPitchRoll(hatire.gyro, &q, &gravity); + + // Get real acceleration, adjusted to remove gravity + // not used in this script + // mpu.dmpGetAccel(&aa, fifoBuffer); + // mpu.dmpGetLinearAccel(&hatire.acc, &aa, &gravity); + + // Calibration sur X mesures + if (AskCalibrate) { + if ( CptCal>=NbCal) { + CptCal=0; + eprom_save.gyro_offset[0] = eprom_save.gyro_offset[0] / NbCal ; + eprom_save.gyro_offset[1] = eprom_save.gyro_offset[1] / NbCal ; + eprom_save.gyro_offset[2] = eprom_save.gyro_offset[2] / NbCal ; + AskCalibrate=false; + SaveParams(); + } + else { + eprom_save.gyro_offset[0] += (float) hatire.gyro[0]; + eprom_save.gyro_offset[1] += (float) hatire.gyro[1]; + eprom_save.gyro_offset[2] += (float) hatire.gyro[2]; + + CptCal++; + } + } + + + // Conversion angles Euler en +-180 Degr�es + for (int i=0; i <= 2; i++) { + hatire.gyro[i]= (hatire.gyro[i] - eprom_save.gyro_offset[i] ) * Rad2Deg; + if (hatire.gyro[i]>180) { + hatire.gyro[i] = hatire.gyro[i] - 360; + } + } + + if (AskCalibrate) { + hatire.gyro[0] = 0; + hatire.gyro[1] = 0; + hatire.gyro[2] = 0; + hatire.acc[0]= 0; + hatire.acc[1] = 0; + hatire.acc[2] = 0; + } + + // Send Trame to HATIRE PC + Serial.write((byte*)&hatire,30); + + hatire.Cpt++; + if (hatire.Cpt>999) { + hatire.Cpt=0; + } + } + } + delay(1); +} + + diff --git a/facetracknoir/clientfiles/HAT_100/README b/facetracknoir/clientfiles/HAT_100/README new file mode 100644 index 00000000..1e4f2926 --- /dev/null +++ b/facetracknoir/clientfiles/HAT_100/README @@ -0,0 +1,35 @@ + Frame exchange protocol fixed size of 30 bytes like this : + + typedef struct { + int16_t Begin ; // 2 Debut + uint16_t Cpt ; // 2 Compteur trame or Code + float gyro[3]; // 12 [Y, P, R] gyro + float acc[3]; // 12 [x, y, z] Acc + int16_t End ; // 2 Fin +} _hatire; +_hat hat; + + +void setup() { + Serial.begin(115200); + // header frame + hatire.Begin=0xAAAA; + // Frame Number or Error code + hat.Cpt=0; + // footer frame + hat.End=0x5555; +} + + + void loop() { + mpu.dmpGetYawPitchRoll(hatire.gyro); + mpu.dmpAccXYZ(hatire.acc); + // Send Trame to HATIRE PC + Serial.write((byte*)&hatire,30); + hatire.Cpt++; + if (hatire.Cpt>999) { + hatire.Cpt=0; + } + delay(1); +} + diff --git a/ftnoir_tracker_hatire/ftnoir_arduino_type.h b/ftnoir_tracker_hatire/ftnoir_arduino_type.h new file mode 100644 index 00000000..4d19043b --- /dev/null +++ b/ftnoir_tracker_hatire/ftnoir_arduino_type.h @@ -0,0 +1,31 @@ +#ifndef FTNOIR_TARDUINO_TYPE_H +#define FTNOIR_TARDUINO_TYPE_H + +// Arduino trame structure +#pragma pack(push,2) +struct TArduinoData +{ + quint16 Begin; // Header trame 0xAAAA; + quint16 Code; // 0->999 Num Trame >=2000 Info >=3000 Init >=5000 Start Command >=9000 Error + float Gyro[3]; + float Acc[3]; + quint16 End; // End trame 0x5555; +} ; +#pragma pack(pop) + + +inline QDataStream & operator >> ( QDataStream& in, TArduinoData& out ) +{ + in.setByteOrder(QDataStream::LittleEndian ); + in.setFloatingPointPrecision(QDataStream::SinglePrecision ); + + in >> (quint16)out.Begin >> (quint16)out.Code + >> (float)out.Gyro[0] >> (float)out.Gyro[1] >> (float)out.Gyro[2] + >> (float)out.Acc[0] >> (float)out.Acc[1] >> (float)out.Acc[2] + >> (quint16)out.End; + return in; +} + + + +#endif \ No newline at end of file diff --git a/ftnoir_tracker_hatire/ftnoir_hat.qrc b/ftnoir_tracker_hatire/ftnoir_hat.qrc new file mode 100644 index 00000000..4c606f92 --- /dev/null +++ b/ftnoir_tracker_hatire/ftnoir_hat.qrc @@ -0,0 +1,6 @@ + + + images/hat.ico + images/hat_logo.png + + diff --git a/ftnoir_tracker_hatire/ftnoir_hatcontrols.ui b/ftnoir_tracker_hatire/ftnoir_hatcontrols.ui new file mode 100644 index 00000000..86f9e48a --- /dev/null +++ b/ftnoir_tracker_hatire/ftnoir_hatcontrols.ui @@ -0,0 +1,1066 @@ + + + UIHATControls + + + + 0 + 0 + 370 + 520 + + + + + 370 + 520 + + + + + 370 + 520 + + + + Qt::NoContextMenu + + + Head Arduino Tracker settings FaceTrackNoIR + + + + images/hat.icoimages/hat.ico + + + 1.000000000000000 + + + Qt::LeftToRight + + + false + + + + + 0 + 480 + 361 + 27 + + + + + + + + 0 + 0 + + + + + 80 + 25 + + + + + 80 + 25 + + + + OK + + + + + + + + 80 + 25 + + + + + 80 + 25 + + + + Save + + + + + + + + 0 + 0 + + + + + 80 + 25 + + + + + 80 + 25 + + + + Cancel + + + + + + + + + 0 + 0 + 360 + 470 + + + + + 360 + 470 + + + + + 360 + 470 + + + + 0 + + + true + + + + + :/images/hat.ico:/images/hat.ico + + + General + + + + + 10 + 350 + 331 + 91 + + + + Information + + + + + 10 + 20 + 311 + 51 + + + + + QFormLayout::AllNonFixedFieldsGrow + + + 10 + + + 10 + + + 0 + + + 0 + + + 0 + + + + + + 31 + 0 + + + + + 60 + 13 + + + + Trame per seconde + + + tps : + + + + + + + + 60 + 16777215 + + + + Status : + + + + + + + + 170 + 0 + + + + + 60 + 16777215 + + + + + + + + + + + + 31 + 0 + + + + + 60 + 13 + + + + 00 + + + + + + + + + + 10 + 130 + 331 + 211 + + + + + 0 + 106 + + + + Axis Configuration + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + 10 + 20 + 311 + 181 + + + + + QLayout::SetMinAndMaxSize + + + 0 + + + 0 + + + 6 + + + + + + 20 + 16777215 + + + + Enable Axis + + + Qt::LeftToRight + + + + + + + + + + + 20 + 16777215 + + + + Enable Axis + + + Qt::LeftToRight + + + + + + + + + + + + + Associate Axis + + + + RotX + + + + + RotY + + + + + RotZ + + + + + + + + Yaw: + + + + + + + Associate Axis + + + + RotX + + + + + RotY + + + + + RotZ + + + + + + + + Associate Axis + + + + RotX + + + + + RotY + + + + + RotZ + + + + + + + + + 20 + 16777215 + + + + Enable Axis + + + Qt::LeftToRight + + + + + + + + + + Pitch: + + + + + + + Roll: + + + + + + + + 20 + 16777215 + + + + Invert Axis + + + Qt::LeftToRight + + + + + + + + + + + + + + 20 + 16777215 + + + + Invert Axis + + + Qt::LeftToRight + + + + + + + + + + + + + + 20 + 16777215 + + + + Invert Axis + + + Qt::LeftToRight + + + + + + + + + + + + + Enable + + + + + + + Axis + + + + + + + Invert + + + + + + + X: + + + + + + + + 20 + 16777215 + + + + Enable Axis + + + Qt::LeftToRight + + + + + + + + + + Associate Axis + + + + X + + + + + Y + + + + + Z + + + + + + + + + 20 + 16777215 + + + + Invert Axis + + + Qt::LeftToRight + + + + + + + + + + + + + Y: + + + + + + + + 20 + 16777215 + + + + Enable Axis + + + Qt::LeftToRight + + + + + + + + + + Associate Axis + + + + X + + + + + Y + + + + + Z + + + + + + + + + 20 + 16777215 + + + + Invert Axis + + + Qt::LeftToRight + + + + + + + + + + + + + Z: + + + + + + + + 20 + 16777215 + + + + Enable Axis + + + Qt::LeftToRight + + + + + + + + + + Associate Axis + + + + X + + + + + Y + + + + + Z + + + + + + + + + 20 + 16777215 + + + + Invert Axis + + + Qt::LeftToRight + + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 16 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 16 + + + + + + + + + + + 10 + 90 + 331 + 31 + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 13 + 16 + + + + + + + + + 80 + 20 + + + + Center + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 13 + 16 + + + + + + + + + 80 + 20 + + + + Reset + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 13 + 16 + + + + + + + + + + 10 + 10 + 331 + 31 + + + + + + + + 60 + 16777215 + + + + Serial Port : + + + + + + + + 100 + 16777215 + + + + false + + + QComboBox::AdjustToMinimumContentsLength + + + 0 + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 40 + 20 + + + + + + + + + + 10 + 50 + 331 + 31 + + + + + 7 + + + + + Choose the Serial Com port where is connected ARDUINO. + + + true + + + + + + + + + About + + + + + 10 + 20 + 111 + 111 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">FTNoIR HAT Plugin<br />Version 1.0</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">by FuraX49</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://hatire.sourceforge.net/"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">Manual (external)</span></a></p></body></html> + + + true + + + + + + 200 + 20 + 128 + 128 + + + + + + + :/images/hat_logo.png + + + + + + 10 + 190 + 331 + 251 + + + + true + + + 800 + + + + + + 10 + 160 + 241 + 20 + + + + + + + 260 + 160 + 75 + 23 + + + + Send + + + + + + + btnCancel + + + + + + + startEngineClicked() + stopEngineClicked() + cameraSettingsClicked() + + diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp new file mode 100644 index 00000000..e961a10f --- /dev/null +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp @@ -0,0 +1,304 @@ +/******************************************************************************** +* FaceTrackNoIR This program is a private project of some enthusiastic * +* gamers from Holland, who don't like to pay much for * +* head-tracking. * +* * +* Copyright (C) 2012 Wim Vriend (Developing) * +* Ron Hendriks (Researching and Testing) * +* * +* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU General Public License as published by the * +* Free Software Foundation; either version 3 of the License, or (at your * +* option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but * +* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * +* more details. * +* * +* You should have received a copy of the GNU General Public License along * +* with this program; if not, see . * +* * +********************************************************************************/ + + +#include "ftnoir_tracker_hat.h" +#include +#include +#include + +FTNoIR_Tracker::FTNoIR_Tracker() +{ + SerialPort = NULL; + waitTimeout = 1000; + TrackerSettings settings; + settings.load_ini(); + applysettings(settings); + + + // Create events + m_StopThread = CreateEvent(0, TRUE, FALSE, 0); + m_WaitThread = CreateEvent(0, TRUE, FALSE, 0); + + ListErrInf = new QList(); + + // prepare & reserve QByteArray + datagram.reserve(30); +} + +FTNoIR_Tracker::~FTNoIR_Tracker() +{ + // Trigger thread to stop + ::SetEvent(m_StopThread); + + // Wait until thread finished + if (isRunning()) { + ::WaitForSingleObject(m_WaitThread, INFINITE); + } + + // Close handles + ::CloseHandle(m_StopThread); + ::CloseHandle(m_WaitThread); + + if (SerialPort!=NULL) { + if (SerialPort->isOpen() ) { + SerialPort->putChar('s'); //Send STOP to Arduino + SerialPort->close(); + } + delete SerialPort; + SerialPort=NULL; + } + +} + +//send CENTER to Arduino +void FTNoIR_Tracker::notifyCenter() { + if (SerialPort!=NULL) { + if (SerialPort->isOpen() ) { + SerialPort->putChar('C'); + } + } +} + + + +//send CENTER to Arduino +void FTNoIR_Tracker::center() { + if (SerialPort!=NULL) { + if (SerialPort->isOpen() ) { + SerialPort->putChar('C'); + } + } +} + +//send RESET to Arduino +void FTNoIR_Tracker::reset() { + if (SerialPort!=NULL) { + if (SerialPort->isOpen() ) { + SerialPort->putChar('R'); + } + } +} + +//send command to Arduino +void FTNoIR_Tracker::sendcmd(QString* cmd) { + QReadLocker locker(&rwlock); + QByteArray bytes; + if (SerialPort!=NULL) { + if (SerialPort->isOpen() ) { + bytes.append(cmd->toAscii()); + SerialPort->write(bytes); + } + } +} + +// return FPS and last status +void FTNoIR_Tracker::get_info(QString* info, int* tps ){ + QReadLocker locker(&rwlock); + *tps=HAT.Code; + if (ListErrInf->size()>0) { + *info=ListErrInf->takeFirst(); + } else { + *info= QString(); + } +} + + +/** QThread run @override **/ +void FTNoIR_Tracker::run() { + // + // Read the data that was received. + // + forever { + + // Check event for stop thread + if(::WaitForSingleObject(m_StopThread, 0) == WAIT_OBJECT_0) + { + // Set event + ::SetEvent(m_WaitThread); + qDebug() << "FTNoIR_Tracker::run() terminated run()"; + return; + } + if (SerialPort->bytesAvailable()>=30) { + QWriteLocker locker(&rwlock); + datagram.clear(); + datagram=SerialPort->read(30); + QDataStream datastream(datagram); + datastream>>ArduinoData; + + if (ArduinoData.Begin==0xAAAA && ArduinoData.End==0x5555 ) { + if (ArduinoData.Code <= 1000) { + HAT=ArduinoData; + } else { + ListErrInf->push_back(QString::fromAscii(datagram.mid(4,24),24)) ; + } + } else { + SerialPort->read(1); + } + } + //for lower cpu load + usleep(10000); + } +} + +void FTNoIR_Tracker::Initialize( QFrame *videoframe ) +{ + qDebug() << "FTNoIR_Tracker::Initialize says: Starting "; + + // + // Create SerialPort if they don't exist already. + // They must be created here, because they must be in the new thread (FTNoIR_Tracker::run()) + // + + if (SerialPort == NULL) { + qDebug() << "FTNoIR_Tracker::Initialize() Open SerialPort"; + SerialPort = new QextSerialPort(sSerialPortName); + if (SerialPort->open(QIODevice::ReadWrite | QIODevice::Unbuffered ) == true) { + SerialPort->flush(); + SerialPort->setBaudRate(BAUD115200); + SerialPort->setParity(PAR_NONE); + SerialPort->setDataBits(DATA_8); + SerialPort->setStopBits(STOP_1); + SerialPort->setFlowControl(FLOW_OFF); + SerialPort->setTimeout(waitTimeout); + SerialPort->setQueryMode(QextSerialPort::EventDriven); //Polling + // Send START to arduino + SerialPort->putChar('S'); + } + else { + QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to open SerialPort",QMessageBox::Ok,QMessageBox::NoButton); + delete SerialPort; + SerialPort = NULL; + } + } + return; +} + +void FTNoIR_Tracker::StartTracker( HWND parent_window ) +{ + start( QThread::TimeCriticalPriority ); + return; +} + +void FTNoIR_Tracker::StopTracker( bool exit ) +{ + // + // OK, the thread is not stopped, doing this. That might be dangerous anyway... + // + if (exit || !exit) return; + return; +} + +// +// Return 6DOF info +// +bool FTNoIR_Tracker::GiveHeadPoseData(THeadPoseData *data) +{ + QReadLocker locker(&rwlock); + data->frame_number = HAT.Code; + + if (bEnableYaw) { + if (bInvertYaw ) data->yaw = HAT.Gyro[iYawAxe] * -1.0f; + else data->yaw = HAT.Gyro[iYawAxe]; + } + + if (bEnablePitch) { + if (bInvertPitch)data->pitch = HAT.Gyro[iPitchAxe] * -1.0f; + else data->pitch = HAT.Gyro[iPitchAxe]; + } + + if (bEnableRoll) { + if (bInvertRoll) data->roll = HAT.Gyro[iRollAxe] * -1.0f; + else data->roll = HAT.Gyro[iRollAxe]; + } + + if (bEnableX) { + if (bInvertX) data->x = HAT.Acc[iXAxe]* -1.0f; + else data->x = HAT.Acc[iXAxe]; + } + + if (bEnableY) { + if (bInvertY) data->y = HAT.Acc[iYAxe]* -1.0f; + else data->y = HAT.Acc[iYAxe]; + } + + if (bEnableZ) { + if (bInvertZ) data->z = HAT.Acc[iZAxe]* -1.0f; + else data->z = HAT.Acc[iZAxe]; + } + + return true; +} + + + +// +// Apply modification Settings +// +void FTNoIR_Tracker::applysettings(const TrackerSettings& settings){ + qDebug()<<"Tracker:: Applying settings"; + + QReadLocker locker(&rwlock); + sSerialPortName= settings.SerialPortName; + + bEnableRoll = settings.EnableRoll; + bEnablePitch = settings.EnablePitch; + bEnableYaw = settings.EnableYaw; + bEnableX = settings.EnableX; + bEnableY = settings.EnableY; + bEnableZ = settings.EnableZ; + + bInvertRoll = settings.InvertRoll; + bInvertPitch = settings.InvertPitch; + bInvertYaw = settings.InvertYaw; + bInvertX = settings.InvertX; + bInvertY = settings.InvertY; + bInvertZ = settings.InvertZ; + + + iRollAxe= settings.RollAxe; + iPitchAxe= settings.PitchAxe; + iYawAxe= settings.YawAxe; + iXAxe= settings.XAxe; + iYAxe= settings.YAxe; + iZAxe= settings.ZAxe; +} + + + + +//////////////////////////////////////////////////////////////////////////////// +// Factory function that creates instances if the Tracker object. + +// Export both decorated and undecorated names. +// GetTracker - Undecorated name, which can be easily used with GetProcAddress +// Win32 API function. +// _GetTracker@0 - Common name decoration for __stdcall functions in C language. +#pragma comment(linker, "/export:GetTracker=_GetTracker@0") + +FTNOIR_TRACKER_BASE_EXPORT ITrackerPtr __stdcall GetTracker() +{ + return new FTNoIR_Tracker; +} diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h new file mode 100644 index 00000000..54e67f48 --- /dev/null +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h @@ -0,0 +1,102 @@ +#ifndef FTNOIR_TRACKER_HAT_H +#define FTNOIR_TRACKER_HAT_H + +#include "..\ftnoir_tracker_base\ftnoir_tracker_base.h" +#include "ftnoir_tracker_hat_settings.h" +#include "ftnoir_arduino_type.h" + +#include +#include +#include +#include +#include +#include +#include "Windows.h" +#include "math.h" + +class QextSerialPort; +class QExtSerialEnumerator; + +class FTNoIR_Tracker : public ITracker, QThread +{ + +public: + FTNoIR_Tracker(); + ~FTNoIR_Tracker(); + + void Initialize( QFrame *videoframe ); + void StartTracker( HWND parent_window ); + void StopTracker( bool exit ); + bool GiveHeadPoseData(THeadPoseData *data); + + void applysettings(const TrackerSettings& settings); + void notifyCenter(); + void center(); + void reset(); + void sendcmd(QString* cmd); + void get_info(QString* info , int* tps ); + +protected: + void run(); // qthread override run method + + +private: + // Handles to neatly terminate thread... + HANDLE m_StopThread; + HANDLE m_WaitThread; + + TArduinoData ArduinoData, HAT ; // Trame from Arduino + QByteArray datagram; + QextSerialPort *SerialPort; + QReadWriteLock rwlock; + QList* ListErrInf ; + int waitTimeout; + QString sSerialPortName; // Port serial name + bool bEnableRoll; + bool bEnablePitch; + bool bEnableYaw; + bool bEnableX; + bool bEnableY; + bool bEnableZ; + + bool bInvertRoll; + bool bInvertPitch; + bool bInvertYaw; + bool bInvertX; + bool bInvertY; + bool bInvertZ; + + + int iRollAxe; + int iPitchAxe; + int iYawAxe; + int iXAxe; + int iYAxe; + int iZAxe; + +}; + + +//******************************************************************************************************* +// FaceTrackNoIR Tracker DLL. Functions used to get general info on the Tracker +//******************************************************************************************************* +class FTNoIR_TrackerDll : public ITrackerDll +{ +public: + FTNoIR_TrackerDll(); + ~FTNoIR_TrackerDll(); + + void Initialize(); + + void getFullName(QString *strToBeFilled); + void getShortName(QString *strToBeFilled); + void getDescription(QString *strToBeFilled); + void getIcon(QIcon *icon); + +private: + QString trackerFullName; // Trackers' name and description + QString trackerShortName; + QString trackerDescription; +}; + +#endif // FTNOIR_TRACKER_HAT_H \ No newline at end of file diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.rc b/ftnoir_tracker_hatire/ftnoir_tracker_hat.rc new file mode 100644 index 00000000..62e0a613 --- /dev/null +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.rc @@ -0,0 +1,61 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +//#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE 9, 1 +#pragma code_page(1252) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp new file mode 100644 index 00000000..b889341f --- /dev/null +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp @@ -0,0 +1,299 @@ +/******************************************************************************** +* FaceTrackNoIR This program is a private project of some enthusiastic * +* gamers from Holland, who don't like to pay much for * +* head-tracking. * +* * +* Copyright (C) 2012 Wim Vriend (Developing) * +* Ron Hendriks (Researching and Testing) * +* * +* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU General Public License as published by the * +* Free Software Foundation; either version 3 of the License, or (at your * +* option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but * +* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * +* more details. * +* * +* You should have received a copy of the GNU General Public License along * +* with this program; if not, see . * +* * +********************************************************************************/ +#include "ftnoir_tracker_hat.h" +#include "ftnoir_tracker_hat_dialog.h" + +#include +#include + +//******************************************************************************************************* +// FaceTrackNoIR Client Settings-dialog. +//******************************************************************************************************* + +// +// Constructor for server-settings-dialog +// +TrackerControls::TrackerControls() : settingsDirty(false), theTracker(NULL), timer(this), +QWidget() +{ + + settingsDirty= false; + theTracker = NULL; + ui.setupUi( this ); + pre_trame = 0; + settings.load_ini(); + + // make SerialPort list + foreach (QextPortInfo PortInfo , QextSerialEnumerator::getPorts() ) { + ui.cbSerialPort->addItem(PortInfo.portName); + } + // Stop if no SerialPort dispo + if (ui.cbSerialPort->count()<1) { + QMessageBox::critical(this,"FaceTrackNoIR Error", "No SerialPort avaible"); + } else { + + int indxport =ui.cbSerialPort->findText(settings.SerialPortName,Qt::MatchExactly ); + if (indxport!=-1) { + ui.cbSerialPort->setCurrentIndex(indxport); + } else { + QMessageBox::warning(this,"FaceTrackNoIR Error", "Selected SerialPort modified"); + ui.cbSerialPort-> setCurrentIndex(indxport); + } + } + + ui.chkEnableRoll->setChecked(settings.EnableRoll); + ui.chkEnablePitch->setChecked(settings.EnablePitch); + ui.chkEnableYaw->setChecked(settings.EnableYaw); + ui.chkEnableX->setChecked(settings.EnableX); + ui.chkEnableY->setChecked(settings.EnableY); + ui.chkEnableZ->setChecked(settings.EnableZ); + + ui.chkInvertRoll->setChecked(settings.InvertRoll); + ui.chkInvertPitch->setChecked(settings.InvertPitch); + ui.chkInvertYaw->setChecked(settings.InvertYaw); + ui.chkInvertX->setChecked(settings.InvertX); + ui.chkInvertY->setChecked(settings.InvertY); + ui.chkInvertZ->setChecked(settings.InvertZ); + + + ui.cb_roll->setCurrentIndex(settings.RollAxe); + ui.cb_pitch->setCurrentIndex(settings.PitchAxe); + ui.cb_yaw->setCurrentIndex(settings.YawAxe); + ui.cb_x->setCurrentIndex(settings.XAxe); + ui.cb_y->setCurrentIndex(settings.YAxe); + ui.cb_z->setCurrentIndex(settings.ZAxe); + + + // Connect Qt signals to member-functions + connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK())); + connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); + connect(ui.btnSave, SIGNAL(clicked()), this, SLOT(doSave())); + + + connect(ui.cbSerialPort, SIGNAL(currentIndexChanged(QString)), this,SLOT(set_mod_port(QString)) ); + + connect( ui.chkEnableRoll,SIGNAL(toggled(bool)), this,SLOT(set_ena_roll(bool)) ); + connect( ui.chkEnablePitch,SIGNAL(toggled(bool)), this,SLOT(set_ena_pitch(bool)) ); + connect( ui.chkEnableYaw,SIGNAL(toggled(bool)), this,SLOT(set_ena_yaw(bool)) ); + connect( ui.chkEnableX,SIGNAL(toggled(bool)), this,SLOT(set_ena_x(bool)) ); + connect( ui.chkEnableY,SIGNAL(toggled(bool)), this,SLOT(set_ena_y(bool)) ); + connect( ui.chkEnableZ,SIGNAL(toggled(bool)), this,SLOT(set_ena_z(bool)) ); + + connect( ui.chkInvertRoll,SIGNAL(toggled(bool)), this,SLOT(set_inv_roll(bool)) ); + connect( ui.chkInvertPitch,SIGNAL(toggled(bool)), this,SLOT(set_inv_pitch(bool)) ); + connect( ui.chkInvertYaw,SIGNAL(toggled(bool)), this,SLOT(set_inv_yaw(bool)) ); + connect( ui.chkInvertX,SIGNAL(toggled(bool)), this,SLOT(set_inv_x(bool)) ); + connect( ui.chkInvertY,SIGNAL(toggled(bool)), this,SLOT(set_inv_y(bool)) ); + connect( ui.chkInvertZ,SIGNAL(toggled(bool)), this,SLOT(set_inv_z(bool)) ); + + + connect(ui.cb_roll, SIGNAL(currentIndexChanged(int)), this,SLOT(set_rot_roll(int))); + connect(ui.cb_pitch, SIGNAL(currentIndexChanged(int)),this,SLOT(set_rot_pitch(int))); + connect(ui.cb_yaw, SIGNAL(currentIndexChanged(int)), this,SLOT(set_rot_yaw(int))); + connect(ui.cb_x, SIGNAL(currentIndexChanged(int)), this,SLOT(set_acc_x(int))); + connect(ui.cb_y, SIGNAL(currentIndexChanged(int)), this,SLOT(set_acc_y(int))); + connect(ui.cb_z, SIGNAL(currentIndexChanged(int)), this,SLOT(set_acc_z(int))); + + connect(ui.btnReset, SIGNAL(clicked()), this, SLOT(doReset())); + connect(ui.btnCenter, SIGNAL(clicked()), this, SLOT(doCenter())); + connect(ui.btnSend, SIGNAL(clicked()), this, SLOT(doSend())); + + connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); +} + +// +// Destructor for server-dialog +// +TrackerControls::~TrackerControls() { + delete this; +} + + +// +// Initialize tracker-client-dialog +// +void TrackerControls::Initialize(QWidget *parent) { + QPoint offsetpos(100, 100); + if (parent) { + this->move(parent->pos() + offsetpos); + } + show(); +} + + +// +// Apply online settings to tracker +// +void TrackerControls::settings_changed() +{ + settingsDirty = true; + if (theTracker) theTracker->applysettings(settings); +} + + +// +// Center asked to ARDUINO +// +void TrackerControls::doCenter() { + if (theTracker) theTracker->center(); +} + +// +// Reset asked to ARDUINO +// +void TrackerControls::doReset() { + if (theTracker) theTracker->reset(); +} + + +// +// Send command to ARDUINO +// +void TrackerControls::doSend() { + if (theTracker) { + if (!ui.lineSend->text().isEmpty()) { + QString cmd; + cmd=ui.lineSend->text(); + theTracker->sendcmd(&cmd); + ui.lineSend->clear(); + } + } +} + + +// +// Display FPS and Status of Arduino. +// +void TrackerControls::poll_tracker_info() +{ + if (theTracker) + { + QString info; + int num_trame; + int nb_trame; + + theTracker->get_info(&info,&num_trame); + if ( !info.isNull()) { + ui.lab_vstatus->setText(info); + ui.pteINFO->moveCursor(QTextCursor::End); + ui.pteINFO->insertPlainText(info); + } + + + if (pre_tramesetText(QString::number(nb_trame*(1000/timer.interval()))); + + pre_trame=num_trame; + } + +} + + +void TrackerControls::doSave() { + settingsDirty=false; + settings.save_ini(); +} + + +// +// OK clicked on server-dialog +// +void TrackerControls::doOK() { + settingsDirty=false; + settings.save_ini(); + this->close(); +} + +// +// Cancel clicked on server-dialog +// +void TrackerControls::doCancel() { + // + // Ask if changed Settings should be saved + // + if (settingsDirty) { + int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard ); + + // qDebug() << "doCancel says: answer =" << ret; + + switch (ret) { + case QMessageBox::Save: + settings.save_ini(); + close(); + break; + case QMessageBox::Discard: + close(); + break; + case QMessageBox::Cancel: + // Cancel was clicked + break; + default: + // should never be reached + break; + } + } + else { + close(); + } +} + + +void TrackerControls::registerTracker(ITracker *tracker) { +// theTracker = (FTNoIR_Tracker *) tracker; + theTracker = static_cast(tracker); + if (isVisible() && settingsDirty) theTracker->applysettings(settings); + ui.cbSerialPort->setEnabled(false); + timer.start(250); + ui.lab_vstatus->setText("HAT START"); +} + + +void TrackerControls::unRegisterTracker() { + theTracker = NULL; + ui.cbSerialPort->setEnabled(true); + timer.stop(); + ui.lab_vstatus->setText("HAT STOPPED"); + ui.lab_vtps->setText(""); +} + + + + +//////////////////////////////////////////////////////////////////////////////// +// Factory function that creates instances if the Tracker-settings dialog object. + +// Export both decorated and undecorated names. +// GetTrackerDialog - Undecorated name, which can be easily used with GetProcAddress +// Win32 API function. +// _GetTrackerDialog@0 - Common name decoration for __stdcall functions in C language. +#pragma comment(linker, "/export:GetTrackerDialog=_GetTrackerDialog@0") + +FTNOIR_TRACKER_BASE_EXPORT ITrackerDialogPtr __stdcall GetTrackerDialog( ) +{ + return new TrackerControls; +} diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h new file mode 100644 index 00000000..c463f361 --- /dev/null +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h @@ -0,0 +1,78 @@ +#ifndef FTNOIR_TRACKER_HAT_DIALOG_H +#define FTNOIR_TRACKER_HAT_DIALOG_H + +#include "..\ftnoir_tracker_base\ftnoir_tracker_base.h" +#include "ftnoir_tracker_hat_settings.h" +#include "ftnoir_tracker_hat.h" +#include "ui_ftnoir_hatcontrols.h" + +#include +#include + +// Widget that has controls for FTNoIR protocol client-settings. +class TrackerControls: public QWidget, Ui::UIHATControls, public ITrackerDialog +{ + Q_OBJECT + +public: + explicit TrackerControls(); + virtual ~TrackerControls(); + + void Initialize(QWidget *parent); + void registerTracker(ITracker *tracker); + void unRegisterTracker() ; + +private: + Ui::UIHATControls ui; + int pre_trame; + FTNoIR_Tracker *theTracker; + +protected slots: + + /* + void set_mod_port(int val) { settings.SerialPortName = ui.cbSerialPort->itemText(val); + QMessageBox::warning(this,"FaceTrackNoIR Error", settings.SerialPortName); + settings_changed(); } +*/ + void set_mod_port(const QString & val) { settings.SerialPortName =val; + QMessageBox::warning(this,"FaceTrackNoIR Error", settings.SerialPortName); + settings_changed(); } + void set_ena_roll(bool val) { settings.EnableRoll = val; settings_changed(); } + void set_ena_pitch(bool val) { settings.EnablePitch = val; settings_changed(); } + void set_ena_yaw(bool val) { settings.EnableYaw = val; settings_changed(); } + void set_ena_x(bool val) { settings.EnableX = val; settings_changed(); } + void set_ena_y(bool val) { settings.EnableY = val; settings_changed(); } + void set_ena_z(bool val) { settings.EnableZ = val; settings_changed(); } + + void set_inv_roll(bool val) { settings.InvertRoll = val; settings_changed(); } + void set_inv_pitch(bool val) { settings.InvertPitch = val; settings_changed(); } + void set_inv_yaw(bool val) { settings.InvertYaw = val; settings_changed(); } + void set_inv_x(bool val) { settings.InvertX = val; settings_changed(); } + void set_inv_y(bool val) { settings.InvertY = val; settings_changed(); } + void set_inv_z(bool val) { settings.InvertZ = val; settings_changed(); } + + + void set_rot_roll(int val) { settings.RollAxe = val; settings_changed(); } + void set_rot_pitch(int val) { settings.PitchAxe = val; settings_changed(); } + void set_rot_yaw(int val) { settings.YawAxe = val; settings_changed(); } + void set_acc_x(int val) { settings.XAxe = val; settings_changed(); } + void set_acc_y(int val) { settings.YAxe = val; settings_changed(); } + void set_acc_z(int val) { settings.ZAxe = val; settings_changed(); } + + void doOK(); + void doCancel(); + void doSave(); + void doReset(); + void doCenter(); + void doSend(); + void poll_tracker_info(); + +protected: + bool settingsDirty; + void settings_changed(); + TrackerSettings settings; + QTimer timer; +}; + + +#endif //FTNOIR_TRACKER_HAT_DIALOG_H \ No newline at end of file diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp new file mode 100644 index 00000000..246eb397 --- /dev/null +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp @@ -0,0 +1,79 @@ +/******************************************************************************** +* FaceTrackNoIR This program is a private project of some enthusiastic * +* gamers from Holland, who don't like to pay much for * +* head-tracking. * +* * +* Copyright (C) 2012 Wim Vriend (Developing) * +* Ron Hendriks (Researching and Testing) * +* * +* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU General Public License as published by the * +* Free Software Foundation; either version 3 of the License, or (at your * +* option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but * +* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * +* more details. * +* * +* You should have received a copy of the GNU General Public License along * +* with this program; if not, see . * +* * +********************************************************************************/ + +#include "ftnoir_tracker_hat.h" +#include +#include + +FTNoIR_TrackerDll::FTNoIR_TrackerDll() { + //populate the description strings + trackerFullName = "Head Arduino Tracker"; + trackerShortName = "HAT"; + trackerDescription = "FaceTrackNoIR HAT"; +} + +FTNoIR_TrackerDll::~FTNoIR_TrackerDll() +{ + +} + +void FTNoIR_TrackerDll::Initialize() +{ + return; +} + +void FTNoIR_TrackerDll::getFullName(QString *strToBeFilled) +{ + *strToBeFilled = trackerFullName; +}; + +void FTNoIR_TrackerDll::getShortName(QString *strToBeFilled) +{ + *strToBeFilled = trackerShortName; +}; + +void FTNoIR_TrackerDll::getDescription(QString *strToBeFilled) +{ + *strToBeFilled = trackerDescription; +}; + +void FTNoIR_TrackerDll::getIcon(QIcon *icon) +{ + *icon = QIcon(":/images/hat.ico"); +}; + +//////////////////////////////////////////////////////////////////////////////// +// Factory function that creates instances if the Tracker object. + +// Export both decorated and undecorated names. +// GetTrackerDll - Undecorated name, which can be easily used with GetProcAddress +// Win32 API function. +// _GetTrackerDll@0 - Common name decoration for __stdcall functions in C language. +#pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0") + +FTNOIR_TRACKER_BASE_EXPORT ITrackerDllPtr __stdcall GetTrackerDll() +{ + return new FTNoIR_TrackerDll; +} diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp new file mode 100644 index 00000000..f8b342cc --- /dev/null +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp @@ -0,0 +1,102 @@ +/******************************************************************************** +* FaceTrackNoIR This program is a private project of some enthusiastic * +* gamers from Holland, who don't like to pay much for * +* head-tracking. * +* * +* Copyright (C) 2012 Wim Vriend (Developing) * +* Ron Hendriks (Researching and Testing) * +* * +* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU General Public License as published by the * +* Free Software Foundation; either version 3 of the License, or (at your * +* option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but * +* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * +* more details. * +* * +* You should have received a copy of the GNU General Public License along * +* with this program; if not, see . * +* * +********************************************************************************/ +#include +#include + +#include "ftnoir_tracker_hat_settings.h" + +void TrackerSettings::load_ini() +{ + qDebug("TrackerSettings::load_ini()"); + QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER) + QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) + + iniFile.beginGroup( "HAT" ); + + SerialPortName=iniFile.value ( "PortName" ).toString(); + + EnableRoll = iniFile.value( "EnableRoll", 1 ).toBool(); + EnablePitch = iniFile.value( "EnablePitch", 1 ).toBool(); + EnableYaw = iniFile.value( "EnableYaw", 1 ).toBool(); + EnableX = iniFile.value( "EnableX", 0 ).toBool(); + EnableY = iniFile.value( "EnableY", 0 ).toBool(); + EnableZ = iniFile.value( "EnableZ", 0 ).toBool(); + + + InvertRoll = iniFile.value( "InvertRoll", 1 ).toBool(); + InvertPitch = iniFile.value( "InvertPitch", 1 ).toBool(); + InvertYaw = iniFile.value( "InvertYaw", 1 ).toBool(); + InvertX = iniFile.value( "InvertX", 0 ).toBool(); + InvertY = iniFile.value( "InvertY", 0 ).toBool(); + InvertZ = iniFile.value( "InvertZ", 0 ).toBool(); + + + RollAxe=iniFile.value("RollAxe",1).toInt(); + PitchAxe=iniFile.value("PitchAxe",2).toInt(); + YawAxe=iniFile.value("YawAxe",0).toInt(); + XAxe=iniFile.value("XAxe",1).toInt(); + YAxe=iniFile.value("YAxe",2).toInt(); + ZAxe=iniFile.value("ZAxe",0).toInt(); + + iniFile.endGroup(); +} + + +void TrackerSettings::save_ini() const +{ + qDebug("TrackerSettings::save_ini()"); + + QSettings settings("Abbequerque Inc.", "FaceTrackNoIR"); // Registry settings (in HK_USER) + QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString(); + QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) + + iniFile.beginGroup ( "HAT" ); + + iniFile.setValue ( "PortName",SerialPortName ); + + iniFile.setValue( "EnableRoll", EnableRoll ); + iniFile.setValue( "EnablePitch", EnablePitch ); + iniFile.setValue( "EnableYaw", EnableYaw ); + iniFile.setValue( "EnableX", EnableX ); + iniFile.setValue( "EnableY", EnableY ); + iniFile.setValue( "EnableZ", EnableZ ); + + iniFile.setValue( "InvertRoll", InvertRoll ); + iniFile.setValue( "InvertPitch", InvertPitch ); + iniFile.setValue( "InvertYaw", InvertYaw ); + iniFile.setValue( "InvertX", InvertX ); + iniFile.setValue( "InvertY", InvertY ); + iniFile.setValue( "InvertZ", InvertZ ); + + iniFile.setValue ( "RollAxe", RollAxe ); + iniFile.setValue ( "PitchAxe", PitchAxe ); + iniFile.setValue ( "YawAxe",YawAxe ); + iniFile.setValue ( "XAxe", XAxe ); + iniFile.setValue ( "YAxe", YAxe ); + iniFile.setValue ( "ZAxe", ZAxe ); + + iniFile.endGroup(); +} diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h new file mode 100644 index 00000000..a29fed6b --- /dev/null +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h @@ -0,0 +1,44 @@ +/* Copyright (c) 2012 Patrick Ruoff + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + */ + +#ifndef FTNOIR_TRACKER_HAT_SETTINGS_H +#define FTNOIR_TRACKER_HAT_SETTINGS_H + + +//----------------------------------------------------------------------------- +struct TrackerSettings +{ + + QString SerialPortName; + bool EnableRoll; + bool EnablePitch; + bool EnableYaw; + bool EnableX; + bool EnableY; + bool EnableZ; + + bool InvertRoll; + bool InvertPitch; + bool InvertYaw; + bool InvertX; + bool InvertY; + bool InvertZ; + + + int RollAxe; + int PitchAxe; + int YawAxe; + int XAxe; + int YAxe; + int ZAxe; + + void load_ini(); + void save_ini() const; +}; + + +#endif //FTNOIR_TRACKER_HAT_SETTINGS_H \ No newline at end of file diff --git a/ftnoir_tracker_hatire/images/hat.ico b/ftnoir_tracker_hatire/images/hat.ico new file mode 100644 index 00000000..d8f5aac4 Binary files /dev/null and b/ftnoir_tracker_hatire/images/hat.ico differ diff --git a/ftnoir_tracker_hatire/images/hat_logo.png b/ftnoir_tracker_hatire/images/hat_logo.png new file mode 100644 index 00000000..c3a92b1b Binary files /dev/null and b/ftnoir_tracker_hatire/images/hat_logo.png differ -- cgit v1.2.3 From c30602927bcd0865d7581e3fea31e65a6a73d592 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 27 Nov 2013 17:27:15 +0100 Subject: merge from FreePIE: vjoy bugfix Signed-off-by: Stanislaw Halik --- facetracknoir/clientfiles/vjoy/VJoy.dll | Bin 0 -> 94208 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 facetracknoir/clientfiles/vjoy/VJoy.dll (limited to 'facetracknoir/clientfiles') diff --git a/facetracknoir/clientfiles/vjoy/VJoy.dll b/facetracknoir/clientfiles/vjoy/VJoy.dll new file mode 100644 index 00000000..e3446675 Binary files /dev/null and b/facetracknoir/clientfiles/vjoy/VJoy.dll differ -- cgit v1.2.3 From 386f3e87423c130d149f19a6fad10b7c51a80fe2 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 29 Nov 2013 10:31:20 +0100 Subject: don't install macam, doesn't work with qtkit --- .../clientfiles/macosx/macam-cvs-build-2009-09-25.zip | Bin 3560122 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 facetracknoir/clientfiles/macosx/macam-cvs-build-2009-09-25.zip (limited to 'facetracknoir/clientfiles') diff --git a/facetracknoir/clientfiles/macosx/macam-cvs-build-2009-09-25.zip b/facetracknoir/clientfiles/macosx/macam-cvs-build-2009-09-25.zip deleted file mode 100644 index 79816779..00000000 Binary files a/facetracknoir/clientfiles/macosx/macam-cvs-build-2009-09-25.zip and /dev/null differ -- cgit v1.2.3 From c47611b99d74af449d49a1f6ebf287947162a46c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 4 Jan 2014 14:42:14 +0100 Subject: add aruco sample printout --- facetracknoir/clientfiles/aruco/test3.jpg | Bin 0 -> 2145 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 facetracknoir/clientfiles/aruco/test3.jpg (limited to 'facetracknoir/clientfiles') diff --git a/facetracknoir/clientfiles/aruco/test3.jpg b/facetracknoir/clientfiles/aruco/test3.jpg new file mode 100644 index 00000000..2ff6dbd0 Binary files /dev/null and b/facetracknoir/clientfiles/aruco/test3.jpg differ -- cgit v1.2.3 From de354eaca23e275386b3b2365cb4d4e0531377e1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 13 Jan 2014 23:41:19 +0100 Subject: remove hatire tracker hatire tracker's unmaintained, unused and has an obvious crash bug The following line: data[frame_cnt] = (long) HAT.Code; contains an arbitrary offset dereference. It's obvious now that the code has only been compile-tested. Because no one reported the issue, it's safe to assume it has no users. If it gets users and becomes actively maintained, it'll return. -sh --- CMakeLists.txt | 17 +- facetracknoir/clientfiles/HAT_100/HAT_100.ino | 389 ------- facetracknoir/clientfiles/HAT_100/README | 35 - ftnoir_tracker_hatire/ftnoir_arduino_type.h | 30 - ftnoir_tracker_hatire/ftnoir_hat.qrc | 6 - ftnoir_tracker_hatire/ftnoir_hatcontrols.ui | 1190 -------------------- ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp | 463 -------- ftnoir_tracker_hatire/ftnoir_tracker_hat.h | 87 -- .../ftnoir_tracker_hat_dialog.cpp | 277 ----- ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h | 50 - ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp | 81 -- .../ftnoir_tracker_hat_settings.h | 85 -- ftnoir_tracker_hatire/images/hat.png | Bin 376 -> 0 bytes ftnoir_tracker_hatire/images/hat_logo.png | Bin 15210 -> 0 bytes 14 files changed, 1 insertion(+), 2709 deletions(-) delete mode 100644 facetracknoir/clientfiles/HAT_100/HAT_100.ino delete mode 100644 facetracknoir/clientfiles/HAT_100/README delete mode 100644 ftnoir_tracker_hatire/ftnoir_arduino_type.h delete mode 100644 ftnoir_tracker_hatire/ftnoir_hat.qrc delete mode 100644 ftnoir_tracker_hatire/ftnoir_hatcontrols.ui delete mode 100644 ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp delete mode 100644 ftnoir_tracker_hatire/ftnoir_tracker_hat.h delete mode 100644 ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp delete mode 100644 ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h delete mode 100644 ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp delete mode 100644 ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h delete mode 100644 ftnoir_tracker_hatire/images/hat.png delete mode 100644 ftnoir_tracker_hatire/images/hat_logo.png (limited to 'facetracknoir/clientfiles') diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b29008b..40682474 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,8 +34,6 @@ if(APPLE) set(CMAKE_CXX_FLAGS " -stdlib=libc++ -std=c++11 ${CMAKE_CXX_FLAGS} -fvisibility=hidden") endif() -set(SDK_HATIRE TRUE CACHE BOOL "hatire: generic Arduino over serial port") - SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) SET(CMAKE_SKIP_INSTALL_RPATH FALSE) @@ -115,10 +113,6 @@ if(MINGW) endif() find_package(OpenCV REQUIRED) -set(maybe-serial-port) -if(SDK_HATIRE) - set(maybe-serial-port SerialPort) -endif() find_package(Qt5 REQUIRED COMPONENTS Core Xml Network Widgets Gui ${maybe-serial-port} QUIET) cmake_policy(SET CMP0020 NEW) @@ -255,7 +249,6 @@ opentrack_module(opentrack-tracker-udp ftnoir_tracker_udp) opentrack_module(opentrack-tracker-joystick ftnoir_tracker_joystick) opentrack_module(opentrack-tracker-rift ftnoir_tracker_rift) opentrack_module(opentrack-tracker-hydra ftnoir_tracker_hydra) -opentrack_module(opentrack-tracker-hatire ftnoir_tracker_hatire) file(GLOB opentrack-csv-c "ftnoir_csv/*.cpp" "ftnoir_csv/*.h") @@ -308,11 +301,7 @@ if(WIN32) set(my-qt-deps ws2_32) endif() -set(maybe-hatire) -if(SDK_HATIRE) -set(maybe-hatire ${Qt5SerialPort_LIBRARIES}) -endif() -set(MY_QT_LIBS ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Xml_LIBRARIES} ${Qt5Core_LIBRARIES} ${maybe-hatire} ${my-qt-deps}) +set(MY_QT_LIBS ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Xml_LIBRARIES} ${Qt5Core_LIBRARIES} ${my-qt-deps}) add_library(opentrack-csv SHARED ${opentrack-csv-c}) target_link_libraries(opentrack-csv ${MY_QT_LIBS}) @@ -417,10 +406,6 @@ if(SDK_ARUCO_LIBPATH) endif() endif() -if(SDK_HATIRE) - opentrack_library(opentrack-tracker-hatire) -endif() - link_with_dinput8(opentrack-tracker-ht) link_with_dinput8(opentrack-tracker-joystick) diff --git a/facetracknoir/clientfiles/HAT_100/HAT_100.ino b/facetracknoir/clientfiles/HAT_100/HAT_100.ino deleted file mode 100644 index f8644ffe..00000000 --- a/facetracknoir/clientfiles/HAT_100/HAT_100.ino +++ /dev/null @@ -1,389 +0,0 @@ -// Arduino sketch for MPU6050 on NanoWII using DMP MotionApps v4.1 -// HAT 14/04/2013 by FuraX49 -// -// Head Arduino Tracker for FaceTrackNoIR -// http://facetracknoir.sourceforge.net/home/default.htm -// I2C device class (I2Cdev) -// https://github.com/jrowberg/i2cdevlib - - -#include -#include -#include "I2Cdev.h" -#include "MPU6050_9Axis_MotionApps41.h" - - -MPU6050 mpu; - - -typedef struct { - int16_t Begin ; // 2 Debut - uint16_t Cpt ; // 2 Compteur trame or Code info or error - float gyro[3]; // 12 [Y, P, R] gyro - float acc[3]; // 12 [x, y, z] Acc - int16_t End ; // 2 Fin -} _hatire; - -typedef struct { - int16_t Begin ; // 2 Debut - uint16_t Code ; // 2 Code info - char Msg[24]; // 24 Message - int16_t End ; // 2 Fin -} _msginfo; - -typedef struct -{ - byte rate; - double gyro_offset[3] ; - double acc_offset[3] ; -} _eprom_save; - - -// MPU control/status vars -bool dmpReady = false; // set true if DMP init was successful -bool dmpLoaded = false; // set true if DMP loaded successfuly -uint8_t mpuIntStatus; // holds actual interrupt status byte from MPU -uint8_t devStatus; // return status after each device operation (0 = success, !0 = error) -uint16_t packetSize; // expected DMP packet size (default is 42 bytes) -uint16_t fifoCount; // count of all bytes currently in FIFO -uint8_t fifoBuffer[64]; // FIFO storage buffer - -char Commande; -char Version[] = "HAT V 1.00"; - -// orientation/motion vars -Quaternion q; // [w, x, y, z] quaternion container -VectorInt16 aa; // [x, y, z] accel sensor measurements -VectorFloat gravity; // [x, y, z] gravity vector - -float Rad2Deg = (180/M_PI) ; - -// trame for message -_hatire hatire; -_msginfo msginfo; -_eprom_save eprom_save; - - -bool AskCalibrate = false; // set true when calibrating is ask -int CptCal = 0; -const int NbCal = 5; - - - - -// ================================================================ -// === INTERRUPT DETECTION ROUTINE === -// ================================================================ -volatile bool mpuInterrupt = false; // indicates whether MPU interrupt pin has gone high - -void dmpDataReady() { - mpuInterrupt = true; -} - -// ================================================================ -// === PRINT SERIAL FORMATTE === -// ================================================================ -void PrintCodeSerial(uint16_t code,char Msg[24],bool EOL ) { - msginfo.Code=code; - memset(msginfo.Msg,0x00,24); - strcpy(msginfo.Msg,Msg); - if (EOL) msginfo.Msg[23]=0x0A; - // Send HATIRE message to PC - Serial.write((byte*)&msginfo,30); -} - - -// ================================================================ -// === INITIAL SETUP === -// ================================================================ - -void setup() { - // join I2C bus (I2Cdev library doesn't do this automatically) - Wire.begin(); - - // initialize serial communication - while (!Serial); // wait for Leonardo enumeration, others continue immediately - - Serial.begin(115200); - PrintCodeSerial(2000,Version,true); - - hatire.Begin=0xAAAA; - hatire.Cpt=0; - hatire.End=0x5555; - - msginfo.Begin=0xAAAA; - msginfo.Code=0; - msginfo.End=0x5555; - - // initialize device - PrintCodeSerial(3001,"Initializing I2C",true); - mpu.initialize(); - - // verify connection - PrintCodeSerial(3002,"Testing connections",true); - - if (mpu.testConnection()){ - PrintCodeSerial(3003,"MPU6050 connection OK",true); - } else { - PrintCodeSerial(9007,"MPU6050 ERRROR CNX",true); - } - - while (Serial.available() && Serial.read()); // empty buffer - - // load and configure the DMP - PrintCodeSerial(3004,"Initializing DMP...",true); - devStatus = mpu.dmpInitialize(); - - // make sure it worked (returns 0 if so) - if (devStatus == 0) { - dmpLoaded=true; - - // Read Epprom saved params - PrintCodeSerial(3005,"Reading saved params...",true); - ReadParams(); - - // turn on the DMP, now that it's ready - PrintCodeSerial(3006,"Enabling DMP...",true); - mpu.setDMPEnabled(true); - - // enable Arduino interrupt detection - PrintCodeSerial(3007,"Enabling interrupt",true); - attachInterrupt(0, dmpDataReady, RISING); - mpuIntStatus = mpu.getIntStatus(); - - // set our DMP Ready flag so the main loop() function knows it's okay to use it - PrintCodeSerial(5000,"HAT BEGIN",true); - dmpReady = true; - // get expected DMP packet size for later comparison - packetSize = mpu.dmpGetFIFOPacketSize(); - // Empty FIFO - fifoCount = mpu.getFIFOCount(); - while (fifoCount > packetSize) { - fifoCount = mpu.getFIFOCount(); - mpu.getFIFOBytes(fifoBuffer, fifoCount); - } - } - else { - // ERROR! - // 1 = initial memory load failed - // 2 = DMP configuration updates failed - // (if it's going to break, usually the code will be 1) - dmpLoaded=false; - PrintCodeSerial(9000+devStatus,"DMP Initialization failed",true); - } -} - - -// ================================================================ -// === RAZ OFFSET === -// ================================================================ -void razoffset() { - eprom_save.gyro_offset[0] = 0; - eprom_save.gyro_offset[1] = 0; - eprom_save.gyro_offset[2] = 0; - eprom_save.acc_offset[0] = 0; - eprom_save.acc_offset[1] = 0; - eprom_save.acc_offset[2] = 0; -} - - -// ================================================================ -// === SAVE PARAMS === -// ================================================================ -void SaveParams() { - eeprom_write_block((const void*)&eprom_save, (void*) 0, sizeof(eprom_save)); -} - - - -// ================================================================ -// === READ PARAMS === -// ================================================================ -void ReadParams() { - eeprom_read_block( (void*)&eprom_save, (void*) 0, sizeof(eprom_save)); -} - - -// ================================================================ -// === Serial Command === -// ================================================================ -void serialEvent(){ - Commande = (char)Serial.read(); - switch (Commande) { - case 'S': - PrintCodeSerial(5001,"HAT START",true); - if (dmpLoaded==true) { - mpu.resetFIFO(); - hatire.Cpt=0; - attachInterrupt(0, dmpDataReady, RISING); - mpu.setDMPEnabled(true); - dmpReady = true; - } - else { - PrintCodeSerial(9011,"Error DMP not loaded",true); - } - break; - - case 's': - PrintCodeSerial(5002,"HAT STOP",true); - if (dmpReady==true) { - mpu.setDMPEnabled(false); - detachInterrupt(0); - dmpReady = false; - } - break; - - case 'R': - PrintCodeSerial(5003,"HAT RESET",true); - if (dmpLoaded==true) { - mpu.setDMPEnabled(false); - detachInterrupt(0); - mpu.resetFIFO(); - hatire.Cpt=0; - dmpReady = false; - setup(); - } - else { - PrintCodeSerial(9011,"Error DMP not loaded",true); - } - break; - - - case 'C': - CptCal=0; - razoffset(); - AskCalibrate=true; - break; - - case 'V': - PrintCodeSerial(2000,Version,true); - break; - - case 'I': - Serial.println(); - Serial.print("Version : \t"); - Serial.println(Version); - Serial.println("Gyroscopes offsets"); - for (int i=0; i <= 2; i++) { - Serial.print(i); - Serial.print(" : "); - Serial.print(eprom_save.gyro_offset[i]); - Serial.println(); - } - Serial.println("Accelerometers offsets"); - for (int i=0; i <= 2; i++) { - Serial.print(i); - Serial.print(" : "); - Serial.print(eprom_save.acc_offset[i]); - Serial.println(); - } - break; - - - default: - break; - } -} - - -// ================================================================ -// === MAIN PROGRAM LOOP === -// ================================================================ -void loop() { - // Leonardo BUG (simul Serial Event) - if(Serial.available() > 0) serialEvent(); - - - // if programming failed, don't try to do anything - if (dmpReady) { - - - while (!mpuInterrupt && fifoCount < packetSize) ; - - // reset interrupt flag and get INT_STATUS byte - mpuInterrupt = false; - mpuIntStatus = mpu.getIntStatus(); - - // get current FIFO count - fifoCount = mpu.getFIFOCount(); - - // check for overflow (this should never happen unless our code is too inefficient) - if ((mpuIntStatus & 0x10) || fifoCount == 1024) { - // reset so we can continue cleanly - mpu.resetFIFO(); - PrintCodeSerial(9010,"Overflow FIFO DMP",true); - hatire.Cpt=0; - - // otherwise, check for DMP data ready interrupt (this should happen frequently) - } - else if (mpuIntStatus & 0x02) { - // wait for correct available data length, should be a VERY short wait - while (fifoCount < packetSize) fifoCount = mpu.getFIFOCount(); - - // read a packet from FIFO - mpu.getFIFOBytes(fifoBuffer, packetSize); - - // track FIFO count here in case there is > 1 packet available - // (this lets us immediately read more without waiting for an interrupt) - fifoCount -= packetSize; - - // Get Euler angles in degrees - mpu.dmpGetQuaternion(&q, fifoBuffer); - mpu.dmpGetGravity(&gravity, &q); - mpu.dmpGetYawPitchRoll(hatire.gyro, &q, &gravity); - - // Get real acceleration, adjusted to remove gravity - // not used in this script - // mpu.dmpGetAccel(&aa, fifoBuffer); - // mpu.dmpGetLinearAccel(&hatire.acc, &aa, &gravity); - - // Calibration sur X mesures - if (AskCalibrate) { - if ( CptCal>=NbCal) { - CptCal=0; - eprom_save.gyro_offset[0] = eprom_save.gyro_offset[0] / NbCal ; - eprom_save.gyro_offset[1] = eprom_save.gyro_offset[1] / NbCal ; - eprom_save.gyro_offset[2] = eprom_save.gyro_offset[2] / NbCal ; - AskCalibrate=false; - SaveParams(); - } - else { - eprom_save.gyro_offset[0] += (float) hatire.gyro[0]; - eprom_save.gyro_offset[1] += (float) hatire.gyro[1]; - eprom_save.gyro_offset[2] += (float) hatire.gyro[2]; - - CptCal++; - } - } - - - // Conversion angles Euler en +-180 Degr�es - for (int i=0; i <= 2; i++) { - hatire.gyro[i]= (hatire.gyro[i] - eprom_save.gyro_offset[i] ) * Rad2Deg; - if (hatire.gyro[i]>180) { - hatire.gyro[i] = hatire.gyro[i] - 360; - } - } - - if (AskCalibrate) { - hatire.gyro[0] = 0; - hatire.gyro[1] = 0; - hatire.gyro[2] = 0; - hatire.acc[0]= 0; - hatire.acc[1] = 0; - hatire.acc[2] = 0; - } - - // Send Trame to HATIRE PC - Serial.write((byte*)&hatire,30); - - hatire.Cpt++; - if (hatire.Cpt>999) { - hatire.Cpt=0; - } - } - } - delay(1); -} - - diff --git a/facetracknoir/clientfiles/HAT_100/README b/facetracknoir/clientfiles/HAT_100/README deleted file mode 100644 index 1e4f2926..00000000 --- a/facetracknoir/clientfiles/HAT_100/README +++ /dev/null @@ -1,35 +0,0 @@ - Frame exchange protocol fixed size of 30 bytes like this : - - typedef struct { - int16_t Begin ; // 2 Debut - uint16_t Cpt ; // 2 Compteur trame or Code - float gyro[3]; // 12 [Y, P, R] gyro - float acc[3]; // 12 [x, y, z] Acc - int16_t End ; // 2 Fin -} _hatire; -_hat hat; - - -void setup() { - Serial.begin(115200); - // header frame - hatire.Begin=0xAAAA; - // Frame Number or Error code - hat.Cpt=0; - // footer frame - hat.End=0x5555; -} - - - void loop() { - mpu.dmpGetYawPitchRoll(hatire.gyro); - mpu.dmpAccXYZ(hatire.acc); - // Send Trame to HATIRE PC - Serial.write((byte*)&hatire,30); - hatire.Cpt++; - if (hatire.Cpt>999) { - hatire.Cpt=0; - } - delay(1); -} - diff --git a/ftnoir_tracker_hatire/ftnoir_arduino_type.h b/ftnoir_tracker_hatire/ftnoir_arduino_type.h deleted file mode 100644 index bd5c4246..00000000 --- a/ftnoir_tracker_hatire/ftnoir_arduino_type.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef FTNOIR_TARDUINO_TYPE_H -#define FTNOIR_TARDUINO_TYPE_H - -// Arduino trame structure -#pragma pack(push,2) -struct TArduinoData -{ - quint16 Begin; // Header trame 0xAAAA; - quint16 Code; // 0->999 Num Trame >=2000 Info >=3000 Init >=5000 Start Command >=9000 Error - float Rot[3]; - float Trans[3]; - quint16 End; // End trame 0x5555; -} ; -#pragma pack(pop) - - -inline QDataStream & operator >> ( QDataStream& in, TArduinoData& out ) -{ - in.setFloatingPointPrecision(QDataStream::SinglePrecision ); - - in >> out.Begin >> out.Code - >> out.Rot[0] >> out.Rot[1] >> out.Rot[2] - >> out.Trans[0] >> out.Trans[1] >> out.Trans[2] - >> out.End; - return in; -} - - - -#endif diff --git a/ftnoir_tracker_hatire/ftnoir_hat.qrc b/ftnoir_tracker_hatire/ftnoir_hat.qrc deleted file mode 100644 index ad67b862..00000000 --- a/ftnoir_tracker_hatire/ftnoir_hat.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - images/hat_logo.png - images/hat.png - - diff --git a/ftnoir_tracker_hatire/ftnoir_hatcontrols.ui b/ftnoir_tracker_hatire/ftnoir_hatcontrols.ui deleted file mode 100644 index 8a6bae62..00000000 --- a/ftnoir_tracker_hatire/ftnoir_hatcontrols.ui +++ /dev/null @@ -1,1190 +0,0 @@ - - - UIHATControls - - - - 0 - 0 - 307 - 567 - - - - - 0 - 0 - - - - - 65536 - 65536 - - - - Qt::NoContextMenu - - - Head Arduino Tracker settings FaceTrackNoIR - - - - :/images/hat.ico:/images/hat.ico - - - 1.000000000000000 - - - Qt::LeftToRight - - - false - - - - - - - 0 - 0 - - - - - 80 - 25 - - - - - 80 - 25 - - - - Cancel - - - - - - - - 0 - 0 - - - - - 80 - 25 - - - - - 80 - 25 - - - - OK - - - - - - - - 0 - 0 - - - - - 65535 - 65535 - - - - 0 - - - - General - - - - - - - - - true - - - - 4 - - - - - - 0 - 0 - - - - - 65535 - 16777215 - - - - false - - - QComboBox::AdjustToMinimumContentsLength - - - 0 - - - - - - - - 0 - 0 - - - - - 65536 - 16777215 - - - - Serial port - - - - - - - - - - - 80 - 20 - - - - Zero - - - - - - - - 80 - 20 - - - - Center - - - - - - - - 80 - 20 - - - - Reset - - - - - - - - 0 - 106 - - - - Axis Configuration - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - Associate Axis - - - - RotX - - - - - RotY - - - - - RotZ - - - - - - - - - 20 - 16777215 - - - - Enable Axis - - - Qt::LeftToRight - - - - - - - - - - - 20 - 16777215 - - - - Enable Axis - - - Qt::LeftToRight - - - - - - - - - - Pitch: - - - - - - - Enable - - - - - - - - 20 - 16777215 - - - - Enable Axis - - - Qt::LeftToRight - - - - - - - - - - Yaw: - - - - - - - Invert - - - - - - - Y: - - - - - - - - 20 - 16777215 - - - - Invert Axis - - - Qt::LeftToRight - - - - - - - - - - - - - X: - - - - - - - - 20 - 16777215 - - - - Invert Axis - - - Qt::LeftToRight - - - - - - - - - - - - - - 20 - 16777215 - - - - Invert Axis - - - Qt::LeftToRight - - - - - - - - - - - - - Associate Axis - - - - X - - - - - Y - - - - - Z - - - - - - - - - 20 - 16777215 - - - - Enable Axis - - - Qt::LeftToRight - - - - - - - - - - Associate Axis - - - - X - - - - - Y - - - - - Z - - - - - - - - Roll: - - - - - - - - 20 - 16777215 - - - - Invert Axis - - - Qt::LeftToRight - - - - - - - - - - - - - Associate Axis - - - - X - - - - - Y - - - - - Z - - - - - - - - - 20 - 16777215 - - - - Invert Axis - - - Qt::LeftToRight - - - - - - - - - - - - - Z: - - - - - - - Associate Axis - - - - RotX - - - - - RotY - - - - - RotZ - - - - - - - - - 20 - 16777215 - - - - Enable Axis - - - Qt::LeftToRight - - - - - - - - - - - - - - 20 - 16777215 - - - - Enable Axis - - - Qt::LeftToRight - - - - - - - - - - - 20 - 16777215 - - - - Invert Axis - - - Qt::LeftToRight - - - - - - - - - - - - - Associate Axis - - - - RotX - - - - - RotY - - - - - RotZ - - - - - - - - Axis - - - - - - - - - - - 0 - 0 - - - - Status - - - false - - - - - - - 31 - 20 - - - - - 60 - 20 - - - - Trame per seconde - - - tps : - - - - - - - - 31 - 20 - - - - - 60 - 20 - - - - 00 - - - - - - - - 0 - 20 - - - - - 60 - 20 - - - - Info : - - - - - - - - 170 - 20 - - - - - 60 - 20 - - - - 00 - - - - - - - - - - - Command - - - - - - Serial Parameters - - - - - - Data bits: - - - - - - - - - - BaudRate: - - - - - - - - - - - - - Flow control: - - - - - - - - - - Parity: - - - - - - - - - - Stop bits: - - - - - - - - - - Arduino Commands - - - - - - Delay Init - - - - - - - Init - - - - - - - Command for Initialising Arduino - - - - - - - Delay Start - - - - - - - Start: - - - - - - - Command for Start send sequence - - - - - - - Delay Sequence - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Delay after Start Command in ms</span></p></body></html> - - - 5000 - - - 50 - - - - - - - Stop: - - - - - - - Command for Stop send sequence - - - - - - - Center: - - - - - - - Command for Center Gyro arduino - - - - - - - Zero: - - - - - - - Command for Center Gyro arduino - - - - - - - Reset: - - - - - - - Command for Reset Arduino - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Little or Big Endian for <span style=" font-family:'Arial,Geneva,Helvetica,sans-serif'; font-size:medium; color:#000000;">the serialization of byte order</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial,Geneva,Helvetica,sans-serif'; font-size:medium; color:#000000;">Arduino is LittleEndian ( unchecked)</span></p></body></html> - - - Endian - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Delay after Init command in ms</span></p></body></html> - - - 5000 - - - 50 - - - - - - - - 60 - 16777215 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Delay before Init command in ms</span></p></body></html> - - - 5000 - - - 50 - - - - - - - - - - - About - - - - - - - Arial Black - 10 - 75 - true - true - - - - Version 1.0.0 - - - Qt::PlainText - - - true - - - - - - - - - - Send - - - - - - - Qt::ActionsContextMenu - - - true - - - - - - Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - 800 - - - false - - - - - - - false - - - - - - - :/images/hat_logo.png - - - - - 128 - 128 - - - - true - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; font-weight:600;">FTNoIR HAT Plugin<br />by FuraX49</span></p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://hatire.sourceforge.net/"><span style=" font-size:8pt; font-weight:600; text-decoration: underline; color:#0000ff;">Manual (external)</span></a></p></body></html> - - - true - - - - - - - - - - - - 80 - 25 - - - - - 80 - 25 - - - - Save - - - - - - - btnOK - btnSave - btnCancel - chkEnableYaw - cb_yaw - chkInvertYaw - chkEnablePitch - cb_pitch - chkInvertPitch - chkEnableRoll - cb_roll - chkInvertRoll - chkEnableX - cb_x - chkInvertX - chkEnableY - cb_y - chkInvertY - chkEnableZ - cb_z - chkInvertZ - QCB_Serial_baudRate - QCB_Serial_dataBits - QCB_Serial_parity - QCB_Serial_stopBits - QCB_Serial_flowControl - lineSend - btnSend - pteINFO - tabWidget - - - - - startEngineClicked() - stopEngineClicked() - cameraSettingsClicked() - - diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp deleted file mode 100644 index 6fef2db0..00000000 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp +++ /dev/null @@ -1,463 +0,0 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * -* * -* Copyright (C) 2012 FuraX49 (HAT Tracker plugins) * -* Homepage: http://hatire.sourceforge.net * -* * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see . * -* * -********************************************************************************/ - -#include "ftnoir_tracker_hat.h" - -FTNoIR_Tracker::FTNoIR_Tracker() -{ - ComPort = NULL; - - HAT.Rot[0]=0; - HAT.Rot[1]=0; - HAT.Rot[2]=0; - HAT.Trans[0]=0; - HAT.Trans[1]=0; - HAT.Trans[2]=0; - - // prepare & reserve QByteArray - dataRead.resize(4096); - dataRead.clear(); - Begin.append((char) 0xAA); - Begin.append((char) 0xAA); - End.append((char) 0x55); - End.append((char) 0x55); -} - -FTNoIR_Tracker::~FTNoIR_Tracker() -{ - if (ComPort!=NULL) { - if (ComPort->isOpen() ) { - ComPort->close(); - } - delete ComPort; - ComPort=NULL; - } -} - -//send CENTER to Arduino -void FTNoIR_Tracker::notifyCenter() { - sendcmd(static_cast(settings.CmdCenter).toLatin1()); -} - -//send ZERO to Arduino -bool FTNoIR_Tracker::notifyZeroed() { - sendcmd(static_cast(settings.CmdZero).toLatin1()); - return true; -} - -//send RESET to Arduino -void FTNoIR_Tracker::reset() { - sendcmd(static_cast(settings.CmdReset).toLatin1()); -} - - -// Info SerialPort -void FTNoIR_Tracker::SerialInfo() { - QByteArray Msg; - if (ComPort!=NULL) { - if (ComPort->isOpen() ) { - Msg.append("\r\n"); - Msg.append(ComPort->portName()); - Msg.append("\r\n"); - Msg.append("BAUDRATE :"); - Msg.append(QString::number(ComPort->baudRate())); - Msg.append("\r\n"); - Msg.append("DataBits :"); - Msg.append(QString::number(ComPort->dataBits())); - Msg.append("\r\n"); - Msg.append("Parity :"); - switch (ComPort->parity()) { - case 0: Msg.append("No parity"); - break; - case 2: Msg.append("Even parity"); - break; - case 3: Msg.append("Odd parity"); - break; - case 4: Msg.append("Space parity"); - break; - case 5: Msg.append("Mark parity"); - break; - default: Msg.append("Unknown parity"); - break; - } - Msg.append("\r\n"); - Msg.append("Stop Bits :"); - switch (ComPort->stopBits()) { - Msg.append(QString::number(ComPort->stopBits())); - case 1: Msg.append("1 stop bit."); - break; - case 2: Msg.append("2 stop bits."); - break; - case 3: Msg.append("1.5 stop bits."); - break; - default: Msg.append("Unknown number of stop bit."); - break; - } - Msg.append("\r\n"); - Msg.append("Flow Control :"); - switch (ComPort->flowControl()) { - case 0: Msg.append("No flow control"); - break; - case 1: Msg.append("Hardware flow control (RTS/CTS)"); - break; - case 2: Msg.append("Software flow control (XON/XOFF)"); - break; - default: Msg.append("Unknown flow control"); - break; - } - emit sendMsgInfo(Msg); - - } - } -} - - -//send command to Arduino -void FTNoIR_Tracker::sendcmd(const QByteArray &cmd) { - QByteArray Msg; - if (cmd.length()>0) { - if (ComPort->isOpen() ) - { - ComPort->write(cmd); - if (!ComPort->waitForBytesWritten(1000)) { - emit sendMsgInfo("TimeOut in writing CMD"); - } else { - Msg.append("\r\n"); - Msg.append("SEND '"); - Msg.append(cmd); - Msg.append("'\r\n"); - } - if ( !ComPort->waitForReadyRead(1000)) { - emit sendMsgInfo("TimeOut in response to CMD") ; - } else { - emit sendMsgInfo(Msg); - } - } else { - emit sendMsgInfo("ComPort not open") ; - } - } -} - - -// return FPS -void FTNoIR_Tracker::get_info( int *tps ){ - *tps=frame_cnt; - frame_cnt=0; -} - -void FTNoIR_Tracker::SerialRead() -{ - QMutexLocker lck(&mutex); - dataRead+=ComPort->readAll(); -} - -#ifndef OPENTRACK_API -void FTNoIR_Tracker::Initialize( QFrame *videoframe ) -{ - CptError=0; - dataRead.clear(); - frame_cnt=0; - - settings.load_ini(); - applysettings(settings); - ComPort = new QSerialPort(this); - ComPort->setPortName(sSerialPortName); - if (ComPort->open(QIODevice::ReadWrite ) == true) { - connect(ComPort, SIGNAL(readyRead()), this, SLOT(SerialRead())); - if ( - ComPort->setBaudRate((QSerialPort::BaudRate)iBaudRate) - && ComPort->setDataBits((QSerialPort::DataBits)iDataBits) - && ComPort->setParity((QSerialPort::Parity)iParity) - && ComPort->setStopBits((QSerialPort::StopBits)iStopBits) - && ComPort->setFlowControl((QSerialPort::FlowControl)iFlowControl) - && ComPort->clear(QSerialPort::AllDirections) - && ComPort->setDataErrorPolicy(QSerialPort::IgnorePolicy) - ) { - // Wait init arduino sequence - for (int i = 1; i <=iDelayInit; i+=50) { - if (ComPort->waitForReadyRead(50)) break; - } - sendcmd(sCmdInit); - // Wait init MPU sequence - for (int i = 1; i <=iDelayStart; i+=50) { - if (ComPort->waitForReadyRead(50)) break; - } - - } else { - QMessageBox::warning(0,"FaceTrackNoIR Error", ComPort->errorString(),QMessageBox::Ok,QMessageBox::NoButton); - } - } - else { - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to open ComPort",QMessageBox::Ok,QMessageBox::NoButton); - delete ComPort; - ComPort = NULL; - } - return; -} - - - -void FTNoIR_Tracker::StartTracker(HWND parent_window) -{ - // Send START cmd to IMU - sendcmd(sCmdStart); - // Wait start MPU sequence - for (int i = 1; i <=iDelaySeq; i+=50) { - if (ComPort->waitForReadyRead(50)) break; - } - return; -} - - -void FTNoIR_Tracker::StopTracker( bool exit ) -{ - QByteArray Msg; - if (sCmdStop.length()>0) { - if (ComPort->isOpen() ) - { - ComPort->write(sCmdStop); - if (!ComPort->waitForBytesWritten(1000)) { - emit sendMsgInfo("TimeOut in writing CMD"); - } else { - Msg.append("\r\n"); - Msg.append("SEND '"); - Msg.append(sCmdStop); - Msg.append("'\r\n"); - } - emit sendMsgInfo(Msg); - } - } - // OK, the thread is not stopped, doing this. That might be dangerous anyway... - // - if (exit || !exit) return; - return; -} - -#else -void FTNoIR_Tracker::StartTracker(QFrame*) -{ - static const int databits_lookup[] = { - QSerialPort::Data5, - QSerialPort::Data6, - QSerialPort::Data7, - QSerialPort::Data8, - QSerialPort::UnknownDataBits - }; - - struct Local { - static int idx(int max, int value) - { - if (value < 0) - return 0; - if (max > value) - return value; - return max - 1; - } - }; - - static const int parity_lookup[] = { - QSerialPort::NoParity, - QSerialPort::EvenParity, - QSerialPort::OddParity, - QSerialPort::SpaceParity, - QSerialPort::MarkParity, - QSerialPort::UnknownParity - }; - - static const int stopbits_lookup[] = { - QSerialPort::OneStop, - QSerialPort::OneAndHalfStop, - QSerialPort::TwoStop, - QSerialPort::UnknownStopBits - }; - - static const int flowctl_lookup[] = { - QSerialPort::NoFlowControl, - QSerialPort::HardwareControl, - QSerialPort::SoftwareControl, - }; - - static const int baudrate_lookup[] = { - QSerialPort::Baud1200, - QSerialPort::Baud2400, - QSerialPort::Baud4800, - QSerialPort::Baud9600, - QSerialPort::Baud19200, - QSerialPort::Baud38400, - QSerialPort::Baud57600, - QSerialPort::Baud115200, - QSerialPort::UnknownBaud - }; - - CptError=0; - dataRead.clear(); - frame_cnt=0; - ComPort = new QSerialPort(this); - { - ComPort->setPortName(QSerialPortInfo::availablePorts().value(settings.SerialPortName).portName()); - } - if (ComPort->open(QIODevice::ReadWrite ) == true) { - connect(ComPort, SIGNAL(readyRead()), this, SLOT(SerialRead())); - if ( - ComPort->setBaudRate(baudrate_lookup[Local::idx(8, settings.pBaudRate)]) - && ComPort->setDataBits((QSerialPort::DataBits)databits_lookup[Local::idx(4, settings.pDataBits)]) - && ComPort->setParity((QSerialPort::Parity)parity_lookup[Local::idx(5, settings.pParity)]) - && ComPort->setStopBits((QSerialPort::StopBits)stopbits_lookup[Local::idx(3, settings.pStopBits)]) - && ComPort->setFlowControl((QSerialPort::FlowControl)flowctl_lookup[Local::idx(3, settings.pFlowControl)]) - && ComPort->clear(QSerialPort::AllDirections) - && ComPort->setDataErrorPolicy(QSerialPort::IgnorePolicy) - ){ - // Wait init arduino sequence - for (int i = 1; i <=settings.DelayInit; i+=50) { - if (ComPort->waitForReadyRead(50)) break; - } - sendcmd(static_cast(settings.CmdInit).toLatin1()); - // Wait init MPU sequence - for (int i = 1; i <=settings.DelayStart; i+=50) { - if (ComPort->waitForReadyRead(50)) break; - } - // Send START cmd to IMU - sendcmd(static_cast(settings.CmdStart).toLatin1()); - - // Wait start MPU sequence - for (int i = 1; i <=settings.DelaySeq; i+=50) { - if (ComPort->waitForReadyRead(50)) break; - } - } else { - QMessageBox::warning(0,"FaceTrackNoIR Error", ComPort->errorString(),QMessageBox::Ok,QMessageBox::NoButton); - } - } - else { - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to open ComPort",QMessageBox::Ok,QMessageBox::NoButton); - delete ComPort; - ComPort = NULL; - } - return; - -} -#endif - - -// -// Return 6DOF info -// -#ifdef OPENTRACK_API -#define THeadPoseData double -#endif - -void FTNoIR_Tracker::GetHeadPoseData(THeadPoseData *data) -{ - QMutexLocker lck(&mutex); - while (dataRead.length()>=30) { - if ((dataRead.startsWith(Begin) && ( dataRead.mid(28,2)==End )) ) { // .Begin==0xAAAA .End==0x5555 - QDataStream datastream(dataRead.left(30)); - if (settings.BigEndian) datastream.setByteOrder(QDataStream::BigEndian ); - else datastream.setByteOrder(QDataStream::LittleEndian ); - datastream>>ArduinoData; - frame_cnt++; - if (ArduinoData.Code <= 1000) { - HAT=ArduinoData; - } else { - emit sendMsgInfo(dataRead.mid(4,24)) ; - } - dataRead.remove(0,30); - } else { - // resynchro trame - int index = dataRead.indexOf(Begin); - if (index==-1) { - index=dataRead.length(); - } - emit sendMsgInfo(dataRead.mid(0,index)) ; - dataRead.remove(0,index); - CptError++; - } - } - - if (CptError>50) { - emit sendMsgInfo("Can't find HAT frame") ; - CptError=0; - return; - } - data[frame_cnt] = (long) HAT.Code; - - struct Fun { - static int clamp3(int foo) - { - if (foo > 2) - return 2; - if (foo < 0) - return 0; - return foo; - } - }; - - if (settings.EnableYaw) { - if (settings.InvertYaw) data[Yaw] = (double) HAT.Rot[Fun::clamp3(settings.YawAxe)] * -1.0f; - else data[Yaw] = (double) HAT.Rot[Fun::clamp3(settings.YawAxe)]; - } - - if (settings.EnablePitch) { - if (settings.InvertPitch) data[Pitch] = (double) HAT.Rot[Fun::clamp3(settings.PitchAxe)] * -1.0f; - else data[Pitch] = (double) HAT.Rot[Fun::clamp3(settings.InvertPitch)]; - } - - if (settings.EnableRoll) { - if (settings.InvertRoll) data[Roll] = (double) HAT.Rot[Fun::clamp3(settings.RollAxe)] * -1.0f; - else data[Roll] = (double) HAT.Rot[Fun::clamp3(settings.RollAxe)]; - } - - if (settings.EnableX) { - if (settings.InvertX) data[TX] =(double) HAT.Trans[Fun::clamp3(settings.XAxe)]* -1.0f; - else data[TX] = HAT.Trans[Fun::clamp3(settings.XAxe)]; - } - - if (settings.EnableY) { - if (settings.InvertY) data[TY] =(double) HAT.Trans[Fun::clamp3(settings.YAxe)]* -1.0f; - else data[TY] = HAT.Trans[Fun::clamp3(settings.YAxe)]; - } - - if (settings.EnableZ) { - if (settings.InvertZ) data[TZ] = HAT.Trans[Fun::clamp3(settings.ZAxe)]* -1.0f; - else data[TZ] = HAT.Trans[Fun::clamp3(settings.ZAxe)]; - } -} - -void FTNoIR_Tracker::applysettings(const TrackerSettings& settings){ - QMutexLocker lck(&mutex); - settings.b->reload(); -} - -#ifdef OPENTRACK_API -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() -#else -#pragma comment(linker, "/export:GetTracker=_GetTracker@0") -FTNOIR_TRACKER_BASE_EXPORT ITrackerPtr __stdcall GetTracker() -#endif -{ - return new FTNoIR_Tracker; -} diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h deleted file mode 100644 index 0dbc4c8c..00000000 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef FTNOIR_TRACKER_HAT_H -#define FTNOIR_TRACKER_HAT_H - -#ifdef OPENTRACK_API -# include "ftnoir_tracker_base/ftnoir_tracker_base.h" -# include "facetracknoir/global-settings.h" -#endif -#include "ftnoir_tracker_hat_settings.h" -#include "ftnoir_arduino_type.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define VER_FILEVERSION_STR "Version 2.0.7\0" - -class FTNoIR_Tracker : public QObject, public ITracker -{ - Q_OBJECT -public: - FTNoIR_Tracker(); - ~FTNoIR_Tracker(); - - virtual void StartTracker(QFrame*); - virtual void GetHeadPoseData(double* data); - void applysettings(const TrackerSettings& settings); - void notifyCenter(); - bool notifyZeroed(); - void reset(); - void SerialInfo(); - void sendcmd(const QByteArray &cmd); - void get_info( int *tps ); - -private Q_SLOTS: - void SerialRead(); - -signals: - void sendMsgInfo(const QByteArray &MsgInfo); - - -private: - QSerialPort *ComPort; - TArduinoData ArduinoData, HAT ; // Trame from Arduino - QByteArray dataRead; - QByteArray dataToSend; - QByteArray Begin; - QByteArray End; - QMutex mutex; - int frame_cnt; - - TrackerSettings settings; - int CptError; -}; - - -//******************************************************************************************************* -// FaceTrackNoIR Tracker DLL. Functions used to get general info on the Tracker -//******************************************************************************************************* -class TrackerDll : -#if defined(OPENTRACK_API) - public Metadata -#else - public ITrackerDll -#endif -{ -public: - TrackerDll(); - ~TrackerDll(); - - void getFullName(QString *strToBeFilled); - void getShortName(QString *strToBeFilled); - void getDescription(QString *strToBeFilled); - void getIcon(QIcon *icon); - -private: - QString trackerFullName; // Trackers' name and description - QString trackerShortName; - QString trackerDescription; -}; - - -#endif // FTNOIR_TRACKER_HAT_H diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp deleted file mode 100644 index 83548966..00000000 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp +++ /dev/null @@ -1,277 +0,0 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * -* * -* Copyright (C) 2012 FuraX49 (HAT Tracker plugins) * -* Homepage: http://hatire.sourceforge.net * -* * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see . * -* * -********************************************************************************/ -#include "ftnoir_tracker_hat.h" -#include "ftnoir_tracker_hat_dialog.h" - -#include - -//******************************************************************************************************* -// FaceTrackNoIR Client Settings-dialog. -//******************************************************************************************************* - -// -// Constructor for server-settings-dialog -// -TrackerControls::TrackerControls() : theTracker(NULL), timer(this) -{ - - ui.setupUi( this ); - - ui.label_version->setText(VER_FILEVERSION_STR); - - // make SerialPort list - ui.cbSerialPort->clear(); - foreach (QSerialPortInfo PortInfo , QSerialPortInfo::availablePorts() ) { - ui.cbSerialPort->addItem(PortInfo.portName()); - } - - // Stop if no SerialPort dispo - if (ui.cbSerialPort->count()<1) { - QMessageBox::critical(this,"FaceTrackNoIR Error", "No SerialPort avaible"); - } else { - ui.cbSerialPort->setCurrentIndex(settings.SerialPortName); - } - // Serial config - ui.QCB_Serial_baudRate->clear(); - ui.QCB_Serial_baudRate->addItem(QLatin1String("9600"),QSerialPort::Baud9600); - ui.QCB_Serial_baudRate->addItem(QLatin1String("19200"),QSerialPort::Baud19200); - ui.QCB_Serial_baudRate->addItem(QLatin1String("38400"),QSerialPort::Baud38400); - ui.QCB_Serial_baudRate->addItem(QLatin1String("57600"),QSerialPort:: Baud57600); - ui.QCB_Serial_baudRate->addItem(QLatin1String("115200"),QSerialPort::Baud115200); - - ui.QCB_Serial_dataBits->clear(); - ui.QCB_Serial_dataBits->addItem(QLatin1String("5"), QSerialPort::Data5); - ui.QCB_Serial_dataBits->addItem(QLatin1String("6"), QSerialPort::Data6); - ui.QCB_Serial_dataBits->addItem(QLatin1String("7"), QSerialPort::Data7); - ui.QCB_Serial_dataBits->addItem(QLatin1String("8"), QSerialPort::Data8); - - ui.QCB_Serial_parity->clear(); - ui.QCB_Serial_parity->addItem(QLatin1String("None"), QSerialPort::NoParity); - ui.QCB_Serial_parity->addItem(QLatin1String("Even"), QSerialPort::EvenParity); - ui.QCB_Serial_parity->addItem(QLatin1String("Odd"), QSerialPort::OddParity); - ui.QCB_Serial_parity->addItem(QLatin1String("Space"), QSerialPort::SpaceParity); - ui.QCB_Serial_parity->addItem(QLatin1String("Mark"), QSerialPort::MarkParity); - - ui.QCB_Serial_stopBits->clear(); - ui.QCB_Serial_stopBits->addItem(QLatin1String("1")); - ui.QCB_Serial_stopBits->addItem(QLatin1String("1.5")); - ui.QCB_Serial_stopBits->addItem(QLatin1String("2")); - - - ui.QCB_Serial_flowControl->clear(); - ui.QCB_Serial_flowControl->addItem(QLatin1String("None")); - ui.QCB_Serial_flowControl->addItem(QLatin1String("RTS/CTS")); - ui.QCB_Serial_flowControl->addItem(QLatin1String("XON/XOFF")); - - tie_setting(settings.EnableRoll, ui.chkEnableRoll); - tie_setting(settings.EnablePitch, ui.chkEnablePitch); - tie_setting(settings.EnableYaw, ui.chkEnableYaw); - tie_setting(settings.EnableX, ui.chkEnableX); - tie_setting(settings.EnableY, ui.chkEnableY); - tie_setting(settings.EnableZ, ui.chkEnableZ); - - tie_setting(settings.InvertRoll, ui.chkInvertRoll); - tie_setting(settings.InvertPitch, ui.chkInvertPitch); - tie_setting(settings.InvertYaw, ui.chkInvertYaw); - tie_setting(settings.InvertX, ui.chkInvertX); - tie_setting(settings.InvertY, ui.chkInvertY); - tie_setting(settings.InvertZ, ui.chkInvertZ); - - tie_setting(settings.RollAxe, ui.cb_roll); - tie_setting(settings.RollAxe, ui.cb_roll); - tie_setting(settings.RollAxe, ui.cb_roll); - - tie_setting(settings.XAxe, ui.cb_x); - tie_setting(settings.YAxe, ui.cb_y); - tie_setting(settings.ZAxe, ui.cb_z); - - tie_setting(settings.CmdStart, ui.le_cmd_start); - tie_setting(settings.CmdStop, ui.le_cmd_stop); - tie_setting(settings.CmdInit, ui.le_cmd_init); - tie_setting(settings.CmdReset, ui.le_cmd_reset); - tie_setting(settings.CmdCenter, ui.le_cmd_center); - tie_setting(settings.CmdZero, ui.le_cmd_zero); - - tie_setting(settings.DelayInit, ui.spb_BeforeInit); - tie_setting(settings.DelayStart, ui.spb_BeforeStart); - tie_setting(settings.DelaySeq, ui.spb_AfterStart); - - tie_setting(settings.BigEndian, ui.cb_Endian); - - tie_setting(settings.pBaudRate, ui.QCB_Serial_baudRate); - tie_setting(settings.pDataBits, ui.QCB_Serial_dataBits); - tie_setting(settings.pParity, ui.QCB_Serial_parity); - tie_setting(settings.pStopBits, ui.QCB_Serial_stopBits); - tie_setting(settings.pFlowControl, ui.QCB_Serial_flowControl); - - tie_setting(settings.SerialPortName, ui.cbSerialPort); - - // Connect Qt signals to member-functions - connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK())); - connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); - connect(ui.btnSave, SIGNAL(clicked()), this, SLOT(doSave())); - - connect(ui.btnReset, SIGNAL(clicked()), this, SLOT(doReset())); - connect(ui.btnCenter, SIGNAL(clicked()), this, SLOT(doCenter())); - connect(ui.btnZero, SIGNAL(clicked()), this, SLOT(doZero())); - connect(ui.btnSend, SIGNAL(clicked()), this, SLOT(doSend())); - - connect(ui.btn_icone, SIGNAL(clicked()), this, SLOT(doSerialInfo())); - - connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); -} - -// -// Center asked to ARDUINO -// -void TrackerControls::doCenter() { - if (theTracker) theTracker->notifyCenter(); -} - -// -// Zero asked to ARDUINO -// -void TrackerControls::doZero() { - if (theTracker) theTracker->notifyZeroed(); -} - - -// -// Reset asked to ARDUINO -// -void TrackerControls::doReset() { - if (theTracker) theTracker->reset(); -} - - -// -// Serial Info debug -// -void TrackerControls::doSerialInfo() { - if (theTracker) theTracker->SerialInfo(); -} - - -// -// Send command to ARDUINO -// -void TrackerControls::doSend() { - if (theTracker) { - if (!ui.lineSend->text().isEmpty()) { - theTracker->sendcmd(ui.lineSend->text().toLatin1()); - } - } -} - - -// -// Display FPS of Arduino. -// -void TrackerControls::poll_tracker_info() -{ - if (theTracker) - { - int nb_trame; - - theTracker->get_info(&nb_trame); - ui.lab_vtps->setText(QString::number(nb_trame*(1000/last_time.elapsed()))); - last_time.restart(); - } - -} - - -void TrackerControls::WriteMsgInfo(const QByteArray &MsgInfo) -{ - QApplication::beep(); - ui.pteINFO->moveCursor(QTextCursor::End); - ui.pteINFO->insertPlainText(QString(MsgInfo)); - QScrollBar *bar = ui.pteINFO->verticalScrollBar(); - bar->setValue(bar->maximum()); -} - - - -void TrackerControls::doSave() { - settings.b->save(); - if (theTracker) - theTracker->applysettings(settings); -} - - -// -// OK clicked on server-dialog -// -void TrackerControls::doOK() { - settings.b->save(); - if (theTracker) - theTracker->applysettings(settings); - this->close(); -} - -// -// Cancel clicked on server-dialog -// -void TrackerControls::doCancel() { - settings.b->revert(); - close(); -} - - -void TrackerControls::registerTracker(ITracker *tracker) { - theTracker = static_cast(tracker); - connect(theTracker, SIGNAL(sendMsgInfo(QByteArray)),this , SLOT(WriteMsgInfo(QByteArray))); - - if (isVisible() && settings.b->modifiedp()) theTracker->applysettings(settings); - - ui.cbSerialPort->setEnabled(false); - ui.pteINFO->clear(); - ui.lab_vstatus->setText("HAT START"); - last_time.start(); - timer.start(250); - -} - - -void TrackerControls::unRegisterTracker() { - theTracker=NULL; - timer.stop(); - ui.cbSerialPort->setEnabled(true); - ui.lab_vstatus->setText("HAT STOPPED"); - ui.lab_vtps->setText(""); -} - -#ifdef OPENTRACK_API -extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog( ) -#else -#pragma comment(linker, "/export:GetTrackerDialog=_GetTrackerDialog@0") -FTNOIR_TRACKER_BASE_EXPORT ITrackerDialogPtr __stdcall GetTrackerDialog( ) -#endif -{ - return new TrackerControls; -} diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h deleted file mode 100644 index fe16e5e8..00000000 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef FTNOIR_TRACKER_HAT_DIALOG_H -#define FTNOIR_TRACKER_HAT_DIALOG_H - -#ifdef OPENTRACK_API -#include "ftnoir_tracker_base/ftnoir_tracker_base.h" -#else -#include "..\ftnoir_tracker_base\ftnoir_tracker_base.h" -#endif -#include "ftnoir_tracker_hat_settings.h" -#include "ftnoir_tracker_hat.h" -#include "ui_ftnoir_hatcontrols.h" -#include -#include -#include -#include -#include - -// Widget that has controls for FTNoIR protocol client-settings. -class TrackerControls: public QWidget, public ITrackerDialog -{ - Q_OBJECT -public: - explicit TrackerControls(); - void registerTracker(ITracker *tracker) virt_override; - void unRegisterTracker() virt_override; -private: - Ui::UIHATControls ui; - FTNoIR_Tracker *theTracker; - QTime last_time; - -public slots: - void WriteMsgInfo(const QByteArray &MsgInfo); - -protected slots: - void doOK(); - void doCancel(); - void doSave(); - void doReset(); - void doCenter(); - void doZero(); - void doSend(); - void poll_tracker_info(); - void doSerialInfo(); - -protected: - TrackerSettings settings; - QTimer timer; -}; - -#endif //FTNOIR_TRACKER_HAT_DIALOG_H diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp deleted file mode 100644 index 5f82d5a0..00000000 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * -* * -* Copyright (C) 2012 FuraX49 (HAT Tracker plugins) * -* Homepage: http://hatire.sourceforge.net * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see . * -* * -********************************************************************************/ - -#include "ftnoir_tracker_hat.h" -#include -#include - -TrackerDll::TrackerDll() { - //populate the description strings - trackerFullName = "Hatire Arduino"; - trackerShortName = "HAT"; - trackerDescription = "FaceTrackNoIR HAT"; -} - -TrackerDll::~TrackerDll() -{ - -} - -void TrackerDll::getFullName(QString *strToBeFilled) -{ - *strToBeFilled = trackerFullName; -} - -void TrackerDll::getShortName(QString *strToBeFilled) -{ - *strToBeFilled = trackerShortName; -} - -void TrackerDll::getDescription(QString *strToBeFilled) -{ - *strToBeFilled = trackerDescription; -} - -void TrackerDll::getIcon(QIcon *icon) -{ - *icon = QIcon(":/images/hat.png"); -} - -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Tracker object. - -// Export both decorated and undecorated names. -// GetTrackerDll - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetTrackerDll@0 - Common name decoration for __stdcall functions in C language. - -#ifdef OPENTRACK_API -# include "facetracknoir/global-settings.h" -extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() -#else -# pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0") -FTNOIR_TRACKER_BASE_EXPORT ITrackerDllPtr __stdcall GetTrackerDll() -#endif -{ - return new TrackerDll; -} diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h deleted file mode 100644 index 4c0fcb8d..00000000 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - */ - -#pragma once - -#include -#include "facetracknoir/options.h" -#include -using namespace options; - -struct TrackerSettings -{ - pbundle b; - value EnableRoll, - EnablePitch, - EnableYaw, - EnableX, - EnableY, - EnableZ, - InvertRoll, - InvertPitch, - InvertYaw, - InvertX, - InvertY, - InvertZ; - value RollAxe, - PitchAxe, - YawAxe, - XAxe, - YAxe, - ZAxe; - value BigEndian; - value CmdStart, - CmdStop, - CmdInit, - CmdReset, - CmdCenter, - CmdZero; - value SerialPortName, DelayInit, DelayStart, DelaySeq; - // unfortunately, no way to distinguish this and enum type - // hence, string type used -sh - value pBaudRate, pDataBits, pParity, pStopBits, pFlowControl; - TrackerSettings() : - b(bundle("HAT")), - EnableRoll(b, "EnableRoll", true), - EnablePitch(b, "EnablePitch", true), - EnableYaw(b, "EnableYaw", true), - EnableX(b, "EnableX", true), - EnableY(b, "EnableY", true), - EnableZ(b, "EnableZ", true), - InvertRoll(b, "InvertRoll", false), - InvertPitch(b, "InvertPitch", false), - InvertYaw(b, "InvertYaw", false), - InvertX(b, "InvertX", false), - InvertY(b, "InvertY", false), - InvertZ(b, "InvertZ", false), - RollAxe(b, "RollAe", 2), - PitchAxe(b, "PitchAxe", 1), - YawAxe(b, "YawAxe", 0), - XAxe(b, "XAxe", 0), - YAxe(b, "YAxe", 1), - ZAxe(b, "ZAxe", 2), - BigEndian(b, "BigEndian", false), - CmdStart(b, "CmdStart", ""), - CmdStop(b, "CmdStop", ""), - CmdInit(b, "CmdInit", ""), - CmdReset(b, "CmdReset", ""), - CmdCenter(b, "CmdCenter", ""), - CmdZero(b, "CmdZero", ""), - SerialPortName(b, "PortName", 0), - DelayInit(b, "DelayInit", 0), - DelayStart(b, "DelayStart", 0), - DelaySeq(b, "DelaySeq", 0), - pBaudRate(b, "BaudRate", 0), - pDataBits(b, "DataBits", 0), - pParity(b, "Parity", 0), - pStopBits(b, "StopBits", 0), - pFlowControl(b, "FlowControl", 0) - { - } -}; diff --git a/ftnoir_tracker_hatire/images/hat.png b/ftnoir_tracker_hatire/images/hat.png deleted file mode 100644 index 46a6e442..00000000 Binary files a/ftnoir_tracker_hatire/images/hat.png and /dev/null differ diff --git a/ftnoir_tracker_hatire/images/hat_logo.png b/ftnoir_tracker_hatire/images/hat_logo.png deleted file mode 100644 index c3a92b1b..00000000 Binary files a/ftnoir_tracker_hatire/images/hat_logo.png and /dev/null differ -- cgit v1.2.3