diff options
Diffstat (limited to 'logic/pipeline.hpp')
-rw-r--r-- | logic/pipeline.hpp | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/logic/pipeline.hpp b/logic/pipeline.hpp index 91dfc668..545a7836 100644 --- a/logic/pipeline.hpp +++ b/logic/pipeline.hpp @@ -31,16 +31,6 @@ using namespace time_units; using vec6_bool = Mat<bool, 6, 1>; using vec3_bool = Mat<bool, 6, 1>; -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; @@ -51,7 +41,7 @@ class reltrans Timer interp_phase_timer; unsigned RC_stage = 0; - bool cur = false; + bool moving_to_reltans = false; bool in_zone = false; public: @@ -68,6 +58,7 @@ public: using namespace time_units; enum bit_flags : unsigned { + f_none = 0, f_center = 1 << 0, f_held_center = 1 << 1, f_enabled_h = 1 << 2, @@ -77,7 +68,8 @@ enum bit_flags : unsigned { struct OTR_LOGIC_EXPORT bits { - std::atomic<unsigned> b; + bit_flags flags{0}; + QMutex lock; void set(bit_flags flag, bool val); void negate(bit_flags flag); @@ -91,13 +83,13 @@ class OTR_LOGIC_EXPORT pipeline : private QThread { Q_OBJECT - QMutex mtx; + mutable QMutex mtx; main_settings s; Mappings& m; event_handler& ev; Timer t; - Pose output_pose, raw_6dof, last_mapped, last_raw; + Pose output_pose, raw_6dof; Pose newpose; runtime_libraries const& libs; @@ -108,8 +100,7 @@ class OTR_LOGIC_EXPORT pipeline : private QThread reltrans rel; - //state_ state, scaled_state; - state_ scaled_state; + Pose center; ns backlog_time {}; @@ -119,8 +110,7 @@ class OTR_LOGIC_EXPORT pipeline : private QThread void logic(); void run() override; bool maybe_enable_center_on_tracking_started(); - void set_center_pose(const Pose& value, bool own_center_logic); - void store_tracker_pose(const Pose& value); + void maybe_set_center_pose(const Pose& value, bool own_center_logic); Pose clamp_value(Pose value) const; Pose apply_center(Pose value) const; std::tuple<Pose, Pose, vec6_bool> get_selected_axis_values(const Pose& newpose) const; |