summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-04-29 17:13:39 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-04-29 17:13:39 +0200
commitfd3a1fc78a7e0ebd178ea0567ca8eec0d25ac53f (patch)
treecd1825cea2c494858dbb8d6abd2e3fc59b854797
parente77e01d40232e129902d0f9fade49bf81ef082ae (diff)
Replace 'game zero' with settings zero-pose in the curves dialog
-rw-r--r--facetracknoir/facetracknoir.cpp50
-rw-r--r--facetracknoir/ftnoir_curves.ui232
-rw-r--r--facetracknoir/tracker.cpp38
-rw-r--r--facetracknoir/tracker.h4
4 files changed, 299 insertions, 25 deletions
diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp
index eeff25ec..2338303e 100644
--- a/facetracknoir/facetracknoir.cpp
+++ b/facetracknoir/facetracknoir.cpp
@@ -1490,7 +1490,7 @@ QWidget( parent , f)
ui.ty_altp,
ui.tz_altp
};
-
+
for (int i = 0; i < 6; i++)
{
configs[i]->setConfig(GlobalPose->axes[i].curvePtr, currentFile);
@@ -1587,9 +1587,7 @@ void CurveConfigurationDialog::loadSettings() {
for (int i = 0; i < 6; i++)
GlobalPose->axes[i].altp = iniFile.value(names[i], false).toBool();
- iniFile.endGroup();
-
- static QCheckBox* widgets[] = {
+ QCheckBox* widgets[] = {
ui.tx_altp,
ui.ty_altp,
ui.tz_altp,
@@ -1601,6 +1599,29 @@ void CurveConfigurationDialog::loadSettings() {
for (int i = 0; i < 6; i++)
widgets[i]->setChecked(GlobalPose->axes[i].altp);
+ QDoubleSpinBox* widgets2[] = {
+ ui.pos_tx,
+ ui.pos_ty,
+ ui.pos_tz,
+ ui.pos_tx,
+ ui.pos_ry,
+ ui.pos_rz
+ };
+
+ const char* names2[] = {
+ "zero_tx",
+ "zero_ty",
+ "zero_tz",
+ "zero_rx",
+ "zero_ry",
+ "zero_rz"
+ };
+
+ for (int i = 0; i < 6; i++)
+ widgets2[i]->setValue(iniFile.value(names2[i], 0).toDouble());
+
+ iniFile.endGroup();
+
settingsDirty = false;
}
@@ -1639,6 +1660,27 @@ void CurveConfigurationDialog::save() {
iniFile.setValue("tx_alt", ui.tx_altp->checkState() != Qt::Unchecked);
iniFile.setValue("ty_alt", ui.ty_altp->checkState() != Qt::Unchecked);
iniFile.setValue("tz_alt", ui.tz_altp->checkState() != Qt::Unchecked);
+
+ QDoubleSpinBox* widgets2[] = {
+ ui.pos_tx,
+ ui.pos_ty,
+ ui.pos_tz,
+ ui.pos_tx,
+ ui.pos_ry,
+ ui.pos_rz
+ };
+
+ const char* names2[] = {
+ "zero_tx",
+ "zero_ty",
+ "zero_tz",
+ "zero_rx",
+ "zero_ry",
+ "zero_rz"
+ };
+
+ for (int i = 0; i < 6; i++)
+ iniFile.setValue(names2[i], widgets2[i]->value());
iniFile.endGroup();
diff --git a/facetracknoir/ftnoir_curves.ui b/facetracknoir/ftnoir_curves.ui
index 12203879..f47108b5 100644
--- a/facetracknoir/ftnoir_curves.ui
+++ b/facetracknoir/ftnoir_curves.ui
@@ -633,6 +633,221 @@ color: rgb(255, 255, 255);
</property>
</widget>
</widget>
+ <widget class="QWidget" name="tab_2">
+ <attribute name="title">
+ <string>Positions</string>
+ </attribute>
+ <widget class="QLabel" name="label">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>44</y>
+ <width>46</width>
+ <height>13</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>RY</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_2">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>41</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>RX</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_3">
+ <property name="geometry">
+ <rect>
+ <x>9</x>
+ <y>75</y>
+ <width>46</width>
+ <height>13</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>RZ</string>
+ </property>
+ </widget>
+ <widget class="QDoubleSpinBox" name="pos_rx">
+ <property name="geometry">
+ <rect>
+ <x>50</x>
+ <y>10</y>
+ <width>131</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="suffix">
+ <string> deg.</string>
+ </property>
+ <property name="decimals">
+ <number>3</number>
+ </property>
+ <property name="minimum">
+ <double>-180.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>180.000000000000000</double>
+ </property>
+ </widget>
+ <widget class="QDoubleSpinBox" name="pos_ry">
+ <property name="geometry">
+ <rect>
+ <x>50</x>
+ <y>40</y>
+ <width>131</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="suffix">
+ <string> deg.</string>
+ </property>
+ <property name="decimals">
+ <number>3</number>
+ </property>
+ <property name="minimum">
+ <double>-180.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>180.000000000000000</double>
+ </property>
+ </widget>
+ <widget class="QDoubleSpinBox" name="pos_rz">
+ <property name="geometry">
+ <rect>
+ <x>49</x>
+ <y>71</y>
+ <width>131</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="suffix">
+ <string> deg.</string>
+ </property>
+ <property name="decimals">
+ <number>3</number>
+ </property>
+ <property name="minimum">
+ <double>-180.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>180.000000000000000</double>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_4">
+ <property name="geometry">
+ <rect>
+ <x>209</x>
+ <y>10</y>
+ <width>41</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>TX</string>
+ </property>
+ </widget>
+ <widget class="QDoubleSpinBox" name="pos_tx">
+ <property name="geometry">
+ <rect>
+ <x>249</x>
+ <y>10</y>
+ <width>152</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="suffix">
+ <string> cm</string>
+ </property>
+ <property name="decimals">
+ <number>3</number>
+ </property>
+ <property name="minimum">
+ <double>-100.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>100.000000000000000</double>
+ </property>
+ </widget>
+ <widget class="QDoubleSpinBox" name="pos_ty">
+ <property name="geometry">
+ <rect>
+ <x>249</x>
+ <y>40</y>
+ <width>152</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="suffix">
+ <string> cm</string>
+ </property>
+ <property name="decimals">
+ <number>3</number>
+ </property>
+ <property name="minimum">
+ <double>-100.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>100.000000000000000</double>
+ </property>
+ </widget>
+ <widget class="QDoubleSpinBox" name="pos_tz">
+ <property name="geometry">
+ <rect>
+ <x>248</x>
+ <y>71</y>
+ <width>154</width>
+ <height>22</height>
+ </rect>
+ </property>
+ <property name="suffix">
+ <string> cm</string>
+ </property>
+ <property name="decimals">
+ <number>3</number>
+ </property>
+ <property name="minimum">
+ <double>-100.000000000000000</double>
+ </property>
+ <property name="maximum">
+ <double>100.000000000000000</double>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_5">
+ <property name="geometry">
+ <rect>
+ <x>209</x>
+ <y>44</y>
+ <width>46</width>
+ <height>13</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>TY</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="label_6">
+ <property name="geometry">
+ <rect>
+ <x>208</x>
+ <y>75</y>
+ <width>46</width>
+ <height>13</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>TZ</string>
+ </property>
+ </widget>
+ </widget>
</widget>
</item>
</layout>
@@ -722,6 +937,23 @@ color: rgb(255, 255, 255);
</customwidgets>
<resources/>
<connections/>
+ <designerdata>
+ <property name="gridDeltaX">
+ <number>10</number>
+ </property>
+ <property name="gridDeltaY">
+ <number>10</number>
+ </property>
+ <property name="gridSnapX">
+ <bool>false</bool>
+ </property>
+ <property name="gridSnapY">
+ <bool>false</bool>
+ </property>
+ <property name="gridVisible">
+ <bool>true</bool>
+ </property>
+ </designerdata>
<slots>
<slot>startEngineClicked()</slot>
<slot>stopEngineClicked()</slot>
diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp
index de4ba724..c42cfa22 100644
--- a/facetracknoir/tracker.cpp
+++ b/facetracknoir/tracker.cpp
@@ -98,6 +98,7 @@ static void get_curve(double pos, double& out, THeadPoseDOF& axis) {
axis.curvePtr->setTrackingActive( true );
axis.curvePtrAlt->setTrackingActive( false );
}
+ out += axis.zero;
}
/** QThread run method @override **/
@@ -182,8 +183,9 @@ void Tracker::run() {
new_camera = target_camera;
}
- for (int i = 0; i < 6; i++)
+ for (int i = 0; i < 6; i++) {
get_curve(new_camera.axes[i], output_camera.axes[i], GlobalPose->axes[i]);
+ }
//
// Send the headpose to the game
@@ -193,24 +195,6 @@ void Tracker::run() {
Libraries->pProtocol->sendHeadposeToGame( gameoutput_camera.axes, newpose ); // degrees & centimeters
}
}
- else {
- //
- // Go to initial position
- //
- if (Libraries->pProtocol) {
- for (int i = 0; i < 6; i++)
- output_camera.axes[i] = 0;
- gameoutput_camera = output_camera;
- Libraries->pProtocol->sendHeadposeToGame( gameoutput_camera.axes, newpose ); // degrees & centimeters
- }
- for (int i = 0; i < 6; i++)
- {
- GlobalPose->axes[i].curvePtr->setTrackingActive(false);
- GlobalPose->axes[i].curvePtrAlt->setTrackingActive(false);
- }
- if (Libraries->pFilter)
- Libraries->pFilter->Initialize();
- }
//for lower cpu load
usleep(1000);
@@ -251,7 +235,23 @@ void Tracker::loadSettings() {
QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
+ iniFile.beginGroup("Tracking");
+
qDebug() << "loadSettings says: iniFile = " << currentFile;
+
+ const char* names2[] = {
+ "zero_tx",
+ "zero_ty",
+ "zero_tz",
+ "zero_rx",
+ "zero_ry",
+ "zero_rz"
+ };
+
+ for (int i = 0; i < 6; i++)
+ GlobalPose->axes[i].zero = iniFile.value(names2[i], 0).toDouble();
+
+ iniFile.endGroup();
}
void Tracker::setInvertAxis(Axis axis, bool invert) { GlobalPose->axes[axis].invert = invert?-1.0f:1.0f; }
diff --git a/facetracknoir/tracker.h b/facetracknoir/tracker.h
index b1cae27f..0cd7c269 100644
--- a/facetracknoir/tracker.h
+++ b/facetracknoir/tracker.h
@@ -123,12 +123,14 @@ public:
}
headPos = 0.0f;
invert = 1;
+ zero = 0;
}
float headPos; // Current position (from faceTracker, radials or meters)
float invert; // Invert measured value (= 1.0f or -1.0f)
FunctionConfig* curvePtr; // Function to translate input -> output
FunctionConfig* curvePtrAlt;
bool altp;
+ float zero;
};
class Tracker : public QThread {
@@ -152,8 +154,6 @@ public:
void getHeadPose(double *data); // Return the current headpose data
void getOutputHeadPose(double *data); // Return the current (processed) headpose data
- float getDegreesFromRads ( float rads ) { return (rads * 57.295781f); }
- float getRadsFromDegrees ( float degrees ) { return (degrees * 0.017453f); }
volatile bool should_quit;
// following are now protected by hTrackMutex
volatile bool do_center; // Center head-position, using the shortkey