diff options
53 files changed, 2399 insertions, 3362 deletions
diff --git a/3rdparty-notices/ARUCO-COPYING.txt b/3rdparty-notices/ARUCO-COPYING.txt deleted file mode 100644 index 24e57080..00000000 --- a/3rdparty-notices/ARUCO-COPYING.txt +++ /dev/null @@ -1,35 +0,0 @@ -The ARUCO Library has been developed by the Ava group of the Univeristy of Cordoba(Spain) -Contact to Rafael Muñoz Salinas <rmsalinas@uco.es> - ------------------------------------------------------------------------ - -Copyright 2011 Rafael Muñoz Salinas. All rights reserved. - - -Redistribution and use in source and binary forms, with or without modification, are -permitted provided that the following conditions are met: - - - 1. Redistributions of source code must retain the above copyright notice, this list of - conditions and the following disclaimer. - - - 2. Redistributions in binary form must reproduce the above copyright notice, this list - of conditions and the following disclaimer in the documentation and/or other materials - provided with the distribution. - - -THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -The views and conclusions contained in the software and documentation are those of the -authors and should not be interpreted as representing official policies, either expressed -or implied, of Rafael Muñoz Salinas. diff --git a/3rdparty-notices/HEADTRACKER-LICENSE.txt b/3rdparty-notices/HEADTRACKER-LICENSE.txt deleted file mode 100644 index a1a778e6..00000000 --- a/3rdparty-notices/HEADTRACKER-LICENSE.txt +++ /dev/null @@ -1,32 +0,0 @@ -Copyright (c) 2012-2013 Stanisław Halik <sthalik@misaki.pl> - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ------------------------------------------------------------------------- - -Credit for the head mesh: - -Jed Frechette submitted the mesh as a pull request. -I cannot thank him enough! - ------------------------------------------------------------------------- - -The project links against the flandmark library, written by -Michal Uřičář and Vojtěch Franc. The library is GPL3-licensed. - -More info at: http://cmp.felk.cvut.cz/~uricamic/flandmark -Github repo: https://github.com/uricamic/flandmark - ------------------------------------------------------------------------- - -The projects uses OpenCV, see http://code.opencv.org for more info.
\ No newline at end of file diff --git a/3rdparty-notices/LIBQXT-COPYING.txt b/3rdparty-notices/LIBQXT-COPYING.txt deleted file mode 100644 index 252b76ba..00000000 --- a/3rdparty-notices/LIBQXT-COPYING.txt +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ diff --git a/3rdparty-notices/POINTTRACKER-COPYING.txt b/3rdparty-notices/POINTTRACKER-COPYING.txt new file mode 100644 index 00000000..1edf8a19 --- /dev/null +++ b/3rdparty-notices/POINTTRACKER-COPYING.txt @@ -0,0 +1,8 @@ +PointTracker was released under the following notice: + +/* Copyright (c) 2012 Patrick Ruoff + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + */
\ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index fef1baed..2be2a878 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,9 +13,9 @@ include(opentrack-install) set(C CMakeLists.txt) file(GLOB opentrack-subprojects - "tracker-*/${C}" + "tracker-pt/${C}" "proto-*/${C}" - "filter-*/${C}" + "filter-accela/${C}" "opentrack*/${C}" "gui/${C}" "x-plane-plugin/${C}" diff --git a/cmake/opentrack-install.cmake b/cmake/opentrack-install.cmake index 598572fa..ade8861a 100644 --- a/cmake/opentrack-install.cmake +++ b/cmake/opentrack-install.cmake @@ -7,7 +7,7 @@ endif() install(FILES ${CMAKE_SOURCE_DIR}/README.md DESTINATION .) install(DIRECTORY ${CMAKE_SOURCE_DIR}/3rdparty-notices DESTINATION .) -install(DIRECTORY "${CMAKE_SOURCE_DIR}/settings" "${CMAKE_SOURCE_DIR}/contrib" DESTINATION .) +install(DIRECTORY "${CMAKE_SOURCE_DIR}/settings" DESTINATION .) install(FILES "${CMAKE_SOURCE_DIR}/bin/freetrackclient.dll" DESTINATION . ${opentrack-perms}) install(FILES diff --git a/filter-accela/CMakeLists.txt b/filter-accela/CMakeLists.txt index 5bfa8128..df4064e2 100644 --- a/filter-accela/CMakeLists.txt +++ b/filter-accela/CMakeLists.txt @@ -1,2 +1,2 @@ -opentrack_boilerplate(opentrack-filter-accela) +opentrack_boilerplate(opentrack-filter-accela STATIC) target_link_libraries(opentrack-filter-accela opentrack-spline-widget) diff --git a/filter-accela/ftnoir_accela_filtercontrols.ui b/filter-accela/ftnoir_accela_filtercontrols.ui deleted file mode 100644 index 1066cd88..00000000 --- a/filter-accela/ftnoir_accela_filtercontrols.ui +++ /dev/null @@ -1,276 +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>521</width> - <height>317</height> - </rect> - </property> - <property name="windowTitle"> - <string>Accela filter settings</string> - </property> - <property name="windowIcon"> - <iconset resource="../gui/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="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="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> - </layout> - </widget> - <tabstops> - <tabstop>buttonBox</tabstop> - </tabstops> - <resources> - <include location="../gui/ui-res.qrc"/> - </resources> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> diff --git a/filter-accela/ftnoir_filter_accela.cpp b/filter-accela/ftnoir_filter_accela.cpp index 0bc03097..b29c989a 100644 --- a/filter-accela/ftnoir_filter_accela.cpp +++ b/filter-accela/ftnoir_filter_accela.cpp @@ -105,6 +105,3 @@ void FTNoIR_Filter::filter(const double* input, double *output) last_output[i] = output[i] = result; } } - -OPENTRACK_DECLARE_FILTER(FTNoIR_Filter, FilterControls, FTNoIR_FilterDll) - diff --git a/filter-accela/ftnoir_filter_accela.h b/filter-accela/ftnoir_filter_accela.h index 289b84f0..94408fb1 100644 --- a/filter-accela/ftnoir_filter_accela.h +++ b/filter-accela/ftnoir_filter_accela.h @@ -5,7 +5,6 @@ * copyright notice and this permission notice appear in all copies. */ #pragma once -#include "ui_ftnoir_accela_filtercontrols.h" #include "opentrack/plugin-api.hpp" #include "spline-widget/functionconfig.h" #include <atomic> @@ -47,33 +46,3 @@ private: double smoothed_input[6]; Timer t; }; - -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_accela 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/filter-accela/ftnoir_filter_accela_dialog.cpp b/filter-accela/ftnoir_filter_accela_dialog.cpp deleted file mode 100644 index 599cb716..00000000 --- a/filter-accela/ftnoir_filter_accela_dialog.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* Copyright (c) 2012-2015 Stanislaw Halik - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - */ -#include "ftnoir_filter_accela.h" -#include <cmath> -#include <QDebug> -#include <algorithm> -#include <QDoubleSpinBox> -#include "opentrack/plugin-api.hpp" -#include "spline-widget/qfunctionconfigurator.h" -#include <QDialog> - -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); - - update_rot_display(ui.rotation_slider->value()); - update_trans_display(ui.translation_slider->value()); - update_ewma_display(ui.ewma_slider->value()); - update_rot_dz_display(ui.rot_dz_slider->value()); - update_trans_dz_display(ui.trans_dz_slider->value()); -} - -void FilterControls::register_filter(IFilter* filter) -{ - accela_filter = static_cast<FTNoIR_Filter*>(filter); -//#define LEAKING_DEBUG -#ifdef LEAKING_DEBUG - auto d = new QDialog(); - auto r = new QFunctionConfigurator(d); - r->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - r->setConfig(&accela_filter->rot, ""); - r->setFixedSize(800, 300); - d->show(); -#endif -} - -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) * s.mult_rot) + "°"); -} - -void FilterControls::update_trans_display(int value) -{ - ui.trans_gain->setText(QString::number((value + 1) * s.mult_trans) + "mm"); -} - -void FilterControls::update_ewma_display(int value) -{ - ui.ewma_label->setText(QString::number(value * s.mult_ewma) + "ms"); -} - -void FilterControls::update_rot_dz_display(int value) -{ - ui.rot_dz->setText(QString::number(value * s.mult_rot_dz) + "°"); -} - -void FilterControls::update_trans_dz_display(int value) -{ - ui.trans_dz->setText(QString::number(value * s.mult_trans_dz) + "mm"); -} - diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index d34ea981..778cbf08 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -24,6 +24,8 @@ target_link_libraries(opentrack opentrack-api opentrack-compat opentrack-version + # trackhat + opentrack-tracker-pt opentrack-filter-accela ) link_with_dinput8(opentrack) diff --git a/gui/facetracknoir.ico b/gui/facetracknoir.ico Binary files differindex 5cac8da1..b5f34db3 100644..100755 --- a/gui/facetracknoir.ico +++ b/gui/facetracknoir.ico diff --git a/gui/images/facetracknoir.png b/gui/images/facetracknoir.png Binary files differindex 85c06df6..4f17de81 100644..100755 --- a/gui/images/facetracknoir.png +++ b/gui/images/facetracknoir.png diff --git a/gui/images/trackhat-clip-left.png b/gui/images/trackhat-clip-left.png Binary files differnew file mode 100644 index 00000000..cdde2160 --- /dev/null +++ b/gui/images/trackhat-clip-left.png diff --git a/gui/images/trackhat-clip-right.png b/gui/images/trackhat-clip-right.png Binary files differnew file mode 100644 index 00000000..59f8ae71 --- /dev/null +++ b/gui/images/trackhat-clip-right.png diff --git a/gui/images/trackhat-hat.png b/gui/images/trackhat-hat.png Binary files differnew file mode 100644 index 00000000..252c2e6b --- /dev/null +++ b/gui/images/trackhat-hat.png diff --git a/gui/install-driver-dialog.ui b/gui/install-driver-dialog.ui new file mode 100644 index 00000000..3ef3bb2f --- /dev/null +++ b/gui/install-driver-dialog.ui @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>DriverDialog</class> + <widget class="QDialog" name="DriverDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>415</width> + <height>94</height> + </rect> + </property> + <property name="windowTitle"> + <string>PS3 Eye driver missing</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="text"> + <string><html><head/><body><p>The PS3 Eye driver or camera is missing. Please install the driver or plug in the camera and restart the program. Thanks!</p></body></html></string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string><html><head/><body><p>Driver download: <a href="https://mega.nz/#!QkAjnBwD!-ULu08uFwGK5hl7ugbFZfuAw2hIdFpwVtn-jewThrN8"><span style=" text-decoration: underline; color:#0000ff;">mega.nz</span></a></p></body></html></string> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/gui/main.cpp b/gui/main.cpp index 3ae01404..43a8b0c6 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -2,7 +2,10 @@ # include <stdlib.h> #endif +#include "opentrack/opencv-camera-dialog.hpp" +#include "wizard.h" #include "ui.h" +#include "ui_install-driver-dialog.h" #include "opentrack-compat/options.hpp" using namespace options; #include <QApplication> @@ -58,10 +61,36 @@ int main(int argc, char** argv) QApplication::setAttribute(Qt::AA_X11InitThreads, true); QApplication app(argc, argv); - auto w = std::make_shared<MainWindow>(); + { + QSettings s(OPENTRACK_ORG); + if (!s.contains("wizard-run-once")) + { + s.setValue("wizard-run-once", true); + auto w = std::make_shared<Wizard>(); + w->show(); + app.exec(); + } + } + + if (get_camera_names().contains("PS3Eye Camera")) + { + auto w = std::make_shared<MainWindow>(); - w->show(); - app.exec(); + w->show(); + app.exec(); + } + else + { + struct Dialog : QDialog + { + Ui::DriverDialog dlg; + Dialog() + { + dlg.setupUi(this); + } + }; + Dialog().exec(); + } // on MSVC crashes in atexit #ifdef _MSC_VER diff --git a/gui/main.ui b/gui/main.ui index 3a034ab0..6c605262 100644 --- a/gui/main.ui +++ b/gui/main.ui @@ -7,10 +7,16 @@ <rect> <x>0</x> <y>0</y> - <width>652</width> - <height>498</height> + <width>738</width> + <height>463</height> </rect> </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="windowIcon"> <iconset resource="ui-res.qrc"> <normaloff>:/images/facetracknoir.png</normaloff>:/images/facetracknoir.png</iconset> @@ -53,26 +59,11 @@ <property name="lineWidth"> <number>0</number> </property> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <property name="spacing"> - <number>0</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> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> <widget class="QFrame" name="top"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -94,138 +85,23 @@ <number>0</number> </property> <property name="bottomMargin"> - <number>4</number> + <number>0</number> </property> <item> <widget class="QFrame" name="video_feed"> <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>320</width> - <height>240</height> - </size> - </property> - <widget class="QFrame" name="video_frame"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>320</width> - <height>240</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <widget class="QLabel" name="video_frame_label"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>320</width> - <height>240</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>320</width> - <height>240</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>320</width> - <height>240</height> - </size> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ui-res.qrc">:/images/no-feed.png</pixmap> - </property> - <property name="scaledContents"> - <bool>false</bool> - </property> - </widget> - </widget> - </widget> - </item> - <item> - <widget class="GLWidget" name="pose_display" native="true"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>320</width> - <height>240</height> + <width>384</width> + <height>288</height> </size> </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QFrame" name="top_display"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="lineWidth"> - <number>0</number> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <property name="spacing"> - <number>6</number> - </property> - <property name="leftMargin"> - <number>5</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>6</number> - </property> - <item> - <widget class="QGroupBox" name="box_raw_headpose"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string notr="true">Raw tracker data</string> - </property> - <layout class="QGridLayout" name="gridLayout_12"> + <layout class="QGridLayout" name="gridLayout_5" rowstretch="0"> <property name="leftMargin"> <number>0</number> </property> @@ -241,586 +117,450 @@ <property name="spacing"> <number>0</number> </property> - <item row="0" column="3"> - <widget class="QLCDNumber" name="raw_yaw"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="lblZ_4"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>TZ</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="lblRotY_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>pitch</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLCDNumber" name="raw_pitch"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="lblY_4"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>TY</string> - </property> - </widget> - </item> <item row="0" column="0"> - <widget class="QLabel" name="lblX_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>TX</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLCDNumber" name="raw_x"> - <property name="enabled"> - <bool>true</bool> - </property> + <widget class="QFrame" name="video_frame"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="lblRotZ_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>roll</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="lblRotX_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>yaw</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLCDNumber" name="raw_y"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="2" column="3"> - <widget class="QLCDNumber" name="raw_roll"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLCDNumber" name="raw_z"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="lineWidth"> - <number>1</number> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Outline</enum> - </property> + <widget class="QLabel" name="video_frame_label"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>384</width> + <height>288</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>384</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>384</width> + <height>288</height> + </size> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ui-res.qrc">:/images/no-feed.png</pixmap> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> </widget> </item> </layout> </widget> </item> <item> - <widget class="QGroupBox" name="box_mapped_headpose"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <widget class="QFrame" name="frame_5"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> </property> - <property name="title"> - <string notr="true">Game data</string> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> </property> - <layout class="QGridLayout" name="gridLayout_14"> + <layout class="QVBoxLayout" name="verticalLayout_4"> <property name="leftMargin"> - <number>0</number> + <number>6</number> </property> <property name="topMargin"> - <number>0</number> + <number>2</number> </property> <property name="rightMargin"> - <number>0</number> + <number>2</number> </property> <property name="bottomMargin"> - <number>0</number> - </property> - <property name="spacing"> - <number>0</number> + <number>2</number> </property> - <item row="1" column="3"> - <widget class="QLCDNumber" name="pose_pitch"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLCDNumber" name="pose_yaw"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLCDNumber" name="pose_z"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="lblx"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>TX</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="lblY_2"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>TY</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLCDNumber" name="pose_x"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item> + <widget class="QFrame" name="frame_4"> + <property name="styleSheet"> + <string notr="true">QFrame +{ + border-color: #000; + border: 1px solid; + background-color: #ccc; +}</string> </property> <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="lblRotY_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>pitch</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QLabel" name="lblRotZ_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>roll</string> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="lblRotX_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <property name="text"> - <string>yaw</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="lblZ_2"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> <property name="frameShadow"> <enum>QFrame::Raised</enum> </property> - <property name="text"> - <string>TZ</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLCDNumber" name="pose_y"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> - </property> + <layout class="QGridLayout" name="gridLayout"> + <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> + <property name="spacing"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="GLWidget" name="pose_display" native="true"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>320</width> + <height>127</height> + </size> + </property> + </widget> + </item> + </layout> </widget> </item> - <item row="2" column="3"> - <widget class="QLCDNumber" name="pose_roll"> - <property name="enabled"> - <bool>true</bool> - </property> + <item> + <widget class="QGroupBox" name="box_raw_headpose"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="smallDecimalPoint"> - <bool>true</bool> - </property> - <property name="digitCount"> - <number>4</number> - </property> - <property name="segmentStyle"> - <enum>QLCDNumber::Flat</enum> + <property name="title"> + <string notr="true">Raw tracker data</string> </property> + <layout class="QGridLayout" name="gridLayout_12"> + <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> + <property name="spacing"> + <number>0</number> + </property> + <item row="0" column="3"> + <widget class="QLCDNumber" name="raw_yaw"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="lblZ_4"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TZ</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QLabel" name="lblRotY_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>pitch</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QLCDNumber" name="raw_pitch"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lblY_4"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TY</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="lblX_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>TX</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLCDNumber" name="raw_x"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QLabel" name="lblRotZ_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>roll</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="lblRotX_4"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <property name="text"> + <string>yaw</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLCDNumber" name="raw_y"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + <item row="2" column="3"> + <widget class="QLCDNumber" name="raw_roll"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLCDNumber" name="raw_z"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="lineWidth"> + <number>1</number> + </property> + <property name="smallDecimalPoint"> + <bool>true</bool> + </property> + <property name="digitCount"> + <number>4</number> + </property> + <property name="segmentStyle"> + <enum>QLCDNumber::Outline</enum> + </property> + </widget> + </item> + </layout> </widget> </item> </layout> @@ -829,7 +569,7 @@ </layout> </widget> </item> - <item> + <item row="1" column="0"> <widget class="QFrame" name="bottom_controls"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> @@ -853,124 +593,37 @@ <property name="spacing"> <number>6</number> </property> - <item row="0" column="1"> - <widget class="QFrame" name="groupWindows"> + <item row="0" column="0"> + <widget class="QFrame" name="frame_2"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>4</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="lineWidth"> - <number>0</number> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> <property name="spacing"> - <number>3</number> + <number>8</number> </property> <property name="leftMargin"> - <number>0</number> + <number>3</number> </property> <property name="topMargin"> - <number>0</number> + <number>2</number> </property> <property name="rightMargin"> - <number>0</number> + <number>3</number> </property> <property name="bottomMargin"> - <number>0</number> + <number>8</number> </property> <item> - <widget class="QFrame" name="groupProfile"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="spacing"> - <number>0</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="QToolButton" name="profile_button"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="text"> - <string>Profile</string> - </property> - <property name="popupMode"> - <enum>QToolButton::InstantPopup</enum> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - <property name="arrowType"> - <enum>Qt::DownArrow</enum> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="iconcomboProfile"> - <property name="maxVisibleItems"> - <number>20</number> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnShortcuts"> - <property name="text"> - <string>Options</string> - </property> - <property name="icon"> - <iconset resource="ui-res.qrc"> - <normaloff>:/images/tools.png</normaloff>:/images/tools.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>80</width> - <height>24</height> - </size> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnEditCurves"> - <property name="text"> - <string>Mapping</string> - </property> - <property name="icon"> - <iconset resource="ui-res.qrc"> - <normaloff>:/images/curves.png</normaloff>:/images/curves.png</iconset> - </property> - <property name="iconSize"> - <size> - <width>80</width> - <height>24</height> - </size> - </property> - </widget> - </item> - <item> <widget class="QGroupBox" name="groupStartStop"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> @@ -981,10 +634,7 @@ <property name="title"> <string notr="true">Controls</string> </property> - <property name="flat"> - <bool>true</bool> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_4"> + <layout class="QVBoxLayout" name="verticalLayout_5"> <property name="spacing"> <number>8</number> </property> @@ -992,18 +642,18 @@ <number>0</number> </property> <property name="topMargin"> - <number>8</number> + <number>4</number> </property> <property name="rightMargin"> <number>0</number> </property> <property name="bottomMargin"> - <number>9</number> + <number>0</number> </property> <item> <widget class="QToolButton" name="btnStartTracker"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -1019,7 +669,7 @@ <bool>false</bool> </property> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -1035,93 +685,58 @@ </layout> </widget> </item> - <item row="0" column="0"> - <widget class="QFrame" name="frame_2"> + <item row="0" column="1"> + <widget class="QFrame" name="groupWindows"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>4</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> + <property name="lineWidth"> + <number>0</number> </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>2</number> - </property> + <layout class="QGridLayout" name="gridLayout_6"> <property name="leftMargin"> - <number>3</number> + <number>0</number> </property> <property name="topMargin"> - <number>2</number> + <number>0</number> </property> <property name="rightMargin"> - <number>3</number> + <number>0</number> </property> <property name="bottomMargin"> - <number>8</number> + <number>0</number> </property> - <item> - <widget class="QGroupBox" name="groupTrackerSource"> - <property name="title"> - <string>Tracker</string> + <item row="0" column="0"> + <widget class="QFrame" name="groupProfile"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <layout class="QGridLayout" name="gridLayout"> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="spacing"> + <number>0</number> + </property> <property name="leftMargin"> - <number>4</number> + <number>0</number> </property> <property name="topMargin"> <number>0</number> </property> <property name="rightMargin"> - <number>4</number> - </property> - <property name="bottomMargin"> <number>0</number> </property> - <property name="horizontalSpacing"> - <number>3</number> - </property> - <property name="verticalSpacing"> + <property name="bottomMargin"> <number>0</number> </property> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboTrackerSource"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QToolButton" name="btnShowEngineControls"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>...</string> - </property> - <property name="flat" stdset="0"> - <bool>false</bool> - </property> - </widget> - </item> </layout> </widget> </item> - <item> + <item row="1" column="0"> <widget class="QGroupBox" name="groupGameProtocol"> <property name="title"> <string>Protocol</string> @@ -1145,27 +760,14 @@ <property name="verticalSpacing"> <number>0</number> </property> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboProtocol"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> + <item row="1" column="0"> + <widget class="QComboBox" name="iconcomboProtocol"/> </item> - <item row="0" column="1"> + <item row="1" column="1"> <widget class="QToolButton" name="btnShowServerControls"> <property name="enabled"> <bool>true</bool> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> <property name="text"> <string>...</string> </property> @@ -1177,62 +779,114 @@ </layout> </widget> </item> - <item> - <widget class="QGroupBox" name="groupFilter"> - <property name="title"> - <string>Filter</string> + <item row="2" column="0"> + <widget class="QFrame" name="frame_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <layout class="QGridLayout" name="gridLayout_3"> + <layout class="QHBoxLayout" name="horizontalLayout_5"> + <property name="spacing"> + <number>0</number> + </property> <property name="leftMargin"> - <number>4</number> + <number>0</number> </property> <property name="topMargin"> <number>0</number> </property> <property name="rightMargin"> - <number>4</number> - </property> - <property name="bottomMargin"> <number>0</number> </property> - <property name="horizontalSpacing"> - <number>3</number> - </property> - <property name="verticalSpacing"> + <property name="bottomMargin"> <number>0</number> </property> - <item row="0" column="0"> - <widget class="QComboBox" name="iconcomboFilter"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QToolButton" name="btnShowFilterControls"> + <item> + <widget class="QToolButton" name="profile_button"> <property name="enabled"> <bool>true</bool> </property> + <property name="text"> + <string>Profile</string> + </property> + <property name="popupMode"> + <enum>QToolButton::InstantPopup</enum> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + <property name="autoRaise"> + <bool>true</bool> + </property> + <property name="arrowType"> + <enum>Qt::DownArrow</enum> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="iconcomboProfile"> <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Maximum"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text"> - <string>...</string> - </property> - <property name="flat" stdset="0"> - <bool>false</bool> + <property name="maxVisibleItems"> + <number>20</number> </property> </widget> </item> </layout> </widget> </item> + <item row="3" column="0"> + <widget class="QPushButton" name="btnEditCurves"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Mapping</string> + </property> + <property name="icon"> + <iconset resource="ui-res.qrc"> + <normaloff>:/images/curves.png</normaloff>:/images/curves.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>80</width> + <height>24</height> + </size> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QPushButton" name="btnShortcuts"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Options</string> + </property> + <property name="icon"> + <iconset resource="ui-res.qrc"> + <normaloff>:/images/tools.png</normaloff>:/images/tools.png</iconset> + </property> + <property name="iconSize"> + <size> + <width>80</width> + <height>24</height> + </size> + </property> + </widget> + </item> </layout> </widget> </item> @@ -1254,16 +908,9 @@ </customwidgets> <tabstops> <tabstop>btnStopTracker</tabstop> - <tabstop>iconcomboTrackerSource</tabstop> - <tabstop>btnShowEngineControls</tabstop> <tabstop>iconcomboProtocol</tabstop> <tabstop>btnShowServerControls</tabstop> - <tabstop>iconcomboFilter</tabstop> - <tabstop>btnShowFilterControls</tabstop> - <tabstop>profile_button</tabstop> - <tabstop>iconcomboProfile</tabstop> <tabstop>btnShortcuts</tabstop> - <tabstop>btnEditCurves</tabstop> <tabstop>profile_button</tabstop> <tabstop>iconcomboProfile</tabstop> </tabstops> diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp index e1324ccc..1e734135 100644 --- a/gui/options-dialog.cpp +++ b/gui/options-dialog.cpp @@ -7,6 +7,7 @@ */ #include "options-dialog.hpp" +#include "tracker-pt/camera.h" #include "keyboard.h" #include <QPushButton> #include <QLayout> @@ -30,9 +31,11 @@ static QString kopts_to_string(const key_opts& kopts) } OptionsDialog::OptionsDialog(main_settings& main, + State& state, std::function<void()> register_global_keys, std::function<void(bool)> pause_keybindings) : main(main), + state(state), register_global_keys(register_global_keys), pause_keybindings(pause_keybindings) { @@ -45,16 +48,51 @@ OptionsDialog::OptionsDialog(main_settings& main, tie_setting(main.center_at_startup, ui.center_at_startup); + tie_setting(pt.camera_mode, ui.camera_mode); + + tie_setting(pt.threshold, ui.threshold_slider); + + tie_setting(pt.min_point_size, ui.mindiam_spin); + tie_setting(pt.max_point_size, ui.maxdiam_spin); + + tie_setting(pt.t_MH_x, ui.tx_spin); + tie_setting(pt.t_MH_y, ui.ty_spin); + tie_setting(pt.t_MH_z, ui.tz_spin); + + tie_setting(pt.fov, ui.camera_fov); + + tie_setting(pt.model_used, ui.model_used); + + connect(ui.ewma_slider, SIGNAL(valueChanged(int)), this, SLOT(update_ewma_display(int))); + connect(ui.rotation_slider, SIGNAL(valueChanged(int)), this, SLOT(update_rot_display(int))); + connect(ui.rot_dz_slider, SIGNAL(valueChanged(int)), this, SLOT(update_rot_dz_display(int))); + connect(ui.translation_slider, SIGNAL(valueChanged(int)), this, SLOT(update_trans_display(int))); + connect(ui.trans_dz_slider, SIGNAL(valueChanged(int)), this, SLOT(update_trans_dz_display(int))); + + tie_setting(acc.rot_threshold, ui.rotation_slider); + tie_setting(acc.trans_threshold, ui.translation_slider); + tie_setting(acc.ewma, ui.ewma_slider); + tie_setting(acc.rot_deadzone, ui.rot_dz_slider); + tie_setting(acc.trans_deadzone, ui.trans_dz_slider); + + update_rot_display(ui.rotation_slider->value()); + update_trans_display(ui.translation_slider->value()); + update_ewma_display(ui.ewma_slider->value()); + update_rot_dz_display(ui.rot_dz_slider->value()); + update_trans_dz_display(ui.trans_dz_slider->value()); + + tie_setting(pt.dynamic_pose, ui.dynamic_pose); + tie_setting(pt.init_phase_timeout, ui.init_phase_timeout); + tie_setting(pt.auto_threshold, ui.auto_threshold); + + connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); + connect( ui.tcalib_button,SIGNAL(toggled(bool)), this,SLOT(startstop_trans_calib(bool)) ); + + timer.start(100); + tie_setting(main.tcomp_p, ui.tcomp_enable); tie_setting(main.tcomp_tz, ui.tcomp_rz); - tie_setting(main.a_x.zero, ui.pos_tx); - tie_setting(main.a_y.zero, ui.pos_ty); - tie_setting(main.a_z.zero, ui.pos_tz); - tie_setting(main.a_yaw.zero, ui.pos_rx); - tie_setting(main.a_pitch.zero, ui.pos_ry); - tie_setting(main.a_roll.zero, ui.pos_rz); - tie_setting(main.a_yaw.invert, ui.invert_yaw); tie_setting(main.a_pitch.invert, ui.invert_pitch); tie_setting(main.a_roll.invert, ui.invert_roll); @@ -130,6 +168,8 @@ void OptionsDialog::bind_key(key_opts& kopts, QLabel* label) } void OptionsDialog::doOK() { + pt.b->save(); + acc.b->save(); main.b->save(); ui.game_detector->save(); this->close(); @@ -137,8 +177,117 @@ void OptionsDialog::doOK() { } void OptionsDialog::doCancel() { + pt.b->reload(); + acc.b->reload(); main.b->reload(); ui.game_detector->revert(); close(); } +void OptionsDialog::startstop_trans_calib(bool start) +{ + auto tracker = get_pt(); + if (!tracker) + { + ui.tcalib_button->setChecked(false); + return; + } + + if (start) + { + qDebug()<<"TrackerDialog:: Starting translation calibration"; + trans_calib.reset(); + trans_calib_running = true; + pt.t_MH_x = 0; + pt.t_MH_y = 0; + pt.t_MH_z = 0; + } + else + { + qDebug()<<"TrackerDialog:: Stopping translation calibration"; + trans_calib_running = false; + { + auto tmp = trans_calib.get_estimate(); + pt.t_MH_x = tmp[0]; + pt.t_MH_y = tmp[1]; + pt.t_MH_z = tmp[2]; + } + } +} + +void OptionsDialog::poll_tracker_info() +{ + auto tracker = get_pt(); + CamInfo info; + if (tracker && tracker->get_cam_info(&info)) + { + QString to_print; + + // display caminfo + to_print = QString::number(info.res_x)+"x"+QString::number(info.res_y)+" @ "+QString::number(info.fps)+" FPS"; + ui.caminfo_label->setText(to_print); + + // display pointinfo + int n_points = tracker->get_n_points(); + to_print = QString::number(n_points); + if (n_points == 3) + to_print += " OK!"; + else + to_print += " BAD!"; + ui.pointinfo_label->setText(to_print); + + // update calibration + if (trans_calib_running) trans_calib_step(); + } + else + { + ui.caminfo_label->setText("Tracker offline"); + ui.pointinfo_label->setText(""); + } +} + +void OptionsDialog::trans_calib_step() +{ + auto tracker = get_pt(); + if (tracker) + { + Affine X_CM = tracker->pose(); + trans_calib.update(X_CM.R, X_CM.t); + } +} + +Tracker_PT* OptionsDialog::get_pt() +{ + auto work = state.work.get(); + if (!work) + return nullptr; + auto ptr = work->libs.pTracker; + if (ptr) + return static_cast<Tracker_PT*>(ptr.get()); + return nullptr; +} + +void OptionsDialog::update_rot_display(int value) +{ + ui.rot_gain->setText(QString::number((value + 1) * 10 / 100.) + "°"); +} + +void OptionsDialog::update_trans_display(int value) +{ + ui.trans_gain->setText(QString::number((value + 1) * 5 / 100.) + "mm"); +} + +void OptionsDialog::update_ewma_display(int value) +{ + ui.ewma_label->setText(QString::number(value * 2) + "ms"); +} + +void OptionsDialog::update_rot_dz_display(int value) +{ + ui.rot_dz->setText(QString::number(value * 2 / 100.) + "°"); +} + +void OptionsDialog::update_trans_dz_display(int value) +{ + ui.trans_dz->setText(QString::number(value * 1 / 100.) + "mm"); +} diff --git a/gui/options-dialog.hpp b/gui/options-dialog.hpp index 7700162b..f333c690 100644 --- a/gui/options-dialog.hpp +++ b/gui/options-dialog.hpp @@ -1,7 +1,15 @@ #pragma once +#include <QObject> +#include <QWidget> +#include <QTimer> #include "ui_settings.h" +#include "opentrack/state.hpp" #include "opentrack/shortcuts.h" +#include "tracker-pt/ftnoir_tracker_pt_settings.h" +#include "trans_calib.h" +#include "tracker-pt/ftnoir_tracker_pt.h" +#include "filter-accela/ftnoir_filter_accela.h" #include <QObject> #include <QWidget> #include <functional> @@ -12,15 +20,32 @@ class OptionsDialog: public QWidget signals: void reload(); public: - OptionsDialog(main_settings& main, std::function<void()> register_global_keys, std::function<void(bool)> pause_keybindings); + OptionsDialog(main_settings& main, State& state, std::function<void()> register_global_keys, std::function<void(bool)> pause_keybindings); private: main_settings& main; + State& state; std::function<void()> register_global_keys; std::function<void(bool)> pause_keybindings; Ui::UI_Settings ui; + settings_pt pt; + settings_accela acc; + QTimer timer; + TranslationCalibrator trans_calib; + bool trans_calib_running; + + Tracker_PT* get_pt(); void closeEvent(QCloseEvent *) override { doCancel(); } private slots: + 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); + void doOK(); void doCancel(); + void startstop_trans_calib(bool start); + void poll_tracker_info(); + void trans_calib_step(); void bind_key(key_opts &kopts, QLabel* label); }; diff --git a/gui/settings.ui b/gui/settings.ui index 3a5de399..b00e0960 100644 --- a/gui/settings.ui +++ b/gui/settings.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>381</width> - <height>603</height> + <width>428</width> + <height>525</height> </rect> </property> <property name="windowTitle"> @@ -23,7 +23,7 @@ <property name="autoFillBackground"> <bool>false</bool> </property> - <layout class="QVBoxLayout" name="verticalLayout_5"> + <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QTabWidget" name="tabWidget"> <property name="currentIndex"> @@ -33,14 +33,41 @@ <attribute name="title"> <string>Shortcuts</string> </attribute> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> + <layout class="QGridLayout" name="gridLayout_9"> + <item row="2" column="0"> + <widget class="QCheckBox" name="center_at_startup"> + <property name="text"> + <string>Center at startup</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item row="3" column="0"> + <widget class="QCheckBox" name="trayp"> + <property name="text"> + <string>Minimize to tray</string> + </property> + </widget> + </item> + <item row="0" column="0"> <widget class="QGroupBox" name="groupBox_8"> <property name="title"> <string>Global shortcuts</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_8"> - <item> + <layout class="QGridLayout" name="gridLayout_15"> + <item row="0" column="0"> <widget class="QLabel" name="label_23"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> @@ -56,41 +83,21 @@ </property> </widget> </item> - <item> + <item row="1" column="0"> <widget class="QGroupBox" name="groupBox"> <property name="styleSheet"> <string notr="true">QGroupBox { border: 0; }</string> </property> <layout class="QGridLayout" name="gridLayout_8"> - <item row="8" column="2"> - <widget class="QPushButton" name="bind_stop"> - <property name="text"> - <string>Bind</string> - </property> - </widget> - </item> - <item row="7" column="0"> - <widget class="QLabel" name="textLabel2_7"> - <property name="text"> - <string>Start tracking</string> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="8" column="0"> - <widget class="QLabel" name="textLabel2_8"> + <item row="6" column="1"> + <widget class="QLabel" name="zero_text"> <property name="text"> - <string>Stop tracking</string> - </property> - <property name="wordWrap"> - <bool>false</bool> + <string/> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QLabel" name="center_text"> + <item row="5" column="1"> + <widget class="QLabel" name="toggle_text"> <property name="text"> <string/> </property> @@ -106,17 +113,20 @@ </property> </widget> </item> - <item row="5" column="1"> - <widget class="QLabel" name="toggle_text"> + <item row="0" column="2"> + <widget class="QPushButton" name="bind_center"> <property name="text"> - <string/> + <string>Bind</string> </property> </widget> </item> - <item row="6" column="1"> - <widget class="QLabel" name="zero_text"> + <item row="5" column="0"> + <widget class="QLabel" name="textLabel2_5"> <property name="text"> - <string/> + <string>Toggle</string> + </property> + <property name="wordWrap"> + <bool>false</bool> </property> </widget> </item> @@ -130,41 +140,44 @@ </property> </widget> </item> - <item row="0" column="2"> - <widget class="QPushButton" name="bind_center"> + <item row="6" column="2"> + <widget class="QPushButton" name="bind_zero"> <property name="text"> <string>Bind</string> </property> </widget> </item> - <item row="5" column="0"> - <widget class="QLabel" name="textLabel2_5"> + <item row="5" column="2"> + <widget class="QPushButton" name="bind_toggle"> <property name="text"> - <string>Toggle</string> - </property> - <property name="wordWrap"> - <bool>false</bool> + <string>Bind</string> </property> </widget> </item> - <item row="6" column="2"> - <widget class="QPushButton" name="bind_zero"> + <item row="7" column="0"> + <widget class="QLabel" name="textLabel2_7"> <property name="text"> - <string>Bind</string> + <string>Start tracking</string> + </property> + <property name="wordWrap"> + <bool>false</bool> </property> </widget> </item> - <item row="5" column="2"> - <widget class="QPushButton" name="bind_toggle"> + <item row="0" column="1"> + <widget class="QLabel" name="center_text"> <property name="text"> - <string>Bind</string> + <string/> </property> </widget> </item> - <item row="7" column="2"> - <widget class="QPushButton" name="bind_start"> + <item row="8" column="0"> + <widget class="QLabel" name="textLabel2_8"> <property name="text"> - <string>Bind</string> + <string>Stop tracking</string> + </property> + <property name="wordWrap"> + <bool>false</bool> </property> </widget> </item> @@ -178,6 +191,20 @@ </property> </widget> </item> + <item row="7" column="2"> + <widget class="QPushButton" name="bind_start"> + <property name="text"> + <string>Bind</string> + </property> + </widget> + </item> + <item row="8" column="2"> + <widget class="QPushButton" name="bind_stop"> + <property name="text"> + <string>Bind</string> + </property> + </widget> + </item> <item row="9" column="2"> <widget class="QPushButton" name="bind_toggle_tracking"> <property name="text"> @@ -212,12 +239,12 @@ </layout> </widget> </item> - <item> - <widget class="QGroupBox" name="groupBox_9"> + <item row="1" column="0"> + <widget class="QGroupBox" name="groupBox_9111"> <property name="title"> <string>Centering method</string> </property> - <layout class="QGridLayout" name="gridLayout"> + <layout class="QGridLayout" name="gridLayout111"> <item row="1" column="0"> <widget class="QLabel" name="label_26"> <property name="text"> @@ -252,140 +279,254 @@ </layout> </widget> </item> - <item> - <widget class="QCheckBox" name="center_at_startup"> - <property name="text"> - <string>Center at startup</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="trayp"> - <property name="text"> - <string>Minimize to tray</string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> </layout> </widget> <widget class="QWidget" name="tab_3"> <attribute name="title"> <string>Camera</string> </attribute> - <layout class="QVBoxLayout" name="verticalLayout_3"> + <layout class="QVBoxLayout" name="verticalLayout_10"> <item> - <widget class="QGroupBox" name="groupBox_5"> + <widget class="QGroupBox" name="groupBox_9"> <property name="title"> - <string>Camera offset</string> + <string>Device</string> </property> - <layout class="QGridLayout" name="gridLayout_6"> + <layout class="QGridLayout" name="gridLayout"> <item row="2" column="0"> - <widget class="QLabel" name="label_17"> + <widget class="QLabel" name="label_32"> <property name="text"> - <string><html><head/><body><p>Specify an angle for off-center camera as a basis for which direction is which, avoiding axis interconnect. Also see <a href="https://github.com/opentrack/opentrack/wiki/choosing-camera-offset"><span style=" text-decoration: underline; color:#0000ff;">description on wiki</span></a>.</p></body></html></string> + <string>Dynamic pose resolution</string> </property> - <property name="alignment"> - <set>Qt::AlignJustify|Qt::AlignVCenter</set> + </widget> + </item> + <item row="2" column="1"> + <widget class="QCheckBox" name="dynamic_pose"> + <property name="text"> + <string/> </property> - <property name="wordWrap"> - <bool>true</bool> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="camera_mode"> + <item> + <property name="text"> + <string>640x480, 75 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>640x480, 60 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>320x240, 189 Hz</string> + </property> + </item> + <item> + <property name="text"> + <string>320x240, 120 Hz</string> + </property> + </item> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_2511"> + <property name="text"> + <string>Mode</string> </property> - <property name="margin"> - <number>2</number> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="camera_fov"> + <item> + <property name="text"> + <string>56°</string> + </property> + </item> + <item> + <property name="text"> + <string>75°</string> + </property> + </item> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Field of view</string> </property> - <property name="openExternalLinks"> - <bool>true</bool> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_33"> + <property name="text"> + <string>Dynamic pose timeout</string> </property> </widget> </item> - <item row="3" column="0" alignment="Qt::AlignLeft"> - <widget class="QGroupBox" name="groupBox_3"> - <property name="styleSheet"> - <string notr="true">QGroupBox -{ - border: 0; -}</string> + <item row="3" column="1"> + <widget class="QSpinBox" name="init_phase_timeout"> + <property name="suffix"> + <string> ms</string> </property> - <layout class="QGridLayout" name="gridLayout_7"> - <item row="2" column="0"> - <widget class="QLabel" name="label_21"> - <property name="text"> - <string>Roll</string> + <property name="minimum"> + <number>1</number> + </property> + <property name="maximum"> + <number>10000</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_6"> + <property name="title"> + <string>Point extraction</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <property name="topMargin"> + <number>4</number> + </property> + <property name="bottomMargin"> + <number>4</number> + </property> + <item> + <widget class="QFrame" name="frame_2"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <layout class="QGridLayout" name="gridLayout_10"> + <property name="topMargin"> + <number>2</number> + </property> + <property name="bottomMargin"> + <number>2</number> + </property> + <property name="verticalSpacing"> + <number>6</number> + </property> + <item row="1" column="1"> + <widget class="QSlider" name="threshold_slider"> + <property name="toolTip"> + <string>Intensity threshold for point extraction</string> + </property> + <property name="maximum"> + <number>255</number> + </property> + <property name="pageStep"> + <number>1</number> + </property> + <property name="value"> + <number>127</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksBothSides</enum> + </property> + <property name="tickInterval"> + <number>25</number> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="camera_roll"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>0</height> - </size> + <item row="1" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Threshold</string> </property> - <property name="minimum"> - <number>-180</number> + <property name="buddy"> + <cstring>threshold_slider</cstring> </property> - <property name="maximum"> - <number>180</number> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_38"> + <property name="text"> + <string>Automatic threshold</string> </property> </widget> </item> <item row="0" column="1"> - <widget class="QSpinBox" name="camera_yaw"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>0</height> - </size> + <widget class="QCheckBox" name="auto_threshold"> + <property name="text"> + <string>Enable, slider sets point size</string> </property> - <property name="minimum"> - <number>-180</number> + </widget> + </item> + </layout> + </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="QGridLayout" name="gridLayout_3"> + <property name="topMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <property name="verticalSpacing"> + <number>0</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_29"> + <property name="text"> + <string>Min size</string> </property> - <property name="maximum"> - <number>180</number> + <property name="buddy"> + <cstring>mindiam_spin</cstring> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_19"> + <item row="0" column="2"> + <widget class="QLabel" name="label_22"> <property name="text"> - <string>Pitch</string> + <string>Max size</string> + </property> + <property name="buddy"> + <cstring>maxdiam_spin</cstring> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="camera_pitch"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>0</height> - </size> + <item row="0" column="3"> + <widget class="QDoubleSpinBox" name="maxdiam_spin"> + <property name="toolTip"> + <string>Maximum point diameter</string> </property> - <property name="minimum"> - <number>-180</number> + <property name="suffix"> + <string> px</string> </property> - <property name="maximum"> - <number>180</number> + <property name="decimals"> + <number>1</number> </property> </widget> </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_18"> - <property name="text"> - <string>Yaw</string> + <item row="0" column="1"> + <widget class="QDoubleSpinBox" name="mindiam_spin"> + <property name="toolTip"> + <string>Minimum point diameter</string> + </property> + <property name="suffix"> + <string> px</string> + </property> + <property name="decimals"> + <number>1</number> </property> </widget> </item> @@ -396,179 +537,341 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_6"> + <widget class="QGroupBox" name="groupBox_11"> <property name="title"> - <string>Center pose offset</string> + <string>Status</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_6"> + <layout class="QHBoxLayout" name="horizontalLayout"> <item> - <widget class="QLabel" name="label_22"> + <widget class="QLabel" name="caminfo_label"> <property name="text"> - <string>Alter the centered position sent to games by a fixed amount.</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - <property name="margin"> - <number>2</number> + <string>Not running</string> </property> </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_7"> - <property name="styleSheet"> - <string notr="true">QGroupBox { - border: 0; -}</string> - </property> - <property name="title"> + <widget class="QLabel" name="pointinfo_label"> + <property name="text"> <string/> </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Model</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QGroupBox" name="groupBox_6111"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string notr="true">QFrame { border: 0; }</string> + </property> + <layout class="QGridLayout" name="gridLayout_17"> + <property name="leftMargin"> + <number>31</number> + </property> + <property name="topMargin"> + <number>4</number> + </property> + <item row="0" column="1"> + <widget class="QComboBox" name="model_used"> + <property name="sizeAdjustPolicy"> + <enum>QComboBox::AdjustToMinimumContentsLength</enum> </property> - <property name="flat"> - <bool>false</bool> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> </property> - <property name="checkable"> - <bool>false</bool> + <item> + <property name="text"> + <string>Cap</string> + </property> + <property name="icon"> + <iconset resource="ui-res.qrc"> + <normaloff>:/images/trackhat-hat.png</normaloff>:/images/trackhat-hat.png</iconset> + </property> + </item> + <item> + <property name="text"> + <string>Clip</string> + </property> + <property name="icon"> + <iconset resource="ui-res.qrc"> + <normaloff>:/images/trackhat-clip-right.png</normaloff>:/images/trackhat-clip-right.png</iconset> + </property> + </item> + <item> + <property name="text"> + <string>Clip left-handed</string> + </property> + <property name="icon"> + <iconset resource="ui-res.qrc"> + <normaloff>:/images/trackhat-clip-left.png</normaloff>:/images/trackhat-clip-left.png</iconset> + </property> + </item> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_31"> + <property name="text"> + <string>Model used</string> </property> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="2" column="1"> - <widget class="QDoubleSpinBox" name="pos_rz"> - <property name="suffix"> - <string> deg.</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - <property name="minimum"> - <double>-180.000000000000000</double> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_10"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Model position calibration</string> + </property> + <layout class="QGridLayout" name="gridLayout_11"> + <item row="0" column="0"> + <widget class="QFrame" name="frame_3"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_12"> + <item row="0" column="0"> + <widget class="QLabel" name="label_61"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="maximum"> - <double>180.000000000000000</double> + <property name="text"> + <string>x:</string> </property> </widget> </item> - <item row="2" column="3"> - <widget class="QDoubleSpinBox" name="pos_tz"> + <item row="0" column="1"> + <widget class="QSpinBox" name="tx_spin"> <property name="suffix"> - <string> cm</string> - </property> - <property name="decimals"> - <number>3</number> + <string> mm</string> </property> <property name="minimum"> - <double>-100.000000000000000</double> + <number>-65535</number> </property> <property name="maximum"> - <double>100.000000000000000</double> + <number>65536</number> </property> </widget> </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_4"> + <item row="1" column="0"> + <widget class="QLabel" name="label_62"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text"> - <string>TX</string> + <string>y:</string> </property> </widget> </item> - <item row="0" column="3"> - <widget class="QDoubleSpinBox" name="pos_tx"> + <item row="1" column="1"> + <widget class="QSpinBox" name="ty_spin"> <property name="suffix"> - <string> cm</string> - </property> - <property name="decimals"> - <number>3</number> + <string> mm</string> </property> <property name="minimum"> - <double>-100.000000000000000</double> + <number>-65535</number> </property> <property name="maximum"> - <double>100.000000000000000</double> + <number>65536</number> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>RY</string> + <item row="2" column="0"> + <widget class="QLabel" name="label_66"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="label_5"> <property name="text"> - <string>TY</string> + <string>z:</string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QDoubleSpinBox" name="pos_ry"> + <item row="2" column="1"> + <widget class="QSpinBox" name="tz_spin"> <property name="suffix"> - <string> deg.</string> - </property> - <property name="decimals"> - <number>3</number> + <string> mm</string> </property> <property name="minimum"> - <double>-180.000000000000000</double> + <number>-65535</number> </property> <property name="maximum"> - <double>180.000000000000000</double> + <number>65536</number> </property> </widget> </item> - <item row="2" column="2"> - <widget class="QLabel" name="label_6"> + </layout> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_59"> + <property name="text"> + <string><html><head/><body><p>Only pitch and yaw during calibration.</p><p>Don't roll and don't translate.</p></body></html></string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QPushButton" name="tcalib_button"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Toggle calibration</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_5"> + <property name="title"> + <string>Camera offset</string> + </property> + <layout class="QGridLayout" name="gridLayout_6"> + <item row="2" column="0"> + <widget class="QLabel" name="label_17"> + <property name="text"> + <string><html><head/><body><p>Specify an angle for off-center camera as a basis for which direction is which, avoiding axis interconnect. Also see <a href="https://github.com/opentrack/opentrack/wiki/choosing-camera-offset"><span style=" text-decoration: underline; color:#0000ff;">description on wiki</span></a>.</p></body></html></string> + </property> + <property name="alignment"> + <set>Qt::AlignJustify|Qt::AlignVCenter</set> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="margin"> + <number>2</number> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="3" column="0" alignment="Qt::AlignLeft"> + <widget class="QGroupBox" name="groupBox_3"> + <property name="styleSheet"> + <string notr="true">QGroupBox +{ + border: 0; +}</string> + </property> + <layout class="QGridLayout" name="gridLayout_7"> + <item row="2" column="0"> + <widget class="QLabel" name="label_21"> <property name="text"> - <string>TZ</string> + <string>Roll</string> </property> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>RZ</string> + <item row="2" column="1"> + <widget class="QSpinBox" name="camera_roll"> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="minimum"> + <number>-180</number> + </property> + <property name="maximum"> + <number>180</number> </property> </widget> </item> - <item row="1" column="3"> - <widget class="QDoubleSpinBox" name="pos_ty"> - <property name="suffix"> - <string> cm</string> - </property> - <property name="decimals"> - <number>3</number> + <item row="0" column="1"> + <widget class="QSpinBox" name="camera_yaw"> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> </property> <property name="minimum"> - <double>-100.000000000000000</double> + <number>-180</number> </property> <property name="maximum"> - <double>100.000000000000000</double> + <number>180</number> </property> </widget> </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_2"> + <item row="1" column="0"> + <widget class="QLabel" name="label_19"> <property name="text"> - <string>RX</string> + <string>Pitch</string> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QDoubleSpinBox" name="pos_rx"> - <property name="suffix"> - <string> deg.</string> - </property> - <property name="decimals"> - <number>3</number> + <item row="1" column="1"> + <widget class="QSpinBox" name="camera_pitch"> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> </property> <property name="minimum"> - <double>-180.000000000000000</double> + <number>-180</number> </property> <property name="maximum"> - <double>180.000000000000000</double> + <number>180</number> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_18"> + <property name="text"> + <string>Yaw</string> </property> </widget> </item> @@ -579,14 +882,14 @@ </widget> </item> <item> - <spacer name="verticalSpacer_2"> + <spacer name="verticalSpacer_5"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>20</width> - <height>40</height> + <height>10</height> </size> </property> </spacer> @@ -655,7 +958,7 @@ </layout> </widget> </item> - <item alignment="Qt::AlignTop"> + <item> <widget class="QGroupBox" name="groupBox_4"> <property name="maximumSize"> <size> @@ -1090,6 +1393,345 @@ </item> </layout> </widget> + <widget class="QWidget" name="tab_6"> + <attribute name="title"> + <string>Filter</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_6"> + <item> + <widget class="QFrame" name="frame_4"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_14"> + <item row="1" column="3"> + <widget class="QSlider" name="rotation_slider"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>24</height> + </size> + </property> + <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>24</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="text"> + <string>Rotation sensitivity</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_6"> + <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="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>24</height> + </size> + </property> + <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>24</number> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="label_27"> + <property name="text"> + <string>Translation deadzone</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_28"> + <property name="text"> + <string>Rotation deadzone</string> + </property> + </widget> + </item> + <item row="4" column="3"> + <widget class="QSlider" name="rot_dz_slider"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>24</height> + </size> + </property> + <property name="maximum"> + <number>100</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksAbove</enum> + </property> + <property name="tickInterval"> + <number>24</number> + </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="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>24</height> + </size> + </property> + <property name="maximum"> + <number>100</number> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="tickPosition"> + <enum>QSlider::TicksAbove</enum> + </property> + <property name="tickInterval"> + <number>24</number> + </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_30"> + <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="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>24</height> + </size> + </property> + <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>24</number> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox_12"> + <property name="title"> + <string/> + </property> + <layout class="QGridLayout" name="gridLayout_13"> + <item row="0" column="1"> + <widget class="QLabel" name="label_26111"> + <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><html><head/><body><p align="justify"><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></body></html></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_5"> + <property name="text"> + <string><html><head/><body><p>Visit <a href="https://github.com/opentrack/opentrack/wiki/Accela-in-opentrack-2.3"><span style=" text-decoration: underline; color:#0000ff;">our wiki</span></a> for description of the settings.</p></body></html></string> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer_4"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Expanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> <widget class="QWidget" name="tab_5"> <attribute name="title"> <string>Game detection</string> @@ -1101,9 +1743,6 @@ <string>Game detection</string> </property> <layout class="QGridLayout" name="gridLayout_2"> - <item row="1" column="0"> - <widget class="process_detector" name="game_detector" native="true"/> - </item> <item row="0" column="0"> <widget class="QLabel" name="label_24"> <property name="sizePolicy"> @@ -1120,6 +1759,9 @@ </property> </widget> </item> + <item row="1" column="0"> + <widget class="process_detector" name="game_detector" native="true"/> + </item> </layout> </widget> </item> @@ -1147,15 +1789,6 @@ <tabstop>tabWidget</tabstop> <tabstop>center_at_startup</tabstop> <tabstop>trayp</tabstop> - <tabstop>camera_yaw</tabstop> - <tabstop>camera_pitch</tabstop> - <tabstop>camera_roll</tabstop> - <tabstop>pos_rx</tabstop> - <tabstop>pos_ry</tabstop> - <tabstop>pos_rz</tabstop> - <tabstop>pos_tx</tabstop> - <tabstop>pos_ty</tabstop> - <tabstop>pos_tz</tabstop> <tabstop>tcomp_enable</tabstop> <tabstop>tcomp_rz</tabstop> <tabstop>src_yaw</tabstop> @@ -1171,8 +1804,27 @@ <tabstop>src_z</tabstop> <tabstop>invert_z</tabstop> </tabstops> - <resources/> + <resources> + <include location="ui-res.qrc"/> + </resources> <connections/> + <designerdata> + <property name="gridDeltaX"> + <number>5</number> + </property> + <property name="gridDeltaY"> + <number>5</number> + </property> + <property name="gridSnapX"> + <bool>true</bool> + </property> + <property name="gridSnapY"> + <bool>true</bool> + </property> + <property name="gridVisible"> + <bool>true</bool> + </property> + </designerdata> <slots> <slot>startEngineClicked()</slot> <slot>stopEngineClicked()</slot> diff --git a/gui/software-update-dialog.hpp b/gui/software-update-dialog.hpp new file mode 100644 index 00000000..21d92ecc --- /dev/null +++ b/gui/software-update-dialog.hpp @@ -0,0 +1,87 @@ +#pragma once + +#include <QtNetwork> +#include <QDialog> +#include <QSettings> +#include <QString> +#include <QRegExp> +#include <functional> +#include "ui_software-update.h" +#include "opentrack-compat/options.hpp" + +extern "C" const char* opentrack_version; + +class update_dialog : public QDialog +{ + Q_OBJECT +public: + struct query + { + query(QWidget* parent) : parent(parent), qnam(parent) {} + + QWidget* parent; + QNetworkAccessManager qnam; + QByteArray buf; + QNetworkReply* r; + void on_finished() + { + if (r->error() != QNetworkReply::NoError) + { + qDebug() << "update error" << r->errorString(); + return; + } + QString str(buf); + QRegExp re("OPENTRACK_VERSION([a-zA-Z0-9_.-]+)"); + int idx = re.indexIn(str); + if (idx != -1) + { + str = re.cap(1); + QSettings s(OPENTRACK_ORG); + QString quiet_version = s.value("quiet-update-version").toString(); + + if (!str.isEmpty() && str != opentrack_version && str != quiet_version) + { + qDebug() << "update version" << str; + update_dialog dlg(parent, *this, str); + dlg.show(); + dlg.raise(); + dlg.exec(); + if (dlg.ui.disable_reminder->isChecked()) + s.setValue("quiet-update-version", str); + } + } + buf.clear(); + r->deleteLater(); + } + void on_ready() + { + buf.append(r->readAll()); + } + void maybe_show_dialog() + { + static auto uri = QStringLiteral("http://www.trackhat.org/#!opentrackversion/c1oxn"); + r = qnam.get(QNetworkRequest(uri)); + + QObject::connect(r, &QNetworkReply::finished, [&]() { on_finished(); }); + QObject::connect(r, &QNetworkReply::readyRead, [&]() { on_ready(); }); + } + }; +private: + Ui::UpdateDialog ui; + query& q; +private slots: + void close(QAbstractButton*) + { + QDialog::close(); + } +public: + update_dialog(QWidget* parent, query& q, const QString& new_version) : QDialog(parent), q(q) + { + ui.setupUi(this); + ui.ver_current->setText(const_cast<const char*>(opentrack_version)); + ui.ver_new->setTextFormat(Qt::RichText); + ui.ver_new->setText("<a href='http://www.trackhat.org/#!trackhat-opentrack/c1jzc'>" + new_version + "</a>"); + ui.ver_new->setOpenExternalLinks(true); + connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close(QAbstractButton*))); + } +}; diff --git a/gui/software-update.ui b/gui/software-update.ui new file mode 100644 index 00000000..07edf66c --- /dev/null +++ b/gui/software-update.ui @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UpdateDialog</class> + <widget class="QDialog" name="UpdateDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>385</width> + <height>187</height> + </rect> + </property> + <property name="windowTitle"> + <string>Dialog</string> + </property> + <layout class="QVBoxLayout"> + <item> + <widget class="QLabel" name="label"> + <property name="font"> + <font> + <pointsize>16</pointsize> + </font> + </property> + <property name="text"> + <string>Software update released</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </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> + <property name="lineWidth"> + <number>0</number> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="leftMargin"> + <number>12</number> + </property> + <property name="topMargin"> + <number>12</number> + </property> + <property name="rightMargin"> + <number>12</number> + </property> + <property name="bottomMargin"> + <number>12</number> + </property> + <property name="spacing"> + <number>12</number> + </property> + <item row="0" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Current version:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="ver_current"> + <property name="text"> + <string>TextLabel</string> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Released version:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="ver_new"> + <property name="text"> + <string>TextLabel</string> + </property> + </widget> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QCheckBox" name="disable_reminder"> + <property name="text"> + <string>Don't remind me again about this version</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Close</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/gui/trackhat-wizard.ui b/gui/trackhat-wizard.ui new file mode 100644 index 00000000..09f68c03 --- /dev/null +++ b/gui/trackhat-wizard.ui @@ -0,0 +1,189 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>wizard</class> + <widget class="QWizard" name="wizard"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>365</width> + <height>586</height> + </rect> + </property> + <property name="modal"> + <bool>true</bool> + </property> + <property name="wizardStyle"> + <enum>QWizard::AeroStyle</enum> + </property> + <property name="options"> + <set>QWizard::NoCancelButton</set> + </property> + <widget class="QWizardPage" name="page_model"> + <property name="title"> + <string>Select a model</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QFrame" name="frame_7"> + <property name="styleSheet"> + <string notr="true">QFrame { + border: 0; + background: transparent; +}</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="leftMargin"> + <number>20</number> + </property> + <property name="bottomMargin"> + <number>12</number> + </property> + <property name="spacing"> + <number>0</number> + </property> + <item row="0" column="1"> + <widget class="QLabel" name="label_12"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>120</width> + <height>108</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>120</width> + <height>108</height> + </size> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ui-res.qrc">:/images/trackhat-hat.png</pixmap> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="label_46"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>130</width> + <height>130</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>130</width> + <height>130</height> + </size> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ui-res.qrc">:/images/trackhat-clip-right.png</pixmap> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLabel" name="label_48"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>130</width> + <height>130</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>130</width> + <height>130</height> + </size> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="ui-res.qrc">:/images/trackhat-clip-left.png</pixmap> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QRadioButton" name="cap_model"> + <property name="text"> + <string>Cap</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QRadioButton" name="clip_model"> + <property name="text"> + <string>Clip, right-handed</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QRadioButton" name="clip_model_left"> + <property name="text"> + <string>Clip, left-handed</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <widget class="QWizardPage" name="page_done"> + <property name="title"> + <string>We're all done!</string> + </property> + <layout class="QGridLayout" name="gridLayout_7"> + <item row="0" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string><html><head/><body><p>You can now use your new hardware and thanks for flying TrackHat.</p></body></html></string> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + <resources> + <include location="ui-res.qrc"/> + </resources> + <connections/> +</ui> diff --git a/tracker-pt/trans_calib.cpp b/gui/trans_calib.cpp index a1a4b641..a1a4b641 100644 --- a/tracker-pt/trans_calib.cpp +++ b/gui/trans_calib.cpp diff --git a/tracker-pt/trans_calib.h b/gui/trans_calib.h index e20fc767..e20fc767 100644 --- a/tracker-pt/trans_calib.h +++ b/gui/trans_calib.h diff --git a/gui/ui-res.qrc b/gui/ui-res.qrc index 030a6153..ec1c7bba 100644 --- a/gui/ui-res.qrc +++ b/gui/ui-res.qrc @@ -6,5 +6,8 @@ <file>images/facetracknoir.png</file> <file>images/no-feed.png</file> <file>images/filter-16.png</file> + <file>images/trackhat-clip-left.png</file> + <file>images/trackhat-clip-right.png</file> + <file>images/trackhat-hat.png</file> </qresource> </RCC> @@ -8,6 +8,8 @@ #include "ui.h" #include "opentrack/tracker.h" +#include "tracker-pt/ftnoir_tracker_pt.h" +#include "filter-accela/ftnoir_filter_accela.h" #include "opentrack-compat/options.hpp" #include "new_file_dialog.h" #include <QFileDialog> @@ -23,7 +25,8 @@ MainWindow::MainWindow() : pose_update_timer(this), kbd_quit(QKeySequence("Ctrl+Q"), this), is_refreshing_profiles(false), - keys_paused(false) + keys_paused(false), + update_query(this) { ui.setupUi(this); @@ -33,41 +36,21 @@ MainWindow::MainWindow() : connect(ui.btnEditCurves, SIGNAL(clicked()), this, SLOT(showCurveConfiguration())); connect(ui.btnShortcuts, SIGNAL(clicked()), this, SLOT(show_options_dialog())); - connect(ui.btnShowEngineControls, SIGNAL(clicked()), this, SLOT(showTrackerSettings())); connect(ui.btnShowServerControls, SIGNAL(clicked()), this, SLOT(showProtocolSettings())); - connect(ui.btnShowFilterControls, SIGNAL(clicked()), this, SLOT(showFilterSettings())); - - modules.filters().push_front(std::make_shared<dylib>("", dylib::Filter)); - - for (auto x : modules.trackers()) - ui.iconcomboTrackerSource->addItem(x->icon, x->name); for (auto x : modules.protocols()) ui.iconcomboProtocol->addItem(x->icon, x->name); - for (auto x : modules.filters()) - ui.iconcomboFilter->addItem(x->icon, x->name); - refresh_config_list(); connect(&config_list_timer, SIGNAL(timeout()), this, SLOT(refresh_config_list())); config_list_timer.start(1000 * 3); - tie_setting(s.tracker_dll, ui.iconcomboTrackerSource); tie_setting(s.protocol_dll, ui.iconcomboProtocol); - tie_setting(s.filter_dll, ui.iconcomboFilter); - - connect(ui.iconcomboTrackerSource, - &QComboBox::currentTextChanged, - [&](QString) -> void { if (pTrackerDialog) pTrackerDialog = nullptr; save(); }); connect(ui.iconcomboProtocol, &QComboBox::currentTextChanged, [&](QString) -> void { if (pProtocolDialog) pProtocolDialog = nullptr; save(); }); - connect(ui.iconcomboFilter, - &QComboBox::currentTextChanged, - [&](QString) -> void { if (pFilterDialog) pFilterDialog = nullptr; save(); }); - connect(ui.btnStartTracker, SIGNAL(clicked()), this, SLOT(startTracker())); connect(ui.btnStopTracker, SIGNAL(clicked()), this, SLOT(stopTracker())); connect(ui.iconcomboProfile, SIGNAL(currentTextChanged(QString)), this, SLOT(profileSelected(QString))); @@ -125,6 +108,16 @@ MainWindow::MainWindow() : connect(this, &MainWindow::emit_minimized, this, &MainWindow::mark_minimized, Qt::QueuedConnection); ui.btnStartTracker->setFocus(); + + update_query.maybe_show_dialog(); +} + +void MainWindow::closeEvent(QCloseEvent *e) +{ + if (maybe_not_close_tracking()) + e->ignore(); + else + e->accept(); } void MainWindow::register_shortcuts() @@ -278,8 +271,6 @@ void MainWindow::updateButtonState(bool running, bool inertialp) ui.btnStartTracker->setEnabled ( not_running ); ui.btnStopTracker->setEnabled ( running ); ui.iconcomboProtocol->setEnabled ( not_running ); - ui.iconcomboFilter->setEnabled ( not_running ); - ui.iconcomboTrackerSource->setEnabled(not_running); ui.video_frame_label->setVisible(not_running || inertialp); ui.profile_button->setEnabled(not_running); } @@ -298,7 +289,7 @@ void MainWindow::startTracker() { // tracker dtor needs run first work = nullptr; - libs = SelectedLibraries(ui.video_frame, current_tracker(), current_protocol(), current_filter()); + libs = SelectedLibraries(ui.video_frame, std::make_shared<Tracker_PT>(), current_protocol(), std::make_shared<FTNoIR_Filter>()); { double p[6] = {0,0,0, 0,0,0}; @@ -319,12 +310,6 @@ void MainWindow::startTracker() { reload_options(); - if (pTrackerDialog) - pTrackerDialog->register_tracker(libs.pTracker.get()); - - if (pFilterDialog) - pFilterDialog->register_filter(libs.pFilter.get()); - if (pProtocolDialog) pProtocolDialog->register_protocol(libs.pProtocol.get()); @@ -349,17 +334,9 @@ void MainWindow::stopTracker() { pose_update_timer.stop(); ui.pose_display->rotateBy(0, 0, 0, 0, 0, 0); - if (pTrackerDialog) - pTrackerDialog->unregister_tracker(); - if (pProtocolDialog) pProtocolDialog->unregister_protocol(); - if (pFilterDialog) - pFilterDialog->unregister_filter(); - - maybe_save(); - work = nullptr; libs = SelectedLibraries(); @@ -382,11 +359,10 @@ void MainWindow::display_pose(const double *mapped, const double *raw) if (mapping_widget) mapping_widget->update(); - double mapped_[6], raw_[6]; + double raw_[6]; for (int i = 0; i < 6; i++) { - mapped_[i] = (int) mapped[i]; raw_[i] = (int) raw[i]; } @@ -397,13 +373,6 @@ void MainWindow::display_pose(const double *mapped, const double *raw) ui.raw_pitch->display(raw_[Pitch]); ui.raw_roll->display(raw_[Roll]); - ui.pose_x->display(mapped_[TX]); - ui.pose_y->display(mapped_[TY]); - ui.pose_z->display(mapped_[TZ]); - ui.pose_yaw->display(mapped_[Yaw]); - ui.pose_pitch->display(mapped_[Pitch]); - ui.pose_roll->display(mapped_[Roll]); - QString game_title; if (libs.pProtocol) game_title = libs.pProtocol->game_name(); @@ -416,7 +385,7 @@ void MainWindow::set_title(const QString& game_title_) if (game_title_ != "") game_title = " :: " + game_title_; QString current = group::ini_filename(); - setWindowTitle(opentrack_version + QStringLiteral(" :: ") + current + game_title); + setWindowTitle(opentrack_version + QStringLiteral(" opentrack") + QStringLiteral(" :: ") + current + game_title); } void MainWindow::showHeadPose() @@ -432,12 +401,12 @@ void MainWindow::showHeadPose() } template<typename t> -bool mk_dialog(mem<dylib> lib, mem<t>& orig) +bool mk_dialog(mem<dylib> lib, mem<t>* orig) { - if (orig && orig->isVisible()) + if (*orig && (*orig)->isVisible()) { - orig->show(); - orig->raise(); + (*orig)->show(); + (*orig)->raise(); return false; } @@ -447,33 +416,18 @@ bool mk_dialog(mem<dylib> lib, mem<t>& orig) dialog->setWindowFlags(Qt::Dialog); dialog->setFixedSize(dialog->size()); - orig = dialog; + *orig = dialog; dialog->show(); - QObject::connect(dialog.get(), &plugin_api::detail::BaseDialog::closing, [&]() -> void { orig = nullptr; }); - return true; } return false; } - -void MainWindow::showTrackerSettings() -{ - if (mk_dialog(current_tracker(), pTrackerDialog) && libs.pTracker) - pTrackerDialog->register_tracker(libs.pTracker.get()); -} - void MainWindow::showProtocolSettings() { - if (mk_dialog(current_protocol(), pProtocolDialog) && libs.pProtocol) + if (mk_dialog(current_protocol(), &pProtocolDialog) && libs.pProtocol) pProtocolDialog->register_protocol(libs.pProtocol.get()); } - -void MainWindow::showFilterSettings() { - if (mk_dialog(current_filter(), pFilterDialog) && libs.pFilter) - pFilterDialog->register_filter(libs.pFilter.get()); -} - template<typename t, typename... Args> bool mk_window(mem<t>* place, Args&&... params) { @@ -495,6 +449,7 @@ bool mk_window(mem<t>* place, Args&&... params) void MainWindow::show_options_dialog() { if (mk_window(&options_widget, s, + *this, [&]() -> void { register_shortcuts(); }, [&](bool flag) -> void { keys_paused = flag; })) connect(options_widget.get(), SIGNAL(reload()), this, SLOT(reload_options())); @@ -504,12 +459,29 @@ void MainWindow::showCurveConfiguration() { mk_window(&mapping_widget, pose, s); } +bool MainWindow::maybe_not_close_tracking() +{ + if (work != nullptr) + { + auto btn = QMessageBox::warning(this, "Tracking active", + "Are you sure you want to exit? This will terminate tracking.", + QMessageBox::Yes, QMessageBox::No); + if (btn == QMessageBox::No) + return true; + } + return false; +} + void MainWindow::exit() { - QCoreApplication::exit(0); + + if (!maybe_not_close_tracking()) + QCoreApplication::exit(0); } void MainWindow::profileSelected(QString name) { + maybe_save(); + if (name == "" || is_refreshing_profiles) return; @@ -32,10 +32,11 @@ #include "curve-config.h" #include "options-dialog.hpp" #include "process_detector.h" +#include "software-update-dialog.hpp" using namespace options; -class MainWindow : public QMainWindow, private State +class MainWindow : public QMainWindow, public State { Q_OBJECT @@ -49,27 +50,18 @@ class MainWindow : public QMainWindow, private State mem<OptionsDialog> options_widget; mem<MapWidget> mapping_widget; QShortcut kbd_quit; - mem<IFilterDialog> pFilterDialog; mem<IProtocolDialog> pProtocolDialog; - mem<ITrackerDialog> pTrackerDialog; process_detector_worker det; QMenu profile_menu; bool is_refreshing_profiles; volatile bool keys_paused; QTimer save_timer; + update_dialog::query update_query; - mem<dylib> current_tracker() - { - return modules.trackers().value(ui.iconcomboTrackerSource->currentIndex(), nullptr); - } mem<dylib> current_protocol() { return modules.protocols().value(ui.iconcomboProtocol->currentIndex(), nullptr); } - mem<dylib> current_filter() - { - return modules.filters().value(ui.iconcomboFilter->currentIndex(), nullptr); - } void changeEvent(QEvent* e) override; @@ -81,6 +73,8 @@ class MainWindow : public QMainWindow, private State static bool get_new_config_name_from_dialog(QString &ret); void set_profile(const QString& profile); void maybe_save(); + bool maybe_not_close_tracking(); + void closeEvent(QCloseEvent *e) override; void register_shortcuts(); private slots: void _save(); @@ -88,9 +82,7 @@ private slots: void exit(); void profileSelected(QString name); - void showTrackerSettings(); void showProtocolSettings(); - void showFilterSettings(); void show_options_dialog(); void showCurveConfiguration(); void showHeadPose(); diff --git a/gui/wizard.cpp b/gui/wizard.cpp new file mode 100644 index 00000000..cf987ecb --- /dev/null +++ b/gui/wizard.cpp @@ -0,0 +1,81 @@ +#include "wizard.h" +#include "opentrack/state.hpp" +#include "tracker-pt/ftnoir_tracker_pt_settings.h" +#include "filter-accela/ftnoir_filter_accela.h" + +Wizard::Wizard() : QWizard(nullptr) +{ + ui.setupUi(this); + connect(this, SIGNAL(accepted()), this, SLOT(set_data())); +} + +static constexpr double tz[][2] = { + { 16.5327205657959, 13.0232553482056 }, + { 55.4535026550293, 100 }, + { 56.8312301635742, 100 }, + { -1, -1 }, +}; + +static constexpr double yaw[][2] = { + { 10.7462686567164, 20.9302325581395 }, + { 30, 115 }, + { 41.9517784118652, 180 }, + { -1, -1 }, +}; + +static constexpr double pitch[][2] = { + { 10.1262916188289, 27.6279069767442 }, + { 32.4454649827784, 180 }, + { -1, -1 }, +}; + +static constexpr double roll[][2] = { + { 12.3995409011841, 25.9534893035889 }, + { 54.3513221740723, 180 }, + { -1, -1 }, +}; + +static void set_mapping(Mapping& m, const double spline[][2]) +{ + m.opts.altp = false; + m.curve.removeAllPoints(); + for (int i = 0; spline[i][0] >= 0; i++) + m.curve.addPoint(QPointF(spline[i][0], spline[i][1])); +} + +void Wizard::set_data() +{ + Model m; + + if (ui.clip_model->isChecked()) + m = ClipRight; + else if (ui.clip_model_left->isChecked()) + m = ClipLeft; + else // ui.cap_model + m = Cap; + + State state; + + set_mapping(state.pose(TZ), tz); + set_mapping(state.pose(Yaw), yaw); + set_mapping(state.pose(Pitch), pitch); + set_mapping(state.pose(Roll), roll); + state.pose.save_mappings(); + + settings_pt pt; + pt.threshold = 31; + pt.min_point_size = 0; + pt.max_point_size = 50; + pt.fov = 1; + pt.camera_mode = 0; + pt.model_used = m; + pt.b->save(); + + settings_accela acc; + acc.ewma = 49; + acc.rot_threshold = 29; + acc.rot_deadzone = 29; + acc.trans_deadzone = 33; + acc.trans_threshold = 19; + acc.b->save(); +} diff --git a/gui/wizard.h b/gui/wizard.h new file mode 100644 index 00000000..9d359172 --- /dev/null +++ b/gui/wizard.h @@ -0,0 +1,21 @@ +#pragma once + +#include "opentrack-compat/options.hpp" +#include "opentrack/main-settings.hpp" +#include "opentrack/mappings.hpp" +#include "ui_trackhat-wizard.h" +#include <QObject> +#include <QWizard> + +class Wizard : public QWizard +{ + Q_OBJECT + Ui_wizard ui; +public: + Wizard(); + + enum Model { Cap = 0, ClipRight = 1, ClipLeft = 2 }; + enum { ClipRightX = 135, ClipLeftX = -135 }; +private slots: + void set_data(); +}; diff --git a/installer/opentrack-installer.iss b/installer/opentrack-installer.iss index c29bc4a3..cbef0380 100644 --- a/installer/opentrack-installer.iss +++ b/installer/opentrack-installer.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #include "../build/opentrack-version.h" -#define MyAppName "opentrack" +#define MyAppName "TrackHat opentrack" #define MyAppVersion OPENTRACK_VERSION #define MyAppPublisher "opentrack" #define MyAppURL "http://github.com/opentrack/opentrack" @@ -12,7 +12,7 @@ ; NOTE: The value of AppId uniquely identifies this application. ; Do not use the same AppId value in installers for other applications. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) -AppId={{63F53541-A29E-4B53-825A-9B6F876A2BD6} +AppId={{E82E655F-BB38-403A-9883-7B01A9F2CBA6} AppName={#MyAppName} AppVersion={#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion} @@ -23,7 +23,7 @@ AppUpdatesURL={#MyAppURL} DefaultDirName={pf}\{#MyAppName} DefaultGroupName={#MyAppName} AllowNoIcons=yes -OutputBaseFilename={#MyAppVersion}-win32-setup +OutputBaseFilename={#MyAppVersion}-setup SetupIconFile=..\gui\facetracknoir.ico Compression=lzma2/ultra64 SolidCompression=yes @@ -42,7 +42,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl" Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] -Source: "..\build\install\*"; DestDir: "{app}"; Flags: ignoreversion createallsubdirs recursesubdirs +Source: "..\build\install\*"; DestDir: "{app}"; Flags: ignoreversion createallsubdirs recursesubdirs; Excludes: "opentrack-tracker-rs-impl.exe,libopentrack-tracker*.dll,libopentrack-filter-*.dll,sixense.dll,contrib"; [Icons] Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" diff --git a/macosx/make-app-bundle.sh b/macosx/make-app-bundle.sh index 30a1517b..ed7dbd39 100644 --- a/macosx/make-app-bundle.sh +++ b/macosx/make-app-bundle.sh @@ -1,6 +1,6 @@ #!/bin/sh -APPNAME=opentrack +APPNAME=trackhat-opentrack dir="$1" test -n "$dir" || exit 1 diff --git a/macosx/opentrack.app/Contents/Info.plist b/macosx/opentrack.app/Contents/Info.plist index 41ca402a..17e17735 100644 --- a/macosx/opentrack.app/Contents/Info.plist +++ b/macosx/opentrack.app/Contents/Info.plist @@ -7,9 +7,9 @@ <key>CFBundleExecutable</key> <string>opentrack.sh</string> <key>CFBundleIdentifier</key> - <string>com.github.opentrack</string> + <string>com.github.opentrack.trackhat</string> <key>CFBundleName</key> - <string>opentrack</string> + <string>trackhat-opentrack</string> <key>CFBundleIconFile</key> <string>opentrack.icns</string> <key>CFBundleVersion</key> @@ -19,7 +19,7 @@ <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleDisplayName</key> - <string>opentrack</string> + <string>trackhat-opentrack</string> <key>CFBundleSignature</key> <string>????</string> </dict> diff --git a/opentrack-compat/options.hpp b/opentrack-compat/options.hpp index d41c5cd1..a317a1f7 100644 --- a/opentrack-compat/options.hpp +++ b/opentrack-compat/options.hpp @@ -47,7 +47,7 @@ template<typename t> using mem = std::shared_ptr<t>; #define OPENTRACK_CONFIG_FILENAME_KEY "settings-filename" #define OPENTRACK_DEFAULT_CONFIG "default.ini" -#define OPENTRACK_ORG "opentrack-2.3" +#define OPENTRACK_ORG "TrackHat opentrack-2.3" namespace options { template<typename k, typename v> using map = std::map<k, v>; diff --git a/opentrack/main-settings.hpp b/opentrack/main-settings.hpp index 793c52f7..2d1c1f22 100644 --- a/opentrack/main-settings.hpp +++ b/opentrack/main-settings.hpp @@ -16,12 +16,10 @@ using namespace options; struct axis_opts { pbundle b; - value<double> zero; value<bool> invert, altp; value<int> src; axis_opts(pbundle b, QString pfx, int idx) : b(b), - zero(b, n(pfx, "zero-pos"), 0), invert(b, n(pfx, "invert-sign"), false), altp(b, n(pfx, "alt-axis-sign"), false), src(b, n(pfx, "source-index"), idx) @@ -44,19 +42,17 @@ struct key_opts { }; struct main_settings : opts { - value<QString> tracker_dll, filter_dll, protocol_dll; + value<QString> protocol_dll; axis_opts a_x, a_y, a_z, a_yaw, a_pitch, a_roll; value<bool> tcomp_p, tcomp_tz; value<bool> tray_enabled; value<int> camera_yaw, camera_pitch, camera_roll; - value<bool> center_at_startup; + value<bool> center_at_startup, wizard_done; value<int> center_method; key_opts key_start_tracking, key_stop_tracking, key_toggle_tracking; key_opts key_center, key_toggle, key_zero; main_settings() : opts("opentrack-ui"), - tracker_dll(b, "tracker-dll", ""), - filter_dll(b, "filter-dll", "Accela"), protocol_dll(b, "protocol-dll", "freetrack 2.0 Enhanced"), a_x(b, "x", TX), a_y(b, "y", TY), @@ -71,6 +67,7 @@ struct main_settings : opts { camera_pitch(b, "camera-pitch", 0), camera_roll(b, "camera-roll", 0), center_at_startup(b, "center-at-startup", true), + wizard_done(b, "wizard-done", false), center_method(b, "centering-method", true), key_start_tracking(b, "start-tracking"), key_stop_tracking(b, "stop-tracking"), diff --git a/opentrack/plugin-support.hpp b/opentrack/plugin-support.hpp index 650eec10..9968890d 100644 --- a/opentrack/plugin-support.hpp +++ b/opentrack/plugin-support.hpp @@ -53,7 +53,7 @@ extern "C" typedef void* (*OPENTRACK_CTOR_FUNPTR)(void); extern "C" typedef Metadata* (*OPENTRACK_METADATA_FUNPTR)(void); struct dylib { - enum Type { Filter, Tracker, Protocol }; + enum Type { Protocol }; dylib(const QString& filename, Type t) : type(t), @@ -162,17 +162,14 @@ struct dylib { static QList<mem<dylib>> enum_libraries() { - const char* filters_n[] = { "opentrack-filter-*.", - "opentrack-tracker-*.", - "opentrack-proto-*." - }; - const Type filters_t[] = { Filter, Tracker, Protocol }; + const char* filters_n[] = { "opentrack-proto-*." }; + const Type filters_t[] = { Protocol }; QDir settingsDir( QCoreApplication::applicationDirPath() ); QList<mem<dylib>> ret; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 1; i++) { QString filter = filters_n[i]; auto t = filters_t[i]; @@ -234,8 +231,6 @@ private: struct Modules { Modules() : module_list(dylib::enum_libraries()), - filter_modules(filter(dylib::Filter)), - tracker_modules(filter(dylib::Tracker)), protocol_modules(filter(dylib::Protocol)) {} QList<mem<dylib>>& filters() { return filter_modules; } diff --git a/opentrack/selected-libraries.cpp b/opentrack/selected-libraries.cpp index 63517774..e3bac0c5 100644 --- a/opentrack/selected-libraries.cpp +++ b/opentrack/selected-libraries.cpp @@ -1,33 +1,25 @@ #include "opentrack/selected-libraries.hpp" #include <QDebug> -SelectedLibraries::SelectedLibraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f) : +SelectedLibraries::SelectedLibraries(QFrame* frame, mem<ITracker> t, dylibptr p, mem<IFilter> f) : pTracker(nullptr), pFilter(nullptr), pProtocol(nullptr), correct(false) { + pTracker = t; pProtocol = make_dylib_instance<IProtocol>(p); + pFilter = f; - if (!pProtocol) + if (!pTracker || !pProtocol) { - qDebug() << "protocol dylib load failure"; + qDebug() << "dylib load failure"; return; } if(!pProtocol->correct()) { qDebug() << "protocol load failure"; - pProtocol = nullptr; - return; - } - - pTracker = make_dylib_instance<ITracker>(t); - pFilter = make_dylib_instance<IFilter>(f); - - if (!pTracker) - { - qDebug() << "tracker dylib load failure"; return; } diff --git a/opentrack/selected-libraries.hpp b/opentrack/selected-libraries.hpp index b396b5ec..5384f9e2 100644 --- a/opentrack/selected-libraries.hpp +++ b/opentrack/selected-libraries.hpp @@ -23,7 +23,7 @@ struct OPENTRACK_EXPORT SelectedLibraries { mem<ITracker> pTracker; mem<IFilter> pFilter; mem<IProtocol> pProtocol; - SelectedLibraries(QFrame* frame, dylibptr t, dylibptr p, dylibptr f); + SelectedLibraries(QFrame* frame, mem<ITracker> t, dylibptr p, mem<IFilter> f); SelectedLibraries() : pTracker(nullptr), pFilter(nullptr), pProtocol(nullptr), correct(false) {} bool correct; }; diff --git a/opentrack/tracker.cpp b/opentrack/tracker.cpp index 6411db40..1bc28b87 100644 --- a/opentrack/tracker.cpp +++ b/opentrack/tracker.cpp @@ -169,7 +169,7 @@ void Tracker::logic() double tmp[3] = { t(0) - t_b[0], t(1) - t_b[1], t(2) - t_b[2] }; t_compensate(cam, tmp, tmp, false); rmat m_; - switch (s.center_method) + switch (1) { case 0: default: @@ -210,9 +210,6 @@ void Tracker::logic() s.tcomp_tz); for (int i = 0; i < 6; i++) - value(i) += m(i).opts.zero; - - for (int i = 0; i < 6; i++) value[i] *= inverts[i] ? -1. : 1.; if (zero_) diff --git a/pose-widget/glwidget.cpp b/pose-widget/glwidget.cpp index 1b30e585..b5d4c0b7 100644 --- a/pose-widget/glwidget.cpp +++ b/pose-widget/glwidget.cpp @@ -125,8 +125,7 @@ void GLWidget::project_quad_texture() { QImage& tex = dir < 0 ? back : front; QImage texture(QSize(sx, sy), QImage::Format_RGBA8888); - QColor bgColor = palette().color(QPalette::Current, QPalette::Window); - texture.fill(bgColor); + texture.fill(QColor(0xcc, 0xcc, 0xcc, 0xff)); const vec2 projected[2][3] = { { pt[0], pt[1], pt[2] }, { pt[3], pt[1], pt[2] } }; const vec2 origs[2][3] = { diff --git a/pose-widget/images/side1.png b/pose-widget/images/side1.png Binary files differindex 5fb72d64..9d4d2b5c 100644..100755 --- a/pose-widget/images/side1.png +++ b/pose-widget/images/side1.png diff --git a/pose-widget/images/side6.png b/pose-widget/images/side6.png Binary files differindex 3b3bda10..7130f47e 100644..100755 --- a/pose-widget/images/side6.png +++ b/pose-widget/images/side6.png diff --git a/tracker-pt/CMakeLists.txt b/tracker-pt/CMakeLists.txt index 36710ecf..79405b4d 100644 --- a/tracker-pt/CMakeLists.txt +++ b/tracker-pt/CMakeLists.txt @@ -1,6 +1,6 @@ find_package(OpenCV 3.0 QUIET) if(OpenCV_FOUND) - opentrack_boilerplate(opentrack-tracker-pt) + opentrack_boilerplate(opentrack-tracker-pt STATIC) target_link_libraries(opentrack-tracker-pt ${OpenCV_LIBS}) target_include_directories(opentrack-tracker-pt SYSTEM PUBLIC ${OpenCV_INCLUDE_DIRS}) link_with_dinput8(opentrack-tracker-pt) diff --git a/tracker-pt/FTNoIR_PT_Controls.ui b/tracker-pt/FTNoIR_PT_Controls.ui deleted file mode 100644 index 75190a5e..00000000 --- a/tracker-pt/FTNoIR_PT_Controls.ui +++ /dev/null @@ -1,1226 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UICPTClientControls</class> - <widget class="QWidget" name="UICPTClientControls"> - <property name="windowModality"> - <enum>Qt::NonModal</enum> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>424</width> - <height>579</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="windowTitle"> - <string>PointTracker Settings</string> - </property> - <property name="windowIcon"> - <iconset resource="ftnoir_tracker_pt.qrc"> - <normaloff>:/Resources/Logo_IR.png</normaloff>:/Resources/Logo_IR.png</iconset> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <layout class="QGridLayout" name="gridLayout_9"> - <property name="sizeConstraint"> - <enum>QLayout::SetFixedSize</enum> - </property> - <item row="0" column="0"> - <widget class="QTabWidget" name="tabWidget"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="locale"> - <locale language="English" country="UnitedStates"/> - </property> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tab_2"> - <attribute name="title"> - <string>Camera</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="title"> - <string>Camera settings</string> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="3" column="0"> - <widget class="QLabel" name="label_37"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>FPS</string> - </property> - <property name="buddy"> - <cstring>fps_spin</cstring> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="res_y_spin"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Desired capture height</string> - </property> - <property name="suffix"> - <string> px</string> - </property> - <property name="maximum"> - <number>2000</number> - </property> - <property name="singleStep"> - <number>10</number> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Diagonal field of view</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_36"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Width</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QSpinBox" name="fov"> - <property name="suffix"> - <string>°</string> - </property> - <property name="prefix"> - <string/> - </property> - <property name="minimum"> - <number>10</number> - </property> - <property name="maximum"> - <number>90</number> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QCheckBox" name="dynamic_pose"> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="label_5"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Dynamic pose resolution</string> - </property> - </widget> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>Dynamic pose timeout</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QSpinBox" name="fps_spin"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Desired capture framerate</string> - </property> - <property name="suffix"> - <string> Hz</string> - </property> - <property name="maximum"> - <number>2000</number> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="QSpinBox" name="init_phase_timeout"> - <property name="suffix"> - <string> ms</string> - </property> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>10000</number> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_41"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Height</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="res_x_spin"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Desired capture width</string> - </property> - <property name="suffix"> - <string> px</string> - </property> - <property name="maximum"> - <number>2000</number> - </property> - <property name="singleStep"> - <number>10</number> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="camdevice_combo"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumContentsLength"> - <number>10</number> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_2"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Device</string> - </property> - <property name="buddy"> - <cstring>camdevice_combo</cstring> - </property> - </widget> - </item> - <item row="7" column="0"> - <widget class="QLabel" name="label_9"> - <property name="text"> - <string>Camera settings dialog</string> - </property> - </widget> - </item> - <item row="7" column="1"> - <widget class="QPushButton" name="camera_settings"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Open</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>Point extraction</string> - </property> - <layout class="QGridLayout" name="gridLayout_7"> - <item row="3" column="0"> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>Max size</string> - </property> - <property name="buddy"> - <cstring>maxdiam_spin</cstring> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Threshold</string> - </property> - <property name="buddy"> - <cstring>threshold_slider</cstring> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Min size</string> - </property> - <property name="buddy"> - <cstring>mindiam_spin</cstring> - </property> - </widget> - </item> - <item row="1" column="1" colspan="2"> - <widget class="QSlider" name="threshold_slider"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Intensity threshold for point extraction</string> - </property> - <property name="maximum"> - <number>255</number> - </property> - <property name="pageStep"> - <number>1</number> - </property> - <property name="value"> - <number>127</number> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="tickPosition"> - <enum>QSlider::TicksBothSides</enum> - </property> - <property name="tickInterval"> - <number>25</number> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_11"> - <property name="text"> - <string>Automatic threshold</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QCheckBox" name="auto_threshold"> - <property name="text"> - <string>Enable, slider sets point size</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QDoubleSpinBox" name="maxdiam_spin"> - <property name="toolTip"> - <string>Maximum point diameter</string> - </property> - <property name="suffix"> - <string> px</string> - </property> - <property name="decimals"> - <number>1</number> - </property> - <property name="singleStep"> - <double>0.100000000000000</double> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QDoubleSpinBox" name="mindiam_spin"> - <property name="toolTip"> - <string>Minimum point diameter</string> - </property> - <property name="suffix"> - <string> px</string> - </property> - <property name="decimals"> - <number>1</number> - </property> - <property name="singleStep"> - <double>0.100000000000000</double> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_4"> - <attribute name="title"> - <string>Model</string> - </attribute> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="0" column="0"> - <widget class="QTabWidget" name="model_tabs"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="tabShape"> - <enum>QTabWidget::Rounded</enum> - </property> - <property name="currentIndex"> - <number>0</number> - </property> - <property name="usesScrollButtons"> - <bool>false</bool> - </property> - <property name="documentMode"> - <bool>false</bool> - </property> - <property name="tabsClosable"> - <bool>false</bool> - </property> - <widget class="QWidget" name="tab_5"> - <attribute name="title"> - <string>Clip</string> - </attribute> - <layout class="QGridLayout" name="gridLayout_6"> - <item row="0" column="0"> - <widget class="QGroupBox" name="groupBox_8"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>331</width> - <height>208</height> - </size> - </property> - <property name="title"> - <string>Model Dimensions</string> - </property> - <widget class="QSpinBox" name="clip_tlength_spin"> - <property name="geometry"> - <rect> - <x>70</x> - <y>35</y> - <width>100</width> - <height>22</height> - </rect> - </property> - <property name="suffix"> - <string> mm</string> - </property> - <property name="minimum"> - <number>-65535</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - <widget class="QSpinBox" name="clip_bheight_spin"> - <property name="geometry"> - <rect> - <x>150</x> - <y>130</y> - <width>100</width> - <height>22</height> - </rect> - </property> - <property name="suffix"> - <string> mm</string> - </property> - <property name="minimum"> - <number>-65535</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - <widget class="QLabel" name="label_44"> - <property name="geometry"> - <rect> - <x>65</x> - <y>55</y> - <width>71</width> - <height>111</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_side.png</pixmap> - </property> - </widget> - <widget class="QLabel" name="label_50"> - <property name="geometry"> - <rect> - <x>20</x> - <y>40</y> - <width>46</width> - <height>13</height> - </rect> - </property> - <property name="text"> - <string>Side</string> - </property> - </widget> - <widget class="QSpinBox" name="clip_blength_spin"> - <property name="geometry"> - <rect> - <x>50</x> - <y>160</y> - <width>100</width> - <height>22</height> - </rect> - </property> - <property name="suffix"> - <string> mm</string> - </property> - <property name="minimum"> - <number>-65535</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - <widget class="QSpinBox" name="clip_theight_spin"> - <property name="geometry"> - <rect> - <x>150</x> - <y>70</y> - <width>100</width> - <height>22</height> - </rect> - </property> - <property name="suffix"> - <string> mm</string> - </property> - <property name="minimum"> - <number>-65535</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - <widget class="QLabel" name="label_51"> - <property name="geometry"> - <rect> - <x>290</x> - <y>40</y> - <width>46</width> - <height>13</height> - </rect> - </property> - <property name="text"> - <string>Front</string> - </property> - </widget> - <widget class="QLabel" name="label_45"> - <property name="geometry"> - <rect> - <x>300</x> - <y>70</y> - <width>21</width> - <height>111</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/clip_front.png</pixmap> - </property> - </widget> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_6"> - <attribute name="title"> - <string>Cap</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_14"> - <item> - <widget class="QGroupBox" name="groupBox_9"> - <property name="minimumSize"> - <size> - <width>331</width> - <height>208</height> - </size> - </property> - <property name="title"> - <string>Model Dimensions</string> - </property> - <widget class="QLabel" name="label_46"> - <property name="geometry"> - <rect> - <x>100</x> - <y>60</y> - <width>111</width> - <height>81</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/cap_side.png</pixmap> - </property> - </widget> - <widget class="QLabel" name="label_48"> - <property name="geometry"> - <rect> - <x>20</x> - <y>40</y> - <width>46</width> - <height>13</height> - </rect> - </property> - <property name="text"> - <string>Side</string> - </property> - </widget> - <widget class="QSpinBox" name="cap_length_spin"> - <property name="geometry"> - <rect> - <x>90</x> - <y>40</y> - <width>101</width> - <height>22</height> - </rect> - </property> - <property name="suffix"> - <string> mm</string> - </property> - <property name="minimum"> - <number>-65535</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - <widget class="QLabel" name="label_47"> - <property name="geometry"> - <rect> - <x>220</x> - <y>100</y> - <width>81</width> - <height>81</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/cap_front.png</pixmap> - </property> - </widget> - <widget class="QSpinBox" name="cap_width_spin"> - <property name="geometry"> - <rect> - <x>240</x> - <y>70</y> - <width>81</width> - <height>22</height> - </rect> - </property> - <property name="suffix"> - <string> mm</string> - </property> - <property name="minimum"> - <number>-65535</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - <widget class="QLabel" name="label_49"> - <property name="geometry"> - <rect> - <x>240</x> - <y>40</y> - <width>46</width> - <height>13</height> - </rect> - </property> - <property name="text"> - <string>Front</string> - </property> - </widget> - <widget class="QSpinBox" name="cap_height_spin"> - <property name="geometry"> - <rect> - <x>20</x> - <y>90</y> - <width>81</width> - <height>22</height> - </rect> - </property> - <property name="suffix"> - <string> mm</string> - </property> - <property name="minimum"> - <number>-65535</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_7"> - <attribute name="title"> - <string>Custom</string> - </attribute> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QGroupBox" name="groupBox_7"> - <property name="title"> - <string>Model Dimensions</string> - </property> - <layout class="QGridLayout" name="gridLayout_5"> - <item row="3" column="1"> - <widget class="QLabel" name="label_57"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>z:</string> - </property> - </widget> - </item> - <item row="2" column="5"> - <widget class="QSpinBox" name="m2y_spin"> - <property name="suffix"> - <string> mm</string> - </property> - <property name="minimum"> - <number>-65535</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="label_63"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>x:</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QSpinBox" name="m1x_spin"> - <property name="suffix"> - <string> mm</string> - </property> - <property name="minimum"> - <number>-65535</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QSpinBox" name="m1y_spin"> - <property name="suffix"> - <string> mm</string> - </property> - <property name="minimum"> - <number>-65535</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - </item> - <item row="3" column="5"> - <widget class="QSpinBox" name="m2z_spin"> - <property name="suffix"> - <string> mm</string> - </property> - <property name="minimum"> - <number>-65535</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - </item> - <item row="1" column="5"> - <widget class="QSpinBox" name="m2x_spin"> - <property name="suffix"> - <string> mm</string> - </property> - <property name="minimum"> - <number>-65535</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - </item> - <item row="0" column="0" colspan="6"> - <widget class="QLabel" name="label_56"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string><html><head/><body><p>Location of the two remaining model points<br/>with respect to the reference point in default pose</p><p>Use any units you want, not necessarily centimeters.</p></body></html></string> - </property> - </widget> - </item> - <item row="3" column="2"> - <widget class="QSpinBox" name="m1z_spin"> - <property name="suffix"> - <string> mm</string> - </property> - <property name="minimum"> - <number>-65535</number> - </property> - <property name="maximum"> - <number>65535</number> - </property> - </widget> - </item> - <item row="2" column="4"> - <widget class="QLabel" name="label_70"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>y:</string> - </property> - </widget> - </item> - <item row="1" column="4"> - <widget class="QLabel" name="label_67"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>x:</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QLabel" name="label_64"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string><html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">3</span></p></body></html></string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_60"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string><html><head/><body><p><span style=" font-size:16pt;">P</span><span style=" font-size:16pt; vertical-align:sub;">2</span></p></body></html></string> - </property> - </widget> - </item> - <item row="3" column="4"> - <widget class="QLabel" name="label_69"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>z:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLabel" name="label_58"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>y:</string> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item row="1" column="0"> - <widget class="QGroupBox" name="groupBox_10"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Model position</string> - </property> - <layout class="QGridLayout" name="gridLayout_4"> - <item row="0" column="0"> - <widget class="QFrame" name="frame_2"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QGridLayout" name="gridLayout_11"> - <item row="0" column="0"> - <widget class="QLabel" name="label_61"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>x:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="tx_spin"> - <property name="suffix"> - <string> mm</string> - </property> - <property name="minimum"> - <number>-65535</number> - </property> - <property name="maximum"> - <number>65536</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_62"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>y:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="ty_spin"> - <property name="suffix"> - <string> mm</string> - </property> - <property name="minimum"> - <number>-65535</number> - </property> - <property name="maximum"> - <number>65536</number> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_66"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>z:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QSpinBox" name="tz_spin"> - <property name="suffix"> - <string> mm</string> - </property> - <property name="minimum"> - <number>-65535</number> - </property> - <property name="maximum"> - <number>65536</number> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="0" column="1"> - <widget class="QFrame" name="frame"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QLabel" name="label_59"> - <property name="text"> - <string><html><head/><body><p><a href="https://github.com/opentrack/opentrack/wiki/model-calibration-for-PT-and-Aruco-trackers"><span style=" text-decoration: underline; color:#0000ff;">Instructions on the opentrack wiki</span></a></p></body></html></string> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="tcalib_button"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Toggle calibration</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_3"> - <attribute name="title"> - <string>About</string> - </attribute> - <layout class="QGridLayout" name="gridLayout_8"> - <item row="0" column="0"> - <widget class="QLabel" name="label_10"> - <property name="text"> - <string><html><head/><body><p><span style=" font-weight:600;">FTNoIR PointTracker Plugin<br/>Version 1.1</span></p><p><span style=" font-weight:600;">by Patrick Ruoff</span></p><p><a href="http://ftnoirpt.sourceforge.net/"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">Manual (external)</span></a></p></body></html></string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="label_35"> - <property name="text"> - <string/> - </property> - <property name="pixmap"> - <pixmap resource="ftnoir_tracker_pt.qrc">:/Resources/Logo_IR.png</pixmap> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item row="1" column="0"> - <widget class="QGroupBox" name="groupBox_5"> - <property name="title"> - <string>Status</string> - </property> - <layout class="QGridLayout" name="gridLayout_10"> - <item row="1" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Extracted Points:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - <item row="0" column="0"> - <widget class="QLabel" name="label_38"> - <property name="text"> - <string>Camera Info:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="pointinfo_label"> - <property name="minimumSize"> - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="caminfo_label"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>120</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <tabstops> - <tabstop>tabWidget</tabstop> - <tabstop>camdevice_combo</tabstop> - <tabstop>res_x_spin</tabstop> - <tabstop>res_y_spin</tabstop> - <tabstop>fps_spin</tabstop> - <tabstop>fov</tabstop> - <tabstop>threshold_slider</tabstop> - <tabstop>model_tabs</tabstop> - <tabstop>clip_tlength_spin</tabstop> - <tabstop>clip_theight_spin</tabstop> - <tabstop>clip_bheight_spin</tabstop> - <tabstop>clip_blength_spin</tabstop> - <tabstop>cap_length_spin</tabstop> - <tabstop>cap_width_spin</tabstop> - <tabstop>cap_height_spin</tabstop> - <tabstop>m1x_spin</tabstop> - <tabstop>m1y_spin</tabstop> - <tabstop>m1z_spin</tabstop> - <tabstop>m2x_spin</tabstop> - <tabstop>m2y_spin</tabstop> - <tabstop>m2z_spin</tabstop> - <tabstop>tx_spin</tabstop> - <tabstop>ty_spin</tabstop> - <tabstop>tz_spin</tabstop> - </tabstops> - <resources> - <include location="ftnoir_tracker_pt.qrc"/> - </resources> - <connections/> - <slots> - <slot>startEngineClicked()</slot> - <slot>stopEngineClicked()</slot> - <slot>cameraSettingsClicked()</slot> - </slots> -</ui> diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index c4ab5963..8192a76d 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -58,15 +58,27 @@ void Tracker_PT::reset_command(Command command) bool Tracker_PT::get_focal_length(float& ret) { + static constexpr float pi = 3.1415926; + float fov_; + switch (s.fov) + { + default: + case 0: + fov_ = 56; + break; + case 1: + fov_ = 75; + break; + } + + const double diag_fov = static_cast<int>(fov_) * pi / 180.f; QMutexLocker l(&camera_mtx); CamInfo info; const bool res = camera.get_info(info); if (res) { - static constexpr double pi = 3.14159265359; const int w = info.res_x, h = info.res_y; const double diag = sqrt(1. + h/(double)w * h/(double)w); - const double diag_fov = static_cast<int>(s.fov) * pi / 180.; const double fov = 2.*atan(tan(diag_fov/2.0)/diag); ret = .5 / tan(.5 * fov); return true; @@ -116,6 +128,25 @@ void Tracker_PT::run() } Affine X_CM = pose(); + + { + Affine X_MH(cv::Matx33f::eye(), cv::Vec3f(s.t_MH_x, s.t_MH_y, s.t_MH_z)); // just copy pasted these lines from below + if (X_MH.t[0] == 0 && X_MH.t[1] == 0 && X_MH.t[2] == 0) + { + int m = s.model_used; + switch (m) + { + default: + // cap + case 0: X_MH.t[0] = 0; X_MH.t[1] = 0; X_MH.t[2] = 0; break; + // clip + case 1: X_MH.t[0] = 135; X_MH.t[1] = 0; X_MH.t[2] = 0; break; + // left clip + case 2: X_MH.t[0] = -135; X_MH.t[1] = 0; X_MH.t[2] = 0; break; + } + } + } + std::function<void(const cv::Vec2f&, const cv::Scalar)> fun = [&](const cv::Vec2f& p, const cv::Scalar color) { @@ -155,10 +186,36 @@ void Tracker_PT::apply_settings() { qDebug()<<"Tracker:: Applying settings"; QMutexLocker l(&camera_mtx); - camera.stop(); - camera.set_device_index(camera_name_to_index(s.camera_name)); - camera.set_res(s.cam_res_x, s.cam_res_y); - camera.set_fps(s.cam_fps); + camera.set_device_index(camera_name_to_index("PS3Eye Camera")); + int res_x, res_y, cam_fps; + switch (s.camera_mode) + { + default: + case 0: + res_x = 640; + res_y = 480; + cam_fps = 75; + break; + case 1: + res_x = 640; + res_y = 480; + cam_fps = 60; + break; + case 2: + res_x = 320; + res_y = 240; + cam_fps = 189; + break; + case 3: + res_x = 320; + res_y = 240; + cam_fps = 120; + break; + } + + camera.set_res(res_x, res_y); + camera.set_fps(cam_fps); + qDebug() << "camera start"; camera.start(); frame = cv::Mat(); qDebug()<<"Tracker::apply ends"; @@ -213,7 +270,3 @@ void Tracker_PT::data(double *data) data[TZ] = t[2] / 10.0; } } - -#include "ftnoir_tracker_pt_dialog.h" -OPENTRACK_DECLARE_TRACKER(Tracker_PT, TrackerDialog_PT, TrackerDll) - diff --git a/tracker-pt/ftnoir_tracker_pt.qrc b/tracker-pt/ftnoir_tracker_pt.qrc deleted file mode 100644 index a8f9a1af..00000000 --- a/tracker-pt/ftnoir_tracker_pt.qrc +++ /dev/null @@ -1,9 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>Resources/cap_front.png</file> - <file>Resources/cap_side.png</file> - <file>Resources/clip_front.png</file> - <file>Resources/clip_side.png</file> - <file>Resources/Logo_IR.png</file> - </qresource> -</RCC> diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp deleted file mode 100644 index 551910f7..00000000 --- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * Copyright (c) 2014-2015 Stanislaw Halik <sthalik@misaki.pl> - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - */ - -#include "ftnoir_tracker_pt_dialog.h" - -#include <QMessageBox> -#include <QDebug> -#include <opencv2/core/core.hpp> -#include <memory> -#include "opentrack-compat/camera-names.hpp" -#include <vector> - -//----------------------------------------------------------------------------- -TrackerDialog_PT::TrackerDialog_PT() - : tracker(NULL), - timer(this), - trans_calib_running(false) -{ - ui.setupUi( this ); - - ui.camdevice_combo->addItems(get_camera_names()); - - tie_setting(s.camera_name, ui.camdevice_combo); - tie_setting(s.cam_res_x, ui.res_x_spin); - tie_setting(s.cam_res_y, ui.res_y_spin); - tie_setting(s.cam_fps, ui.fps_spin); - - tie_setting(s.threshold, ui.threshold_slider); - - tie_setting(s.min_point_size, ui.mindiam_spin); - tie_setting(s.max_point_size, ui.maxdiam_spin); - - tie_setting(s.clip_by, ui.clip_bheight_spin); - tie_setting(s.clip_bz, ui.clip_blength_spin); - tie_setting(s.clip_ty, ui.clip_theight_spin); - tie_setting(s.clip_tz, ui.clip_tlength_spin); - - tie_setting(s.cap_x, ui.cap_width_spin); - tie_setting(s.cap_y, ui.cap_height_spin); - tie_setting(s.cap_z, ui.cap_length_spin); - - tie_setting(s.m01_x, ui.m1x_spin); - tie_setting(s.m01_y, ui.m1y_spin); - tie_setting(s.m01_z, ui.m1z_spin); - - tie_setting(s.m02_x, ui.m2x_spin); - tie_setting(s.m02_y, ui.m2y_spin); - tie_setting(s.m02_z, ui.m2z_spin); - - tie_setting(s.t_MH_x, ui.tx_spin); - tie_setting(s.t_MH_y, ui.ty_spin); - tie_setting(s.t_MH_z, ui.tz_spin); - - tie_setting(s.fov, ui.fov); - - tie_setting(s.active_model_panel, ui.model_tabs); - - tie_setting(s.dynamic_pose, ui.dynamic_pose); - tie_setting(s.init_phase_timeout, ui.init_phase_timeout); - - tie_setting(s.auto_threshold, ui.auto_threshold); - - connect( ui.tcalib_button,SIGNAL(toggled(bool)), this,SLOT(startstop_trans_calib(bool)) ); - - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); - - connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info())); - connect(ui.camera_settings, SIGNAL(pressed()), this, SLOT(camera_settings())); - timer.start(100); -} - -void TrackerDialog_PT::camera_settings() -{ - if (tracker) - open_camera_settings(static_cast<cv::VideoCapture*>(tracker->camera), s.camera_name, &tracker->camera_mtx); - else - open_camera_settings(nullptr, s.camera_name, nullptr); -} - -void TrackerDialog_PT::startstop_trans_calib(bool start) -{ - if (start) - { - qDebug()<<"TrackerDialog:: Starting translation calibration"; - trans_calib.reset(); - trans_calib_running = true; - s.t_MH_x = 0; - s.t_MH_y = 0; - s.t_MH_z = 0; - } - else - { - qDebug()<<"TrackerDialog:: Stopping translation calibration"; - trans_calib_running = false; - { - auto tmp = trans_calib.get_estimate(); - s.t_MH_x = tmp[0]; - s.t_MH_y = tmp[1]; - s.t_MH_z = tmp[2]; - } - } -} - -void TrackerDialog_PT::poll_tracker_info() -{ - CamInfo info; - if (tracker && tracker->get_cam_info(&info)) - { - QString to_print; - { - // display caminfo - to_print = QString::number(info.res_x)+"x"+QString::number(info.res_y)+" @ "+QString::number(info.fps)+" FPS"; - } - ui.caminfo_label->setText(to_print); - - // display pointinfo - int n_points = tracker->get_n_points(); - to_print = QString::number(n_points); - if (n_points == 3) - to_print += " OK!"; - else - to_print += " BAD!"; - ui.pointinfo_label->setText(to_print); - - // update calibration - if (trans_calib_running) trans_calib_step(); - } - else - { - ui.caminfo_label->setText("Tracker offline"); - ui.pointinfo_label->setText(""); - } -} - -void TrackerDialog_PT::trans_calib_step() -{ - if (tracker) - { - Affine X_CM = tracker->pose(); - trans_calib.update(X_CM.R, X_CM.t); - } -} - -void TrackerDialog_PT::save() -{ - s.b->save(); -} - -void TrackerDialog_PT::doOK() -{ - save(); - close(); -} - -void TrackerDialog_PT::doCancel() -{ - s.b->reload(); - close(); -} - -void TrackerDialog_PT::register_tracker(ITracker *t) -{ - qDebug()<<"TrackerDialog:: Tracker registered"; - tracker = static_cast<Tracker_PT*>(t); - ui.tcalib_button->setEnabled(true); - //ui.center_button->setEnabled(true); -} - -void TrackerDialog_PT::unregister_tracker() -{ - qDebug()<<"TrackerDialog:: Tracker un-registered"; - tracker = NULL; - ui.tcalib_button->setEnabled(false); - //ui.center_button->setEnabled(false); -} - diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.h b/tracker-pt/ftnoir_tracker_pt_dialog.h deleted file mode 100644 index 3502e227..00000000 --- a/tracker-pt/ftnoir_tracker_pt_dialog.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (c) 2012 Patrick Ruoff - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - */ - -#ifndef FTNOIR_TRACKER_PT_DIALOG_H -#define FTNOIR_TRACKER_PT_DIALOG_H - -#include "opentrack/plugin-api.hpp" -#include "ftnoir_tracker_pt_settings.h" -#include "ftnoir_tracker_pt.h" -#include "trans_calib.h" -#include "pt_video_widget.h" -#include "ui_FTNoIR_PT_Controls.h" -#include "opentrack/opencv-camera-dialog.hpp" - -#include <QTimer> - -//----------------------------------------------------------------------------- -// The dialog that shows up when the user presses "Settings" -class TrackerDialog_PT : public ITrackerDialog, protected camera_dialog<Tracker_PT> -{ - Q_OBJECT -public: - TrackerDialog_PT(); - void register_tracker(ITracker *tracker) override; - void unregister_tracker() override; - void save(); - void trans_calib_step(); - -public slots: - void doOK(); - void doCancel(); - - void startstop_trans_calib(bool start); - void poll_tracker_info(); - void camera_settings(); -private: - settings_pt s; - Tracker_PT* tracker; - QTimer timer; - - TranslationCalibrator trans_calib; - bool trans_calib_running; - - Ui::UICPTClientControls ui; -}; - -#endif //FTNOIR_TRACKER_PT_DIALOG_H diff --git a/tracker-pt/ftnoir_tracker_pt_settings.h b/tracker-pt/ftnoir_tracker_pt_settings.h index e4bfa371..85f068fe 100644 --- a/tracker-pt/ftnoir_tracker_pt_settings.h +++ b/tracker-pt/ftnoir_tracker_pt_settings.h @@ -14,54 +14,28 @@ using namespace options; struct settings_pt : opts { - value<QString> camera_name; - value<int> cam_res_x, - cam_res_y, - cam_fps, - threshold; + value<int> threshold; value<double> min_point_size, max_point_size; - value<int> m01_x, m01_y, m01_z; - value<int> m02_x, m02_y, m02_z; - value<int> t_MH_x, t_MH_y, t_MH_z; + value<int> fov, camera_mode; + value<int> model_used; - value<int> clip_ty, clip_tz, clip_by, clip_bz; - value<int> active_model_panel, cap_x, cap_y, cap_z; - - value<int> fov; - value<bool> dynamic_pose; value<int> init_phase_timeout; value<bool> auto_threshold; settings_pt() : opts("tracker-pt"), - camera_name(b, "camera-name", ""), - cam_res_x(b, "camera-res-width", 640), - cam_res_y(b, "camera-res-height", 480), - cam_fps(b, "camera-fps", 30), threshold(b, "threshold-primary", 128), - min_point_size(b, "min-point-size", 1), + min_point_size(b, "min-point-size", 0), max_point_size(b, "max-point-size", 50), - m01_x(b, "m_01-x", 0), - m01_y(b, "m_01-y", 0), - m01_z(b, "m_01-z", 0), - m02_x(b, "m_02-x", 0), - m02_y(b, "m_02-y", 0), - m02_z(b, "m_02-z", 0), t_MH_x(b, "model-centroid-x", 0), t_MH_y(b, "model-centroid-y", 0), t_MH_z(b, "model-centroid-z", 0), - clip_ty(b, "clip-ty", 40), - clip_tz(b, "clip-tz", 30), - clip_by(b, "clip-by", 70), - clip_bz(b, "clip-bz", 80), - active_model_panel(b, "active-model-panel", 0), - cap_x(b, "cap-x", 40), - cap_y(b, "cap-y", 60), - cap_z(b, "cap-z", 100), - fov(b, "camera-fov", 56), + fov(b, "camera-fov", 0), + camera_mode(b, "camera-mode", 0), + model_used(b, "model-used", 0), dynamic_pose(b, "dynamic-pose-resolution", true), init_phase_timeout(b, "init-phase-timeout", 500), auto_threshold(b, "automatic-threshold", false) diff --git a/tracker-pt/point_tracker.h b/tracker-pt/point_tracker.h index 2757f22c..48c7617e 100644 --- a/tracker-pt/point_tracker.h +++ b/tracker-pt/point_tracker.h @@ -64,8 +64,6 @@ public: cv::Vec3f u; // unit vector perpendicular to M01,M02-plane cv::Matx22f P; - - enum Model { Clip = 0, Cap = 1, Custom = 2 }; PointModel(settings_pt& s) { @@ -80,26 +78,32 @@ public: float s22 = M02.dot(M02); P = 1.0/(s11*s22-s12*s12) * cv::Matx22f(s22, -s12, -s12, s11); } - + void set_model(settings_pt& s) { - switch (s.active_model_panel) + enum { Cap = 0, ClipRight = 1, ClipLeft = 2 }; + + switch (s.model_used) { - case Clip: - M01 = cv::Vec3f(0, static_cast<double>(s.clip_ty), -static_cast<double>(s.clip_tz)); - M02 = cv::Vec3f(0, -static_cast<double>(s.clip_by), -static_cast<double>(s.clip_bz)); - break; + default: case Cap: - M01 = cv::Vec3f(-static_cast<double>(s.cap_x), -static_cast<double>(s.cap_y), -static_cast<double>(s.cap_z)); - M02 = cv::Vec3f(static_cast<double>(s.cap_x), -static_cast<double>(s.cap_y), -static_cast<double>(s.cap_z)); + { + const double x = 60, y = 90, z = 95; + M01 = cv::Vec3f(-x, -y, z); + M02 = cv::Vec3f(x, -y, z); break; - case Custom: - M01 = cv::Vec3f(s.m01_x, s.m01_y, s.m01_z); - M02 = cv::Vec3f(s.m02_x, s.m02_y, s.m02_z); + } + case ClipLeft: + case ClipRight: + { + const double a = 27, b = 43, c = 62, d = 74; + M01 = cv::Vec3f(0, b, -a); + M02 = cv::Vec3f(0, -c, -d); break; } + } } - + void get_d_order(const std::vector<cv::Vec2f>& points, int* d_order, cv::Vec2f d) const; }; |