diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-08-06 09:39:39 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-08-07 21:03:42 +0200 |
commit | a497af1ad4298de4ae9fab4453a0164950c4faf4 (patch) | |
tree | cd8f37e7d90f6f1b3ac585ab6d0d5822ddc6a993 /opentrack-logic/tracker.h | |
parent | 6571b78ffd9f74f9e863ff4c78b8ddebb53d52c5 (diff) |
logic/tracker: fix gimbal lock in a crude way
Divide euler angle representation by four. Now 180 maps to 45. Our
conversion back from matrix to euler won't cause gimbal lock anymore. Of
course multiply back when it's time to map.
Keep the real representation for translation compensation.
The value of four got chosen since it's a multiply of two (IEEE float
exponent is base 2).
Diffstat (limited to 'opentrack-logic/tracker.h')
-rw-r--r-- | opentrack-logic/tracker.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/opentrack-logic/tracker.h b/opentrack-logic/tracker.h index 310bac31..09aca424 100644 --- a/opentrack-logic/tracker.h +++ b/opentrack-logic/tracker.h @@ -71,7 +71,7 @@ private: using rmat = euler::rmat; using euler_t = euler::euler_t; - rmat r_b; + rmat r_b, r_b_real; double t_b[3]; double map(double pos, Mapping& axis); @@ -82,11 +82,15 @@ private: static constexpr double pi = OPENTRACK_PI; static constexpr double r2d = 180. / OPENTRACK_PI; static constexpr double d2r = OPENTRACK_PI / 180.; + + // note: float exponent base is 2 + static constexpr double c_mult = 4; + static constexpr double c_div = 1./c_mult; public: Tracker(Mappings& m, SelectedLibraries& libs, TrackLogger &logger); ~Tracker(); - rmat get_camera_offset_matrix(); + rmat get_camera_offset_matrix(double c); void get_raw_and_mapped_poses(double* mapped, double* raw) const; void start() { QThread::start(); } void toggle_enabled() { enabledp = !enabledp; } |