diff options
author | Davide Mameli <davide@eyeware.tech> | 2023-03-07 12:51:23 +0100 |
---|---|---|
committer | Davide Mameli <davide@eyeware.tech> | 2023-03-07 16:15:16 +0100 |
commit | c8cccf1a21b600efd89258f48ef6dacaf187e96b (patch) | |
tree | 33ef0c896af5dbc9092354bf6e91cabc9b2bbdcb /tracker-eyeware-beam/eyeware_beam.h | |
parent | e8c0b30ff2db91c60b26b90054c16b22dca28956 (diff) |
Initial commit
Diffstat (limited to 'tracker-eyeware-beam/eyeware_beam.h')
-rw-r--r-- | tracker-eyeware-beam/eyeware_beam.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/tracker-eyeware-beam/eyeware_beam.h b/tracker-eyeware-beam/eyeware_beam.h new file mode 100644 index 00000000..b30703bc --- /dev/null +++ b/tracker-eyeware-beam/eyeware_beam.h @@ -0,0 +1,74 @@ +/* Copyright (c) 2023 Eyeware Tech SA https://www.eyeware.tech + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + */ + +#pragma once + +#include "api/plugin-api.hpp" + +#include "ui_eyeware_beam.h" + +#include "eyeware/tracker_client.h" + +#include <QObject> +#include <QMutex> + +class eyeware_beam_tracker : public QObject, public ITracker +{ + Q_OBJECT + +public: + eyeware_beam_tracker(); + ~eyeware_beam_tracker() override; + module_status start_tracker(QFrame* frame) override; + void data(double *data) override; + +private: + void extract_translation(const eyeware::Vector3D& t, + double& translation_x_cm, + double& translation_y_cm, + 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; + + QMutex mtx; + + double last_pitch_deg = 0.0; + double last_roll_deg = 0.0; + double last_yaw_deg = 0.0; + 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 +{ + Q_OBJECT + +public: + eyeware_beam_dialog(); + void register_tracker(ITracker * x) override { tracker = static_cast<eyeware_beam_tracker*>(x); } + void unregister_tracker() override { tracker = nullptr; } + +private: + Ui::eyeware_beam_ui ui; + eyeware_beam_tracker* tracker = nullptr; + +private Q_SLOTS: + void doOK(); +}; + +class eyeware_beam_metadata : public Metadata +{ + Q_OBJECT + QString name() override { return QString("Eyeware Beam"); } + QIcon icon() override { return QIcon(":/images/eyeware_beam_logo.png"); } +}; |