summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_hatire
diff options
context:
space:
mode:
Diffstat (limited to 'ftnoir_tracker_hatire')
-rw-r--r--ftnoir_tracker_hatire/ftnoir_arduino_type.h14
-rw-r--r--ftnoir_tracker_hatire/ftnoir_tracker_hat.h144
-rw-r--r--ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h128
-rw-r--r--ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h95
4 files changed, 189 insertions, 192 deletions
diff --git a/ftnoir_tracker_hatire/ftnoir_arduino_type.h b/ftnoir_tracker_hatire/ftnoir_arduino_type.h
index efcee05c..57afed63 100644
--- a/ftnoir_tracker_hatire/ftnoir_arduino_type.h
+++ b/ftnoir_tracker_hatire/ftnoir_arduino_type.h
@@ -7,24 +7,24 @@
#pragma pack(push,2)
struct TArduinoData
{
- quint16 Begin; // Header trame 0xAAAA;
- quint16 Code; // 0->999 Num Trame >=2000 Info >=3000 Init >=5000 Start Command >=9000 Error
- float Rot[3];
- float Trans[3];
- quint16 End; // End trame 0x5555;
+ quint16 Begin; // Header trame 0xAAAA;
+ quint16 Code; // 0->999 Num Trame >=2000 Info >=3000 Init >=5000 Start Command >=9000 Error
+ float Rot[3];
+ float Trans[3];
+ quint16 End; // End trame 0x5555;
} ;
#pragma pack(pop)
inline QDataStream & operator >> ( QDataStream& in, TArduinoData& out )
{
- in.setFloatingPointPrecision(QDataStream::SinglePrecision );
+ in.setFloatingPointPrecision(QDataStream::SinglePrecision );
in >> out.Begin >> out.Code
>> out.Rot[0] >> out.Rot[1] >> out.Rot[2]
>> out.Trans[0] >> out.Trans[1] >> out.Trans[2]
>> out.End;
- return in;
+ return in;
}
diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h
index d9dd0694..9471ebfb 100644
--- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h
+++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h
@@ -4,7 +4,7 @@
#ifdef OPENTRACK_API
# include "opentrack/plugin-support.hpp"
#else
-# include "..\ftnoir_tracker_base\ftnoir_tracker_base.h"
+# include "..\ftnoir_tracker_base\ftnoir_tracker_base.h"
#endif
#include "ftnoir_tracker_hat_settings.h"
#include "ftnoir_arduino_type.h"
@@ -22,11 +22,11 @@
#define VER_FILEVERSION_STR "Version 2.1.1\0"
class FTNoIR_Tracker : public QObject, public ITracker
-{
- Q_OBJECT
+{
+ Q_OBJECT
public:
- FTNoIR_Tracker();
- ~FTNoIR_Tracker();
+ FTNoIR_Tracker();
+ ~FTNoIR_Tracker();
#ifdef OPENTRACK_API
void start_tracker(QFrame*);
@@ -40,77 +40,77 @@ public:
bool GiveHeadPoseData(THeadPoseData *data);
void notifyCenter();
#endif
- void applysettings(const TrackerSettings& settings);
- bool notifyZeroed();
- void reset();
- void SerialInfo();
- void sendcmd(const QByteArray &cmd);
- void get_info( int *tps );
+ void applysettings(const TrackerSettings& settings);
+ bool notifyZeroed();
+ void reset();
+ void SerialInfo();
+ void sendcmd(const QByteArray &cmd);
+ void get_info( int *tps );
private Q_SLOTS:
void SerialRead();
- void Log(QString message);
+ void Log(QString message);
signals:
void sendMsgInfo(const QByteArray &MsgInfo);
private:
- QSerialPort *ComPort;
+ QSerialPort *ComPort;
TArduinoData ArduinoData, HAT ; // Trame from Arduino
QByteArray dataRead;
QByteArray dataToSend;
- QByteArray Begin;
+ QByteArray Begin;
QByteArray End;
- QMutex mutex;
- int frame_cnt;
+ QMutex mutex;
+ int frame_cnt;
bool new_frame;
TrackerSettings settings;
- bool bEnableRoll;
- bool bEnablePitch;
- bool bEnableYaw;
- bool bEnableX;
- bool bEnableY;
- bool bEnableZ;
-
- bool bInvertRoll;
- bool bInvertPitch;
- bool bInvertYaw;
- bool bInvertX;
- bool bInvertY;
- bool bInvertZ;
- bool bEnableLogging;
-
- int iRollAxe;
- int iPitchAxe;
- int iYawAxe;
- int iXAxe;
- int iYAxe;
- int iZAxe;
-
- QByteArray sCmdStart;
- QByteArray sCmdStop;
- QByteArray sCmdInit;
- QByteArray sCmdReset;
- QByteArray sCmdCenter;
- QByteArray sCmdZero;
-
- int iDelayInit;
- int iDelayStart;
- int iDelaySeq;
-
- bool bBigEndian;
-
- QString sSerialPortName;
- QSerialPort::BaudRate iBaudRate;
- QSerialPort::DataBits iDataBits;
- QSerialPort::Parity iParity;
- QSerialPort::StopBits iStopBits;
- QSerialPort::FlowControl iFlowControl;
-
- QFile flDiagnostics;
+ bool bEnableRoll;
+ bool bEnablePitch;
+ bool bEnableYaw;
+ bool bEnableX;
+ bool bEnableY;
+ bool bEnableZ;
+
+ bool bInvertRoll;
+ bool bInvertPitch;
+ bool bInvertYaw;
+ bool bInvertX;
+ bool bInvertY;
+ bool bInvertZ;
+ bool bEnableLogging;
+
+ int iRollAxe;
+ int iPitchAxe;
+ int iYawAxe;
+ int iXAxe;
+ int iYAxe;
+ int iZAxe;
+
+ QByteArray sCmdStart;
+ QByteArray sCmdStop;
+ QByteArray sCmdInit;
+ QByteArray sCmdReset;
+ QByteArray sCmdCenter;
+ QByteArray sCmdZero;
+
+ int iDelayInit;
+ int iDelayStart;
+ int iDelaySeq;
+
+ bool bBigEndian;
+
+ QString sSerialPortName;
+ QSerialPort::BaudRate iBaudRate;
+ QSerialPort::DataBits iDataBits;
+ QSerialPort::Parity iParity;
+ QSerialPort::StopBits iStopBits;
+ QSerialPort::FlowControl iFlowControl;
+
+ QFile flDiagnostics;
#ifdef OPENTRACK_API
int iFpsArduino;
#endif
@@ -125,33 +125,33 @@ private:
//*******************************************************************************************************
class TrackerDll :
#if defined(OPENTRACK_API)
- public Metadata
+public Metadata
#else
- public ITrackerDll
+public ITrackerDll
#endif
{
public:
- TrackerDll();
- ~TrackerDll();
+ TrackerDll();
+ ~TrackerDll();
#ifndef OPENTRACK_API
- void Initialize();
+ void Initialize();
#endif
-
+
#ifdef OPENTRACK_API
QString name();
QIcon icon();
#else
- void getFullName(QString *strToBeFilled);
- void getShortName(QString *strToBeFilled);
- void getDescription(QString *strToBeFilled);
- void getIcon(QIcon *icon);
+ void getFullName(QString *strToBeFilled);
+ void getShortName(QString *strToBeFilled);
+ void getDescription(QString *strToBeFilled);
+ void getIcon(QIcon *icon);
#endif
private:
- QString trackerFullName; // Trackers' name and description
- QString trackerShortName;
- QString trackerDescription;
+ QString trackerFullName; // Trackers' name and description
+ QString trackerShortName;
+ QString trackerDescription;
};
diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h
index 5d3e2c36..7d0fcd83 100644
--- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h
+++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h
@@ -19,13 +19,13 @@
// Widget that has controls for FTNoIR protocol client-settings.
#ifdef OPENTRACK_API
class TrackerControls: public ITrackerDialog
-#else
+ #else
class TrackerControls: public QWidget, public ITrackerDialog
-#endif
+ #endif
{
Q_OBJECT
public:
- explicit TrackerControls();
+ explicit TrackerControls();
virtual ~TrackerControls();
#ifdef OPENTRACK_API
void Initialize(QWidget *parent) ; // unused
@@ -38,76 +38,76 @@ public:
#endif
private:
- Ui::UIHATControls ui;
- FTNoIR_Tracker *theTracker;
- QTime last_time;
-
+ Ui::UIHATControls ui;
+ FTNoIR_Tracker *theTracker;
+ QTime last_time;
+
public slots:
void WriteMsgInfo(const QByteArray &MsgInfo);
protected slots:
- void set_mod_port(const QString & val) { settings.SerialPortName =val; settings_changed(); }
- void set_ena_roll(bool val) { settings.EnableRoll = val; settings_changed(); }
- void set_ena_pitch(bool val) { settings.EnablePitch = val; settings_changed(); }
- void set_ena_yaw(bool val) { settings.EnableYaw = val; settings_changed(); }
- void set_ena_x(bool val) { settings.EnableX = val; settings_changed(); }
- void set_ena_y(bool val) { settings.EnableY = val; settings_changed(); }
- void set_ena_z(bool val) { settings.EnableZ = val; settings_changed(); }
-
- void set_inv_roll(bool val) { settings.InvertRoll = val; settings_changed(); }
- void set_inv_pitch(bool val) { settings.InvertPitch = val; settings_changed(); }
- void set_inv_yaw(bool val) { settings.InvertYaw = val; settings_changed(); }
- void set_inv_x(bool val) { settings.InvertX = val; settings_changed(); }
- void set_inv_y(bool val) { settings.InvertY = val; settings_changed(); }
- void set_inv_z(bool val) { settings.InvertZ = val; settings_changed(); }
-
- void set_diag_logging(bool val) { settings.EnableLogging = val; settings_changed(); }
-
-
- void set_rot_roll(int val) { settings.RollAxe = val; settings_changed(); }
- void set_rot_pitch(int val) { settings.PitchAxe = val; settings_changed(); }
- void set_rot_yaw(int val) { settings.YawAxe = val; settings_changed(); }
- void set_acc_x(int val) { settings.XAxe = val; settings_changed(); }
- void set_acc_y(int val) { settings.YAxe = val; settings_changed(); }
- void set_acc_z(int val) { settings.ZAxe = val; settings_changed(); }
-
- void set_cmd_start(const QString &val) { settings.CmdStart = val; settings_changed(); }
- void set_cmd_stop(const QString &val) { settings.CmdStop = val; settings_changed(); }
- void set_cmd_init(const QString &val) { settings.CmdInit = val; settings_changed(); }
- void set_cmd_reset(const QString &val) { settings.CmdReset = val; settings_changed(); }
- void set_cmd_center(const QString &val) { settings.CmdCenter = val; settings_changed(); }
- void set_cmd_zero(const QString &val) { settings.CmdZero = val; settings_changed(); }
-
- void set_DelayInit(int val) { settings.DelayInit = val; settings_changed(); }
- void set_DelayStart(int val) { settings.DelayStart = val; settings_changed(); }
- void set_DelaySeq(int val) { settings.DelaySeq = val; settings_changed(); }
-
- void set_endian(bool val) { settings.BigEndian = val; settings_changed(); }
+ void set_mod_port(const QString & val) { settings.SerialPortName =val; settings_changed(); }
+ void set_ena_roll(bool val) { settings.EnableRoll = val; settings_changed(); }
+ void set_ena_pitch(bool val) { settings.EnablePitch = val; settings_changed(); }
+ void set_ena_yaw(bool val) { settings.EnableYaw = val; settings_changed(); }
+ void set_ena_x(bool val) { settings.EnableX = val; settings_changed(); }
+ void set_ena_y(bool val) { settings.EnableY = val; settings_changed(); }
+ void set_ena_z(bool val) { settings.EnableZ = val; settings_changed(); }
+
+ void set_inv_roll(bool val) { settings.InvertRoll = val; settings_changed(); }
+ void set_inv_pitch(bool val) { settings.InvertPitch = val; settings_changed(); }
+ void set_inv_yaw(bool val) { settings.InvertYaw = val; settings_changed(); }
+ void set_inv_x(bool val) { settings.InvertX = val; settings_changed(); }
+ void set_inv_y(bool val) { settings.InvertY = val; settings_changed(); }
+ void set_inv_z(bool val) { settings.InvertZ = val; settings_changed(); }
+
+ void set_diag_logging(bool val) { settings.EnableLogging = val; settings_changed(); }
+
+
+ void set_rot_roll(int val) { settings.RollAxe = val; settings_changed(); }
+ void set_rot_pitch(int val) { settings.PitchAxe = val; settings_changed(); }
+ void set_rot_yaw(int val) { settings.YawAxe = val; settings_changed(); }
+ void set_acc_x(int val) { settings.XAxe = val; settings_changed(); }
+ void set_acc_y(int val) { settings.YAxe = val; settings_changed(); }
+ void set_acc_z(int val) { settings.ZAxe = val; settings_changed(); }
+
+ void set_cmd_start(const QString &val) { settings.CmdStart = val; settings_changed(); }
+ void set_cmd_stop(const QString &val) { settings.CmdStop = val; settings_changed(); }
+ void set_cmd_init(const QString &val) { settings.CmdInit = val; settings_changed(); }
+ void set_cmd_reset(const QString &val) { settings.CmdReset = val; settings_changed(); }
+ void set_cmd_center(const QString &val) { settings.CmdCenter = val; settings_changed(); }
+ void set_cmd_zero(const QString &val) { settings.CmdZero = val; settings_changed(); }
+
+ void set_DelayInit(int val) { settings.DelayInit = val; settings_changed(); }
+ void set_DelayStart(int val) { settings.DelayStart = val; settings_changed(); }
+ void set_DelaySeq(int val) { settings.DelaySeq = val; settings_changed(); }
+
+ void set_endian(bool val) { settings.BigEndian = val; settings_changed(); }
#ifdef OPENTRACK_API
- void set_Fps(int val) { settings.FPSArduino = val; settings_changed(); }
+ void set_Fps(int val) { settings.FPSArduino = val; settings_changed(); }
#endif
- void set_mod_baud(int val) { settings.pBaudRate = static_cast<QSerialPort::BaudRate>(ui.QCB_Serial_baudRate->itemData(val).toInt()) ; settings_changed(); }
- void set_mod_dataBits(int val) { settings.pDataBits = static_cast<QSerialPort::DataBits>(ui.QCB_Serial_dataBits->itemData(val).toInt()) ; settings_changed(); }
- void set_mod_parity(int val) { settings.pParity = static_cast<QSerialPort::Parity>(ui.QCB_Serial_parity->itemData(val).toInt()) ; settings_changed(); }
- void set_mod_stopBits(int val) { settings.pStopBits = static_cast<QSerialPort::StopBits>(ui.QCB_Serial_stopBits->itemData(val).toInt()); settings_changed(); }
- void set_mod_flowControl(int val) { settings.pFlowControl = static_cast<QSerialPort::FlowControl>(ui.QCB_Serial_flowControl->itemData(val).toInt()) ; settings_changed(); }
-
- void doOK();
- void doCancel();
- void doSave();
- void doReset();
- void doCenter();
- void doZero();
- void doSend();
- void poll_tracker_info();
- void doSerialInfo();
+ void set_mod_baud(int val) { settings.pBaudRate = static_cast<QSerialPort::BaudRate>(ui.QCB_Serial_baudRate->itemData(val).toInt()) ; settings_changed(); }
+ void set_mod_dataBits(int val) { settings.pDataBits = static_cast<QSerialPort::DataBits>(ui.QCB_Serial_dataBits->itemData(val).toInt()) ; settings_changed(); }
+ void set_mod_parity(int val) { settings.pParity = static_cast<QSerialPort::Parity>(ui.QCB_Serial_parity->itemData(val).toInt()) ; settings_changed(); }
+ void set_mod_stopBits(int val) { settings.pStopBits = static_cast<QSerialPort::StopBits>(ui.QCB_Serial_stopBits->itemData(val).toInt()); settings_changed(); }
+ void set_mod_flowControl(int val) { settings.pFlowControl = static_cast<QSerialPort::FlowControl>(ui.QCB_Serial_flowControl->itemData(val).toInt()) ; settings_changed(); }
+
+ void doOK();
+ void doCancel();
+ void doSave();
+ void doReset();
+ void doCenter();
+ void doZero();
+ void doSend();
+ void poll_tracker_info();
+ void doSerialInfo();
protected:
- bool settingsDirty;
- void settings_changed();
- TrackerSettings settings;
- QTimer timer;
+ bool settingsDirty;
+ void settings_changed();
+ TrackerSettings settings;
+ QTimer timer;
private slots:
void on_lineSend_returnPressed();
diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h
index 5754da8c..ade46d54 100644
--- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h
+++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h
@@ -12,59 +12,56 @@
//-----------------------------------------------------------------------------
struct TrackerSettings
-{
-
- void load_ini();
- void save_ini() const;
-
- bool EnableRoll;
- bool EnablePitch;
- bool EnableYaw;
- bool EnableX;
- bool EnableY;
- bool EnableZ;
-
- bool InvertRoll;
- bool InvertPitch;
- bool InvertYaw;
- bool InvertX;
- bool InvertY;
- bool InvertZ;
-
-
- int RollAxe;
- int PitchAxe;
- int YawAxe;
- int XAxe;
- int YAxe;
- int ZAxe;
-
- QString CmdStart;
- QString CmdStop;
- QString CmdInit;
- QString CmdReset;
- QString CmdCenter;
- QString CmdZero;
-
- int DelayInit;
- int DelayStart;
- int DelaySeq;
-
- bool BigEndian;
- bool EnableLogging;
-
- QString SerialPortName;
- QSerialPort::BaudRate pBaudRate;
- QSerialPort::DataBits pDataBits;
- QSerialPort::Parity pParity;
- QSerialPort::StopBits pStopBits;
- QSerialPort::FlowControl pFlowControl;
+{
+ void load_ini();
+ void save_ini() const;
+
+ bool EnableRoll;
+ bool EnablePitch;
+ bool EnableYaw;
+ bool EnableX;
+ bool EnableY;
+ bool EnableZ;
+
+ bool InvertRoll;
+ bool InvertPitch;
+ bool InvertYaw;
+ bool InvertX;
+ bool InvertY;
+ bool InvertZ;
+
+
+ int RollAxe;
+ int PitchAxe;
+ int YawAxe;
+ int XAxe;
+ int YAxe;
+ int ZAxe;
+
+ QString CmdStart;
+ QString CmdStop;
+ QString CmdInit;
+ QString CmdReset;
+ QString CmdCenter;
+ QString CmdZero;
+
+ int DelayInit;
+ int DelayStart;
+ int DelaySeq;
+
+ bool BigEndian;
+ bool EnableLogging;
+
+ QString SerialPortName;
+ QSerialPort::BaudRate pBaudRate;
+ QSerialPort::DataBits pDataBits;
+ QSerialPort::Parity pParity;
+ QSerialPort::StopBits pStopBits;
+ QSerialPort::FlowControl pFlowControl;
#ifdef OPENTRACK_API
int FPSArduino;
#endif
-
-
};