summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-10-22 10:39:17 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-10-27 16:42:57 +0200
commitd20e3d4a3ac6114b296f0284f336b59c178b4e72 (patch)
tree1e660b6bafdc533014ac893b2b17af9dbdfdad44
parent682c42a74150c1d345fa5d7dd3ed4a8136f8071d (diff)
filter/accela: kill rotation nonlinearity
-rw-r--r--filter-accela/accela-settings.hpp4
-rw-r--r--filter-accela/ftnoir_accela_filtercontrols.ui313
-rw-r--r--filter-accela/ftnoir_filter_accela.cpp12
-rw-r--r--filter-accela/ftnoir_filter_accela_dialog.cpp8
-rw-r--r--migration/20160917_00-accela.cpp5
5 files changed, 106 insertions, 236 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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;right&quot;&gt;&lt;br/&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Accela by &lt;/span&gt;&lt;a href=&quot;https://github.com/sthalik&quot;&gt;&lt;span style=&quot; font-size:10pt; text-decoration: underline; color:#0057ae;&quot;&gt;Stanisław Halik&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;&lt;br/&gt;Thanks to &lt;/span&gt;&lt;a href=&quot;https://github.com/dbaarda&quot;&gt;&lt;span style=&quot; font-size:10pt; text-decoration: underline; color:#0057ae;&quot;&gt;Donovan Baarda&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p align=&quot;right&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;2012-2015&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;right&quot;&gt;&lt;br/&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Visit &lt;/span&gt;&lt;a href=&quot;https://github.com/opentrack/opentrack/wiki/Accela-in-opentrack-2.3&quot;&gt;&lt;span style=&quot; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;our wiki&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; for description of the settings.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;x&lt;span style=&quot; vertical-align:super;&quot;&gt;2&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;right&quot;&gt;&lt;br/&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;Accela by &lt;/span&gt;&lt;a href=&quot;https://github.com/sthalik&quot;&gt;&lt;span style=&quot; font-size:10pt; text-decoration: underline; color:#0057ae;&quot;&gt;Stanisław Halik&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;&lt;br/&gt;Thanks to &lt;/span&gt;&lt;a href=&quot;https://github.com/dbaarda&quot;&gt;&lt;span style=&quot; font-size:10pt; text-decoration: underline; color:#0057ae;&quot;&gt;Donovan Baarda&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p align=&quot;right&quot;&gt;&lt;span style=&quot; font-size:10pt;&quot;&gt;2012-2015&lt;/span&gt;&lt;/p&gt;&lt;p align=&quot;right&quot;&gt;&lt;br/&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Visit &lt;/span&gt;&lt;a href=&quot;https://github.com/opentrack/opentrack/wiki/Accela-in-opentrack-2.3&quot;&gt;&lt;span style=&quot; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;our wiki&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt; for description of the settings.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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
diff --git a/migration/20160917_00-accela.cpp b/migration/20160917_00-accela.cpp
index 7704a4fe..aa14484a 100644
--- a/migration/20160917_00-accela.cpp
+++ b/migration/20160917_00-accela.cpp
@@ -107,11 +107,6 @@ struct move_accela_to_sliders : migration
tmp = val;
}
- value<slider_value> tmp(new_b, slider_name, slider_value(-1e6, s.rot_nonlinearity().min(), s.rot_nonlinearity().max()));
- tmp = old_b->contains(slider_name)
- ? old_b->get<slider_value>(slider_name)
- : slider_value(1.1, 1, 1.75);
-
new_b->save();
}
};