summaryrefslogtreecommitdiffhomepage
path: root/FaceTrackNoIR
diff options
context:
space:
mode:
Diffstat (limited to 'FaceTrackNoIR')
-rw-r--r--FaceTrackNoIR/FGServer.h6
-rw-r--r--FaceTrackNoIR/FTIRServer.cpp7
-rw-r--r--FaceTrackNoIR/FTIRServer.h33
-rw-r--r--FaceTrackNoIR/FTServer.h30
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.cpp75
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.h10
-rw-r--r--FaceTrackNoIR/FaceTrackNoIR.ui936
-rw-r--r--FaceTrackNoIR/tracker.cpp273
-rw-r--r--FaceTrackNoIR/tracker.h46
9 files changed, 399 insertions, 1017 deletions
diff --git a/FaceTrackNoIR/FGServer.h b/FaceTrackNoIR/FGServer.h
index 0df2eb1d..bd849c80 100644
--- a/FaceTrackNoIR/FGServer.h
+++ b/FaceTrackNoIR/FGServer.h
@@ -86,9 +86,9 @@ public:
void setVirtRotX(float rot) { virtRotX = rot; }
void setVirtRotY(float rot) { virtRotY = rot; }
void setVirtRotZ(float rot) { virtRotZ = rot; }
- void setVirtPosX(float pos) { virtPosX = pos; }
- void setVirtPosY(float pos) { virtPosY = pos; }
- void setVirtPosZ(float pos) { virtPosZ = pos; }
+ void setVirtPosX(float pos) { virtPosX = pos / 100.0f; }
+ void setVirtPosY(float pos) { virtPosY = pos / 100.0f; }
+ void setVirtPosZ(float pos) { virtPosZ = pos / 100.0f; }
};
diff --git a/FaceTrackNoIR/FTIRServer.cpp b/FaceTrackNoIR/FTIRServer.cpp
index bee31ca0..a3298ace 100644
--- a/FaceTrackNoIR/FTIRServer.cpp
+++ b/FaceTrackNoIR/FTIRServer.cpp
@@ -97,6 +97,13 @@ void FTIRServer::run() {
// qDebug() << "FTIRServer says: virtRotX =" << virtRotX << " virtRotY =" << virtRotY;
setposition (virtPosX, virtPosY, virtPosZ, virtRotZ, virtRotX, virtRotY );
+ //// Use this for some debug-output to file...
+ //QFile data("outputFTIR.txt");
+ //if (data.open(QFile::WriteOnly | QFile::Append)) {
+ // QTextStream out(&data);
+ // out << virtPosX << " " << virtPosY << " " << virtPosZ << virtRotX << " " << virtRotY << " " << virtRotZ << '\n';
+ //}
+
//qDebug() << "FTIRServer says: pMemData.xRot =" << pMemData->data.xRot << " yRot =" << pMemData->data.yRot;
ReleaseMutex(hFTIRMutex);
}
diff --git a/FaceTrackNoIR/FTIRServer.h b/FaceTrackNoIR/FTIRServer.h
index 868beaaf..503514ec 100644
--- a/FaceTrackNoIR/FTIRServer.h
+++ b/FaceTrackNoIR/FTIRServer.h
@@ -68,21 +68,10 @@ private:
FTIRMemMap *pMemData;
HANDLE hFTIRMutex;
- ///** member varables for saving the head pose **/
- //float headPosX;
- //float headPosY;
- //float headPosZ;
- //
- //float headRotX;
- //float headRotY;
- //float headRotZ;
- //bool confid;
-
-
// Private properties
QString ProgramName;
QLibrary FTIRClientLib;
- float scale2AnalogLimits( float x, float min_x, float max_x );
+ static float scale2AnalogLimits( float x, float min_x, float max_x );
public:
@@ -95,21 +84,13 @@ public:
static float virtRotY;
static float virtRotZ;
- //void setHeadPosX(float x) { headPosX = x; }
- //void setHeadPosY(float y) { headPosY = y; }
- //void setHeadPosZ(float z) { headPosZ = z; }
-
- //void setHeadRotX(float x) { headRotX = x; }
- //void setHeadRotY(float y) { headRotY = y; }
- //void setHeadRotZ(float z) { headRotZ = z; }
-
- void setVirtRotX(float rot) { virtRotX = scale2AnalogLimits (rot, -180.0f, 180.0f); }
- void setVirtRotY(float rot) { virtRotY = scale2AnalogLimits (rot, -180.0f, 180.0f); }
- void setVirtRotZ(float rot) { virtRotZ = scale2AnalogLimits (rot, -180.0f, 180.0f); }
+ static void setVirtRotX(float rot) { virtRotX = scale2AnalogLimits (rot, -180.0f, 180.0f); }
+ static void setVirtRotY(float rot) { virtRotY = scale2AnalogLimits (rot, -180.0f, 180.0f); }
+ static void setVirtRotZ(float rot) { virtRotZ = scale2AnalogLimits (rot, -180.0f, 180.0f); }
- void setVirtPosX(float pos) { virtPosX = scale2AnalogLimits (pos, -50.0f, 50.0f); }
- void setVirtPosY(float pos) { virtPosY = scale2AnalogLimits (pos, -50.0f, 50.0f); }
- void setVirtPosZ(float pos) { virtPosZ = scale2AnalogLimits (pos, -50.0f, 50.0f); }
+ static void setVirtPosX(float pos) { virtPosX = scale2AnalogLimits (pos * 10.0f, -500.0f, 500.0f); }
+ static void setVirtPosY(float pos) { virtPosY = scale2AnalogLimits (pos * 10.0f, -500.0f, 500.0f); }
+ static void setVirtPosZ(float pos) { virtPosZ = scale2AnalogLimits (pos * 10.0f, -500.0f, 500.0f); }
};
diff --git a/FaceTrackNoIR/FTServer.h b/FaceTrackNoIR/FTServer.h
index fc4476b4..72642785 100644
--- a/FaceTrackNoIR/FTServer.h
+++ b/FaceTrackNoIR/FTServer.h
@@ -99,20 +99,22 @@ private:
QLibrary FTClientLib;
public:
- void setHeadPosX(float x) { headPosX = x; }
- void setHeadPosY(float y) { headPosY = y; }
- void setHeadPosZ(float z) { headPosZ = z; }
-
- void setHeadRotX(float x) { headRotX = x; }
- void setHeadRotY(float y) { headRotY = y; }
- void setHeadRotZ(float z) { headRotZ = z; }
-
- void setVirtRotX(float rot) { virtRotX = rot; }
- void setVirtRotY(float rot) { virtRotY = rot; }
- void setVirtRotZ(float rot) { virtRotZ = rot; }
- void setVirtPosX(float pos) { virtPosX = pos; }
- void setVirtPosY(float pos) { virtPosY = pos; }
- void setVirtPosZ(float pos) { virtPosZ = pos; }
+ void setHeadPosX(float x) { headPosX = x * 10; }
+ void setHeadPosY(float y) { headPosY = y * 10; }
+ void setHeadPosZ(float z) { headPosZ = z * 10; }
+
+ void setHeadRotX(float x) { headRotX = getRadsFromDegrees(x); }
+ void setHeadRotY(float y) { headRotY = getRadsFromDegrees(y); }
+ void setHeadRotZ(float z) { headRotZ = getRadsFromDegrees(z); }
+
+ void setVirtRotX(float rot) { virtRotX = getRadsFromDegrees(rot); }
+ void setVirtRotY(float rot) { virtRotY = getRadsFromDegrees(rot); }
+ void setVirtRotZ(float rot) { virtRotZ = getRadsFromDegrees(rot); }
+ void setVirtPosX(float pos) { virtPosX = pos * 10; }
+ void setVirtPosY(float pos) { virtPosY = pos * 10; }
+ void setVirtPosZ(float pos) { virtPosZ = pos * 10; }
+
+ float getRadsFromDegrees ( float degrees ) { return (degrees * 0.017453f); }
};
diff --git a/FaceTrackNoIR/FaceTrackNoIR.cpp b/FaceTrackNoIR/FaceTrackNoIR.cpp
index d3511c16..ef579436 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.cpp
+++ b/FaceTrackNoIR/FaceTrackNoIR.cpp
@@ -84,14 +84,7 @@ void FaceTrackNoIR::setupFaceTrackNoIR() {
connect(ui.btnStartTracker, SIGNAL(clicked()), this, SLOT(startTracker()));
connect(ui.btnStopTracker, SIGNAL(clicked()), this, SLOT(stopTracker()));
- // Connect sliders for sensitivity
- connect(ui.sensYaw, SIGNAL(valueChanged(int)), this, SLOT(setSensYaw(int)));
- connect(ui.sensRoll, SIGNAL(valueChanged(int)), this, SLOT(setSensRoll(int)));
- connect(ui.sensPitch, SIGNAL(valueChanged(int)), this, SLOT(setSensPitch(int)));
- connect(ui.sensX, SIGNAL(valueChanged(int)), this, SLOT(setSensX(int)));
- connect(ui.sensY, SIGNAL(valueChanged(int)), this, SLOT(setSensY(int)));
- connect(ui.sensZ, SIGNAL(valueChanged(int)), this, SLOT(setSensZ(int)));
-
+ // Connect checkboxes
connect(ui.chkInvertYaw, SIGNAL(stateChanged(int)), this, SLOT(setInvertYaw(int)));
connect(ui.chkInvertRoll, SIGNAL(stateChanged(int)), this, SLOT(setInvertRoll(int)));
connect(ui.chkInvertPitch, SIGNAL(stateChanged(int)), this, SLOT(setInvertPitch(int)));
@@ -109,8 +102,6 @@ void FaceTrackNoIR::setupFaceTrackNoIR() {
connect(ui.redY, SIGNAL(valueChanged(int)), this, SLOT(setRedY(int)));
connect(ui.redZ, SIGNAL(valueChanged(int)), this, SLOT(setRedZ(int)));
- connect(ui.slideNeutralZone, SIGNAL(valueChanged(int)), this, SLOT(setNeutralZone(int)));
-
// Connect slider for smoothing
connect(ui.slideSmoothing, SIGNAL(valueChanged(int)), this, SLOT(setSmoothing(int)));
@@ -288,13 +279,6 @@ void FaceTrackNoIR::save() {
iniFile.beginGroup ( "Tracking" );
iniFile.setValue ( "Smooth", ui.slideSmoothing->value() );
- iniFile.setValue ( "NeutralZone", ui.slideNeutralZone->value() );
- iniFile.setValue ( "sensYaw", ui.sensYaw->value() );
- iniFile.setValue ( "sensPitch", ui.sensPitch->value() );
- iniFile.setValue ( "sensRoll", ui.sensRoll->value() );
- iniFile.setValue ( "sensX", ui.sensX->value() );
- iniFile.setValue ( "sensY", ui.sensY->value() );
- iniFile.setValue ( "sensZ", ui.sensZ->value() );
iniFile.setValue ( "invertYaw", ui.chkInvertYaw->isChecked() );
iniFile.setValue ( "invertPitch", ui.chkInvertPitch->isChecked() );
iniFile.setValue ( "invertRoll", ui.chkInvertRoll->isChecked() );
@@ -351,13 +335,6 @@ void FaceTrackNoIR::loadSettings() {
iniFile.beginGroup ( "Tracking" );
ui.slideSmoothing->setValue (iniFile.value ( "Smooth", 10 ).toInt());
- ui.slideNeutralZone->setValue (iniFile.value ( "NeutralZone", 5 ).toInt());
- ui.sensYaw->setValue (iniFile.value ( "sensYaw", 100 ).toInt());
- ui.sensPitch->setValue (iniFile.value ( "sensPitch", 100 ).toInt());
- ui.sensRoll->setValue (iniFile.value ( "sensRoll", 100 ).toInt());
- ui.sensX->setValue (iniFile.value ( "sensX", 100 ).toInt());
- ui.sensY->setValue (iniFile.value ( "sensY", 100 ).toInt());
- ui.sensZ->setValue (iniFile.value ( "sensZ", 100 ).toInt());
ui.chkInvertYaw->setChecked (iniFile.value ( "invertYaw", 0 ).toBool());
ui.chkInvertPitch->setChecked (iniFile.value ( "invertPitch", 0 ).toBool());
ui.chkInvertRoll->setChecked (iniFile.value ( "invertRoll", 0 ).toBool());
@@ -426,16 +403,8 @@ void FaceTrackNoIR::startTracker( ) {
//
tracker->setup( ui.headPoseWidget , this);
tracker->setSmoothing ( ui.slideSmoothing->value() );
- tracker->setNeutralZone ( ui.slideNeutralZone->value() );
tracker->setUseFilter (ui.chkUseEWMA->isChecked() );
- tracker->setSensYaw (ui.sensYaw->value() );
- tracker->setSensPitch (ui.sensPitch->value() );
- tracker->setSensRoll (ui.sensRoll->value() );
- tracker->setSensX (ui.sensX->value() );
- tracker->setSensY (ui.sensY->value() );
- tracker->setSensZ (ui.sensZ->value() );
-
tracker->setInvertYaw (ui.chkInvertYaw->isChecked() );
tracker->setInvertPitch (ui.chkInvertPitch->isChecked() );
tracker->setInvertRoll (ui.chkInvertRoll->isChecked() );
@@ -514,42 +483,6 @@ void FaceTrackNoIR::stopTracker( ) {
ui.btnShowServerControls->setEnabled ( true );
}
-/** set the sensibility from the slider **/
-void FaceTrackNoIR::setSensYaw( int sens ) {
- Tracker::setSensYaw ( sens );
- settingsDirty = true;
-}
-
-/** set the sensibility from the slider **/
-void FaceTrackNoIR::setSensPitch( int sens ) {
- Tracker::setSensPitch ( sens );
- settingsDirty = true;
-}
-
-/** set the sensibility from the slider **/
-void FaceTrackNoIR::setSensRoll( int sens ) {
- Tracker::setSensRoll ( sens );
- settingsDirty = true;
-}
-
-/** set the sensibility from the slider **/
-void FaceTrackNoIR::setSensX( int sens ) {
- Tracker::setSensX ( sens );
- settingsDirty = true;
-}
-
-/** set the sensibility from the slider **/
-void FaceTrackNoIR::setSensY( int sens ) {
- Tracker::setSensY ( sens );
- settingsDirty = true;
-}
-
-/** set the sensibility from the slider **/
-void FaceTrackNoIR::setSensZ( int sens ) {
- Tracker::setSensZ ( sens );
- settingsDirty = true;
-}
-
/** set the invert from the checkbox **/
void FaceTrackNoIR::setInvertYaw( int invert ) {
Tracker::setInvertYaw ( (invert != 0)?true:false );
@@ -628,12 +561,6 @@ void FaceTrackNoIR::setRedZ( int redh ) {
settingsDirty = true;
}
-/** set the Neutral Zone for rotations from the slider **/
-void FaceTrackNoIR::setNeutralZone( int angle ) {
- Tracker::setNeutralZone ( angle );
- settingsDirty = true;
-}
-
/** set the smoothing from the slider **/
void FaceTrackNoIR::setSmoothing( int smooth ) {
diff --git a/FaceTrackNoIR/FaceTrackNoIR.h b/FaceTrackNoIR/FaceTrackNoIR.h
index c14d4e16..923517a4 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.h
+++ b/FaceTrackNoIR/FaceTrackNoIR.h
@@ -117,14 +117,6 @@ private:
void showKeyboardShortcuts();
void showCurveConfiguration();
- // sensibility sliders
- void setSensYaw( int sens );
- void setSensPitch( int sens );
- void setSensRoll( int sens );
- void setSensX( int sens );
- void setSensY( int sens );
- void setSensZ( int sens );
-
// invert checkboxes
void setInvertYaw( int invert );
void setInvertPitch( int invert );
@@ -143,8 +135,6 @@ private:
void setRedY( int redh );
void setRedZ( int redh );
- void setNeutralZone( int angle );
-
//smoothing slider
void setSmoothing( int smooth );
diff --git a/FaceTrackNoIR/FaceTrackNoIR.ui b/FaceTrackNoIR/FaceTrackNoIR.ui
index b0889c31..fe4facb4 100644
--- a/FaceTrackNoIR/FaceTrackNoIR.ui
+++ b/FaceTrackNoIR/FaceTrackNoIR.ui
@@ -90,6 +90,10 @@ QPushButton {
min-width: 4em;
}
+QCheckBox {
+ background:none;
+}
+
QPushButton:disabled {
color: rgb(128, 128, 128);
}
@@ -942,198 +946,7 @@ color:#000;</string>
</widget>
</item>
<item>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0" colspan="2">
- <widget class="QLabel" name="lblSensYaw_3">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>150</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true">color:#ccc;
-background:none;</string>
- </property>
- <property name="text">
- <string>Global settings</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QSlider" name="slideSmoothing">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>15</height>
- </size>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>120</number>
- </property>
- <property name="pageStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>10</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::NoTicks</enum>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QSpinBox" name="spinSmoothing">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximum">
- <number>120</number>
- </property>
- <property name="value">
- <number>10</number>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QCheckBox" name="chkUseEWMA">
- <property name="text">
- <string/>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="lblSensYaw_5">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>150</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true">color:#ccc;
-background:none;</string>
- </property>
- <property name="text">
- <string>Use EWMA filtering:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="lblSensYaw_4">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>150</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true">color:#ccc;
-background:none;</string>
- </property>
- <property name="text">
- <string>Smoothing (samples):</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QSlider" name="slideNeutralZone">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>15</height>
- </size>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="maximum">
- <number>45</number>
- </property>
- <property name="pageStep">
- <number>5</number>
- </property>
- <property name="value">
- <number>5</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::NoTicks</enum>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QSpinBox" name="spinNeutralZone">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximum">
- <number>45</number>
- </property>
- <property name="singleStep">
- <number>5</number>
- </property>
- <property name="value">
- <number>5</number>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="lblSensYaw_6">
- <property name="minimumSize">
- <size>
- <width>25</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>150</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true">color:#ccc;
-background:none;</string>
- </property>
- <property name="text">
- <string>Neutral Zone:</string>
- </property>
- </widget>
- </item>
- </layout>
+ <layout class="QGridLayout" name="gridLayout_2"/>
</item>
<item>
<spacer name="horizontalSpacer_3">
@@ -1285,30 +1098,7 @@ opacity:100;</string>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0" colspan="2">
- <widget class="QLabel" name="lblSensitivity">
- <property name="minimumSize">
- <size>
- <width>110</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>150</width>
- <height>16777215</height>
- </size>
- </property>
- <property name="styleSheet">
- <string notr="true">color:#ccc;
-background:none;</string>
- </property>
- <property name="text">
- <string>Sensitivity (100 = x1)</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
+ <item row="1" column="3">
<widget class="QLabel" name="lblSensYaw">
<property name="minimumSize">
<size>
@@ -1331,51 +1121,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QSlider" name="sensYaw">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>15</height>
- </size>
- </property>
- <property name="maximum">
- <number>500</number>
- </property>
- <property name="pageStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::NoTicks</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="2" rowspan="2">
- <widget class="QSpinBox" name="spinSensYaw">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximum">
- <number>500</number>
- </property>
- <property name="singleStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item row="1" column="6">
+ <item row="1" column="7">
<widget class="QLabel" name="lblSensX">
<property name="minimumSize">
<size>
@@ -1398,70 +1144,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="1" column="7">
- <widget class="QSlider" name="sensX">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>15</height>
- </size>
- </property>
- <property name="maximum">
- <number>500</number>
- </property>
- <property name="pageStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::NoTicks</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="8">
- <widget class="QSpinBox" name="spinSensX">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximum">
- <number>500</number>
- </property>
- <property name="singleStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item row="2" column="8" rowspan="2">
- <widget class="QSpinBox" name="spinSensY">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximum">
- <number>500</number>
- </property>
- <property name="singleStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item row="3" column="0">
+ <item row="2" column="3">
<widget class="QLabel" name="lblSensPitch">
<property name="minimumSize">
<size>
@@ -1484,51 +1167,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="3" column="1">
- <widget class="QSlider" name="sensPitch">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>15</height>
- </size>
- </property>
- <property name="maximum">
- <number>500</number>
- </property>
- <property name="pageStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::NoTicks</enum>
- </property>
- </widget>
- </item>
- <item row="3" column="2">
- <widget class="QSpinBox" name="spinSensPitch">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximum">
- <number>500</number>
- </property>
- <property name="singleStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item row="3" column="6">
+ <item row="2" column="7">
<widget class="QLabel" name="lblSensY">
<property name="minimumSize">
<size>
@@ -1551,32 +1190,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="3" column="7">
- <widget class="QSlider" name="sensY">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>15</height>
- </size>
- </property>
- <property name="maximum">
- <number>500</number>
- </property>
- <property name="pageStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::NoTicks</enum>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
+ <item row="3" column="3">
<widget class="QLabel" name="lblSensRoll">
<property name="minimumSize">
<size>
@@ -1599,51 +1213,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="4" column="1">
- <widget class="QSlider" name="sensRoll">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>15</height>
- </size>
- </property>
- <property name="maximum">
- <number>500</number>
- </property>
- <property name="pageStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::NoTicks</enum>
- </property>
- </widget>
- </item>
- <item row="4" column="2">
- <widget class="QSpinBox" name="spinSensRoll">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximum">
- <number>500</number>
- </property>
- <property name="singleStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item row="4" column="6">
+ <item row="3" column="7">
<widget class="QLabel" name="lblSensZ">
<property name="minimumSize">
<size>
@@ -1666,58 +1236,17 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="4" column="7">
- <widget class="QSlider" name="sensZ">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>15</height>
- </size>
- </property>
- <property name="maximum">
- <number>500</number>
- </property>
- <property name="pageStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::NoTicks</enum>
- </property>
- </widget>
- </item>
- <item row="4" column="8">
- <widget class="QSpinBox" name="spinSensZ">
- <property name="minimumSize">
- <size>
- <width>50</width>
- <height>22</height>
- </size>
- </property>
- <property name="maximum">
- <number>500</number>
- </property>
- <property name="singleStep">
- <number>10</number>
- </property>
- <property name="value">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item row="1" column="5">
+ <item row="1" column="6">
<widget class="QCheckBox" name="chkInvertYaw">
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
+ </property>
<property name="text">
<string/>
</property>
</widget>
</item>
- <item row="0" column="5">
+ <item row="0" column="6">
<widget class="QLabel" name="lblInvert1">
<property name="minimumSize">
<size>
@@ -1740,28 +1269,37 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="3" column="5">
+ <item row="2" column="6">
<widget class="QCheckBox" name="chkInvertPitch">
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
+ </property>
<property name="text">
<string/>
</property>
</widget>
</item>
- <item row="4" column="5">
+ <item row="3" column="6">
<widget class="QCheckBox" name="chkInvertRoll">
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
+ </property>
<property name="text">
<string/>
</property>
</widget>
</item>
- <item row="1" column="11">
+ <item row="1" column="10">
<widget class="QCheckBox" name="chkInvertX">
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
+ </property>
<property name="text">
<string/>
</property>
</widget>
</item>
- <item row="0" column="11">
+ <item row="0" column="10">
<widget class="QLabel" name="lblInvert1_2">
<property name="minimumSize">
<size>
@@ -1784,21 +1322,27 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="3" column="11">
+ <item row="2" column="10">
<widget class="QCheckBox" name="chkInvertY">
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
+ </property>
<property name="text">
<string/>
</property>
</widget>
</item>
- <item row="4" column="11">
+ <item row="3" column="10">
<widget class="QCheckBox" name="chkInvertZ">
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
+ </property>
<property name="text">
<string/>
</property>
</widget>
</item>
- <item row="1" column="3">
+ <item row="1" column="4">
<widget class="QSlider" name="redYaw">
<property name="minimumSize">
<size>
@@ -1823,7 +1367,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="3" column="3">
+ <item row="2" column="4">
<widget class="QSlider" name="redPitch">
<property name="minimumSize">
<size>
@@ -1848,7 +1392,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="4" column="3">
+ <item row="3" column="4">
<widget class="QSlider" name="redRoll">
<property name="minimumSize">
<size>
@@ -1873,7 +1417,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="1" column="4">
+ <item row="1" column="5">
<widget class="QSpinBox" name="spinRedYaw">
<property name="minimumSize">
<size>
@@ -1881,6 +1425,9 @@ background:none;</string>
<height>22</height>
</size>
</property>
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
+ </property>
<property name="maximum">
<number>100</number>
</property>
@@ -1892,7 +1439,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="3" column="4">
+ <item row="2" column="5">
<widget class="QSpinBox" name="spinRedPitch">
<property name="minimumSize">
<size>
@@ -1900,6 +1447,9 @@ background:none;</string>
<height>22</height>
</size>
</property>
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
+ </property>
<property name="maximum">
<number>100</number>
</property>
@@ -1911,7 +1461,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="4" column="4">
+ <item row="3" column="5">
<widget class="QSpinBox" name="spinRedRoll">
<property name="minimumSize">
<size>
@@ -1919,6 +1469,9 @@ background:none;</string>
<height>22</height>
</size>
</property>
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
+ </property>
<property name="maximum">
<number>100</number>
</property>
@@ -1930,7 +1483,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="0" column="3">
+ <item row="0" column="4">
<widget class="QLabel" name="lblSensitivity_2">
<property name="minimumSize">
<size>
@@ -1953,7 +1506,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="1" column="9">
+ <item row="1" column="8">
<widget class="QSlider" name="redX">
<property name="minimumSize">
<size>
@@ -1978,7 +1531,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="3" column="9">
+ <item row="2" column="8">
<widget class="QSlider" name="redY">
<property name="minimumSize">
<size>
@@ -2003,7 +1556,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="4" column="9">
+ <item row="3" column="8">
<widget class="QSlider" name="redZ">
<property name="minimumSize">
<size>
@@ -2028,7 +1581,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="1" column="10">
+ <item row="1" column="9">
<widget class="QSpinBox" name="spinRedX">
<property name="minimumSize">
<size>
@@ -2036,6 +1589,9 @@ background:none;</string>
<height>22</height>
</size>
</property>
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
+ </property>
<property name="maximum">
<number>100</number>
</property>
@@ -2047,7 +1603,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="3" column="10">
+ <item row="2" column="9">
<widget class="QSpinBox" name="spinRedY">
<property name="minimumSize">
<size>
@@ -2055,6 +1611,9 @@ background:none;</string>
<height>22</height>
</size>
</property>
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
+ </property>
<property name="maximum">
<number>100</number>
</property>
@@ -2066,7 +1625,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="4" column="10">
+ <item row="3" column="9">
<widget class="QSpinBox" name="spinRedZ">
<property name="minimumSize">
<size>
@@ -2074,6 +1633,9 @@ background:none;</string>
<height>22</height>
</size>
</property>
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
+ </property>
<property name="maximum">
<number>100</number>
</property>
@@ -2085,7 +1647,7 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="0" column="9">
+ <item row="0" column="8">
<widget class="QLabel" name="lblSensitivity_3">
<property name="minimumSize">
<size>
@@ -2108,11 +1670,21 @@ background:none;</string>
</property>
</widget>
</item>
- <item row="0" column="7">
- <widget class="QLabel" name="lblSensitivity_4">
+ <item row="1" column="2">
+ <widget class="QCheckBox" name="chkUseEWMA">
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="lblSensYaw_5">
<property name="minimumSize">
<size>
- <width>110</width>
+ <width>25</width>
<height>0</height>
</size>
</property>
@@ -2127,7 +1699,111 @@ background:none;</string>
background:none;</string>
</property>
<property name="text">
- <string>Sensitivity (100 = x1)</string>
+ <string>Use EWMA filtering:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="lblSensYaw_3">
+ <property name="minimumSize">
+ <size>
+ <width>25</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>150</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">color:#ccc;
+background:none;</string>
+ </property>
+ <property name="text">
+ <string>Global settings</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="lblSensYaw_4">
+ <property name="minimumSize">
+ <size>
+ <width>25</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>150</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">color:#ccc;
+background:none;</string>
+ </property>
+ <property name="text">
+ <string>Smoothing:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QSlider" name="slideSmoothing">
+ <property name="minimumSize">
+ <size>
+ <width>50</width>
+ <height>15</height>
+ </size>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>120</number>
+ </property>
+ <property name="pageStep">
+ <number>10</number>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="tickPosition">
+ <enum>QSlider::NoTicks</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="2">
+ <widget class="QSpinBox" name="spinSmoothing">
+ <property name="minimumSize">
+ <size>
+ <width>50</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
+ </property>
+ <property name="maximum">
+ <number>120</number>
+ </property>
+ <property name="value">
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QLabel" name="label">
+ <property name="styleSheet">
+ <string notr="true">color:#ccc;
+background:none;</string>
+ </property>
+ <property name="text">
+ <string>(samples)</string>
</property>
</widget>
</item>
@@ -2370,20 +2046,6 @@ background:none;</string>
<tabstop>btnStopTracker</tabstop>
<tabstop>btnShowEngineControls</tabstop>
<tabstop>iconcomboBox</tabstop>
- <tabstop>sensYaw</tabstop>
- <tabstop>spinSensYaw</tabstop>
- <tabstop>sensPitch</tabstop>
- <tabstop>spinSensPitch</tabstop>
- <tabstop>sensRoll</tabstop>
- <tabstop>spinSensRoll</tabstop>
- <tabstop>sensX</tabstop>
- <tabstop>spinSensX</tabstop>
- <tabstop>sensY</tabstop>
- <tabstop>spinSensY</tabstop>
- <tabstop>sensZ</tabstop>
- <tabstop>spinSensZ</tabstop>
- <tabstop>slideSmoothing</tabstop>
- <tabstop>spinSmoothing</tabstop>
<tabstop>headXLine</tabstop>
<tabstop>headRotXLine</tabstop>
<tabstop>headYLine</tabstop>
@@ -2396,198 +2058,6 @@ background:none;</string>
</resources>
<connections>
<connection>
- <sender>sensYaw</sender>
- <signal>valueChanged(int)</signal>
- <receiver>spinSensYaw</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>391</x>
- <y>442</y>
- </hint>
- <hint type="destinationlabel">
- <x>447</x>
- <y>446</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>spinSensYaw</sender>
- <signal>valueChanged(int)</signal>
- <receiver>sensYaw</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>447</x>
- <y>446</y>
- </hint>
- <hint type="destinationlabel">
- <x>391</x>
- <y>442</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>sensPitch</sender>
- <signal>valueChanged(int)</signal>
- <receiver>spinSensPitch</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>391</x>
- <y>473</y>
- </hint>
- <hint type="destinationlabel">
- <x>447</x>
- <y>476</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>spinSensPitch</sender>
- <signal>valueChanged(int)</signal>
- <receiver>sensPitch</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>447</x>
- <y>476</y>
- </hint>
- <hint type="destinationlabel">
- <x>391</x>
- <y>473</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>sensRoll</sender>
- <signal>valueChanged(int)</signal>
- <receiver>spinSensRoll</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>391</x>
- <y>499</y>
- </hint>
- <hint type="destinationlabel">
- <x>447</x>
- <y>502</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>spinSensRoll</sender>
- <signal>valueChanged(int)</signal>
- <receiver>sensRoll</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>447</x>
- <y>502</y>
- </hint>
- <hint type="destinationlabel">
- <x>391</x>
- <y>499</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>sensX</sender>
- <signal>valueChanged(int)</signal>
- <receiver>spinSensX</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>698</x>
- <y>442</y>
- </hint>
- <hint type="destinationlabel">
- <x>754</x>
- <y>445</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>spinSensX</sender>
- <signal>valueChanged(int)</signal>
- <receiver>sensX</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>754</x>
- <y>445</y>
- </hint>
- <hint type="destinationlabel">
- <x>698</x>
- <y>442</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>sensY</sender>
- <signal>valueChanged(int)</signal>
- <receiver>spinSensY</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>698</x>
- <y>473</y>
- </hint>
- <hint type="destinationlabel">
- <x>754</x>
- <y>472</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>spinSensY</sender>
- <signal>valueChanged(int)</signal>
- <receiver>sensY</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>754</x>
- <y>472</y>
- </hint>
- <hint type="destinationlabel">
- <x>698</x>
- <y>473</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>sensZ</sender>
- <signal>valueChanged(int)</signal>
- <receiver>spinSensZ</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>698</x>
- <y>499</y>
- </hint>
- <hint type="destinationlabel">
- <x>754</x>
- <y>502</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>spinSensZ</sender>
- <signal>valueChanged(int)</signal>
- <receiver>sensZ</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>754</x>
- <y>502</y>
- </hint>
- <hint type="destinationlabel">
- <x>698</x>
- <y>499</y>
- </hint>
- </hints>
- </connection>
- <connection>
<sender>slideSmoothing</sender>
<signal>valueChanged(int)</signal>
<receiver>spinSmoothing</receiver>
@@ -2811,37 +2281,5 @@ background:none;</string>
</hint>
</hints>
</connection>
- <connection>
- <sender>slideNeutralZone</sender>
- <signal>valueChanged(int)</signal>
- <receiver>spinNeutralZone</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>701</x>
- <y>233</y>
- </hint>
- <hint type="destinationlabel">
- <x>800</x>
- <y>242</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>spinNeutralZone</sender>
- <signal>valueChanged(int)</signal>
- <receiver>slideNeutralZone</receiver>
- <slot>setValue(int)</slot>
- <hints>
- <hint type="sourcelabel">
- <x>806</x>
- <y>232</y>
- </hint>
- <hint type="destinationlabel">
- <x>741</x>
- <y>231</y>
- </hint>
- </hints>
- </connection>
</connections>
</ui>
diff --git a/FaceTrackNoIR/tracker.cpp b/FaceTrackNoIR/tracker.cpp
index ce928d66..82f26fc2 100644
--- a/FaceTrackNoIR/tracker.cpp
+++ b/FaceTrackNoIR/tracker.cpp
@@ -48,7 +48,6 @@ bool Tracker::do_tracking = true;
bool Tracker::do_center = false;
bool Tracker::useFilter = false;
-float Tracker::rotNeutralZone = 0.087f; // Neutral Zone for rotations (rad)
long Tracker::prevHeadPoseTime = 0;
THeadPoseDOF Tracker::Pitch; // One structure for each of 6DOF's
THeadPoseDOF Tracker::Yaw;
@@ -231,16 +230,15 @@ void Tracker::run() {
bool lastBackKey = false; // Remember state, to detect rising edge
bool lastEqualsKey = false;
+ float rawrotX, rawrotY, rawrotZ; // Locals...
+ float rawposX, rawposY, rawposZ;
+ float rotX, rotY, rotZ; // Locals...
+ float posX, posY, posZ;
+
SYSTEMTIME now;
long newHeadPoseTime;
float dT;
- //QFile data("output.txt");
- //if (data.open(QFile::WriteOnly | QFile::Truncate)) {
- // QTextStream out(&data);
- // out << "Polling results";
- //}
-
//
// Setup the DirectInput for keyboard strokes
//
@@ -364,45 +362,41 @@ void Tracker::run() {
// to substract that later...
//
if(Tracker::set_initial == false) {
- Tracker::Z.initial_headPos = Tracker::getHeadPosZ();
+ Tracker::X.initial_headPos = Tracker::X.headPos;
+ Tracker::Y.initial_headPos = Tracker::Y.headPos;
+ Tracker::Z.initial_headPos = Tracker::Z.headPos;
MessageBeep (MB_ICONASTERISK);
Tracker::set_initial = true;
}
- headXLine->setText(QString("%1").arg(Tracker::getHeadPosX()*100, 0, 'f', 1));
- headYLine->setText(QString("%1").arg(Tracker::getHeadPosY()*100, 0, 'f', 1));
- headZLine->setText(QString("%1").arg(Tracker::getHeadPosZ()*100, 0, 'f', 1));
+ rawrotX = Tracker::Pitch.headPos; // degrees
+ rawrotY = Tracker::Yaw.headPos;
+ rawrotZ = Tracker::Roll.headPos;
+ rawposX = Tracker::X.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));
- headRotXLine->setText(QString("%1").arg(Tracker::getHeadRotX()*100, 0, 'f', 1));
- headRotYLine->setText(QString("%1").arg(Tracker::getHeadRotY()*100, 0, 'f', 1));
- headRotZLine->setText(QString("%1").arg(Tracker::getHeadRotZ()*100, 0, 'f', 1));
-//// listener.setTrackedPosition(QPoint(Tracker::getHeadPosX()-50, Tracker::getHeadPosY()-37.5));
//
// Copy the Raw values directly to Free-track server
//
if (server_FT) {
- server_FT->setHeadRotX( Tracker::Pitch.headPos ); // rads
- server_FT->setHeadRotY( Tracker::Yaw.headPos );
- server_FT->setHeadRotZ( Tracker::Roll.headPos);
+ //server_FT->setHeadRotX( rawrotX ); // degrees
+ //server_FT->setHeadRotY( rawrotY );
+ //server_FT->setHeadRotZ( rawrotZ );
- server_FT->setHeadPosX( Tracker::X.headPos * 1000.0f); // From m to mm
- server_FT->setHeadPosY( Tracker::Y.headPos * 1000.0f);
- server_FT->setHeadPosZ( ( Tracker::Z.headPos - Tracker::Z.initial_headPos ) * 1000.0f);
+ //server_FT->setHeadPosX( rawposX ); // meters
+ //server_FT->setHeadPosY( rawposY );
+ //server_FT->setHeadPosZ( rawposZ );
}
-
- //
- // Copy the Raw values directly to Fake-trackIR server
- //
- //if (server_FTIR) {
- // server_FTIR->setHeadRotX( Tracker::Pitch.headPos ); // rads
- // server_FTIR->setHeadRotY( Tracker::Yaw.headPos );
- // server_FTIR->setHeadRotZ( Tracker::Roll.headPos);
-
- // server_FTIR->setHeadPosX( Tracker::X.headPos * 1000.0f); // From m to mm
- // server_FTIR->setHeadPosY( Tracker::Y.headPos * 1000.0f);
- // server_FTIR->setHeadPosZ( ( Tracker::Z.headPos - Tracker::Z.initial_headPos ) * 1000.0f);
- //}
}
//
@@ -413,99 +407,147 @@ void Tracker::run() {
Yaw.offset_headPos = getSmoothFromList( &Yaw.rawList );
Roll.offset_headPos = getSmoothFromList( &Roll.rawList );
X.offset_headPos = getSmoothFromList( &X.rawList );
- Y.offset_headPos = getSmoothFromList( &Y.rawList );
//
// Reset the initial distance to the camera
//
+ Y.offset_headPos = getSmoothFromList( &Y.rawList ) - Tracker::Y.initial_headPos;
Z.offset_headPos = getSmoothFromList( &Z.rawList ) - Tracker::Z.initial_headPos;
Tracker::do_center = false;
}
if (Tracker::do_tracking && Tracker::confid) {
+
+////// Use this for some debug-output to file...
+//// QFile data("output.txt");
+//// if (data.open(QFile::WriteOnly | QFile::Append)) {
+//// QTextStream out(&data);
+//// out << Pitch.NeutralZone << " " << getDegreesFromRads(rotX) << " " << getOutputFromCurve(&Pitch.curve, getDegreesFromRads(rotX), Pitch.NeutralZone, Pitch.MaxInput) << '\n';
+////// out << dT << " " << getSmoothFromList( &Pitch.rawList ) << " " << Pitch.offset_headPos << '\n';
+//// }
+
// Pitch
if (Tracker::useFilter) {
- Pitch.newPos = lowPassFilter ( getSmoothFromList( &Pitch.rawList ) - Pitch.offset_headPos,
+ rotX = lowPassFilter ( getSmoothFromList( &Pitch.rawList ) - Pitch.offset_headPos,
&Pitch.prevPos, dT, Tracker::Pitch.red );
}
else {
- Pitch.newPos = getSmoothFromList( &Pitch.rawList ) - Pitch.offset_headPos;
+ rotX = getSmoothFromList( &Pitch.rawList ) - Pitch.offset_headPos;
}
-
- QFile data("output.txt");
- if (data.open(QFile::WriteOnly | QFile::Append)) {
- QTextStream out(&data);
- out << "Input = " << getDegreesFromRads(Pitch.newPos) << " Output = " << getOutputFromCurve(&Pitch.curve, getDegreesFromRads(Pitch.newPos)) << '\n';
- }
+ rotX = Pitch.invert * getOutputFromCurve(&Pitch.curve, rotX, Pitch.NeutralZone, Pitch.MaxInput);
// Yaw
if (Tracker::useFilter) {
- Yaw.newPos = lowPassFilter ( getSmoothFromList( &Yaw.rawList ) - Yaw.offset_headPos,
+ rotY = lowPassFilter ( getSmoothFromList( &Yaw.rawList ) - Yaw.offset_headPos,
&Yaw.prevPos, dT, Tracker::Yaw.red );
}
else {
- Yaw.newPos = getSmoothFromList( &Yaw.rawList ) - Yaw.offset_headPos;
+ rotY = getSmoothFromList( &Yaw.rawList ) - Yaw.offset_headPos;
}
+ rotY = Yaw.invert * getOutputFromCurve(&Yaw.curve, rotY, Yaw.NeutralZone, Yaw.MaxInput);
// Roll
if (Tracker::useFilter) {
- Roll.newPos = lowPassFilter ( getSmoothFromList( &Roll.rawList ) - Roll.offset_headPos,
+ rotZ = lowPassFilter ( getSmoothFromList( &Roll.rawList ) - Roll.offset_headPos,
&Roll.prevPos, dT, Tracker::Roll.red );
}
else {
- Roll.newPos = getSmoothFromList( &Roll.rawList ) - Roll.offset_headPos;
+ rotZ = getSmoothFromList( &Roll.rawList ) - Roll.offset_headPos;
+ }
+ rotZ = Roll.invert * getOutputFromCurve(&Roll.curve, rotZ, Roll.NeutralZone, Roll.MaxInput);
+
+ // X
+ if (Tracker::useFilter) {
+ posX = lowPassFilter ( getSmoothFromList( &X.rawList ) - X.offset_headPos,
+ &X.prevPos, dT, Tracker::X.red );
+ }
+ else {
+ posX = getSmoothFromList( &X.rawList ) - X.offset_headPos;
+ }
+ posX = X.invert * getOutputFromCurve(&X.curve, posX, X.NeutralZone, X.MaxInput);
+
+ // Y
+ if (Tracker::useFilter) {
+ posY = lowPassFilter ( getSmoothFromList( &Y.rawList ) - Y.offset_headPos - Y.initial_headPos,
+ &Y.prevPos, dT, Tracker::Y.red );
+ }
+ else {
+ posY = getSmoothFromList( &Y.rawList ) - Y.offset_headPos - Y.initial_headPos;
+ }
+ posY = Y.invert * getOutputFromCurve(&Y.curve, posY, Y.NeutralZone, Y.MaxInput);
+
+ // Z
+ if (Tracker::useFilter) {
+ posZ = lowPassFilter ( getSmoothFromList( &Z.rawList ) - Z.offset_headPos - Z.initial_headPos,
+ &Z.prevPos, dT, Tracker::Z.red );
+ }
+ else {
+ posZ = getSmoothFromList( &Z.rawList ) - Z.offset_headPos - Z.initial_headPos;
}
+ posZ = Z.invert * getOutputFromCurve(&Z.curve, posZ, Z.NeutralZone, Z.MaxInput);
+
//
// Also send the Virtual Pose to selected Protocol-Server
//
// Free-track
if (server_FT) {
- server_FT->setVirtRotX ( Tracker::Pitch.invert * Tracker::Pitch.sens * Pitch.newPos );
- server_FT->setVirtRotY ( Tracker::Yaw.invert * Tracker::Yaw.sens * Yaw.newPos );
- server_FT->setVirtRotZ ( Tracker::Roll.invert * Tracker::Roll.sens * Roll.newPos );
+ server_FT->setVirtRotX ( rotX ); // degrees
+ server_FT->setVirtRotY ( rotY );
+ server_FT->setVirtRotZ ( rotZ );
+
+ server_FT->setVirtPosX ( posX ); // centimeters
+ server_FT->setVirtPosY ( posY );
+ server_FT->setVirtPosZ ( posZ );
+
+ server_FT->setHeadRotX( rotX ); // degrees
+ server_FT->setHeadRotY( rotY );
+ server_FT->setHeadRotZ( rotZ );
+
+ server_FT->setHeadPosX( posX ); // centimeters
+ server_FT->setHeadPosY( posY );
+ server_FT->setHeadPosZ( posZ );
- server_FT->setVirtPosX ( ( Tracker::X.invert * Tracker::X.sens * (getSmoothFromList( &X.rawList ) - X.offset_headPos) ) * 1000.0f);
- server_FT->setVirtPosY ( ( Tracker::Y.invert * Tracker::Y.sens * (getSmoothFromList( &Y.rawList ) - Y.offset_headPos) ) * 1000.0f );
- server_FT->setVirtPosZ ( ( Tracker::Z.invert * Tracker::Z.sens * (getSmoothFromList( &Z.rawList ) - Z.offset_headPos - Tracker::Z.initial_headPos) ) * 1000.0f );
}
// FlightGear
if (server_FG) {
- server_FG->setVirtRotX ( getDegreesFromRads ( Tracker::Pitch.invert * Tracker::Pitch.sens * (getSmoothFromList( &Pitch.rawList ) - Pitch.offset_headPos) ) );
- server_FG->setVirtRotY ( getDegreesFromRads ( Tracker::Yaw.invert * Tracker::Yaw.sens * (getSmoothFromList( &Yaw.rawList ) - Yaw.offset_headPos) ) );
- server_FG->setVirtRotZ ( getDegreesFromRads ( Tracker::Roll.invert * Tracker::Roll.sens * (getSmoothFromList( &Roll.rawList ) - Roll.offset_headPos) ) );
- server_FG->setVirtPosX ( Tracker::X.invert * Tracker::X.sens * (getSmoothFromList( &X.rawList ) - X.offset_headPos) );
- server_FG->setVirtPosY ( Tracker::Y.invert * Tracker::Y.sens * (getSmoothFromList( &Y.rawList ) - Y.offset_headPos) );
- server_FG->setVirtPosZ ( Tracker::Z.invert * Tracker::Z.sens * (getSmoothFromList( &Z.rawList ) - Z.offset_headPos - Tracker::Z.initial_headPos) );
+ server_FG->setVirtRotX ( rotX ); // degrees
+ server_FG->setVirtRotY ( rotY );
+ server_FG->setVirtRotZ ( rotZ );
+ server_FG->setVirtPosX ( posX ); // centimeters
+ server_FG->setVirtPosY ( posY );
+ server_FG->setVirtPosZ ( posZ );
}
// PPJoy virtual joystick
if (server_PPJoy) {
- server_PPJoy->setVirtRotX ( getDegreesFromRads (Tracker::Pitch.invert * Tracker::Pitch.sens * Pitch.newPos ) );
- server_PPJoy->setVirtRotY ( getDegreesFromRads (Tracker::Yaw.invert * Tracker::Yaw.sens * Yaw.newPos ) );
- server_PPJoy->setVirtRotZ ( getDegreesFromRads (Tracker::Roll.invert * Tracker::Roll.sens * Roll.newPos ) );
+ server_PPJoy->setVirtRotX ( rotX ); // degrees
+ server_PPJoy->setVirtRotY ( rotY );
+ server_PPJoy->setVirtRotZ ( rotZ );
- server_PPJoy->setVirtPosX ( ( Tracker::X.invert * Tracker::X.sens * (getSmoothFromList( &X.rawList ) - X.offset_headPos) ) * 100.0f);
- server_PPJoy->setVirtPosY ( ( Tracker::Y.invert * Tracker::Y.sens * (getSmoothFromList( &Y.rawList ) - Y.offset_headPos) ) * 100.0f );
- server_PPJoy->setVirtPosZ ( ( Tracker::Z.invert * Tracker::Z.sens * (getSmoothFromList( &Z.rawList ) - Z.offset_headPos - Tracker::Z.initial_headPos) ) * 100.0f );
+ server_PPJoy->setVirtPosX ( posX ); // centimeters
+ server_PPJoy->setVirtPosY ( posY );
+ server_PPJoy->setVirtPosZ ( posZ );
}
// Fake-trackIR
if (server_FTIR) {
- float rotX = getDegreesFromRads ( Tracker::Pitch.invert * Tracker::Pitch.sens * Pitch.newPos );
- float rotY = getDegreesFromRads ( Tracker::Yaw.invert * Tracker::Yaw.sens * Yaw.newPos );
- float rotZ = getDegreesFromRads ( Tracker::Roll.invert * Tracker::Roll.sens * Roll.newPos );
-// qDebug() << "Tracker::run() says: virtRotX =" << rotX << " virtRotY =" << rotY;
+ // For some reason (not yet understood) the values only came through after being copied to locals...
+ // Trying again?!
+ //float rotX = getDegreesFromRads ( Tracker::Pitch.invert * Tracker::Pitch.sens * rotX );
+ //float rotY = getDegreesFromRads ( Tracker::Yaw.invert * Tracker::Yaw.sens * rotY );
+ //float rotZ = getDegreesFromRads ( Tracker::Roll.invert * Tracker::Roll.sens * rotZ );
+ qDebug() << "Tracker::run() says: virtRotX =" << rotX << " virtRotY =" << rotY;
- server_FTIR->setVirtRotX ( rotX );
+ server_FTIR->setVirtRotX ( rotX ); // degrees
server_FTIR->setVirtRotY ( rotY );
server_FTIR->setVirtRotZ ( rotZ );
- server_FTIR->setVirtPosX ( ( Tracker::X.invert * Tracker::X.sens * (getSmoothFromList( &X.rawList ) - X.offset_headPos) ) * 1000.0f);
- server_FTIR->setVirtPosY ( ( Tracker::Y.invert * Tracker::Y.sens * (getSmoothFromList( &Y.rawList ) - Y.offset_headPos) ) * 1000.0f );
- server_FTIR->setVirtPosZ ( ( Tracker::Z.invert * Tracker::Z.sens * (getSmoothFromList( &Z.rawList ) - Z.offset_headPos - Tracker::Z.initial_headPos) ) * 1000.0f );
+ server_FTIR->setVirtPosX ( posX ); // centimeters
+ server_FTIR->setVirtPosY ( posY );
+ server_FTIR->setVirtPosZ ( posZ );
}
}
@@ -568,52 +610,34 @@ void Tracker::receiveHeadPose(void *,smEngineHeadPoseData head_pose, smCameraVid
{
//
// Perform actions, when valid data is received from faceAPI.
+ // Write the Raw headpose-data and add it to the RawList, for processing...
//
if( head_pose.confidence > 0 ) {
Tracker::confid = true;
- Tracker::setHeadPosX(head_pose.head_pos.x);
- Tracker::setHeadPosY(head_pose.head_pos.y);
- Tracker::setHeadPosZ(head_pose.head_pos.z);
-
- Tracker::setHeadRotX(head_pose.head_rot.x_rads);
- Tracker::setHeadRotY(head_pose.head_rot.y_rads);
- Tracker::setHeadRotZ(head_pose.head_rot.z_rads);
// Pitch
- Pitch.newPos = getCorrectedNewRaw ( Tracker::Pitch.headPos, rotNeutralZone );
- addRaw2List ( &Pitch.rawList, Pitch.maxItems, Pitch.newPos );
+ Tracker::Pitch.headPos = head_pose.head_rot.x_rads * 57.295781f; // degrees
+ addRaw2List ( &Pitch.rawList, Pitch.maxItems, Tracker::Pitch.headPos );
// Yaw
- Yaw.newPos = getCorrectedNewRaw ( Tracker::Yaw.headPos, rotNeutralZone );
- addRaw2List ( &Yaw.rawList, Yaw.maxItems, Yaw.newPos );
+ Tracker::Yaw.headPos = head_pose.head_rot.y_rads * 57.295781f; // degrees
+ addRaw2List ( &Yaw.rawList, Yaw.maxItems, Tracker::Yaw.headPos );
// Roll
- Roll.newPos = getCorrectedNewRaw ( Tracker::Roll.headPos, rotNeutralZone );
- addRaw2List ( &Roll.rawList, Roll.maxItems, Roll.newPos );
-
- //
- // Log something
- //
- //rate = rateLimiter ( Tracker::Pitch.headPos, &Tracker::Pitch.prevRawPos, dT, 1.0f );
- //QFile data("output.txt");
- //if (data.open(QFile::WriteOnly | QFile::Append)) {
- // QTextStream out(&data);
- // out << "Limited Raw= " << rate << " dT= " << dT << " Raw= " << Tracker::Pitch.headPos << " Filtered= " << Pitch.newPos << '\n';
- //}
-
-
+ Tracker::Roll.headPos = head_pose.head_rot.z_rads * 57.295781f; // degrees
+ addRaw2List ( &Roll.rawList, Roll.maxItems, Tracker::Roll.headPos );
// X-position
- X.newPos = Tracker::X.headPos;
- addRaw2List ( &X.rawList, X.maxItems, X.newPos );
+ Tracker::X.headPos = head_pose.head_pos.x * 100.0f; // centimeters
+ addRaw2List ( &X.rawList, X.maxItems, Tracker::X.headPos );
// Y-position
- Y.newPos = Tracker::Y.headPos;
- addRaw2List ( &Y.rawList, Y.maxItems, Y.newPos );
+ Tracker::Y.headPos = head_pose.head_pos.y * 100.0f; // centimeters
+ addRaw2List ( &Y.rawList, Y.maxItems, Tracker::Y.headPos );
// Z-position (distance to camera, absolute!)
- Z.newPos = Tracker::Z.headPos;
- addRaw2List ( &Z.rawList, Z.maxItems, Z.newPos );
+ Tracker::Z.headPos = head_pose.head_pos.z * 100.0f; // centimeters
+ addRaw2List ( &Z.rawList, Z.maxItems, Tracker::Z.headPos );
} else {
Tracker::confid = false;
@@ -773,8 +797,25 @@ float clamped_value = 0.0f;
//
// Get the output from the curve.
//
-float Tracker::getOutputFromCurve ( QPainterPath *curve, float input ) {
- return curve->pointAtPercent(input/100.0f).x();
+float Tracker::getOutputFromCurve ( QPainterPath *curve, float input, float neutralzone, float maxinput ) {
+float sign;
+
+ sign = 1.0f;
+ if (input < 0.0f) {
+ sign = -1.0f;
+ }
+
+ //
+ // Always return 0 inside the NeutralZone
+ // Always return max. when input larger than expected
+ //
+ if (fabs(input) < neutralzone) return 0.0f;
+ if (fabs(input) > maxinput) return sign * curve->pointAtPercent(1.0).x();
+
+ //
+ // Return the value, derived from the Bezier-curve
+ //
+ return sign * curve->pointAtPercent((fabs(input) - neutralzone)/maxinput).x();
}
//
@@ -813,32 +854,38 @@ QPointF point1, point2, point3, point4;
iniFile.beginGroup ( "Curves" );
getCurvePoints( &iniFile, "Yaw_", &point1, &point2, &point3, &point4, NeutralZone, sensYaw, 50, 180 );
Yaw.curve.moveTo( QPointF(0,0) );
- Yaw.curve.lineTo(point1);
+ Yaw.NeutralZone = point1.y(); // Get the Neutral Zone
+ Yaw.MaxInput = point4.y(); // Get Maximum Input
Yaw.curve.cubicTo(point2, point3, point4);
getCurvePoints( &iniFile, "Pitch_", &point1, &point2, &point3, &point4, NeutralZone, sensPitch, 50, 180 );
Pitch.curve.moveTo( QPointF(0,0) );
- Pitch.curve.lineTo(point1);
- Pitch.curve.cubicTo(point2, point3, point4);
+ Pitch.NeutralZone = point1.y(); // Get the Neutral Zone
+ Pitch.MaxInput = point4.y(); // Get Maximum Input
+ Pitch.curve.cubicTo(point2, point3, point4);
getCurvePoints( &iniFile, "Roll_", &point1, &point2, &point3, &point4, NeutralZone, sensRoll, 50, 180 );
Roll.curve.moveTo( QPointF(0,0) );
- Roll.curve.lineTo(point1);
+ Roll.NeutralZone = point1.y(); // Get the Neutral Zone
+ Roll.MaxInput = point4.y(); // Get Maximum Input
Roll.curve.cubicTo(point2, point3, point4);
getCurvePoints( &iniFile, "X_", &point1, &point2, &point3, &point4, NeutralZone, sensX, 50, 180 );
X.curve.moveTo( QPointF(0,0) );
- X.curve.lineTo(point1);
+ X.NeutralZone = point1.y(); // Get the Neutral Zone
+ X.MaxInput = point4.y(); // Get Maximum Input
X.curve.cubicTo(point2, point3, point4);
getCurvePoints( &iniFile, "Y_", &point1, &point2, &point3, &point4, NeutralZone, sensY, 50, 180 );
Y.curve.moveTo( QPointF(0,0) );
- Y.curve.lineTo(point1);
+ Y.NeutralZone = point1.y(); // Get the Neutral Zone
+ Y.MaxInput = point4.y(); // Get Maximum Input
Y.curve.cubicTo(point2, point3, point4);
getCurvePoints( &iniFile, "Z_", &point1, &point2, &point3, &point4, NeutralZone, sensZ, 50, 180 );
Z.curve.moveTo( QPointF(0,0) );
- Z.curve.lineTo(point1);
+ Z.NeutralZone = point1.y(); // Get the Neutral Zone
+ Z.MaxInput = point4.y(); // Get Maximum Input
Z.curve.cubicTo(point2, point3, point4);
iniFile.endGroup ();
diff --git a/FaceTrackNoIR/tracker.h b/FaceTrackNoIR/tracker.h
index 51d83f41..e3d6063f 100644
--- a/FaceTrackNoIR/tracker.h
+++ b/FaceTrackNoIR/tracker.h
@@ -74,15 +74,15 @@ struct THeadPoseDOF {
float headPos; // Current position (from faceTracker, radials or meters)
float initial_headPos; // Position on startup (first valid value)
float offset_headPos; // Offset for centering
- float sens; // Sensitivity (multiplication factor)
float invert; // Invert measured value (= 1.0f or -1.0f)
float red; // Reduction factor (used for EWMA-filtering, between 0.0f and 1.0f)
QList<float> rawList; // List of 'n' headPos values (used for moving average)
int maxItems; // Maximum number of elements is rawList
- float newPos; // New Position (used locally)
float prevPos; // Previous Position
float prevRawPos; // Previous Raw Position
QPainterPath curve; // Bezier curve to translate input -> output
+ int NeutralZone; // Neutral zone
+ int MaxInput; // Maximum raw input
};
//
@@ -136,7 +136,6 @@ private:
static bool do_center; // Center head-position, using EQUALS key on keyboard
static bool useFilter;
- static float rotNeutralZone; // Neutral Zone for rotations (rad).
static long prevHeadPoseTime; // Time from previous sample
/** QT objects **/
@@ -172,33 +171,25 @@ public:
bool isShortKeyPressed( TShortKey *key, BYTE *keystate );
QSharedPointer<EngineBase> getEngine() { return _engine; };
-// smEngineHandle getEngineHandle() { return _engine->handle(); };
- static float getHeadPosX() {return X.headPos;}
- static float getHeadPosY() {return Y.headPos;}
- static float getHeadPosZ() {return Z.headPos;}
+ //static float getHeadPosX() {return X.headPos;}
+ //static float getHeadPosY() {return Y.headPos;}
+ //static float getHeadPosZ() {return Z.headPos;}
- static void setHeadPosX(float x) { X.headPos = x; }
- static void setHeadPosY(float y) { Y.headPos = y; }
- static void setHeadPosZ(float z) { Z.headPos = z; }
+ //static void setHeadPosX(float x) { X.headPos = x; }
+ //static void setHeadPosY(float y) { Y.headPos = y; }
+ //static void setHeadPosZ(float z) { Z.headPos = z; }
- static float getHeadRotX() {return Pitch.headPos;}
- static float getHeadRotY() {return Yaw.headPos;}
- static float getHeadRotZ() {return Roll.headPos;}
+ //static float getHeadRotX() {return Pitch.headPos;}
+ //static float getHeadRotY() {return Yaw.headPos;}
+ //static float getHeadRotZ() {return Roll.headPos;}
- static void setHeadRotX(float x) { Pitch.headPos = x; }
- static void setHeadRotY(float y) { Yaw.headPos = y; }
- static void setHeadRotZ(float z) { Roll.headPos = z; }
+ //static void setHeadRotX(float x) { Pitch.headPos = x; }
+ //static void setHeadRotY(float y) { Yaw.headPos = y; }
+ //static void setHeadRotZ(float z) { Roll.headPos = z; }
static bool getConfid() { return confid; }
- static void setSensPitch(int x) { Pitch.sens = x/100.0f; }
- static void setSensYaw(int x) { Yaw.sens = x/100.0f; }
- static void setSensRoll(int x) { Roll.sens = x/100.0f; }
- static void setSensX(int x) { X.sens = x/100.0f; }
- static void setSensY(int x) { Y.sens = x/100.0f; }
- static void setSensZ(int x) { Z.sens = x/100.0f; }
-
static void setInvertPitch(bool invert) { Pitch.invert = invert?-1.0f:+1.0f; }
static void setInvertYaw(bool invert) { Yaw.invert = invert?-1.0f:+1.0f; }
static void setInvertRoll(bool invert) { Roll.invert = invert?-1.0f:+1.0f; }
@@ -215,11 +206,10 @@ public:
static void setRedY(int x) { Y.red = x/100.0f; }
static void setRedZ(int x) { Z.red = x/100.0f; }
- static void setNeutralZone(int x) { rotNeutralZone = (x * 2.0f * 3.14159)/360.0f; }
-
- float getSmoothFromList ( QList<float> *rawList );
- float getDegreesFromRads ( float rads ) { return (rads * 57.295781f); }
- float getOutputFromCurve ( QPainterPath *curve, float input );
+ static float getSmoothFromList ( QList<float> *rawList );
+ static float getDegreesFromRads ( float rads ) { return (rads * 57.295781f); }
+ static float getRadsFromDegrees ( float degrees ) { return (degrees * 0.017453f); }
+ static float getOutputFromCurve ( QPainterPath *curve, float input, float neutralzone, float maxinput );
// For now, use one slider for all
void setSmoothing(int x) {