From c172c327c2b927427c24a7e3a5f345673d0e5929 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 3 Aug 2018 04:43:28 +0000 Subject: logic/pipeline: rotation order fix v2: fix comments v3: fix reltrans --- logic/pipeline.hpp | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'logic/pipeline.hpp') diff --git a/logic/pipeline.hpp b/logic/pipeline.hpp index 0b48d741..b293663f 100644 --- a/logic/pipeline.hpp +++ b/logic/pipeline.hpp @@ -31,6 +31,16 @@ using euler_t = euler::euler_t; using vec6_bool = Mat; using vec3_bool = Mat; +static constexpr inline double scale_c = 8; +static constexpr inline double scale_inv_c = 1/scale_c; + +struct state_ +{ + rmat inv_rot_center { rmat::eye() }; + rmat rotation { rmat::eye() }; + euler_t t_center; +}; + class reltrans { euler_t interp_pos; @@ -85,7 +95,7 @@ DEFINE_ENUM_OPERATORS(bits::flags); class OTR_LOGIC_EXPORT pipeline : private QThread, private bits { Q_OBJECT -private: + QMutex mtx; main_settings s; Mappings& m; @@ -101,21 +111,12 @@ private: // the logger while the tracker is running. TrackLogger& logger; - struct state_ - { - rmat inv_rot_center; - rmat rotation; - euler_t t_center; - - state_() : inv_rot_center(rmat::eye()) - {} - }; - reltrans rel; - state_ state; + //state_ state, scaled_state; + state_ scaled_state; - ns backlog_time = ns(0); + ns backlog_time { ns{} }; bool tracking_started = false; @@ -124,16 +125,17 @@ private: void run() override; bool maybe_enable_center_on_tracking_started(); void maybe_set_center_pose(const Pose& value, bool own_center_logic); + void store_tracker_pose(const Pose& value); Pose clamp_value(Pose value) const; Pose apply_center(Pose value) const; - std::tuple get_selected_axis_value(const Pose& newpose) const; + std::tuple get_selected_axis_values(const Pose& newpose) const; Pose maybe_apply_filter(const Pose& value) const; Pose apply_reltrans(Pose value, vec6_bool disabled, bool centerp); Pose apply_zero_pos(Pose value) const; public: pipeline(Mappings& m, runtime_libraries& libs, event_handler& ev, TrackLogger& logger); - ~pipeline(); + ~pipeline() override; void raw_and_mapped_pose(double* mapped, double* raw) const; void start() { QThread::start(QThread::HighPriority); } @@ -149,4 +151,4 @@ public: } // ns pipeline_impl -using pipeline_impl::pipeline; +using pipeline = pipeline_impl::pipeline; -- cgit v1.2.3