diff options
author | Wim Vriend <facetracknoir@gmail.com> | 2013-01-02 12:47:43 +0000 |
---|---|---|
committer | Wim Vriend <facetracknoir@gmail.com> | 2013-01-02 12:47:43 +0000 |
commit | 9593aa9c3c231add3dadabf0a1ea9f8182f88a79 (patch) | |
tree | d1757438f9fae9b280760269258b23b9849796bc | |
parent | b0fdafe9f556048023e5cdc7098e7d6fd839e40c (diff) |
Added reduction parameter for Patrick.
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@202 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
-rw-r--r-- | FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui | 170 | ||||
-rw-r--r-- | FTNoIR_Filter_Accela/FTNoIR_Filter_accela.h | 2 | ||||
-rw-r--r-- | FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp | 10 | ||||
-rw-r--r-- | FTNoIR_Filter_Accela/ftnoir_filter_accela_dialog.cpp | 17 |
4 files changed, 186 insertions, 13 deletions
diff --git a/FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui b/FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui index d5b08268..af6522ce 100644 --- a/FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui +++ b/FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui @@ -10,7 +10,7 @@ <x>0</x>
<y>0</y>
<width>880</width>
- <height>643</height>
+ <height>673</height>
</rect>
</property>
<property name="windowTitle">
@@ -44,13 +44,13 @@ <property name="minimumSize">
<size>
<width>850</width>
- <height>594</height>
+ <height>574</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>300</width>
- <height>594</height>
+ <height>574</height>
</size>
</property>
<property name="currentIndex">
@@ -60,13 +60,13 @@ <attribute name="title">
<string>Rotation</string>
</attribute>
- <widget class="QFunctionConfigurator" name="scalingConfig" native="true">
+ <widget class="QFunctionConfigurator" name="scalingConfig">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>819</width>
- <height>244</height>
+ <height>510</height>
</rect>
</property>
<property name="maxInputEGU" stdset="0">
@@ -87,14 +87,14 @@ <property name="gridDistEGU_Output" stdset="0">
<number>1</number>
</property>
- <property name="colorBezier" stdset="0">
+ <property name="colorBezier">
<color>
<red>255</red>
<green>170</green>
<blue>0</blue>
</color>
</property>
- <property name="colorBackground" stdset="0">
+ <property name="colorBackground">
<color>
<red>192</red>
<green>192</green>
@@ -116,13 +116,13 @@ <attribute name="title">
<string>Translation</string>
</attribute>
- <widget class="QFunctionConfigurator" name="translationScalingConfig" native="true">
+ <widget class="QFunctionConfigurator" name="translationScalingConfig">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>819</width>
- <height>244</height>
+ <height>510</height>
</rect>
</property>
<property name="maxInputEGU" stdset="0">
@@ -143,14 +143,14 @@ <property name="gridDistEGU_Output" stdset="0">
<number>1</number>
</property>
- <property name="colorBezier" stdset="0">
+ <property name="colorBezier">
<color>
<red>85</red>
<green>255</green>
<blue>0</blue>
</color>
</property>
- <property name="colorBackground" stdset="0">
+ <property name="colorBackground">
<color>
<red>192</red>
<green>192</green>
@@ -168,6 +168,119 @@ </widget>
</item>
<item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <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:#0;
+background:none;</string>
+ </property>
+ <property name="text">
+ <string>Reduction factor:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSlider" name="slideReduction">
+ <property name="minimumSize">
+ <size>
+ <width>50</width>
+ <height>15</height>
+ </size>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ <property name="pageStep">
+ <number>5</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>
+ <widget class="QSpinBox" name="spinReduction">
+ <property name="minimumSize">
+ <size>
+ <width>35</width>
+ <height>22</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">background:none;</string>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>100</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="lblSensYaw_5">
+ <property name="minimumSize">
+ <size>
+ <width>25</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>400</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">color:#0;
+background:none;</string>
+ </property>
+ <property name="text">
+ <string>(lowering this value will speed up response (in exchange for stability)</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <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>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="spacer">
@@ -208,7 +321,40 @@ </customwidget>
</customwidgets>
<resources/>
- <connections/>
+ <connections>
+ <connection>
+ <sender>slideReduction</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>spinReduction</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>219</x>
+ <y>620</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>310</x>
+ <y>622</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spinReduction</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>slideReduction</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>315</x>
+ <y>613</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>170</x>
+ <y>621</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
<slots>
<slot>startEngineClicked()</slot>
<slot>stopEngineClicked()</slot>
diff --git a/FTNoIR_Filter_Accela/FTNoIR_Filter_accela.h b/FTNoIR_Filter_Accela/FTNoIR_Filter_accela.h index 0a57eb88..77aa59ea 100644 --- a/FTNoIR_Filter_Accela/FTNoIR_Filter_accela.h +++ b/FTNoIR_Filter_Accela/FTNoIR_Filter_accela.h @@ -86,6 +86,7 @@ private: bool first_run;
double kFactor, kFactorTranslation;
double kSensitivity, kSensitivityTranslation;
+ double kMagicNumber; // Stanislaws' magic number (should be 100 according to him...)
FunctionConfig functionConfig;
FunctionConfig translationFunctionConfig;
@@ -124,6 +125,7 @@ private slots: void doOK();
void doCancel();
void settingChanged(bool) { settingsDirty = true; };
+ void settingChanged(int) { settingsDirty = true; };
};
//*******************************************************************************************************
diff --git a/FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp b/FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp index a6f9264b..3e4c3bf6 100644 --- a/FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp +++ b/FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp @@ -21,6 +21,7 @@ FTNoIR_Filter::FTNoIR_Filter() : translationFunctionConfig("Accela-Scaling-Translation", 4, 6)
{
first_run = true;
+ kMagicNumber = 100.0f;
loadSettings(); // Load the Settings
}
@@ -54,6 +55,11 @@ void FTNoIR_Filter::loadSettings() { defPoints.append(defScaleTranslation[i]);
}
translationFunctionConfig.loadSettings(iniFile, defPoints);
+
+ iniFile.beginGroup ( "Accela" );
+ kMagicNumber = iniFile.value ( "Reduction", 100 ).toFloat();
+ iniFile.endGroup ();
+
}
void FTNoIR_Filter::FilterHeadPoseData(THeadPoseData *current_camera_position, THeadPoseData *target_camera_position, THeadPoseData *new_camera_position, bool newTarget)
@@ -123,7 +129,11 @@ void FTNoIR_Filter::FilterHeadPoseData(THeadPoseData *current_camera_position, T // the idea is that "empty" updates without new head pose data are still
// useful for filtering, as skipping them would result in jerky output.
// the magic "100" is the amount of calls to the filter by FTNOIR per sec.
+ // WVR: Added kMagicNumber for Patrick
double velocity = foo / 100.0;
+ if (kMagicNumber > 0.0f) {
+ double velocity = foo / kMagicNumber;
+ }
double sum = start + velocity * sign;
bool done = (sign > 0 ? sum >= e2 : sum <= e2);
if (done) {
diff --git a/FTNoIR_Filter_Accela/ftnoir_filter_accela_dialog.cpp b/FTNoIR_Filter_Accela/ftnoir_filter_accela_dialog.cpp index 8af8a280..c230eed8 100644 --- a/FTNoIR_Filter_Accela/ftnoir_filter_accela_dialog.cpp +++ b/FTNoIR_Filter_Accela/ftnoir_filter_accela_dialog.cpp @@ -3,7 +3,7 @@ * gamers from Holland, who don't like to pay much for *
* head-tracking. *
* *
-* Copyright (C) 2012 Wim Vriend (Developing) *
+* Copyright (C) 2013 Wim Vriend (Developing) *
* Ron Hendriks (Researching and Testing) *
* *
* Homepage *
@@ -22,6 +22,10 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************/
+/*
+ Modifications (last one on top):
+ 20130102 - WVR: Added 'reduction factor' to accommodate Patrick's need for speed.
+*/
#include "ftnoir_filter_Accela.h"
#include "math.h"
#include <QDebug>
@@ -46,6 +50,9 @@ FilterControls::FilterControls() : connect(ui.scalingConfig, SIGNAL(CurveChanged(bool)), this, SLOT(settingChanged(bool)));
connect(ui.translationScalingConfig, SIGNAL(CurveChanged(bool)), this, SLOT(settingChanged(bool)));
+ // Connect slider for reduction
+ connect(ui.slideReduction, SIGNAL(valueChanged(int)), this, SLOT(settingChanged(int)));
+
qDebug() << "FilterControls() says: started";
}
@@ -160,6 +167,10 @@ QList<QPointF> defPoints; ui.translationScalingConfig->setConfig(&translationFunctionConfig, currentFile);
ui.scalingConfig->setConfig(&functionConfig, currentFile);
+ iniFile.beginGroup ( "Accela" );
+ ui.slideReduction->setValue (iniFile.value ( "Reduction", 100 ).toInt());
+ iniFile.endGroup ();
+
settingsDirty = false;
}
@@ -174,6 +185,10 @@ void FilterControls::save() { qDebug() << "FTNoIR_Filter::save() says: iniFile = " << currentFile;
+ iniFile.beginGroup ( "Accela" );
+ iniFile.setValue ( "Reduction", ui.slideReduction->value() );
+ iniFile.endGroup ();
+
functionConfig.saveSettings(iniFile);
translationFunctionConfig.saveSettings(iniFile);
|