diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-10-21 23:57:30 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-10-22 00:02:55 +0200 |
commit | fedee5430656657e4c9fff3ab21927c4323007ce (patch) | |
tree | 15f2114dc7a082a7524435dde164c933302575c6 | |
parent | 49bc9a8550a8ab1fd037da31260bb38d80b6da15 (diff) | |
parent | 52cb9e157db8823dc8318ce2df79fac837413e7f (diff) |
Merge libovr 0.2.5 changes!opentrack-2.0a5
- mm0zct & sthalik
-rw-r--r-- | TODO.txt | 14 | ||||
-rw-r--r-- | facetracknoir/facetracknoir.cpp | 6 | ||||
-rw-r--r-- | facetracknoir/facetracknoir.h | 2 | ||||
-rw-r--r-- | facetracknoir/facetracknoir.ui | 1047 | ||||
-rw-r--r-- | ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 140 | ||||
-rw-r--r-- | ftnoir_tracker_rift/ftnoir_tracker_rift.h | 11 |
6 files changed, 727 insertions, 493 deletions
@@ -18,6 +18,20 @@ Rift tracker could do with positional estimation using intertial sensors. Rift could do with a return-yaw-to-centre hotkey that's not the global all-axis option. Hydra is really just a hack just now, could be improved a lot. + + Add per-tracker hotkey support + +20131005 sh + what do you think about boost 1.54 for property maps -> qsettings? + also, boost concepts + and qt5 +20131007 sh + respect hier(7) with regard to shared object installation. + install them inside ../lib/opentrack relative to ./bin where + the main program oughta reside. +20131008 sh + during the switch to qt5, recreate widgets, this time with layouts. + the original layouts were pretty crappy, hence the original breakage. 20131011 sh low-hanging fruit: default saving profiles to a directory in user home, not into global stuffies diff --git a/facetracknoir/facetracknoir.cpp b/facetracknoir/facetracknoir.cpp index c1d4bc85..afc46625 100644 --- a/facetracknoir/facetracknoir.cpp +++ b/facetracknoir/facetracknoir.cpp @@ -102,7 +102,8 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent, Qt::WindowFlags flags) : pSecondTrackerDialog(NULL), pProtocolDialog(NULL), pFilterDialog(NULL), - looping(false) + looping(false), + kbd_quit(QKeySequence("Ctrl+Q"), this) { ui.setupUi(this); setFixedSize(size()); @@ -171,6 +172,9 @@ FaceTrackNoIR::FaceTrackNoIR(QWidget *parent, Qt::WindowFlags flags) : connect(&keyCenter, SIGNAL(activated()), this, SLOT(shortcutRecentered())); connect(&keyToggle, SIGNAL(activated()), this, SLOT(shortcutToggled())); #endif + + connect(&kbd_quit, SIGNAL(activated()), this, SLOT(exit())); + kbd_quit.setEnabled(true); } /** destructor stops the engine and quits the faceapi **/ diff --git a/facetracknoir/facetracknoir.h b/facetracknoir/facetracknoir.h index c5b2dc01..491274c8 100644 --- a/facetracknoir/facetracknoir.h +++ b/facetracknoir/facetracknoir.h @@ -38,6 +38,7 @@ #include <QtGui> #include <QString> #include <QByteArray> +#include <QShortcut> #if !defined(_WIN32) # include "qxt-mini/QxtGlobalShortcut" #else @@ -123,6 +124,7 @@ private: QList<DynamicLibrary*> dlopen_filters; QList<DynamicLibrary*> dlopen_trackers; QList<DynamicLibrary*> dlopen_protocols; + QShortcut kbd_quit; #ifndef _WIN32 void bind_keyboard_shortcut(QxtGlobalShortcut& key, const QString label, QSettings& iniFile); diff --git a/facetracknoir/facetracknoir.ui b/facetracknoir/facetracknoir.ui index 5bda6067..7ef41537 100644 --- a/facetracknoir/facetracknoir.ui +++ b/facetracknoir/facetracknoir.ui @@ -142,7 +142,7 @@ <property name="geometry">
<rect>
<x>120</x>
- <y>40</y>
+ <y>60</y>
<width>203</width>
<height>97</height>
</rect>
@@ -163,33 +163,29 @@ <string notr="true"/>
</property>
<property name="alignment">
- <set>Qt::AlignJustify|Qt::AlignVCenter</set>
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="flat">
- <bool>false</bool>
+ <bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_8">
- <item row="1" column="0">
- <widget class="QLabel" name="lblY">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="maximumSize">
- <size>
- <width>65536</width>
- <height>65536</height>
- </size>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Y</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLCDNumber" name="lcdNumOutputPosX">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetMaximumSize</enum>
+ </property>
+ <property name="leftMargin">
+ <number>2</number>
+ </property>
+ <property name="topMargin">
+ <number>2</number>
+ </property>
+ <property name="rightMargin">
+ <number>2</number>
+ </property>
+ <property name="bottomMargin">
+ <number>6</number>
+ </property>
+ <item row="0" column="3">
+ <widget class="QLCDNumber" name="lcdNumOutputRotX">
<property name="enabled">
<bool>true</bool>
</property>
@@ -214,16 +210,19 @@ <property name="smallDecimalPoint">
<bool>false</bool>
</property>
+ <property name="numDigits">
+ <number>5</number>
+ </property>
<property name="digitCount">
<number>5</number>
</property>
<property name="segmentStyle">
- <enum>QLCDNumber::Filled</enum>
+ <enum>QLCDNumber::Flat</enum>
</property>
</widget>
</item>
- <item row="1" column="3">
- <widget class="QLCDNumber" name="lcdNumOutputRotY">
+ <item row="1" column="1">
+ <widget class="QLCDNumber" name="lcdNumOutputPosY">
<property name="enabled">
<bool>true</bool>
</property>
@@ -248,16 +247,45 @@ <property name="smallDecimalPoint">
<bool>false</bool>
</property>
+ <property name="numDigits">
+ <number>5</number>
+ </property>
<property name="digitCount">
<number>5</number>
</property>
<property name="segmentStyle">
- <enum>QLCDNumber::Filled</enum>
+ <enum>QLCDNumber::Flat</enum>
</property>
</widget>
</item>
- <item row="0" column="3">
- <widget class="QLCDNumber" name="lcdNumOutputRotX">
+ <item row="2" column="2">
+ <widget class="QLabel" name="lblRotZ">
+ <property name="maximumSize">
+ <size>
+ <width>65536</width>
+ <height>65536</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>roll</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLabel" name="lblRotY">
+ <property name="maximumSize">
+ <size>
+ <width>65536</width>
+ <height>65536</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>pitch</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3">
+ <widget class="QLCDNumber" name="lcdNumOutputRotY">
<property name="enabled">
<bool>true</bool>
</property>
@@ -282,16 +310,19 @@ <property name="smallDecimalPoint">
<bool>false</bool>
</property>
+ <property name="numDigits">
+ <number>5</number>
+ </property>
<property name="digitCount">
<number>5</number>
</property>
<property name="segmentStyle">
- <enum>QLCDNumber::Filled</enum>
+ <enum>QLCDNumber::Flat</enum>
</property>
</widget>
</item>
- <item row="2" column="0">
- <widget class="QLabel" name="lblZ">
+ <item row="0" column="1">
+ <widget class="QLCDNumber" name="lcdNumOutputPosX">
<property name="enabled">
<bool>true</bool>
</property>
@@ -304,21 +335,26 @@ <property name="autoFillBackground">
<bool>false</bool>
</property>
- <property name="text">
- <string>Z</string>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
</property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QLabel" name="lblRotY">
- <property name="maximumSize">
- <size>
- <width>65536</width>
- <height>65536</height>
- </size>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
</property>
- <property name="text">
- <string>pitch</string>
+ <property name="lineWidth">
+ <number>1</number>
+ </property>
+ <property name="smallDecimalPoint">
+ <bool>false</bool>
+ </property>
+ <property name="numDigits">
+ <number>5</number>
+ </property>
+ <property name="digitCount">
+ <number>5</number>
+ </property>
+ <property name="segmentStyle">
+ <enum>QLCDNumber::Flat</enum>
</property>
</widget>
</item>
@@ -348,11 +384,14 @@ <property name="smallDecimalPoint">
<bool>false</bool>
</property>
+ <property name="numDigits">
+ <number>5</number>
+ </property>
<property name="digitCount">
<number>5</number>
</property>
<property name="segmentStyle">
- <enum>QLCDNumber::Filled</enum>
+ <enum>QLCDNumber::Flat</enum>
</property>
</widget>
</item>
@@ -364,21 +403,37 @@ <height>65536</height>
</size>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>X</string>
</property>
</widget>
</item>
- <item row="2" column="2">
- <widget class="QLabel" name="lblRotZ">
+ <item row="1" column="0">
+ <widget class="QLabel" name="lblY">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
<property name="maximumSize">
<size>
<width>65536</width>
<height>65536</height>
</size>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
<property name="text">
- <string>roll</string>
+ <string>Y</string>
</property>
</widget>
</item>
@@ -408,16 +463,19 @@ <property name="smallDecimalPoint">
<bool>false</bool>
</property>
+ <property name="numDigits">
+ <number>5</number>
+ </property>
<property name="digitCount">
<number>5</number>
</property>
<property name="segmentStyle">
- <enum>QLCDNumber::Filled</enum>
+ <enum>QLCDNumber::Flat</enum>
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QLCDNumber" name="lcdNumOutputPosY">
+ <item row="2" column="0">
+ <widget class="QLabel" name="lblZ">
<property name="enabled">
<bool>true</bool>
</property>
@@ -427,26 +485,16 @@ <height>65536</height>
</size>
</property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow">
- <enum>QFrame::Plain</enum>
- </property>
- <property name="lineWidth">
- <number>1</number>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
</property>
- <property name="smallDecimalPoint">
+ <property name="autoFillBackground">
<bool>false</bool>
</property>
- <property name="digitCount">
- <number>5</number>
- </property>
- <property name="segmentStyle">
- <enum>QLCDNumber::Filled</enum>
+ <property name="text">
+ <string>Z</string>
</property>
</widget>
</item>
@@ -468,9 +516,9 @@ <widget class="GLWidget" name="pose_display" native="true">
<property name="geometry">
<rect>
- <x>10</x>
- <y>40</y>
- <width>90</width>
+ <x>20</x>
+ <y>50</y>
+ <width>81</width>
<height>100</height>
</rect>
</property>
@@ -499,7 +547,7 @@ <x>350</x>
<y>370</y>
<width>191</width>
- <height>80</height>
+ <height>91</height>
</rect>
</property>
<property name="minimumSize">
@@ -524,7 +572,7 @@ <set>Qt::AlignCenter</set>
</property>
<property name="flat">
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property name="checkable">
<bool>false</bool>
@@ -583,7 +631,7 @@ <property name="geometry">
<rect>
<x>580</x>
- <y>470</y>
+ <y>460</y>
<width>171</width>
<height>38</height>
</rect>
@@ -621,7 +669,7 @@ </property>
<property name="iconSize">
<size>
- <width>120</width>
+ <width>98</width>
<height>24</height>
</size>
</property>
@@ -629,9 +677,9 @@ <widget class="QLabel" name="game_name">
<property name="geometry">
<rect>
- <x>350</x>
+ <x>130</x>
<y>36</y>
- <width>371</width>
+ <width>651</width>
<height>20</height>
</rect>
</property>
@@ -649,7 +697,7 @@ <property name="geometry">
<rect>
<x>350</x>
- <y>262</y>
+ <y>270</y>
<width>191</width>
<height>91</height>
</rect>
@@ -676,7 +724,7 @@ <set>Qt::AlignCenter</set>
</property>
<property name="flat">
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property name="checkable">
<bool>false</bool>
@@ -732,9 +780,9 @@ <property name="geometry">
<rect>
<x>350</x>
- <y>70</y>
+ <y>60</y>
<width>191</width>
- <height>83</height>
+ <height>91</height>
</rect>
</property>
<property name="minimumSize">
@@ -759,7 +807,7 @@ <set>Qt::AlignCenter</set>
</property>
<property name="flat">
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property name="checkable">
<bool>false</bool>
@@ -811,333 +859,12 @@ </item>
</layout>
</widget>
- <widget class="QGroupBox" name="groupBox">
- <property name="geometry">
- <rect>
- <x>20</x>
- <y>420</y>
- <width>321</width>
- <height>131</height>
- </rect>
- </property>
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>0</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>65536</width>
- <height>65536</height>
- </size>
- </property>
- <property name="title">
- <string>Raw data</string>
- </property>
- <property name="flat">
- <bool>false</bool>
- </property>
- <layout class="QGridLayout" name="gridLayout_7" rowstretch="0,0,0" columnstretch="6,6,6,6" rowminimumheight="6,6,6" columnminimumwidth="6,6,6,6">
- <property name="spacing">
- <number>6</number>
- </property>
- <item row="0" column="0">
- <widget class="QLabel" name="label_4">
- <property name="maximumSize">
- <size>
- <width>65536</width>
- <height>65536</height>
- </size>
- </property>
- <property name="text">
- <string>TX</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QLCDNumber" name="lcdNumX">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="maximumSize">
- <size>
- <width>65536</width>
- <height>65536</height>
- </size>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="lineWidth">
- <number>0</number>
- </property>
- <property name="midLineWidth">
- <number>0</number>
- </property>
- <property name="smallDecimalPoint">
- <bool>false</bool>
- </property>
- <property name="digitCount">
- <number>5</number>
- </property>
- <property name="segmentStyle">
- <enum>QLCDNumber::Flat</enum>
- </property>
- </widget>
- </item>
- <item row="0" column="2">
- <widget class="QLabel" name="label_9">
- <property name="maximumSize">
- <size>
- <width>65536</width>
- <height>65536</height>
- </size>
- </property>
- <property name="text">
- <string>yaw</string>
- </property>
- </widget>
- </item>
- <item row="0" column="3">
- <widget class="QLCDNumber" name="lcdNumRotX">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="maximumSize">
- <size>
- <width>65536</width>
- <height>65536</height>
- </size>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="lineWidth">
- <number>0</number>
- </property>
- <property name="midLineWidth">
- <number>0</number>
- </property>
- <property name="smallDecimalPoint">
- <bool>false</bool>
- </property>
- <property name="digitCount">
- <number>5</number>
- </property>
- <property name="segmentStyle">
- <enum>QLCDNumber::Flat</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label_5">
- <property name="maximumSize">
- <size>
- <width>65536</width>
- <height>65536</height>
- </size>
- </property>
- <property name="text">
- <string>TY</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QLCDNumber" name="lcdNumY">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="maximumSize">
- <size>
- <width>65536</width>
- <height>65536</height>
- </size>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="lineWidth">
- <number>0</number>
- </property>
- <property name="midLineWidth">
- <number>0</number>
- </property>
- <property name="smallDecimalPoint">
- <bool>false</bool>
- </property>
- <property name="digitCount">
- <number>5</number>
- </property>
- <property name="segmentStyle">
- <enum>QLCDNumber::Flat</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="2">
- <widget class="QLabel" name="label_8">
- <property name="maximumSize">
- <size>
- <width>65536</width>
- <height>65536</height>
- </size>
- </property>
- <property name="text">
- <string>pitch</string>
- </property>
- </widget>
- </item>
- <item row="1" column="3">
- <widget class="QLCDNumber" name="lcdNumRotY">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="maximumSize">
- <size>
- <width>65536</width>
- <height>65536</height>
- </size>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="lineWidth">
- <number>0</number>
- </property>
- <property name="midLineWidth">
- <number>0</number>
- </property>
- <property name="smallDecimalPoint">
- <bool>false</bool>
- </property>
- <property name="digitCount">
- <number>5</number>
- </property>
- <property name="segmentStyle">
- <enum>QLCDNumber::Flat</enum>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_6">
- <property name="maximumSize">
- <size>
- <width>65536</width>
- <height>65536</height>
- </size>
- </property>
- <property name="text">
- <string>TZ</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <widget class="QLCDNumber" name="lcdNumZ">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="maximumSize">
- <size>
- <width>65536</width>
- <height>65536</height>
- </size>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="lineWidth">
- <number>0</number>
- </property>
- <property name="midLineWidth">
- <number>0</number>
- </property>
- <property name="smallDecimalPoint">
- <bool>false</bool>
- </property>
- <property name="digitCount">
- <number>5</number>
- </property>
- <property name="segmentStyle">
- <enum>QLCDNumber::Flat</enum>
- </property>
- </widget>
- </item>
- <item row="2" column="2">
- <widget class="QLabel" name="label_7">
- <property name="maximumSize">
- <size>
- <width>65536</width>
- <height>65536</height>
- </size>
- </property>
- <property name="text">
- <string>roll</string>
- </property>
- </widget>
- </item>
- <item row="2" column="3">
- <widget class="QLCDNumber" name="lcdNumRotZ">
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="maximumSize">
- <size>
- <width>65536</width>
- <height>65536</height>
- </size>
- </property>
- <property name="autoFillBackground">
- <bool>false</bool>
- </property>
- <property name="frameShape">
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="lineWidth">
- <number>0</number>
- </property>
- <property name="midLineWidth">
- <number>0</number>
- </property>
- <property name="smallDecimalPoint">
- <bool>false</bool>
- </property>
- <property name="digitCount">
- <number>5</number>
- </property>
- <property name="segmentStyle">
- <enum>QLCDNumber::Flat</enum>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
<widget class="QLabel" name="cameraName">
<property name="geometry">
<rect>
- <x>350</x>
+ <x>130</x>
<y>10</y>
- <width>371</width>
+ <width>651</width>
<height>25</height>
</rect>
</property>
@@ -1184,7 +911,7 @@ <set>Qt::AlignCenter</set>
</property>
<property name="flat">
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property name="checkable">
<bool>false</bool>
@@ -1319,9 +1046,9 @@ <property name="geometry">
<rect>
<x>350</x>
- <y>180</y>
+ <y>160</y>
<width>191</width>
- <height>83</height>
+ <height>91</height>
</rect>
</property>
<property name="minimumSize">
@@ -1343,7 +1070,7 @@ <set>Qt::AlignCenter</set>
</property>
<property name="flat">
- <bool>false</bool>
+ <bool>true</bool>
</property>
<property name="checkable">
<bool>false</bool>
@@ -1422,6 +1149,9 @@ <property name="alignment">
<set>Qt::AlignCenter</set>
</property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
<layout class="QGridLayout" name="gridLayout_9" rowstretch="0" columnstretch="0,0" rowminimumheight="0" columnminimumwidth="0,0">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
@@ -1476,7 +1206,7 @@ <property name="geometry">
<rect>
<x>580</x>
- <y>420</y>
+ <y>410</y>
<width>171</width>
<height>38</height>
</rect>
@@ -1506,7 +1236,7 @@ <string>Edit the Keyboard and mouse shortcuts</string>
</property>
<property name="text">
- <string>Shortcuts</string>
+ <string>Keys</string>
</property>
<property name="icon">
<iconset resource="main-facetracknoir.qrc">
@@ -1514,7 +1244,7 @@ </property>
<property name="iconSize">
<size>
- <width>24</width>
+ <width>98</width>
<height>24</height>
</size>
</property>
@@ -1546,6 +1276,9 @@ <property name="alignment">
<set>Qt::AlignCenter</set>
</property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
<layout class="QGridLayout" name="gridLayout_5" rowstretch="6,6,6" columnstretch="6,6" rowminimumheight="6,6,6" columnminimumwidth="6,6">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
@@ -1637,6 +1370,492 @@ </item>
</layout>
</widget>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>420</y>
+ <width>131</width>
+ <height>111</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Raw translation</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignBottom|Qt::AlignHCenter</set>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetMaximumSize</enum>
+ </property>
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::FieldsStayAtSizeHint</enum>
+ </property>
+ <property name="rowWrapPolicy">
+ <enum>QFormLayout::DontWrapRows</enum>
+ </property>
+ <property name="labelAlignment">
+ <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
+ </property>
+ <property name="formAlignment">
+ <set>Qt::AlignBottom|Qt::AlignHCenter</set>
+ </property>
+ <property name="leftMargin">
+ <number>6</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>65536</width>
+ <height>65536</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>TX</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLCDNumber" name="lcdNumX">
+ <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="maximumSize">
+ <size>
+ <width>65536</width>
+ <height>65536</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>12</pointsize>
+ </font>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="midLineWidth">
+ <number>0</number>
+ </property>
+ <property name="smallDecimalPoint">
+ <bool>false</bool>
+ </property>
+ <property name="digitCount">
+ <number>4</number>
+ </property>
+ <property name="segmentStyle">
+ <enum>QLCDNumber::Flat</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>65536</width>
+ <height>65536</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>TY</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLCDNumber" name="lcdNumY">
+ <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="maximumSize">
+ <size>
+ <width>65536</width>
+ <height>65536</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>12</pointsize>
+ </font>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="midLineWidth">
+ <number>0</number>
+ </property>
+ <property name="smallDecimalPoint">
+ <bool>false</bool>
+ </property>
+ <property name="digitCount">
+ <number>4</number>
+ </property>
+ <property name="segmentStyle">
+ <enum>QLCDNumber::Flat</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>65536</width>
+ <height>65536</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>TZ</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLCDNumber" name="lcdNumZ">
+ <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="maximumSize">
+ <size>
+ <width>65536</width>
+ <height>65536</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>12</pointsize>
+ </font>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="midLineWidth">
+ <number>0</number>
+ </property>
+ <property name="smallDecimalPoint">
+ <bool>false</bool>
+ </property>
+ <property name="digitCount">
+ <number>4</number>
+ </property>
+ <property name="segmentStyle">
+ <enum>QLCDNumber::Flat</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="geometry">
+ <rect>
+ <x>190</x>
+ <y>420</y>
+ <width>131</width>
+ <height>111</height>
+ </rect>
+ </property>
+ <property name="title">
+ <string>Raw rotation</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignBottom|Qt::AlignHCenter</set>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ <layout class="QFormLayout" name="formLayout_2">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetMaximumSize</enum>
+ </property>
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::FieldsStayAtSizeHint</enum>
+ </property>
+ <property name="rowWrapPolicy">
+ <enum>QFormLayout::DontWrapRows</enum>
+ </property>
+ <property name="labelAlignment">
+ <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
+ </property>
+ <property name="formAlignment">
+ <set>Qt::AlignBottom|Qt::AlignHCenter</set>
+ </property>
+ <property name="leftMargin">
+ <number>6</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_9">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>65536</width>
+ <height>65536</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>yaw</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLCDNumber" name="lcdNumRotX">
+ <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="maximumSize">
+ <size>
+ <width>65536</width>
+ <height>65536</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>12</pointsize>
+ </font>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="midLineWidth">
+ <number>0</number>
+ </property>
+ <property name="smallDecimalPoint">
+ <bool>false</bool>
+ </property>
+ <property name="digitCount">
+ <number>4</number>
+ </property>
+ <property name="segmentStyle">
+ <enum>QLCDNumber::Flat</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_8">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>65536</width>
+ <height>65536</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>pitch</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QLCDNumber" name="lcdNumRotY">
+ <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="maximumSize">
+ <size>
+ <width>65536</width>
+ <height>65536</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>12</pointsize>
+ </font>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="midLineWidth">
+ <number>0</number>
+ </property>
+ <property name="smallDecimalPoint">
+ <bool>false</bool>
+ </property>
+ <property name="digitCount">
+ <number>4</number>
+ </property>
+ <property name="segmentStyle">
+ <enum>QLCDNumber::Flat</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_7">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>65536</width>
+ <height>65536</height>
+ </size>
+ </property>
+ <property name="text">
+ <string>roll</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QLCDNumber" name="lcdNumRotZ">
+ <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="maximumSize">
+ <size>
+ <width>65536</width>
+ <height>65536</height>
+ </size>
+ </property>
+ <property name="font">
+ <font>
+ <pointsize>12</pointsize>
+ </font>
+ </property>
+ <property name="autoFillBackground">
+ <bool>false</bool>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="lineWidth">
+ <number>0</number>
+ </property>
+ <property name="midLineWidth">
+ <number>0</number>
+ </property>
+ <property name="smallDecimalPoint">
+ <bool>false</bool>
+ </property>
+ <property name="digitCount">
+ <number>4</number>
+ </property>
+ <property name="segmentStyle">
+ <enum>QLCDNumber::Flat</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ <zorder>lcdNumRotZ</zorder>
+ <zorder>label_8</zorder>
+ <zorder>label_7</zorder>
+ <zorder>lcdNumRotY</zorder>
+ <zorder>lcdNumRotX</zorder>
+ <zorder>label_9</zorder>
+ </widget>
</widget>
</widget>
<layoutdefault spacing="0" margin="0"/>
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index ab694108..7fade51c 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -6,98 +6,94 @@ using namespace OVR; -//used to turn on the re-centre spring effect -//#define OPENTRACK_RIFT_RECENTRE_SPRING - Rift_Tracker::Rift_Tracker() { - bEnableRoll = true; - bEnablePitch = true; - bEnableYaw = true; + bEnableRoll = true; + bEnablePitch = true; + bEnableYaw = true; #if 0 - bEnableX = true; - bEnableY = true; - bEnableZ = true; + bEnableX = true; + bEnableY = true; + bEnableZ = true; #endif - should_quit = false; + should_quit = false; + pManager = NULL; + pHMD = NULL; + pSensor = NULL; + pSFusion = NULL; } Rift_Tracker::~Rift_Tracker() { - System::Destroy(); + pSensor->Release(); + delete pSFusion; + pHMD->Release(); + pManager->Release(); + System::Destroy(); } -/* -void controller_manager_setup_callback( sixenseUtils::ControllerManager::setup_step step ) { - - QMessageBox::warning(0,"OpenTrack Info", "controller manager callback",QMessageBox::Ok,QMessageBox::NoButton); - if( sixenseUtils::getTheControllerManager()->isMenuVisible() ) { - // Ask the controller manager what the next instruction string should be. - std::string controller_manager_text_string = sixenseUtils::getTheControllerManager()->getStepString(); - QMessageBox::warning(0,"OpenTrack Info", controller_manager_text_string.c_str(),QMessageBox::Ok,QMessageBox::NoButton); - // We could also load the supplied controllermanager textures using the filename: sixenseUtils::getTheControllerManager()->getTextureFileName(); - } -}*/ void Rift_Tracker::StartTracker(QFrame* videoFrame) { - //QMessageBox::warning(0,"FaceTrackNoIR Notification", "Tracking loading settings...",QMessageBox::Ok,QMessageBox::NoButton); + loadSettings(); // // Startup the Oculus SDK device handling, use the first Rift sensor we find. // System::Init(Log::ConfigureDefaultLog(LogMask_All)); - auto ptr_manager = DeviceManager::Create(); - if (ptr_manager != nullptr) - { - pManager = *ptr_manager; - DeviceEnumerator<HMDDevice> enumerator = pManager->EnumerateDevices<HMDDevice>(); - if (enumerator.IsAvailable()) - { - auto ptr_hmd = enumerator.CreateDevice(); - - if (ptr_hmd != nullptr) - { - pHMD = *ptr_hmd; - auto ptr_sensor = pHMD->GetSensor(); - if (ptr_sensor != 0) - pSensor = *ptr_sensor; - } + pManager = DeviceManager::Create(); + if (pManager != NULL) + { + DeviceEnumerator<HMDDevice> enumerator = pManager->EnumerateDevices<HMDDevice>(); + if (enumerator.IsAvailable()) + { + pHMD = enumerator.CreateDevice(); + + if (pHMD != NULL) + { + pSensor = pHMD->GetSensor(); + }else{ + QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to find Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); + } - if (pSensor){ - SFusion.reset(new OVR::SensorFusion()); - SFusion->AttachToSensor(pSensor); - }else{ - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to find Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); - } - //isCalibrated = false; - //MagCal.BeginAutoCalibration(SFusion); - } + if (pSensor){ + pSFusion = new OVR::SensorFusion(); + pSFusion->Reset(); + pSFusion->AttachToSensor(pSensor); + }else{ + QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to create Rift sensor",QMessageBox::Ok,QMessageBox::NoButton); + } + + }else{ + QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to find Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); + } + }else{ + QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to start Rift tracker",QMessageBox::Ok,QMessageBox::NoButton); } } bool Rift_Tracker::GiveHeadPoseData(double *data) { - if (SFusion != nullptr) { - Quatf hmdOrient = SFusion->GetOrientation(); - float newHeadPose[6]; - + if (pSFusion != NULL) { + Quatf hmdOrient = pSFusion->GetOrientation(); + float newHeadPose[6]; + float yaw = 0.0f; float pitch = 0.0f; float roll = 0.0f; hmdOrient.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch , &roll); - newHeadPose[Yaw] = yaw; + newHeadPose[Yaw] = yaw; newHeadPose[Pitch] =pitch; newHeadPose[Roll] = roll; #if 0 - newHeadPose[TX] = acd.controllers[0].pos[0]/50.0f; - newHeadPose[TY] = acd.controllers[0].pos[1]/50.0f; - newHeadPose[TZ] = acd.controllers[0].pos[2]/50.0f; - - if (bEnableX) { + newHeadPose[TX] = acd.controllers[0].pos[0]/50.0f; + newHeadPose[TY] = acd.controllers[0].pos[1]/50.0f; + newHeadPose[TZ] = acd.controllers[0].pos[2]/50.0f; + + if (bEnableX) { data[TX] = newHeadPose[TX]; } if (bEnableY) { @@ -117,7 +113,7 @@ bool Rift_Tracker::GiveHeadPoseData(double *data) data[Roll] = newHeadPose[Roll] * 57.295781f; } } - return pHMD.GetPtr() != NULL; + return pHMD != NULL; } @@ -126,24 +122,24 @@ bool Rift_Tracker::GiveHeadPoseData(double *data) // void Rift_Tracker::loadSettings() { - qDebug() << "FTNoIR_Tracker::loadSettings says: Starting "; - QSettings settings("opentrack"); // Registry settings (in HK_USER) + qDebug() << "FTNoIR_Tracker::loadSettings says: Starting "; + QSettings settings("opentrack"); // Registry settings (in HK_USER) - QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); - QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) + QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString(); + QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file) - qDebug() << "FTNoIR_Tracker::loadSettings says: iniFile = " << currentFile; + qDebug() << "FTNoIR_Tracker::loadSettings says: iniFile = " << currentFile; - iniFile.beginGroup ( "Rift" ); - bEnableRoll = iniFile.value ( "EnableRoll", 1 ).toBool(); - bEnablePitch = iniFile.value ( "EnablePitch", 1 ).toBool(); - bEnableYaw = iniFile.value ( "EnableYaw", 1 ).toBool(); + iniFile.beginGroup ( "Rift" ); + bEnableRoll = iniFile.value ( "EnableRoll", 1 ).toBool(); + bEnablePitch = iniFile.value ( "EnablePitch", 1 ).toBool(); + bEnableYaw = iniFile.value ( "EnableYaw", 1 ).toBool(); #if 0 - bEnableX = iniFile.value ( "EnableX", 1 ).toBool(); - bEnableY = iniFile.value ( "EnableY", 1 ).toBool(); - bEnableZ = iniFile.value ( "EnableZ", 1 ).toBool(); + bEnableX = iniFile.value ( "EnableX", 1 ).toBool(); + bEnableY = iniFile.value ( "EnableY", 1 ).toBool(); + bEnableZ = iniFile.value ( "EnableZ", 1 ).toBool(); #endif - iniFile.endGroup (); + iniFile.endGroup (); } diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index 34742d6c..970a64a2 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -22,11 +22,10 @@ protected: private: static bool isInitialised; - OVR::Ptr<OVR::DeviceManager> pManager; - OVR::Ptr<OVR::HMDDevice> pHMD; - OVR::Ptr<OVR::SensorDevice> pSensor; - std::unique_ptr<OVR::SensorFusion> SFusion; - // Magnetometer calibration and yaw correction + OVR::DeviceManager* pManager; + OVR::HMDDevice* pHMD; + OVR::SensorDevice* pSensor; + OVR::SensorFusion* pSFusion; bool bEnableRoll; bool bEnablePitch; bool bEnableYaw; @@ -35,7 +34,7 @@ private: bool bEnableY; bool bEnableZ; #endif - QMutex mutex; + }; // Widget that has controls for FTNoIR protocol client-settings. |