From 9593aa9c3c231add3dadabf0a1ea9f8182f88a79 Mon Sep 17 00:00:00 2001 From: Wim Vriend Date: Wed, 2 Jan 2013 12:47:43 +0000 Subject: Added reduction parameter for Patrick. git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@202 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb --- FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui | 170 +++++++++++++++++++-- FTNoIR_Filter_Accela/FTNoIR_Filter_accela.h | 2 + FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp | 10 ++ .../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 @@ 0 0 880 - 643 + 673 @@ -44,13 +44,13 @@ 850 - 594 + 574 300 - 594 + 574 @@ -60,13 +60,13 @@ Rotation - + 20 20 819 - 244 + 510 @@ -87,14 +87,14 @@ 1 - + 255 170 0 - + 192 192 @@ -116,13 +116,13 @@ Translation - + 20 20 819 - 244 + 510 @@ -143,14 +143,14 @@ 1 - + 85 255 0 - + 192 192 @@ -167,6 +167,119 @@ + + + + + + + 25 + 0 + + + + + 150 + 16777215 + + + + color:#0; +background:none; + + + Reduction factor: + + + + + + + + 50 + 15 + + + + 1 + + + 100 + + + 5 + + + 100 + + + Qt::Horizontal + + + QSlider::NoTicks + + + + + + + + 35 + 22 + + + + background:none; + + + 1 + + + 100 + + + 100 + + + + + + + + 25 + 0 + + + + + 400 + 16777215 + + + + color:#0; +background:none; + + + (lowering this value will speed up response (in exchange for stability) + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + @@ -208,7 +321,40 @@ - + + + slideReduction + valueChanged(int) + spinReduction + setValue(int) + + + 219 + 620 + + + 310 + 622 + + + + + spinReduction + valueChanged(int) + slideReduction + setValue(int) + + + 315 + 613 + + + 170 + 621 + + + + startEngineClicked() stopEngineClicked() 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 . * * * ********************************************************************************/ +/* + 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 @@ -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 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); -- cgit v1.2.3