diff options
Diffstat (limited to 'ftnoir_tracker_hatire')
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_arduino_type.h | 30 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_hat.qrc | 6 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_hatcontrols.ui | 1190 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp | 463 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_tracker_hat.h | 87 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp | 277 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h | 50 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp | 81 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h | 85 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/images/hat.png | bin | 376 -> 0 bytes | |||
-rw-r--r-- | ftnoir_tracker_hatire/images/hat_logo.png | bin | 15210 -> 0 bytes |
11 files changed, 0 insertions, 2269 deletions
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 @@ -<RCC> - <qresource prefix="/"> - <file>images/hat_logo.png</file> - <file>images/hat.png</file> - </qresource> -</RCC> 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 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UIHATControls</class> - <widget class="QWidget" name="UIHATControls"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>307</width> - <height>567</height> - </rect> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>65536</height> - </size> - </property> - <property name="contextMenuPolicy"> - <enum>Qt::NoContextMenu</enum> - </property> - <property name="windowTitle"> - <string>Head Arduino Tracker settings FaceTrackNoIR</string> - </property> - <property name="windowIcon"> - <iconset> - <normaloff>:/images/hat.ico</normaloff>:/images/hat.ico</iconset> - </property> - <property name="windowOpacity"> - <double>1.000000000000000</double> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout_7"> - <item row="1" column="2"> - <widget class="QPushButton" name="btnCancel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>80</width> - <height>25</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>25</height> - </size> - </property> - <property name="text"> - <string>Cancel</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QPushButton" name="btnOK"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>80</width> - <height>25</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>25</height> - </size> - </property> - <property name="text"> - <string>OK</string> - </property> - </widget> - </item> - <item row="0" column="0" colspan="3"> - <widget class="QTabWidget" name="tabWidget"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>65535</width> - <height>65535</height> - </size> - </property> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tab_config"> - <attribute name="title"> - <string>General</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string/> - </property> - <property name="flat"> - <bool>true</bool> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <property name="spacing"> - <number>4</number> - </property> - <item row="0" column="1"> - <widget class="QComboBox" name="cbSerialPort"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>65535</width> - <height>16777215</height> - </size> - </property> - <property name="editable"> - <bool>false</bool> - </property> - <property name="sizeAdjustPolicy"> - <enum>QComboBox::AdjustToMinimumContentsLength</enum> - </property> - <property name="modelColumn"> - <number>0</number> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_5"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="maximumSize"> - <size> - <width>65536</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Serial port</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnZero"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>20</height> - </size> - </property> - <property name="text"> - <string>Zero</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnCenter"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>20</height> - </size> - </property> - <property name="text"> - <string>Center</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnReset"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>20</height> - </size> - </property> - <property name="text"> - <string>Reset</string> - </property> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_3"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>106</height> - </size> - </property> - <property name="title"> - <string>Axis Configuration</string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - <layout class="QGridLayout" name="gridLayout_6"> - <item row="2" column="2"> - <widget class="QComboBox" name="cb_pitch"> - <property name="toolTip"> - <string>Associate Axis</string> - </property> - <item> - <property name="text"> - <string>RotX</string> - </property> - </item> - <item> - <property name="text"> - <string>RotY</string> - </property> - </item> - <item> - <property name="text"> - <string>RotZ</string> - </property> - </item> - </widget> - </item> - <item row="1" column="1"> - <widget class="QCheckBox" name="chkEnableYaw"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Enable Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QCheckBox" name="chkEnableX"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Enable Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_pitch"> - <property name="text"> - <string>Pitch:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Enable</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QCheckBox" name="chkEnablePitch"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Enable Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_yaw"> - <property name="text"> - <string>Yaw:</string> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Invert</string> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="label_y"> - <property name="text"> - <string>Y:</string> - </property> - </widget> - </item> - <item row="3" column="3"> - <widget class="QCheckBox" name="chkInvertRoll"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Invert Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_x"> - <property name="text"> - <string>X:</string> - </property> - </widget> - </item> - <item row="5" column="3"> - <widget class="QCheckBox" name="chkInvertY"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Invert Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="6" column="3"> - <widget class="QCheckBox" name="chkInvertZ"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Invert Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="6" column="2"> - <widget class="QComboBox" name="cb_z"> - <property name="toolTip"> - <string>Associate Axis</string> - </property> - <item> - <property name="text"> - <string>X</string> - </property> - </item> - <item> - <property name="text"> - <string>Y</string> - </property> - </item> - <item> - <property name="text"> - <string>Z</string> - </property> - </item> - </widget> - </item> - <item row="6" column="1"> - <widget class="QCheckBox" name="chkEnableZ"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Enable Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="5" column="2"> - <widget class="QComboBox" name="cb_y"> - <property name="toolTip"> - <string>Associate Axis</string> - </property> - <item> - <property name="text"> - <string>X</string> - </property> - </item> - <item> - <property name="text"> - <string>Y</string> - </property> - </item> - <item> - <property name="text"> - <string>Z</string> - </property> - </item> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_roll"> - <property name="text"> - <string>Roll:</string> - </property> - </widget> - </item> - <item row="4" column="3"> - <widget class="QCheckBox" name="chkInvertX"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Invert Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="4" column="2"> - <widget class="QComboBox" name="cb_x"> - <property name="toolTip"> - <string>Associate Axis</string> - </property> - <item> - <property name="text"> - <string>X</string> - </property> - </item> - <item> - <property name="text"> - <string>Y</string> - </property> - </item> - <item> - <property name="text"> - <string>Z</string> - </property> - </item> - </widget> - </item> - <item row="2" column="3"> - <widget class="QCheckBox" name="chkInvertPitch"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Invert Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="label_z"> - <property name="text"> - <string>Z:</string> - </property> - </widget> - </item> - <item row="3" column="2"> - <widget class="QComboBox" name="cb_roll"> - <property name="toolTip"> - <string>Associate Axis</string> - </property> - <item> - <property name="text"> - <string>RotX</string> - </property> - </item> - <item> - <property name="text"> - <string>RotY</string> - </property> - </item> - <item> - <property name="text"> - <string>RotZ</string> - </property> - </item> - </widget> - </item> - <item row="3" column="1"> - <widget class="QCheckBox" name="chkEnableRoll"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Enable Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QCheckBox" name="chkEnableY"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Enable Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QCheckBox" name="chkInvertYaw"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Invert Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QComboBox" name="cb_yaw"> - <property name="toolTip"> - <string>Associate Axis</string> - </property> - <item> - <property name="text"> - <string>RotX</string> - </property> - </item> - <item> - <property name="text"> - <string>RotY</string> - </property> - </item> - <item> - <property name="text"> - <string>RotZ</string> - </property> - </item> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Axis</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_status"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Status</string> - </property> - <property name="flat"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="0" column="0"> - <widget class="QLabel" name="lab_tps"> - <property name="minimumSize"> - <size> - <width>31</width> - <height>20</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>60</width> - <height>20</height> - </size> - </property> - <property name="toolTip"> - <string>Trame per seconde</string> - </property> - <property name="text"> - <string>tps :</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="lab_vtps"> - <property name="minimumSize"> - <size> - <width>31</width> - <height>20</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>60</width> - <height>20</height> - </size> - </property> - <property name="text"> - <string>00</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="lab_status"> - <property name="minimumSize"> - <size> - <width>0</width> - <height>20</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>60</width> - <height>20</height> - </size> - </property> - <property name="text"> - <string>Info :</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="lab_vstatus"> - <property name="minimumSize"> - <size> - <width>170</width> - <height>20</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>60</width> - <height>20</height> - </size> - </property> - <property name="text"> - <string>00</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_cmds"> - <attribute name="title"> - <string>Command</string> - </attribute> - <layout class="QGridLayout" name="gridLayout_5"> - <item row="1" column="0"> - <widget class="QGroupBox" name="parametersBox"> - <property name="title"> - <string>Serial Parameters</string> - </property> - <layout class="QGridLayout" name="gridLayout_8"> - <item row="1" column="0"> - <widget class="QLabel" name="dataBitsLabel"> - <property name="text"> - <string>Data bits:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="QCB_Serial_dataBits"/> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="baudRateLabel"> - <property name="text"> - <string>BaudRate:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="QCB_Serial_baudRate"/> - </item> - <item row="3" column="1"> - <widget class="QComboBox" name="QCB_Serial_stopBits"/> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="flowControlLabel"> - <property name="text"> - <string>Flow control:</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QComboBox" name="QCB_Serial_flowControl"/> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="parityLabel"> - <property name="text"> - <string>Parity:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QComboBox" name="QCB_Serial_parity"/> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="stopBitsLabel"> - <property name="text"> - <string>Stop bits:</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="0" column="0"> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Arduino Commands</string> - </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="1"> - <widget class="QLabel" name="lab_cmd_init_2"> - <property name="text"> - <string>Delay Init</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="lab_cmd_init"> - <property name="text"> - <string>Init</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLineEdit" name="le_cmd_init"> - <property name="toolTip"> - <string>Command for Initialising Arduino</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLabel" name="lab_cmd_init_3"> - <property name="text"> - <string>Delay Start</string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="lab_cmd_start"> - <property name="text"> - <string>Start:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLineEdit" name="le_cmd_start"> - <property name="toolTip"> - <string>Command for Start send sequence</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QLabel" name="lab_cmd_init_4"> - <property name="text"> - <string>Delay Sequence</string> - </property> - </widget> - </item> - <item row="4" column="2"> - <widget class="QSpinBox" name="spb_AfterStart"> - <property name="toolTip"> - <string><!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></string> - </property> - <property name="maximum"> - <number>5000</number> - </property> - <property name="singleStep"> - <number>50</number> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="lab_cmd_stop"> - <property name="text"> - <string>Stop:</string> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QLineEdit" name="le_cmd_stop"> - <property name="toolTip"> - <string>Command for Stop send sequence</string> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="lab_cmd_center"> - <property name="text"> - <string>Center:</string> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="QLineEdit" name="le_cmd_center"> - <property name="toolTip"> - <string>Command for Center Gyro arduino</string> - </property> - </widget> - </item> - <item row="7" column="0"> - <widget class="QLabel" name="lab_cmd_zero"> - <property name="text"> - <string>Zero:</string> - </property> - </widget> - </item> - <item row="7" column="1"> - <widget class="QLineEdit" name="le_cmd_zero"> - <property name="toolTip"> - <string>Command for Center Gyro arduino</string> - </property> - </widget> - </item> - <item row="8" column="0"> - <widget class="QLabel" name="lab_cmd_reset"> - <property name="text"> - <string>Reset:</string> - </property> - </widget> - </item> - <item row="8" column="1"> - <widget class="QLineEdit" name="le_cmd_reset"> - <property name="toolTip"> - <string>Command for Reset Arduino</string> - </property> - </widget> - </item> - <item row="8" column="2"> - <widget class="QCheckBox" name="cb_Endian"> - <property name="toolTip"> - <string><!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></string> - </property> - <property name="text"> - <string>Endian</string> - </property> - </widget> - </item> - <item row="3" column="2"> - <widget class="QSpinBox" name="spb_BeforeStart"> - <property name="toolTip"> - <string><!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></string> - </property> - <property name="maximum"> - <number>5000</number> - </property> - <property name="singleStep"> - <number>50</number> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QSpinBox" name="spb_BeforeInit"> - <property name="maximumSize"> - <size> - <width>60</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string><!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></string> - </property> - <property name="maximum"> - <number>5000</number> - </property> - <property name="singleStep"> - <number>50</number> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_about"> - <attribute name="title"> - <string>About</string> - </attribute> - <layout class="QGridLayout" name="gridLayout_4"> - <item row="1" column="0"> - <widget class="QLabel" name="label_version"> - <property name="font"> - <font> - <family>Arial Black</family> - <pointsize>10</pointsize> - <weight>75</weight> - <italic>true</italic> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Version 1.0.0</string> - </property> - <property name="textFormat"> - <enum>Qt::PlainText</enum> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="2" column="0" colspan="2"> - <widget class="QLineEdit" name="lineSend"/> - </item> - <item row="2" column="2"> - <widget class="QPushButton" name="btnSend"> - <property name="text"> - <string>Send</string> - </property> - </widget> - </item> - <item row="3" column="0" colspan="3"> - <widget class="QPlainTextEdit" name="pteINFO"> - <property name="contextMenuPolicy"> - <enum>Qt::ActionsContextMenu</enum> - </property> - <property name="readOnly"> - <bool>true</bool> - </property> - <property name="plainText"> - <string notr="true"/> - </property> - <property name="textInteractionFlags"> - <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> - </property> - <property name="maximumBlockCount"> - <number>800</number> - </property> - <property name="backgroundVisible"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="0" column="2" rowspan="2"> - <widget class="QPushButton" name="btn_icone"> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset> - <normalon>:/images/hat_logo.png</normalon> - </iconset> - </property> - <property name="iconSize"> - <size> - <width>128</width> - <height>128</height> - </size> - </property> - <property name="flat"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="0" column="0" colspan="2"> - <widget class="QLabel" name="label_info_2"> - <property name="text"> - <string><!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></string> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item row="1" column="1"> - <widget class="QPushButton" name="btnSave"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>25</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>25</height> - </size> - </property> - <property name="text"> - <string>Save</string> - </property> - </widget> - </item> - </layout> - </widget> - <tabstops> - <tabstop>btnOK</tabstop> - <tabstop>btnSave</tabstop> - <tabstop>btnCancel</tabstop> - <tabstop>chkEnableYaw</tabstop> - <tabstop>cb_yaw</tabstop> - <tabstop>chkInvertYaw</tabstop> - <tabstop>chkEnablePitch</tabstop> - <tabstop>cb_pitch</tabstop> - <tabstop>chkInvertPitch</tabstop> - <tabstop>chkEnableRoll</tabstop> - <tabstop>cb_roll</tabstop> - <tabstop>chkInvertRoll</tabstop> - <tabstop>chkEnableX</tabstop> - <tabstop>cb_x</tabstop> - <tabstop>chkInvertX</tabstop> - <tabstop>chkEnableY</tabstop> - <tabstop>cb_y</tabstop> - <tabstop>chkInvertY</tabstop> - <tabstop>chkEnableZ</tabstop> - <tabstop>cb_z</tabstop> - <tabstop>chkInvertZ</tabstop> - <tabstop>QCB_Serial_baudRate</tabstop> - <tabstop>QCB_Serial_dataBits</tabstop> - <tabstop>QCB_Serial_parity</tabstop> - <tabstop>QCB_Serial_stopBits</tabstop> - <tabstop>QCB_Serial_flowControl</tabstop> - <tabstop>lineSend</tabstop> - <tabstop>btnSend</tabstop> - <tabstop>pteINFO</tabstop> - <tabstop>tabWidget</tabstop> - </tabstops> - <resources/> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> 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 <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ - -#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<QString>(settings.CmdCenter).toLatin1()); -} - -//send ZERO to Arduino -bool FTNoIR_Tracker::notifyZeroed() { - sendcmd(static_cast<QString>(settings.CmdZero).toLatin1()); - return true; -} - -//send RESET to Arduino -void FTNoIR_Tracker::reset() { - sendcmd(static_cast<QString>(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<QString>(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<QString>(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 <QObject> -#include <QPalette> -#include <QtGui> -#include <QByteArray> -#include <QMessageBox> -#include <QtSerialPort/QSerialPort> -#include <QtSerialPort/QSerialPortInfo> -#include <QMutex> -#include <QMutexLocker> - -#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 <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ -#include "ftnoir_tracker_hat.h" -#include "ftnoir_tracker_hat_dialog.h" - -#include <QScrollBar> - -//******************************************************************************************************* -// 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<FTNoIR_Tracker*>(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 <QObject> -#include <QTime> -#include <QTimer> -#include <QMessageBox> -#include <QMetaType> - -// 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 <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ - -#include "ftnoir_tracker_hat.h" -#include <QIcon> -#include <QDebug> - -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 <QtSerialPort/QSerialPort> -#include "facetracknoir/options.h" -#include <ftnoir_tracker_base/ftnoir_tracker_types.h> -using namespace options; - -struct TrackerSettings -{ - pbundle b; - value<bool> EnableRoll, - EnablePitch, - EnableYaw, - EnableX, - EnableY, - EnableZ, - InvertRoll, - InvertPitch, - InvertYaw, - InvertX, - InvertY, - InvertZ; - value<int> RollAxe, - PitchAxe, - YawAxe, - XAxe, - YAxe, - ZAxe; - value<bool> BigEndian; - value<QString> CmdStart, - CmdStop, - CmdInit, - CmdReset, - CmdCenter, - CmdZero; - value<int> SerialPortName, DelayInit, DelayStart, DelaySeq; - // unfortunately, no way to distinguish this and enum type - // hence, string type used -sh - value<int> 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 Binary files differdeleted file mode 100644 index 46a6e442..00000000 --- a/ftnoir_tracker_hatire/images/hat.png +++ /dev/null diff --git a/ftnoir_tracker_hatire/images/hat_logo.png b/ftnoir_tracker_hatire/images/hat_logo.png Binary files differdeleted file mode 100644 index c3a92b1b..00000000 --- a/ftnoir_tracker_hatire/images/hat_logo.png +++ /dev/null |