diff options
author | eyedav <88885346+eyedav@users.noreply.github.com> | 2023-03-20 17:03:45 +0100 |
---|---|---|
committer | eyedav <88885346+eyedav@users.noreply.github.com> | 2023-03-20 17:03:45 +0100 |
commit | 7519fe5fa5925da20ad7fe435b686f8c41adcfd7 (patch) | |
tree | 9a80e6f4b15eea0bb9397d2dc60de4cda327ffd8 /tracker-eyeware-beam | |
parent | b35641308049d7484296cebc68ec7882d966c6e8 (diff) |
Eyeware Beam using the C API
Diffstat (limited to 'tracker-eyeware-beam')
-rw-r--r-- | tracker-eyeware-beam/eyeware_beam.cpp | 13 | ||||
-rw-r--r-- | tracker-eyeware-beam/eyeware_beam.h | 6 |
2 files changed, 10 insertions, 9 deletions
diff --git a/tracker-eyeware-beam/eyeware_beam.cpp b/tracker-eyeware-beam/eyeware_beam.cpp index 6762b1bf..f48b5d4d 100644 --- a/tracker-eyeware-beam/eyeware_beam.cpp +++ b/tracker-eyeware-beam/eyeware_beam.cpp @@ -9,6 +9,10 @@ #include <QMutexLocker> +static constexpr double rad_to_deg = 180.0 / M_PI; +static constexpr double m_to_cm = 100.0; +static constexpr double epsilon = 0.000001; + eyeware_beam_tracker::eyeware_beam_tracker() { } @@ -16,7 +20,8 @@ eyeware_beam_tracker::eyeware_beam_tracker() eyeware_beam_tracker::~eyeware_beam_tracker() { QMutexLocker lck(&mtx); - tracker_client.reset(nullptr); + release_tracker_instance(tracker_client); + tracker_client = nullptr; } module_status eyeware_beam_tracker::start_tracker(QFrame* videoframe) @@ -24,7 +29,7 @@ module_status eyeware_beam_tracker::start_tracker(QFrame* videoframe) QMutexLocker lck(&mtx); try { - tracker_client = std::make_unique<eyeware::TrackerClient>(); + tracker_client = create_tracker_instance("127.0.0.1", 12010); } catch (...) { @@ -77,9 +82,9 @@ void eyeware_beam_tracker::data(double *data) { QMutexLocker lck(&mtx); - if (tracker_client && tracker_client->connected()) + if (connected(tracker_client)) { - eyeware::HeadPoseInfo head_pose_info = tracker_client->get_head_pose_info(); + eyeware::HeadPoseInfo head_pose_info = get_head_pose_info(tracker_client); if (!head_pose_info.is_lost) { extract_translation(head_pose_info.transform.translation, last_translation_x_cm, diff --git a/tracker-eyeware-beam/eyeware_beam.h b/tracker-eyeware-beam/eyeware_beam.h index b30703bc..9ebf1f3c 100644 --- a/tracker-eyeware-beam/eyeware_beam.h +++ b/tracker-eyeware-beam/eyeware_beam.h @@ -33,7 +33,7 @@ private: double& translation_z_cm); void extract_rotation_angles(const eyeware::Matrix3x3& R, double& pitch_deg, double& roll_deg, double& yaw_deg); - std::unique_ptr<eyeware::TrackerClient> tracker_client = nullptr; + eyeware::TrackerClient* tracker_client = nullptr; QMutex mtx; @@ -43,10 +43,6 @@ private: double last_translation_x_cm = 0.0; double last_translation_y_cm = 0.0; double last_translation_z_cm = 0.0; - - const double rad_to_deg = 180.0 / M_PI; - const double m_to_cm = 100.0; - const double epsilon = 0.000001; }; class eyeware_beam_dialog : public ITrackerDialog |