diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-11-18 21:12:29 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-11-18 21:12:29 +0100 |
commit | ec6c5632446c04a643bc7a05e323fe4a16f0978b (patch) | |
tree | a17199825c0242636a071a20da5a499f9138ebeb | |
parent | 21cac744a6d6ca59f686ac332b531e5be65cc3af (diff) |
logic/tracker: make camera offset only work on translation
-rw-r--r-- | logic/tracker.cpp | 14 | ||||
-rw-r--r-- | logic/tracker.h | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/logic/tracker.cpp b/logic/tracker.cpp index 9f4c3617..a5892dd0 100644 --- a/logic/tracker.cpp +++ b/logic/tracker.cpp @@ -35,7 +35,8 @@ Tracker::Tracker(Mappings& m, SelectedLibraries& libs, TrackLogger& logger) : m(m), libs(libs), logger(logger), - backlog_time(0) + backlog_time(0), + tracking_started(false) { set(f_center, s.center_at_startup); } @@ -170,28 +171,23 @@ void Tracker::logic() scaled_rotation.camera = get_camera_offset_matrix(c_div); real_rotation.camera = get_camera_offset_matrix(1); - scaled_rotation.rotation = scaled_rotation.camera * scaled_rotation.rotation; - real_rotation.rotation = real_rotation.camera * real_rotation.rotation; - bool nanp = is_nan(value) || is_nan(scaled_rotation.rotation) || is_nan(real_rotation.rotation); if (!nanp) { - bool can_center = false; - - if (get(f_center)) + if (!tracking_started) { using std::fabs; for (int i = 0; i < 6; i++) if (fabs(newpose(i)) != 0) { - can_center = true; + tracking_started = true; break; } } - if (can_center) + if (get(f_center) && tracking_started) { set(f_center, false); diff --git a/logic/tracker.h b/logic/tracker.h index ddb71b44..4a5bdf50 100644 --- a/logic/tracker.h +++ b/logic/tracker.h @@ -88,6 +88,8 @@ private: long backlog_time; + bool tracking_started; + double map(double pos, Map& axis); void logic(); void t_compensate(const rmat& rmat, const euler_t& ypr, euler_t& output, |