summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorWim Vriend <facetracknoir@gmail.com>2011-02-12 16:13:30 +0000
committerWim Vriend <facetracknoir@gmail.com>2011-02-12 16:13:30 +0000
commit63ce1b5dc62e5c1a079f8a675c0a4371adb27d29 (patch)
tree0a8ac58de927502c9f33d97a2c82966ae980e54a
parenta8a619f078f543b56e8ae785d92844b806444195 (diff)
Displaying headpose-data seemed to cause crashes.
Update is now done in FaceTrackNoIR.cpp, using a timer. git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@51 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
-rw-r--r--FTNoIR_Tracker_UDP/FTNoIR_FTNClientControls.ui199
-rw-r--r--FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h80
-rw-r--r--FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.vcproj114
-rw-r--r--FTNoIR_Tracker_UDP/ftnoir_tracker_base.h26
-rw-r--r--FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp261
-rw-r--r--FaceTrackNoIR.suobin347136 -> 347136 bytes
-rw-r--r--FaceTrackNoIR/FTNoIR_FGcontrols.ui8
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.cpp19
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.h6
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.ui384
-rw-r--r--FaceTrackNoIR/tracker.cpp79
-rw-r--r--FaceTrackNoIR/tracker.h12
-rw-r--r--bin/FaceTrackNoIR.exebin761856 -> 761856 bytes
-rw-r--r--bin/Settings/FlightGear.ini6
-rw-r--r--bin/Settings/SimConnect.ini10
15 files changed, 872 insertions, 332 deletions
diff --git a/FTNoIR_Tracker_UDP/FTNoIR_FTNClientControls.ui b/FTNoIR_Tracker_UDP/FTNoIR_FTNClientControls.ui
new file mode 100644
index 00000000..11e07cf3
--- /dev/null
+++ b/FTNoIR_Tracker_UDP/FTNoIR_FTNClientControls.ui
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>UICFTNClientControls</class>
+ <widget class="QWidget" name="UICFTNClientControls">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>411</width>
+ <height>129</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>FTNoIR tracker settings FaceTrackNoIR</string>
+ </property>
+ <property name="windowIcon">
+ <iconset>
+ <normaloff>images/FaceTrackNoIR.ico</normaloff>images/FaceTrackNoIR.ico</iconset>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <layout class="QVBoxLayout" name="_vertical_layout">
+ <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Port-number</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="spinPortNumber">
+ <property name="minimum">
+ <number>5550</number>
+ </property>
+ <property name="maximum">
+ <number>10000</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Enter the port-number for the remote PC.</string>
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Remember: you may have to change firewall-settings too!</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
+ </property>
+ <item>
+ <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>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <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>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>10</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <tabstops>
+ <tabstop>spinPortNumber</tabstop>
+ <tabstop>btnOK</tabstop>
+ <tabstop>btnCancel</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+ <slots>
+ <slot>startEngineClicked()</slot>
+ <slot>stopEngineClicked()</slot>
+ <slot>cameraSettingsClicked()</slot>
+ </slots>
+</ui>
diff --git a/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h b/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h
new file mode 100644
index 00000000..b3467341
--- /dev/null
+++ b/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h
@@ -0,0 +1,80 @@
+#include "ftnoir_tracker_base.h"
+#include "ui_FTNoIR_FTNClientcontrols.h"
+#include <QThread>
+#include <QUdpSocket>
+#include <QMessageBox>
+#include <QSettings>
+#include "Windows.h"
+#include "math.h"
+
+class FTNoIR_Tracker_UDP : public ITracker, QThread
+{
+public:
+ FTNoIR_Tracker_UDP();
+ ~FTNoIR_Tracker_UDP();
+
+ void Release();
+ void Initialize();
+ void StartTracker();
+ void GiveHeadPoseData(THeadPoseData *data);
+ void loadSettings();
+
+ bool setParameterValue(const int index, const float newvalue);
+
+protected:
+ void run(); // qthread override run method
+
+private:
+ // Handles to neatly terminate thread...
+ HANDLE m_StopThread;
+ HANDLE m_WaitThread;
+
+ // UDP socket-variables
+ QUdpSocket *inSocket; // Receive from ...
+ QUdpSocket *outSocket; // Send to ...
+ QHostAddress destIP; // Destination IP-address
+ int destPort; // Destination port-number
+ QHostAddress srcIP; // Source IP-address
+ int srcPort; // Source port-number
+
+ THeadPoseData newHeadPose; // Structure with new headpose
+
+ //parameter list for the filter-function(s)
+ enum
+ {
+ kPortAddress=0, // Index in QList
+ kNumFilterParameters // Indicate number of parameters used
+ };
+ QList<std::pair<float,float>> parameterRange;
+ QList<float> parameterValueAsFloat;
+
+};
+
+// Widget that has controls for FTNoIR protocol client-settings.
+class FTNClientControls: public QWidget, Ui::UICFTNClientControls, public ITrackerDialog
+{
+ Q_OBJECT
+public:
+
+ explicit FTNClientControls( QWidget *parent=0, Qt::WindowFlags f=0 );
+ virtual ~FTNClientControls();
+ void showEvent ( QShowEvent * event );
+
+ void Release(); // Member functions which are accessible from outside the DLL
+ void Initialize(QWidget *parent);
+
+private:
+ Ui::UICFTNClientControls ui;
+ void loadSettings();
+ void save();
+
+ /** helper **/
+ bool settingsDirty;
+
+private slots:
+ void doOK();
+ void doCancel();
+ void settingChanged() { settingsDirty = true; };
+};
+
+
diff --git a/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.vcproj b/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.vcproj
index 55e6d66b..ae299ed2 100644
--- a/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.vcproj
+++ b/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.vcproj
@@ -180,17 +180,91 @@
<File
RelativePath=".\ftnoir_tracker_base.h"
>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description=""
+ CommandLine=""
+ AdditionalDependencies=""
+ Outputs=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description=""
+ CommandLine=""
+ AdditionalDependencies=""
+ Outputs=""
+ />
+ </FileConfiguration>
</File>
<File
RelativePath=".\ftnoir_tracker_base_global.h"
>
</File>
+ <File
+ RelativePath=".\FTNoIR_Tracker_UDP.h"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Moc&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -D_WINDLL -DFTNOIR_TRACKER_BASE_LIB -DNDEBUG -DQT_CORE_LIB -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DUNICODE -DWIN32 -I&quot;$(QTDIR)\include\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\QtGui\.&quot; -I&quot;$(QTDIR)\include\qtmain\.&quot; -I&quot;$(QTDIR)\include\QtNetwork\.&quot; -I&quot;.\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;.\GeneratedFiles\.&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
+ Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Moc&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\moc.exe&quot; &quot;$(InputPath)&quot; -o &quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot; -D_WINDLL -DFTNOIR_TRACKER_UDP_LIB -DQT_CORE_LIB -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DUNICODE -DWIN32 -I&quot;$(QTDIR)\include\.&quot; -I&quot;$(QTDIR)\include\QtCore\.&quot; -I&quot;$(QTDIR)\include\qtmain\.&quot; -I&quot;.\.&quot; -I&quot;.\GeneratedFiles\$(ConfigurationName)\.&quot; -I&quot;.\GeneratedFiles\.&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="&quot;$(QTDIR)\bin\moc.exe&quot;;$(InputPath)"
+ Outputs="&quot;.\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp&quot;"
+ />
+ </FileConfiguration>
+ </File>
</Filter>
<Filter
Name="Form Files"
Filter="ui"
UniqueIdentifier="{99349809-55BA-4b9d-BF79-8FDBB0286EB3}"
>
+ <File
+ RelativePath=".\FTNoIR_FTNClientControls.ui"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Uic&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_$(InputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="$(QTDIR)\bin\uic.exe"
+ Outputs="&quot;.\GeneratedFiles\ui_$(InputName).h&quot;"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ Description="Uic&apos;ing $(InputFileName)..."
+ CommandLine="&quot;$(QTDIR)\bin\uic.exe&quot; -o &quot;.\GeneratedFiles\ui_$(InputName).h&quot; &quot;$(InputPath)&quot;&#x0D;&#x0A;"
+ AdditionalDependencies="$(QTDIR)\bin\uic.exe"
+ Outputs="&quot;.\GeneratedFiles\ui_$(InputName).h&quot;"
+ />
+ </FileConfiguration>
+ </File>
</Filter>
<Filter
Name="Resource Files"
@@ -205,6 +279,46 @@
UniqueIdentifier="{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}"
SourceControlFiles="false"
>
+ <File
+ RelativePath=".\GeneratedFiles\ui_FTNoIR_FTNClientControls.h"
+ >
+ </File>
+ <Filter
+ Name="Release"
+ Filter="cpp;moc"
+ SourceControlFiles="false"
+ >
+ <File
+ RelativePath=".\GeneratedFiles\Release\moc_FTNoIR_Tracker_UDP.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Debug"
+ Filter="cpp;moc"
+ SourceControlFiles="false"
+ >
+ <File
+ RelativePath=".\GeneratedFiles\Debug\moc_FTNoIR_Tracker_UDP.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
</Filter>
</Files>
<Globals>
diff --git a/FTNoIR_Tracker_UDP/ftnoir_tracker_base.h b/FTNoIR_Tracker_UDP/ftnoir_tracker_base.h
index 60f0caf3..f39a8b4d 100644
--- a/FTNoIR_Tracker_UDP/ftnoir_tracker_base.h
+++ b/FTNoIR_Tracker_UDP/ftnoir_tracker_base.h
@@ -2,6 +2,7 @@
#define FTNOIR_TRACKER_BASE_H
#include "ftnoir_tracker_base_global.h"
+#include <QtGui/QWidget>
//
// x,y,z position in centimetres, yaw, pitch and roll in degrees...
@@ -19,7 +20,7 @@ struct THeadPoseData {
// Instances are obtained via factory function.
struct ITracker
{
- virtual void Release() = 0;
+ virtual void Release() = 0; // Member required to enable Auto-remove
virtual void Initialize() = 0;
virtual void StartTracker() = 0;
virtual void GiveHeadPoseData(THeadPoseData *data) = 0;
@@ -44,4 +45,27 @@ __stdcall
GetTracker(
void);
+
+// COM-Like abstract interface.
+// This interface doesn't require __declspec(dllexport/dllimport) specifier.
+// Method calls are dispatched via virtual table.
+// Any C++ compiler can use it.
+// Instances are obtained via factory function.
+struct ITrackerDialog
+{
+ virtual void Release() = 0; // Member required to enable Auto-remove
+ virtual void Initialize(QWidget *parent) = 0;
+};
+
+// Handle type. In C++ language the iterface type is used.
+typedef ITrackerDialog* TRACKERDIALOGHANDLE;
+
+// Factory function that creates instances of the Tracker object.
+EXTERN_C
+FTNOIR_TRACKER_BASE_EXPORT
+TRACKERDIALOGHANDLE
+__stdcall
+GetTrackerDialog(void);
+
+
#endif // FTNOIR_TRACKER_BASE_H
diff --git a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp
index 9dfb26a7..93ef60b6 100644
--- a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp
+++ b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp
@@ -1,51 +1,4 @@
-#include "ftnoir_tracker_base.h"
-#include <QThread>
-#include <QUdpSocket>
-#include <QMessageBox>
-#include "Windows.h"
-#include "math.h"
-
-class FTNoIR_Tracker_UDP : public ITracker, QThread
-{
-public:
- FTNoIR_Tracker_UDP();
- ~FTNoIR_Tracker_UDP();
-
- void Release();
- void Initialize();
- void StartTracker();
- void GiveHeadPoseData(THeadPoseData *data);
-
- bool setParameterValue(const int index, const float newvalue);
-
-protected:
- void run(); // qthread override run method
-
-private:
- // Handles to neatly terminate thread...
- HANDLE m_StopThread;
- HANDLE m_WaitThread;
-
- // UDP socket-variables
- QUdpSocket *inSocket; // Receive from ...
- QUdpSocket *outSocket; // Send to ...
- QHostAddress destIP; // Destination IP-address
- int destPort; // Destination port-number
- QHostAddress srcIP; // Source IP-address
- int srcPort; // Source port-number
-
- THeadPoseData newHeadPose; // Structure with new headpose
-
- //parameter list for the filter-function(s)
- enum
- {
- kPortAddress=0, // Index in QList
- kNumFilterParameters // Indicate number of parameters used
- };
- QList<std::pair<float,float>> parameterRange;
- QList<float> parameterValueAsFloat;
-
-};
+#include "ftnoir_tracker_udp.h"
FTNoIR_Tracker_UDP::FTNoIR_Tracker_UDP()
{
@@ -71,23 +24,6 @@ FTNoIR_Tracker_UDP::FTNoIR_Tracker_UDP()
newHeadPose.yaw = 0.0f;
newHeadPose.pitch = 0.0f;
newHeadPose.roll = 0.0f;
-
- //
- // Create UDP-sockets if they don't exist already.
- // They must be created here, because they must be in the new thread (FTNoIR_Tracker_UDP::run())
- //
- if (inSocket == 0) {
- qDebug() << "FTNoIR_Tracker_UDP::run() creating insocket";
- inSocket = new QUdpSocket();
- // Connect the inSocket to the port, to receive messages
-
- if (!inSocket->bind(QHostAddress::Any, (int) parameterValueAsFloat[kPortAddress], QUdpSocket::ShareAddress )) {
- QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to bind UDP-port",QMessageBox::Ok,QMessageBox::NoButton);
- delete inSocket;
- inSocket = 0;
- }
- }
-
}
FTNoIR_Tracker_UDP::~FTNoIR_Tracker_UDP()
@@ -163,6 +99,25 @@ void FTNoIR_Tracker_UDP::Release()
void FTNoIR_Tracker_UDP::Initialize()
{
+ qDebug() << "FTNoIR_Tracker_UDP::Initialize says: Starting ";
+ loadSettings();
+
+ //
+ // Create UDP-sockets if they don't exist already.
+ // They must be created here, because they must be in the new thread (FTNoIR_Tracker_UDP::run())
+ //
+ if (inSocket == 0) {
+ qDebug() << "FTNoIR_Tracker_UDP::Initialize() creating insocket";
+ inSocket = new QUdpSocket();
+ // Connect the inSocket to the port, to receive messages
+
+ if (!inSocket->bind(QHostAddress::Any, (int) parameterValueAsFloat[kPortAddress], QUdpSocket::ShareAddress )) {
+ QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to bind UDP-port",QMessageBox::Ok,QMessageBox::NoButton);
+ delete inSocket;
+ inSocket = 0;
+ }
+ }
+
return;
}
@@ -211,6 +166,24 @@ bool FTNoIR_Tracker_UDP::setParameterValue(const int index, const float newvalue
}
};
+//
+// Load the current Settings from the currently 'active' INI-file.
+//
+void FTNoIR_Tracker_UDP::loadSettings() {
+
+ qDebug() << "FTNoIR_Tracker_UDP::loadSettings says: Starting ";
+ 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)
+
+ qDebug() << "FTNoIR_Tracker_UDP::loadSettings says: iniFile = " << currentFile;
+
+ iniFile.beginGroup ( "FTNClient" );
+ setParameterValue(kPortAddress, (float) iniFile.value ( "PortNumber", 5550 ).toInt());
+ iniFile.endGroup ();
+}
+
////////////////////////////////////////////////////////////////////////////////
// Factory function that creates instances if the Tracker object.
@@ -226,3 +199,161 @@ FTNOIR_TRACKER_BASE_EXPORT TRACKERHANDLE __stdcall GetTracker()
return new FTNoIR_Tracker_UDP;
}
+//*******************************************************************************************************
+// FaceTrackNoIR Client Settings-dialog.
+//*******************************************************************************************************
+
+//
+// Constructor for server-settings-dialog
+//
+FTNClientControls::FTNClientControls( QWidget *parent, Qt::WindowFlags f ) :
+QWidget( parent , f)
+{
+ ui.setupUi( this );
+
+ QPoint offsetpos(100, 100);
+ if (parent) {
+ this->move(parent->pos() + offsetpos);
+ }
+
+ // Connect Qt signals to member-functions
+ connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
+ connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
+ //connect(ui.spinIPFirstNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+ //connect(ui.spinIPSecondNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+ //connect(ui.spinIPThirdNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+ //connect(ui.spinIPFourthNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+ connect(ui.spinPortNumber, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+
+ // Load the settings from the current .INI-file
+ loadSettings();
+}
+
+//
+// Destructor for server-dialog
+//
+FTNClientControls::~FTNClientControls() {
+ qDebug() << "~FTNClientControls() says: started";
+}
+
+void FTNClientControls::Release()
+{
+ delete this;
+}
+
+//
+// Initialize tracker-client-dialog
+//
+void FTNClientControls::Initialize(QWidget *parent) {
+
+ QPoint offsetpos(100, 100);
+ if (parent) {
+ this->move(parent->pos() + offsetpos);
+ }
+ show();
+}
+
+//
+// OK clicked on server-dialog
+//
+void FTNClientControls::doOK() {
+ save();
+ this->close();
+}
+
+// override show event
+void FTNClientControls::showEvent ( QShowEvent * event ) {
+ loadSettings();
+}
+
+//
+// Cancel clicked on server-dialog
+//
+void FTNClientControls::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:
+ save();
+ this->close();
+ break;
+ case QMessageBox::Discard:
+ this->close();
+ break;
+ case QMessageBox::Cancel:
+ // Cancel was clicked
+ break;
+ default:
+ // should never be reached
+ break;
+ }
+ }
+ else {
+ this->close();
+ }
+}
+
+//
+// Load the current Settings from the currently 'active' INI-file.
+//
+void FTNClientControls::loadSettings() {
+
+// qDebug() << "loadSettings says: Starting ";
+ 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)
+
+// qDebug() << "loadSettings says: iniFile = " << currentFile;
+
+ iniFile.beginGroup ( "FTNClient" );
+ //ui.spinIPFirstNibble->setValue( iniFile.value ( "IP-1", 192 ).toInt() );
+ //ui.spinIPSecondNibble->setValue( iniFile.value ( "IP-2", 168 ).toInt() );
+ //ui.spinIPThirdNibble->setValue( iniFile.value ( "IP-3", 2 ).toInt() );
+ //ui.spinIPFourthNibble->setValue( iniFile.value ( "IP-4", 1 ).toInt() );
+
+ ui.spinPortNumber->setValue( iniFile.value ( "PortNumber", 5550 ).toInt() );
+ iniFile.endGroup ();
+
+ settingsDirty = false;
+}
+
+//
+// Save the current Settings to the currently 'active' INI-file.
+//
+void FTNClientControls::save() {
+
+ 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 ( "FTNClient" );
+ //iniFile.setValue ( "IP-1", ui.spinIPFirstNibble->value() );
+ //iniFile.setValue ( "IP-2", ui.spinIPSecondNibble->value() );
+ //iniFile.setValue ( "IP-3", ui.spinIPThirdNibble->value() );
+ //iniFile.setValue ( "IP-4", ui.spinIPFourthNibble->value() );
+ iniFile.setValue ( "PortNumber", ui.spinPortNumber->value() );
+ iniFile.endGroup ();
+
+ settingsDirty = false;
+}
+////////////////////////////////////////////////////////////////////////////////
+// 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 TRACKERDIALOGHANDLE __stdcall GetTrackerDialog( )
+{
+ return new FTNClientControls;
+}
diff --git a/FaceTrackNoIR.suo b/FaceTrackNoIR.suo
index 2d013289..006a6e0c 100644
--- a/FaceTrackNoIR.suo
+++ b/FaceTrackNoIR.suo
Binary files differ
diff --git a/FaceTrackNoIR/FTNoIR_FGcontrols.ui b/FaceTrackNoIR/FTNoIR_FGcontrols.ui
index 5f5d1563..c5f81c29 100644
--- a/FaceTrackNoIR/FTNoIR_FGcontrols.ui
+++ b/FaceTrackNoIR/FTNoIR_FGcontrols.ui
@@ -38,7 +38,7 @@
<number>255</number>
</property>
<property name="singleStep">
- <number>5</number>
+ <number>1</number>
</property>
</widget>
</item>
@@ -54,7 +54,7 @@
<number>255</number>
</property>
<property name="singleStep">
- <number>5</number>
+ <number>1</number>
</property>
</widget>
</item>
@@ -70,7 +70,7 @@
<number>255</number>
</property>
<property name="singleStep">
- <number>5</number>
+ <number>1</number>
</property>
</widget>
</item>
@@ -86,7 +86,7 @@
<number>255</number>
</property>
<property name="singleStep">
- <number>5</number>
+ <number>1</number>
</property>
</widget>
</item>
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp
index e9a0c8be..7197a5f7 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.cpp
+++ b/FaceTrackNoIR/FaceTrackNoIR.cpp
@@ -147,6 +147,11 @@ void FaceTrackNoIR::setupFaceTrackNoIR() {
//Setup the timer for automatically minimizing after StartTracker.
timMinimizeFTN = new QTimer(this);
connect(timMinimizeFTN, SIGNAL(timeout()), this, SLOT(showMinimized()));
+
+ //Setup the timer for showing the headpose.
+ timUpdateHeadPose = new QTimer(this);
+ connect(timUpdateHeadPose, SIGNAL(timeout()), this, SLOT(showHeadPose()));
+ timUpdateHeadPose->start(10);
}
/** destructor stops the engine and quits the faceapi **/
@@ -654,6 +659,20 @@ void FaceTrackNoIR::setUseFilter( int set ) {
settingsDirty = true;
}
+/** Show the headpose in the widget (triggered by timer) **/
+void FaceTrackNoIR::showHeadPose() {
+THeadPoseData newdata;
+
+ Tracker::getHeadPose(&newdata);
+ ui.lcdNumX->display((double) (((int)(newdata.x * 10.0f))/10.0f));
+ ui.lcdNumY->display((double) (((int)(newdata.y * 10.0f))/10.0f));
+ ui.lcdNumZ->display((double) (((int)(newdata.z * 10.0f))/10.0f));
+
+ ui.lcdNumRotX->display((double) (((int)(newdata.yaw * 10.0f))/10.0f));
+ ui.lcdNumRotY->display((double) (((int)(newdata.pitch * 10.0f))/10.0f));
+ ui.lcdNumRotZ->display((double) (((int)(newdata.roll * 10.0f))/10.0f));
+}
+
/** set the redhold from the slider **/
void FaceTrackNoIR::setMinSmooth( int redh ) {
Tracker::setMinSmooth ( redh );
diff --git a/FaceTrackNoIR/FaceTrackNoIR.h b/FaceTrackNoIR/FaceTrackNoIR.h
index 0498770a..7518d896 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.h
+++ b/FaceTrackNoIR/FaceTrackNoIR.h
@@ -75,7 +75,8 @@ public:
private:
Ui::FaceTrackNoIRClass ui;
Tracker *tracker;
- QTimer *timMinimizeFTN;
+ QTimer *timMinimizeFTN; // Timer to Auto-minimize
+ QTimer *timUpdateHeadPose; // Timer to display headpose
QStringList iniFileList; // List of INI-files, that are present in the Settings folder
ITrackerDialogPtr pTrackerDialog; // Pointer to Tracker dialog instance (in DLL)
@@ -147,8 +148,9 @@ private:
void setInvertZ( int invert );
void setUseFilter( int set );
+ void showHeadPose();
- // reduction factor sliders
+ // EWMA filter sliders
void setMinSmooth( int redh );
void setMaxSmooth( int redh );
void setPowCurve( int redh );
diff --git a/FaceTrackNoIR/FaceTrackNoIR.ui b/FaceTrackNoIR/FaceTrackNoIR.ui
index 25adf15f..b030f18b 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.ui
+++ b/FaceTrackNoIR/FaceTrackNoIR.ui
@@ -154,6 +154,134 @@ QGroupBox {
<property name="spacing">
<number>6</number>
</property>
+ <item row="4" column="0">
+ <widget class="QWidget" name="widget4video" native="true">
+ <property name="minimumSize">
+ <size>
+ <width>250</width>
+ <height>150</height>
+ </size>
+ </property>
+ <widget class="QFrame" name="video_frame">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>250</width>
+ <height>170</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>250</width>
+ <height>150</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>500</width>
+ <height>500</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ </widget>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_6">
+ <item>
+ <widget class="QWidget" name="widget4logo" native="true">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>90</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>90</height>
+ </size>
+ </property>
+ <widget class="QPushButton" name="btnDonate">
+ <property name="geometry">
+ <rect>
+ <x>100</x>
+ <y>20</y>
+ <width>145</width>
+ <height>34</height>
+ </rect>
+ </property>
+ <property name="toolTip">
+ <string>Please help us: make gaming fun...</string>
+ </property>
+ <property name="text">
+ <string>Click here to
+Support FaceTrackNoIR!</string>
+ </property>
+ <property name="icon">
+ <iconset resource="FaceTrackNoIR.qrc">
+ <normaloff>:/UIElements/Donate.png</normaloff>:/UIElements/Donate.png</iconset>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>18</width>
+ <height>18</height>
+ </size>
+ </property>
+ </widget>
+ <widget class="QFrame" name="logoInstitute">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>90</width>
+ <height>90</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>90</width>
+ <height>90</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>16777215</width>
+ <height>90</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">QFrame#logoInstitute {
+ background:#595959 url(UIElements/logoFaceTrackNoIR.png) no-repeat;
+border:none;
+}</string>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Raised</enum>
+ </property>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </item>
<item row="5" column="0">
<widget class="QWidget" name="headPoseWidget" native="true">
<property name="minimumSize">
@@ -171,60 +299,6 @@ QGroupBox {
<property name="styleSheet">
<string notr="true"/>
</property>
- <widget class="QLineEdit" name="headRotYLine">
- <property name="geometry">
- <rect>
- <x>151</x>
- <y>40</y>
- <width>80</width>
- <height>20</height>
- </rect>
- </property>
- <property name="styleSheet">
- <string notr="true">border:1px solid #ccc;
-background:white;
-color:#000;</string>
- </property>
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- <widget class="QLineEdit" name="headRotXLine">
- <property name="geometry">
- <rect>
- <x>151</x>
- <y>10</y>
- <width>81</width>
- <height>20</height>
- </rect>
- </property>
- <property name="styleSheet">
- <string notr="true">border:1px solid #ccc;
-background:white;
-color:#000;</string>
- </property>
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
- <widget class="QLineEdit" name="headRotZLine">
- <property name="geometry">
- <rect>
- <x>150</x>
- <y>70</y>
- <width>81</width>
- <height>20</height>
- </rect>
- </property>
- <property name="styleSheet">
- <string notr="true">border:1px solid #ccc;
-background:white;
-color:#000;</string>
- </property>
- <property name="text">
- <string>N/A</string>
- </property>
- </widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
@@ -327,190 +401,86 @@ color:white;</string>
<string>rotX</string>
</property>
</widget>
- <widget class="QLineEdit" name="headZLine">
+ <widget class="QLCDNumber" name="lcdNumX">
<property name="geometry">
<rect>
<x>30</x>
- <y>70</y>
- <width>81</width>
- <height>20</height>
+ <y>10</y>
+ <width>71</width>
+ <height>23</height>
</rect>
</property>
- <property name="styleSheet">
- <string notr="true">border:1px solid #ccc;
-background:white;
-color:#000;</string>
- </property>
- <property name="text">
- <string>N/A</string>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
</property>
</widget>
- <widget class="QLineEdit" name="headYLine">
+ <widget class="QLCDNumber" name="lcdNumY">
<property name="geometry">
<rect>
<x>30</x>
<y>40</y>
- <width>81</width>
- <height>20</height>
+ <width>71</width>
+ <height>23</height>
</rect>
</property>
- <property name="styleSheet">
- <string notr="true">border:1px solid #ccc;
-background:white;
-color:#000;</string>
- </property>
- <property name="text">
- <string>N/A</string>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
</property>
</widget>
- <widget class="QLineEdit" name="headXLine">
+ <widget class="QLCDNumber" name="lcdNumZ">
<property name="geometry">
<rect>
<x>30</x>
- <y>10</y>
- <width>81</width>
- <height>20</height>
+ <y>70</y>
+ <width>71</width>
+ <height>23</height>
</rect>
</property>
- <property name="styleSheet">
- <string notr="true">border:1px solid #ccc;
-background:white;
-color:#000;</string>
- </property>
- <property name="text">
- <string>N/A</string>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
</property>
</widget>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QWidget" name="widget4video" native="true">
- <property name="minimumSize">
- <size>
- <width>250</width>
- <height>150</height>
- </size>
- </property>
- <widget class="QFrame" name="video_frame">
+ <widget class="QLCDNumber" name="lcdNumRotX">
<property name="geometry">
<rect>
- <x>0</x>
- <y>0</y>
- <width>250</width>
- <height>170</height>
+ <x>150</x>
+ <y>10</y>
+ <width>71</width>
+ <height>23</height>
</rect>
</property>
- <property name="minimumSize">
- <size>
- <width>250</width>
- <height>150</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>500</width>
- <height>500</height>
- </size>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
</property>
- <property name="styleSheet">
- <string notr="true"/>
+ </widget>
+ <widget class="QLCDNumber" name="lcdNumRotY">
+ <property name="geometry">
+ <rect>
+ <x>150</x>
+ <y>40</y>
+ <width>71</width>
+ <height>23</height>
+ </rect>
</property>
<property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
+ <enum>QFrame::NoFrame</enum>
</property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
+ </widget>
+ <widget class="QLCDNumber" name="lcdNumRotZ">
+ <property name="geometry">
+ <rect>
+ <x>150</x>
+ <y>70</y>
+ <width>71</width>
+ <height>23</height>
+ </rect>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
</property>
</widget>
</widget>
</item>
- <item row="0" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_6">
- <item>
- <widget class="QWidget" name="widget4logo" native="true">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>90</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>90</height>
- </size>
- </property>
- <widget class="QPushButton" name="btnDonate">
- <property name="geometry">
- <rect>
- <x>100</x>
- <y>20</y>
- <width>145</width>
- <height>34</height>
- </rect>
- </property>
- <property name="toolTip">
- <string>Please help us: make gaming fun...</string>
- </property>
- <property name="text">
- <string>Click here to
-Support FaceTrackNoIR!</string>
- </property>
- <property name="icon">
- <iconset resource="FaceTrackNoIR.qrc">
- <normaloff>:/UIElements/Donate.png</normaloff>:/UIElements/Donate.png</iconset>
- </property>
- <property name="iconSize">
- <size>
- <width>18</width>
- <height>18</height>
- </size>
- </property>
- </widget>
- <widget class="QFrame" name="logoInstitute">
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>90</width>
- <height>90</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>90</width>
- <height>90</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>16777215</width>
- <height>90</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true">QFrame#logoInstitute {
- background:#595959 url(UIElements/logoFaceTrackNoIR.png) no-repeat;
-border:none;
-}</string>
- </property>
- <property name="frameShape">
- <enum>QFrame::StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- </widget>
- </widget>
- </item>
- </layout>
- </item>
</layout>
</item>
<item>
@@ -2181,12 +2151,6 @@ background:none;</string>
<tabstop>btnStopTracker</tabstop>
<tabstop>btnShowEngineControls</tabstop>
<tabstop>iconcomboBox</tabstop>
- <tabstop>headXLine</tabstop>
- <tabstop>headRotXLine</tabstop>
- <tabstop>headYLine</tabstop>
- <tabstop>headRotYLine</tabstop>
- <tabstop>headZLine</tabstop>
- <tabstop>headRotZLine</tabstop>
</tabstops>
<resources>
<include location="FaceTrackNoIR.qrc"/>
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index c8208023..6455f9b6 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -258,7 +258,7 @@ void Tracker::setup(QWidget *head, FaceTrackNoIR *parent) {
bool DLL_Ok;
// retrieve pointers to the User Interface and the main Application
- headPoseWidget = head;
+// headPoseWidget = head;
mainApp = parent;
if (selectedTracker == FT_SM_FACEAPI) {
@@ -277,15 +277,6 @@ void Tracker::setup(QWidget *head, FaceTrackNoIR *parent) {
pTracker->StartTracker();
}
- // set up the line edits for calling
- headXLine = headPoseWidget->findChild<QLineEdit *>("headXLine");
- headYLine = headPoseWidget->findChild<QLineEdit *>("headYLine");
- headZLine = headPoseWidget->findChild<QLineEdit *>("headZLine");
-
- headRotXLine = headPoseWidget->findChild<QLineEdit *>("headRotXLine");
- headRotYLine = headPoseWidget->findChild<QLineEdit *>("headRotYLine");
- headRotZLine = headPoseWidget->findChild<QLineEdit *>("headRotZLine");
-
//
// Check if the Protocol-server files were installed OK.
// Some servers also create a memory-mapping, for Inter Process Communication.
@@ -320,9 +311,6 @@ void Tracker::run() {
bool lastStartStopKey = false;
bool lastInhibitKey = false;
- float rawrotX, rawrotY, rawrotZ; // Locals...
- float rawposX, rawposY, rawposZ;
-
SYSTEMTIME now;
long newHeadPoseTime;
float dT;
@@ -336,6 +324,27 @@ void Tracker::run() {
smEngineHeadPoseData temp_head_pose; // headpose from faceAPI
# endif
+ current_camera_position.x = 0.0f;
+ current_camera_position.y = 0.0f;
+ current_camera_position.z = 0.0f;
+ current_camera_position.yaw = 0.0f;
+ current_camera_position.pitch = 0.0f;
+ current_camera_position.roll = 0.0f;
+
+ target_camera_position.x = 0.0f;
+ target_camera_position.y = 0.0f;
+ target_camera_position.z = 0.0f;
+ target_camera_position.yaw = 0.0f;
+ target_camera_position.pitch = 0.0f;
+ target_camera_position.roll = 0.0f;
+
+ new_camera_position.x = 0.0f;
+ new_camera_position.y = 0.0f;
+ new_camera_position.z = 0.0f;
+ new_camera_position.yaw = 0.0f;
+ new_camera_position.pitch = 0.0f;
+ new_camera_position.roll = 0.0f;
+
//
// Test some Filter-stuff
//
@@ -533,22 +542,6 @@ void Tracker::run() {
MessageBeep (MB_ICONASTERISK);
Tracker::set_initial = true;
}
-
- rawrotX = Tracker::Pitch.headPos- Tracker::Pitch.initial_headPos; // degrees
- rawrotY = Tracker::Yaw.headPos- Tracker::Yaw.initial_headPos;
- rawrotZ = Tracker::Roll.headPos - Tracker::Roll.initial_headPos;
- rawposX = Tracker::X.headPos - Tracker::X.initial_headPos; // centimeters
- rawposY = Tracker::Y.headPos - Tracker::Y.initial_headPos;
- rawposZ = Tracker::Z.headPos - Tracker::Z.initial_headPos;
-
- headRotXLine->setText(QString("%1").arg( rawrotX, 0, 'f', 1)); // show degrees
- headRotYLine->setText(QString("%1").arg( rawrotY, 0, 'f', 1));
- headRotZLine->setText(QString("%1").arg( rawrotZ, 0, 'f', 1));
-
- headXLine->setText(QString("%1").arg( rawposX, 0, 'f', 1)); // show centimeters
- headYLine->setText(QString("%1").arg( rawposY, 0, 'f', 1));
- headZLine->setText(QString("%1").arg( rawposZ, 0, 'f', 1));
-
}
//
@@ -614,21 +607,30 @@ void Tracker::run() {
server_Game->setHeadRotY( new_camera_position.yaw );
server_Game->setHeadRotZ( new_camera_position.roll );
- server_Game->setHeadPosX( new_camera_position.x ); // centimeters
+ server_Game->setHeadPosX( new_camera_position.x ); // centimeters
server_Game->setHeadPosY( new_camera_position.y );
server_Game->setHeadPosZ( new_camera_position.z );
}
// All Protocol server(s)
if (server_Game) {
- server_Game->setVirtRotX ( new_camera_position.pitch ); // degrees
+ server_Game->setVirtRotX ( new_camera_position.pitch ); // degrees
server_Game->setVirtRotY ( new_camera_position.yaw );
server_Game->setVirtRotZ ( new_camera_position.roll );
- server_Game->setVirtPosX ( new_camera_position.x ); // centimeters
+ server_Game->setVirtPosX ( new_camera_position.x ); // centimeters
server_Game->setVirtPosY ( new_camera_position.y );
server_Game->setVirtPosZ ( new_camera_position.z );
}
+// headRotXLine->setText(QString("%1").arg( new_camera_position.pitch, 0, 'f', 1)); // show degrees
+// headRotYLine->setText(QString("%1").arg( new_camera_position.yaw, 0, 'f', 1));
+// headRotZLine->setText(QString("%1").arg( new_camera_position.roll, 0, 'f', 1));
+//
+//// headXLine->setText(QString("%1").arg( new_camera_position.x, 0, 'f', 1)); // show centimeters
+// headYLine->setText(QString("%1").arg( new_camera_position.y, 0, 'f', 1));
+// headZLine->setText(QString("%1").arg( new_camera_position.z, 0, 'f', 1));
+
+
# ifdef USE_DEBUG_CLIENT
debug_Client->setHeadRotX( Tracker::Pitch.headPos ); // degrees
debug_Client->setHeadRotY( Tracker::Yaw.headPos );
@@ -848,6 +850,19 @@ void Tracker::setPowCurve( int x ) {
}
//
+// Set the filter-value from the GUI.
+//
+void Tracker::getHeadPose( THeadPoseData *data ) {
+ data->x = Tracker::X.headPos - Tracker::X.initial_headPos; // centimeters
+ data->y = Tracker::Y.headPos - Tracker::Y.initial_headPos;
+ data->z = Tracker::Z.headPos - Tracker::Z.initial_headPos;
+
+ data->pitch = Tracker::Pitch.headPos- Tracker::Pitch.initial_headPos; // degrees
+ data->yaw = Tracker::Yaw.headPos- Tracker::Yaw.initial_headPos;
+ data->roll = Tracker::Roll.headPos - Tracker::Roll.initial_headPos;
+}
+
+//
// Get the Smoothed value from the QList.
//
float Tracker::getSmoothFromList ( QList<float> *rawList ) {
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h
index 56be4771..3eeae2f2 100644
--- a/FaceTrackNoIR/tracker.h
+++ b/FaceTrackNoIR/tracker.h
@@ -181,16 +181,6 @@ private:
static bool setEngineStop; // Stop tracker->engine, when OFF
static long prevHeadPoseTime; // Time from previous sample
- /** QT objects **/
- QLineEdit *headXLine;
- QLineEdit *headYLine;
- QLineEdit *headZLine;
-
- QLineEdit *headRotXLine;
- QLineEdit *headRotYLine;
- QLineEdit *headRotZLine;
-
- QWidget *headPoseWidget;
FaceTrackNoIR *mainApp;
QSharedPointer<ProtocolServerBase> server_Game; // Protocol Server to communicate headpose-data to the Game!
@@ -228,6 +218,8 @@ public:
static void setMaxSmooth(int x);
static void setPowCurve(int x);
+ static void getHeadPose(THeadPoseData *data); // Return the current headpose data
+
static float getSmoothFromList ( QList<float> *rawList );
static float getDegreesFromRads ( float rads ) { return (rads * 57.295781f); }
static float getRadsFromDegrees ( float degrees ) { return (degrees * 0.017453f); }
diff --git a/bin/FaceTrackNoIR.exe b/bin/FaceTrackNoIR.exe
index 17fbe3db..389124a0 100644
--- a/bin/FaceTrackNoIR.exe
+++ b/bin/FaceTrackNoIR.exe
Binary files differ
diff --git a/bin/Settings/FlightGear.ini b/bin/Settings/FlightGear.ini
index 0b3d6235..75a8f9b6 100644
--- a/bin/Settings/FlightGear.ini
+++ b/bin/Settings/FlightGear.ini
@@ -1,5 +1,5 @@
[Tracking]
-Smooth=4
+Smooth=6
invertYaw=false
invertPitch=false
invertRoll=false
@@ -13,9 +13,9 @@ redRoll=70
redX=70
redY=70
redZ=70
-minSmooth=15
+minSmooth=25
powCurve=10
-maxSmooth=50
+maxSmooth=70
[GameProtocol]
Selection=1
diff --git a/bin/Settings/SimConnect.ini b/bin/Settings/SimConnect.ini
index d7654904..95b6202b 100644
--- a/bin/Settings/SimConnect.ini
+++ b/bin/Settings/SimConnect.ini
@@ -1,5 +1,5 @@
[Tracking]
-Smooth=10
+Smooth=4
invertYaw=false
invertPitch=false
invertRoll=false
@@ -13,9 +13,9 @@ redRoll=90
redX=90
redY=90
redZ=90
-minSmooth=15
-powCurve=2
-maxSmooth=80
+minSmooth=10
+powCurve=12
+maxSmooth=70
[GameProtocol]
Selection=5
@@ -69,7 +69,7 @@ Inhibit_Roll=false
Inhibit_X=false
Inhibit_Y=false
Inhibit_Z=false
-SetEngineStop=false
+SetEngineStop=true
[FTN]
LocalPCOnly=true