diff options
Diffstat (limited to 'filter-accela')
-rw-r--r-- | filter-accela/accela-settings.hpp | 4 | ||||
-rw-r--r-- | filter-accela/ftnoir_accela_filtercontrols.ui | 313 | ||||
-rw-r--r-- | filter-accela/ftnoir_filter_accela.cpp | 12 | ||||
-rw-r--r-- | filter-accela/ftnoir_filter_accela_dialog.cpp | 8 |
4 files changed, 106 insertions, 231 deletions
diff --git a/filter-accela/accela-settings.hpp b/filter-accela/accela-settings.hpp index 3c4487be..2dfc965c 100644 --- a/filter-accela/accela-settings.hpp +++ b/filter-accela/accela-settings.hpp @@ -50,14 +50,12 @@ struct settings_accela : opts value<slider_value> rot_sensitivity, pos_sensitivity; value<slider_value> rot_deadzone, pos_deadzone; value<slider_value> ewma; - value<slider_value> rot_nonlinearity; settings_accela() : opts("accela-sliders"), rot_sensitivity(b, "rotation-sensitivity", slider_value(1.5, .05, 2.5)), pos_sensitivity(b, "translation-sensitivity", slider_value(1., .05, 1.5)), rot_deadzone(b, "rotation-deadzone", slider_value(.03, 0, .1)), pos_deadzone(b, "translation-deadzone", slider_value(.1, 0, 1)), - ewma(b, "ewma", slider_value(0, 0, 200)), - rot_nonlinearity(b, "rotation-nonlinearity", slider_value(1, 1, 1.25)) + ewma(b, "ewma", slider_value(0, 0, 200)) {} }; diff --git a/filter-accela/ftnoir_accela_filtercontrols.ui b/filter-accela/ftnoir_accela_filtercontrols.ui index 913b775e..f390c329 100644 --- a/filter-accela/ftnoir_accela_filtercontrols.ui +++ b/filter-accela/ftnoir_accela_filtercontrols.ui @@ -10,7 +10,7 @@ <x>0</x> <y>0</y> <width>550</width> - <height>431</height> + <height>345</height> </rect> </property> <property name="sizePolicy"> @@ -36,67 +36,62 @@ <property name="topMargin"> <number>5</number> </property> - <item row="0" column="0"> - <widget class="QGroupBox" name="groupBox66"> - <property name="title"> - <string>General</string> + <item row="3" column="0"> + <widget class="QLabel" name="label_9"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="font"> + <font> + <pointsize>7</pointsize> + </font> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="text"> + <string><html><head/><body><p align="right"><br/><span style=" font-size:10pt;">Accela by </span><a href="https://github.com/sthalik"><span style=" font-size:10pt; text-decoration: underline; color:#0057ae;">Stanisław Halik</span></a><span style=" font-size:10pt;"><br/>Thanks to </span><a href="https://github.com/dbaarda"><span style=" font-size:10pt; text-decoration: underline; color:#0057ae;">Donovan Baarda</span></a></p><p align="right"><span style=" font-size:10pt;">2012-2015</span></p><p align="right"><br/><span style=" font-size:8pt;">Visit </span><a href="https://github.com/opentrack/opentrack/wiki/Accela-in-opentrack-2.3"><span style=" font-size:8pt; text-decoration: underline; color:#0000ff;">our wiki</span></a><span style=" font-size:8pt;"> for description of the settings.</span></p></body></html></string> + </property> + <property name="textFormat"> + <enum>Qt::RichText</enum> + </property> + <property name="scaledContents"> + <bool>false</bool> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="indent"> + <number>0</number> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + <property name="textInteractionFlags"> + <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="topMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Smoothing</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="ewma_label"> - <property name="minimumSize"> - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>0 ms</string> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="ewma_slider"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>20</number> - </property> - <property name="pageStep"> - <number>1</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="tickPosition"> - <enum>QSlider::TicksAbove</enum> - </property> - <property name="tickInterval"> - <number>5</number> - </property> - </widget> - </item> - </layout> </widget> </item> <item row="2" column="0"> @@ -339,166 +334,69 @@ </layout> </widget> </item> - <item row="3" column="0"> - <widget class="QGroupBox" name="groupBox"> + <item row="0" column="0"> + <widget class="QGroupBox" name="groupBox66"> <property name="title"> - <string>Rotation nonlinearity</string> + <string>General</string> </property> - <layout class="QVBoxLayout" name="verticalLayout"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="topMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> <item> - <widget class="QLabel" name="label_5"> + <widget class="QLabel" name="label_2"> <property name="text"> - <string>Setting it higher will filter out rotation noise but may cause sudden jumps on very high settings.</string> + <string>Smoothing</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="ewma_label"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> </property> - <property name="wordWrap"> - <bool>true</bool> + <property name="text"> + <string>0 ms</string> </property> </widget> </item> <item> - <widget class="QFrame" name="frame"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="spacing"> - <number>6</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Value</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="rot_nl"> - <property name="minimumSize"> - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="font"> - <font> - <pointsize>12</pointsize> - </font> - </property> - <property name="text"> - <string><html><head/><body><p>x<span style=" vertical-align:super;">2</span></p></body></html></string> - </property> - </widget> - </item> - <item> - <widget class="QSlider" name="rot_nl_slider"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimum"> - <number>0</number> - </property> - <property name="maximum"> - <number>10</number> - </property> - <property name="pageStep"> - <number>1</number> - </property> - <property name="value"> - <number>1</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="tickPosition"> - <enum>QSlider::TicksAbove</enum> - </property> - <property name="tickInterval"> - <number>3</number> - </property> - </widget> - </item> - </layout> + <widget class="QSlider" name="ewma_slider"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimum"> + <number>0</number> + </property> + <property name="maximum"> + <number>20</number> + </property> + <property name="pageStep"> + <number>1</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksAbove</enum> + </property> + <property name="tickInterval"> + <number>5</number> + </property> </widget> </item> </layout> </widget> </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_9"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="font"> - <font> - <pointsize>7</pointsize> - </font> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="text"> - <string><html><head/><body><p align="right"><br/><span style=" font-size:10pt;">Accela by </span><a href="https://github.com/sthalik"><span style=" font-size:10pt; text-decoration: underline; color:#0057ae;">Stanisław Halik</span></a><span style=" font-size:10pt;"><br/>Thanks to </span><a href="https://github.com/dbaarda"><span style=" font-size:10pt; text-decoration: underline; color:#0057ae;">Donovan Baarda</span></a></p><p align="right"><span style=" font-size:10pt;">2012-2015</span></p><p align="right"><br/><span style=" font-size:8pt;">Visit </span><a href="https://github.com/opentrack/opentrack/wiki/Accela-in-opentrack-2.3"><span style=" font-size:8pt; text-decoration: underline; color:#0000ff;">our wiki</span></a><span style=" font-size:8pt;"> for description of the settings.</span></p></body></html></string> - </property> - <property name="textFormat"> - <enum>Qt::RichText</enum> - </property> - <property name="scaledContents"> - <bool>false</bool> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - <property name="margin"> - <number>0</number> - </property> - <property name="indent"> - <number>0</number> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - <property name="textInteractionFlags"> - <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> </layout> </widget> <tabstops> @@ -507,7 +405,6 @@ <tabstop>rot_dz_slider</tabstop> <tabstop>translation_slider</tabstop> <tabstop>trans_dz_slider</tabstop> - <tabstop>rot_nl_slider</tabstop> </tabstops> <resources> <include location="../gui/opentrack-res.qrc"/> diff --git a/filter-accela/ftnoir_filter_accela.cpp b/filter-accela/ftnoir_filter_accela.cpp index 51b5d6e9..8a403211 100644 --- a/filter-accela/ftnoir_filter_accela.cpp +++ b/filter-accela/ftnoir_filter_accela.cpp @@ -101,7 +101,6 @@ void accela::filter(const double* input, double *output) const double alpha = dt/(dt+RC); const double rot_dz = s.rot_deadzone.to<double>(); const double pos_dz = s.pos_deadzone.to<double>(); - const double nl = s.rot_nonlinearity.to<double>(); // rot @@ -117,17 +116,6 @@ void accela::filter(const double* input, double *output) deltas[i] = d / rot_thres; } - if (nl > 1.) - { - for (unsigned k = 3; k < 6; k++) - { - static constexpr double nl_end = 7; - - if (fabs(deltas[k]) <= nl_end) - deltas[k] = copysign(pow(fabs(deltas[k]/nl_end), nl) * nl_end, deltas[k]); - } - } - do_deltas(&deltas[Yaw], &output[Yaw], alpha, smoothed_input[0], [this](double x) { return spline_rot.get_value_no_save(x); }); #if defined DEBUG_ACCELA diff --git a/filter-accela/ftnoir_filter_accela_dialog.cpp b/filter-accela/ftnoir_filter_accela_dialog.cpp index c504188a..ab6634c4 100644 --- a/filter-accela/ftnoir_filter_accela_dialog.cpp +++ b/filter-accela/ftnoir_filter_accela_dialog.cpp @@ -25,20 +25,12 @@ dialog_accela::dialog_accela() tie_setting(s.ewma, ui.ewma_slider); tie_setting(s.rot_deadzone, ui.rot_dz_slider); tie_setting(s.pos_deadzone, ui.trans_dz_slider); - tie_setting(s.rot_nonlinearity, ui.rot_nl_slider); tie_setting(s.rot_sensitivity, ui.rot_gain, [](const slider_value& s) { return tr("%1°").arg(s, 0, 'g', 4); }); tie_setting(s.pos_sensitivity, ui.trans_gain, [](const slider_value& s) { return tr("%1mm").arg(s, 0, 'g', 4); }); tie_setting(s.ewma, ui.ewma_label, [](const slider_value& s) { return tr("%1ms").arg(s); }); tie_setting(s.rot_deadzone, ui.rot_dz, [](const slider_value& s) { return tr("%1°").arg(s, 0, 'g', 4); }); tie_setting(s.pos_deadzone, ui.trans_dz, [](const slider_value& s) { return tr("%1mm").arg(s); }); - tie_setting(s.rot_nonlinearity, ui.rot_nl, [](const slider_value& s) { - return tr("<html><head/><body>" - "<p>x<span style='vertical-align:super;'>" - "%1" - "</span></p>" - "</body></html>").arg(s); - }); //#define SPLINE_ROT_DEBUG //#define SPLINE_TRANS_DEBUG |