summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2013-10-24 21:28:53 +0200
committerStanislaw Halik <sthalik@misaki.pl>2013-10-24 21:28:53 +0200
commitd201a0aef9bd71cf48ed41486ba549ff22ed3a87 (patch)
treed422abf7a30d7dadb366efd3d00e3cda29b4a8e1
parentf40d7a58d0032289e6c122bbd57bc8b6bed8ebcd (diff)
parente248b039d1110dddc5c3ee13172b75a818f6d265 (diff)
Merge branch 'master' of github.com:opentrack/opentrack
-rw-r--r--3rdparty-notices/NFAILCLIENT-CREDIT.txt4
-rw-r--r--facetracknoir/tracker.cpp88
-rw-r--r--ftnoir_protocol_wine/ftnoir_protocol_wine.cpp9
3 files changed, 43 insertions, 58 deletions
diff --git a/3rdparty-notices/NFAILCLIENT-CREDIT.txt b/3rdparty-notices/NFAILCLIENT-CREDIT.txt
new file mode 100644
index 00000000..7a69b0ae
--- /dev/null
+++ b/3rdparty-notices/NFAILCLIENT-CREDIT.txt
@@ -0,0 +1,4 @@
+NFailClient is a clean-room implementation of NFail LLC NFailClient.
+
+Completed as an operation spanning the whole Europe, NFailClient was
+written by gnomes, halflings and rakshasa. \ No newline at end of file
diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp
index 38b70199..980415c8 100644
--- a/facetracknoir/tracker.cpp
+++ b/facetracknoir/tracker.cpp
@@ -35,8 +35,8 @@ Tracker::Tracker( FaceTrackNoIR *parent ) :
enabled(true)
{
// Retieve the pointer to the parent
- mainApp = parent;
- // Load the settings from the INI-file
+ mainApp = parent;
+ // Load the settings from the INI-file
}
Tracker::~Tracker()
@@ -60,17 +60,12 @@ static void get_curve(double pos, double& out, THeadPoseDOF& axis) {
/** QThread run method @override **/
void Tracker::run() {
- T6DOF target_camera;
- T6DOF new_camera;
-
- /** Direct Input variables **/
- T6DOF offset_camera;
- T6DOF gameoutput_camera;
+ T6DOF offset_camera, new_camera, gameoutput_camera, target_camera, target_camera2;
bool bTracker1Confid = false;
bool bTracker2Confid = false;
- double newpose[6];
+ double newpose[6] = {0};
double last_post_filter[6];
#if defined(_WIN32)
@@ -78,17 +73,10 @@ void Tracker::run() {
#endif
for (;;)
- {
+ {
if (should_quit)
break;
- for (int i = 0; i < 6; i++)
- newpose[i] = 0;
-
- //
- // The second tracker serves as 'secondary'. So if an axis is written by the second tracker it CAN be overwritten by the Primary tracker.
- // This is enforced by the sequence below.
- //
if (Libraries->pSecondTracker) {
bTracker2Confid = Libraries->pSecondTracker->GiveHeadPoseData(newpose);
}
@@ -100,57 +88,45 @@ void Tracker::run() {
{
QMutexLocker foo(&mtx);
const bool confid = bTracker1Confid || bTracker2Confid;
-
+
if ( confid ) {
for (int i = 0; i < 6; i++)
mainApp->axis(i).headPos = newpose[i];
}
-
- //
- // If Center is pressed, copy the current values to the offsets.
- //
+
if (do_center) {
- //
- // Only copy valid values
- //
for (int i = 0; i < 6; i++)
- offset_camera.axes[i] = mainApp->axis(i).headPos;
-
+ offset_camera.axes[i] = target_camera.axes[i];
+
do_center = false;
-
+
if (Libraries->pFilter)
Libraries->pFilter->Initialize();
}
-
- if (confid && enabled) {
- // get values
+
+ if (enabled && confid)
+ {
for (int i = 0; i < 6; i++)
target_camera.axes[i] = mainApp->axis(i).headPos;
-
- // do the centering
- target_camera = target_camera - offset_camera;
-
- //
- // Use advanced filtering, when a filter was selected.
- //
- if (Libraries->pFilter) {
- for (int i = 0; i < 6; i++)
- last_post_filter[i] = gameoutput_camera.axes[i];
- Libraries->pFilter->FilterHeadPoseData(target_camera.axes, new_camera.axes, last_post_filter);
- }
- else {
- new_camera = target_camera;
- }
-
- for (int i = 0; i < 6; i++) {
- get_curve(new_camera.axes[i], output_camera.axes[i], mainApp->axis(i));
- }
-
- // Send the headpose to the game
- if (Libraries->pProtocol) {
- gameoutput_camera = output_camera;
- Libraries->pProtocol->sendHeadposeToGame( gameoutput_camera.axes ); // degrees & centimeters
- }
+
+ target_camera2 = target_camera - offset_camera;
+ }
+
+ if (Libraries->pFilter) {
+ for (int i = 0; i < 6; i++)
+ last_post_filter[i] = gameoutput_camera.axes[i];
+ Libraries->pFilter->FilterHeadPoseData(target_camera2.axes, new_camera.axes, last_post_filter);
+ } else {
+ new_camera = target_camera2;
+ }
+
+ for (int i = 0; i < 6; i++) {
+ get_curve(new_camera.axes[i], output_camera.axes[i], mainApp->axis(i));
+ }
+
+ if (Libraries->pProtocol) {
+ gameoutput_camera = output_camera;
+ Libraries->pProtocol->sendHeadposeToGame( gameoutput_camera.axes ); // degrees & centimeters
}
}
diff --git a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp
index c5d0754f..d9c3f1e0 100644
--- a/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp
+++ b/ftnoir_protocol_wine/ftnoir_protocol_wine.cpp
@@ -19,9 +19,14 @@ FTNoIR_Protocol::~FTNoIR_Protocol()
{
if (shm) {
shm->stop = true;
- wrapper.waitForFinished(2000);
+ wrapper.waitForFinished(100);
+ }
+ wrapper.terminate();
+ if (!wrapper.waitForFinished(100))
+ {
+ wrapper.kill();
+ wrapper.waitForFinished(42);
}
- wrapper.kill();
shm_unlink("/" WINE_SHM_NAME);
}