summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_filter_accela
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-06-18 08:45:52 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-06-18 08:45:52 +0200
commit47a512da1e98b88cd96fc761c567cef4eadd376c (patch)
tree5e1562b547dcf0f7ee3aa8fb9a6f387ce665b204 /ftnoir_filter_accela
parent33287155bdc7e4beefb45ceef0aaaeb4ecb742a7 (diff)
flush
It crashes after drawing a frame for now.
Diffstat (limited to 'ftnoir_filter_accela')
-rw-r--r--ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui299
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.cpp9
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.h37
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp85
4 files changed, 3 insertions, 427 deletions
diff --git a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui b/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui
deleted file mode 100644
index c16fbe0a..00000000
--- a/ftnoir_filter_accela/ftnoir_accela_filtercontrols.ui
+++ /dev/null
@@ -1,299 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>AccelaUICFilterControls</class>
- <widget class="QWidget" name="AccelaUICFilterControls">
- <property name="windowModality">
- <enum>Qt::NonModal</enum>
- </property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>501</width>
- <height>358</height>
- </rect>
- </property>
- <property name="windowTitle">
- <string>Accela filter settings</string>
- </property>
- <property name="windowIcon">
- <iconset resource="../facetracknoir/ui-res.qrc">
- <normaloff>:/images/filter-16.png</normaloff>:/images/filter-16.png</iconset>
- </property>
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QFrame" name="frame">
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Raised</enum>
- </property>
- <layout class="QGridLayout" name="gridLayout_3">
- <item row="1" column="3">
- <widget class="QSlider" name="rotation_slider">
- <property name="maximum">
- <number>99</number>
- </property>
- <property name="pageStep">
- <number>5</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- <property name="tickInterval">
- <number>25</number>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="lblSensYaw_6">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="styleSheet">
- <string notr="true">color:#0;
-background:none;</string>
- </property>
- <property name="text">
- <string>Rotation sensitivity</string>
- </property>
- </widget>
- </item>
- <item row="0" column="0">
- <widget class="QLabel" name="label_2">
- <property name="text">
- <string>Smoothing</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLabel" name="ewma_label">
- <property name="minimumSize">
- <size>
- <width>48</width>
- <height>0</height>
- </size>
- </property>
- <property name="text">
- <string>0 ms</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLabel" name="rot_gain">
- <property name="text">
- <string>0°</string>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QSlider" name="ewma_slider">
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="singleStep">
- <number>10</number>
- </property>
- <property name="pageStep">
- <number>25</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- <property name="tickInterval">
- <number>25</number>
- </property>
- </widget>
- </item>
- <item row="6" column="0">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Translation deadzone</string>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label_4">
- <property name="text">
- <string>Rotation deadzone</string>
- </property>
- </widget>
- </item>
- <item row="4" column="3">
- <widget class="QSlider" name="rot_dz_slider">
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QLabel" name="rot_dz">
- <property name="text">
- <string>0°</string>
- </property>
- </widget>
- </item>
- <item row="6" column="3">
- <widget class="QSlider" name="trans_dz_slider">
- <property name="maximum">
- <number>100</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="6" column="1">
- <widget class="QLabel" name="trans_dz">
- <property name="text">
- <string>0mm</string>
- </property>
- </widget>
- </item>
- <item row="5" column="0">
- <widget class="QLabel" name="label">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Translation sensitivity</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1">
- <widget class="QLabel" name="trans_gain">
- <property name="text">
- <string>0mm</string>
- </property>
- </widget>
- </item>
- <item row="5" column="3">
- <widget class="QSlider" name="translation_slider">
- <property name="maximum">
- <number>99</number>
- </property>
- <property name="pageStep">
- <number>5</number>
- </property>
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="tickPosition">
- <enum>QSlider::TicksAbove</enum>
- </property>
- <property name="tickInterval">
- <number>25</number>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="3" 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>
- <item row="1" column="0">
- <widget class="QGroupBox" name="groupBox">
- <property name="title">
- <string>GroupBox</string>
- </property>
- <layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="1">
- <widget class="QLabel" name="label_9">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" 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;justify&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;/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::AlignCenter</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="0" column="0">
- <widget class="QLabel" name="label_3">
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Visit &lt;a href=&quot;https://github.com/opentrack/opentrack/wiki/Accela-in-opentrack-2.3&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;our wiki&lt;/span&gt;&lt;/a&gt; for description of the settings.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="openExternalLinks">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <tabstops>
- <tabstop>buttonBox</tabstop>
- </tabstops>
- <resources>
- <include location="../facetracknoir/ui-res.qrc"/>
- </resources>
- <connections/>
- <slots>
- <slot>startEngineClicked()</slot>
- <slot>stopEngineClicked()</slot>
- <slot>cameraSettingsClicked()</slot>
- </slots>
-</ui>
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
index 77964d32..f0b0b468 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp
+++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp
@@ -97,12 +97,3 @@ void FTNoIR_Filter::filter(const double* input, double *output)
}
}
-extern "C" OPENTRACK_EXPORT IFilter* GetConstructor()
-{
- return new FTNoIR_Filter;
-}
-
-extern "C" OPENTRACK_EXPORT Metadata* GetMetadata()
-{
- return new FTNoIR_FilterDll;
-}
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h
index aa10e161..17698922 100644
--- a/ftnoir_filter_accela/ftnoir_filter_accela.h
+++ b/ftnoir_filter_accela/ftnoir_filter_accela.h
@@ -1,5 +1,4 @@
#pragma once
-#include "ui_ftnoir_accela_filtercontrols.h"
#include "opentrack/plugin-api.hpp"
#include <atomic>
#include <QMutex>
@@ -9,9 +8,9 @@
using namespace options;
#include "opentrack/timer.hpp"
-struct settings : opts {
+struct settings_accela : opts {
value<int> rot_threshold, trans_threshold, ewma, rot_deadzone, trans_deadzone;
- settings() :
+ settings_accela() :
opts("Accela"),
rot_threshold(b, "rotation-threshold", 30),
trans_threshold(b, "translation-threshold", 50),
@@ -27,7 +26,7 @@ public:
FTNoIR_Filter();
void filter(const double* input, double *output);
private:
- settings s;
+ settings_accela s;
bool first_run;
double last_output[6];
double smoothed_input[6];
@@ -35,33 +34,3 @@ private:
double f(double val, const double gains[][2]);
};
-
-class FilterControls: public IFilterDialog
-{
- Q_OBJECT
-public:
- FilterControls();
- void register_filter(IFilter* filter);
- void unregister_filter();
-private:
- Ui::AccelaUICFilterControls ui;
- void discard();
- void save();
- FTNoIR_Filter* accela_filter;
- settings s;
-private slots:
- void doOK();
- void doCancel();
- void update_ewma_display(int value);
- void update_rot_display(int value);
- void update_trans_display(int value);
- void update_rot_dz_display(int value);
- void update_trans_dz_display(int value);
-};
-
-class FTNoIR_FilterDll : public Metadata
-{
-public:
- QString name() { return QString("Accela"); }
- QIcon icon() { return QIcon(":/images/filter-16.png"); }
-};
diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp
deleted file mode 100644
index 550c9d24..00000000
--- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#include "ftnoir_filter_accela/ftnoir_filter_accela.h"
-#include <cmath>
-#include <QDebug>
-#include <algorithm>
-#include <QDoubleSpinBox>
-#include "opentrack/plugin-api.hpp"
-
-FilterControls::FilterControls() :
- accela_filter(nullptr)
-{
- ui.setupUi( this );
- connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK()));
- connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel()));
-
- connect(ui.rotation_slider, SIGNAL(valueChanged(int)), this, SLOT(update_rot_display(int)));
- connect(ui.translation_slider, SIGNAL(valueChanged(int)), this, SLOT(update_trans_display(int)));
- connect(ui.ewma_slider, SIGNAL(valueChanged(int)), this, SLOT(update_ewma_display(int)));
- connect(ui.rot_dz_slider, SIGNAL(valueChanged(int)), this, SLOT(update_rot_dz_display(int)));
- connect(ui.trans_dz_slider, SIGNAL(valueChanged(int)), this, SLOT(update_trans_dz_display(int)));
-
- tie_setting(s.rot_threshold, ui.rotation_slider);
- tie_setting(s.trans_threshold, ui.translation_slider);
- tie_setting(s.ewma, ui.ewma_slider);
- tie_setting(s.rot_deadzone, ui.rot_dz_slider);
- tie_setting(s.trans_deadzone, ui.trans_dz_slider);
-}
-
-void FilterControls::register_filter(IFilter* filter)
-{
- accela_filter = static_cast<FTNoIR_Filter*>(filter);
-}
-
-void FilterControls::unregister_filter()
-{
- accela_filter = nullptr;
-}
-
-void FilterControls::doOK() {
- save();
- this->close();
-}
-
-void FilterControls::doCancel() {
- discard();
- close();
-}
-
-void FilterControls::discard()
-{
- s.b->reload();
-}
-
-void FilterControls::save() {
- s.b->save();
-}
-
-void FilterControls::update_rot_display(int value)
-{
- ui.rot_gain->setText(QString::number((value + 1) * 10 / 100.) + "°");
-}
-
-void FilterControls::update_trans_display(int value)
-{
- ui.trans_gain->setText(QString::number((value + 1) * 5 / 100.) + "mm");
-}
-
-void FilterControls::update_ewma_display(int value)
-{
- ui.ewma_label->setText(QString::number(value * 2) + "ms");
-}
-
-void FilterControls::update_rot_dz_display(int value)
-{
- ui.rot_dz->setText(QString::number(value * 2 / 100.) + "°");
-}
-
-void FilterControls::update_trans_dz_display(int value)
-{
- ui.trans_dz->setText(QString::number(value * 1 / 100.) + "mm");
-}
-
-extern "C" OPENTRACK_EXPORT IFilterDialog* GetDialog()
-{
- return new FilterControls;
-}