diff options
Diffstat (limited to 'FTNoIR_Tracker_UDP')
-rw-r--r-- | FTNoIR_Tracker_UDP/FTNoIR_FTNClientControls.ui | 184 | ||||
-rw-r--r-- | FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h | 7 | ||||
-rw-r--r-- | FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp | 45 | ||||
-rw-r--r-- | FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp | 31 |
4 files changed, 239 insertions, 28 deletions
diff --git a/FTNoIR_Tracker_UDP/FTNoIR_FTNClientControls.ui b/FTNoIR_Tracker_UDP/FTNoIR_FTNClientControls.ui index 11e07cf3..7ac6c0f4 100644 --- a/FTNoIR_Tracker_UDP/FTNoIR_FTNClientControls.ui +++ b/FTNoIR_Tracker_UDP/FTNoIR_FTNClientControls.ui @@ -7,7 +7,7 @@ <x>0</x>
<y>0</y>
<width>411</width>
- <height>129</height>
+ <height>210</height>
</rect>
</property>
<property name="windowTitle">
@@ -59,6 +59,188 @@ </layout>
</item>
<item>
+ <widget class="QGroupBox" name="groupBox_3">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>85</height>
+ </size>
+ </property>
+ <property name="title">
+ <string>Enable Axis</string>
+ </property>
+ <widget class="QWidget" name="layoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>10</x>
+ <y>20</y>
+ <width>143</width>
+ <height>60</height>
+ </rect>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Roll:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>Pitch:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_11">
+ <property name="text">
+ <string>Yaw:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QCheckBox" name="chkEnableRoll">
+ <property name="maximumSize">
+ <size>
+ <width>20</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="styleSheet">
+ <string notr="true"/>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="chkEnablePitch">
+ <property name="maximumSize">
+ <size>
+ <width>20</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="chkEnableYaw">
+ <property name="maximumSize">
+ <size>
+ <width>20</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3">
+ <widget class="QLabel" name="label_14">
+ <property name="text">
+ <string>X:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="4">
+ <widget class="QCheckBox" name="chkEnableX">
+ <property name="maximumSize">
+ <size>
+ <width>20</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3">
+ <widget class="QLabel" name="label_15">
+ <property name="text">
+ <string>Y:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="4">
+ <widget class="QCheckBox" name="chkEnableY">
+ <property name="maximumSize">
+ <size>
+ <width>20</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3">
+ <widget class="QLabel" name="label_16">
+ <property name="text">
+ <string>Z:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="4">
+ <widget class="QCheckBox" name="chkEnableZ">
+ <property name="maximumSize">
+ <size>
+ <width>20</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="layoutDirection">
+ <enum>Qt::LeftToRight</enum>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Minimum</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
diff --git a/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h b/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h index b1638e7b..94645c84 100644 --- a/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h +++ b/FTNoIR_Tracker_UDP/FTNoIR_Tracker_UDP.h @@ -38,6 +38,12 @@ private: THeadPoseData newHeadPose; // Structure with new headpose
float portAddress; // Port-number
+ bool bEnableRoll;
+ bool bEnablePitch;
+ bool bEnableYaw;
+ bool bEnableX;
+ bool bEnableY;
+ bool bEnableZ;
};
// Widget that has controls for FTNoIR protocol client-settings.
@@ -66,6 +72,7 @@ private slots: void doOK();
void doCancel();
void settingChanged() { settingsDirty = true; };
+ void settingChanged(int) { settingsDirty = true; };
};
//*******************************************************************************************************
diff --git a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp index ecf0e5dd..102c85bd 100644 --- a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp +++ b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp.cpp @@ -33,15 +33,12 @@ FTNoIR_Tracker::FTNoIR_Tracker() m_StopThread = CreateEvent(0, TRUE, FALSE, 0);
m_WaitThread = CreateEvent(0, TRUE, FALSE, 0);
- ////allocate memory for the parameters
- //parameterValueAsFloat.clear();
- //parameterRange.clear();
-
- //// Add the parameters to the list
- //parameterRange.append(std::pair<float,float>(1000.0f,9999.0f));
- //parameterValueAsFloat.append(0.0f);
- //setParameterValue(kPortAddress,5551.0f);
-
+ bEnableRoll = true;
+ bEnablePitch = true;
+ bEnableYaw = true;
+ bEnableX = true;
+ bEnableY = true;
+ bEnableZ = true;
portAddress = 5551;
newHeadPose.x = 0.0f;
@@ -159,12 +156,24 @@ void FTNoIR_Tracker::StopTracker( bool exit ) bool FTNoIR_Tracker::GiveHeadPoseData(THeadPoseData *data)
{
- data->x = newHeadPose.x;
- data->y = newHeadPose.y;
- data->z = newHeadPose.z;
- data->yaw = newHeadPose.yaw;
- data->pitch = newHeadPose.pitch;
- data->roll = newHeadPose.roll;
+ if (bEnableX) {
+ data->x = newHeadPose.x;
+ }
+ if (bEnableX) {
+ data->y = newHeadPose.y;
+ }
+ if (bEnableX) {
+ data->z = newHeadPose.z;
+ }
+ if (bEnableX) {
+ data->yaw = newHeadPose.yaw;
+ }
+ if (bEnableX) {
+ data->pitch = newHeadPose.pitch;
+ }
+ if (bEnableX) {
+ data->roll = newHeadPose.roll;
+ }
return true;
}
@@ -182,6 +191,12 @@ void FTNoIR_Tracker::loadSettings() { qDebug() << "FTNoIR_Tracker::loadSettings says: iniFile = " << currentFile;
iniFile.beginGroup ( "FTNClient" );
+ bEnableRoll = iniFile.value ( "EnableRoll", 1 ).toBool();
+ bEnablePitch = iniFile.value ( "EnablePitch", 1 ).toBool();
+ bEnableYaw = iniFile.value ( "EnableYaw", 1 ).toBool();
+ bEnableX = iniFile.value ( "EnableX", 1 ).toBool();
+ bEnableY = iniFile.value ( "EnableY", 1 ).toBool();
+ bEnableZ = iniFile.value ( "EnableZ", 1 ).toBool();
portAddress = (float) iniFile.value ( "PortNumber", 5550 ).toInt();
iniFile.endGroup ();
}
diff --git a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp index c5bee64f..2857715a 100644 --- a/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp +++ b/FTNoIR_Tracker_UDP/ftnoir_tracker_udp_dialog.cpp @@ -39,12 +39,15 @@ QWidget() // Connect Qt signals to member-functions
connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK()));
connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel()));
- //connect(ui.spinIPFirstNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
- //connect(ui.spinIPSecondNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
- //connect(ui.spinIPThirdNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
- //connect(ui.spinIPFourthNibble, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
connect(ui.spinPortNumber, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()));
+ connect(ui.chkEnableRoll, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int)));
+ connect(ui.chkEnablePitch, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int)));
+ connect(ui.chkEnableYaw, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int)));
+ connect(ui.chkEnableX, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int)));
+ connect(ui.chkEnableY, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int)));
+ connect(ui.chkEnableZ, SIGNAL(stateChanged(int)), this, SLOT(settingChanged(int)));
+
// Load the settings from the current .INI-file
loadSettings();
}
@@ -129,10 +132,12 @@ void TrackerControls::loadSettings() { // qDebug() << "loadSettings says: iniFile = " << currentFile;
iniFile.beginGroup ( "FTNClient" );
- //ui.spinIPFirstNibble->setValue( iniFile.value ( "IP-1", 192 ).toInt() );
- //ui.spinIPSecondNibble->setValue( iniFile.value ( "IP-2", 168 ).toInt() );
- //ui.spinIPThirdNibble->setValue( iniFile.value ( "IP-3", 2 ).toInt() );
- //ui.spinIPFourthNibble->setValue( iniFile.value ( "IP-4", 1 ).toInt() );
+ ui.chkEnableRoll->setChecked(iniFile.value ( "EnableRoll", 1 ).toBool());
+ ui.chkEnablePitch->setChecked(iniFile.value ( "EnablePitch", 1 ).toBool());
+ ui.chkEnableYaw->setChecked(iniFile.value ( "EnableYaw", 1 ).toBool());
+ ui.chkEnableX->setChecked(iniFile.value ( "EnableX", 1 ).toBool());
+ ui.chkEnableY->setChecked(iniFile.value ( "EnableY", 1 ).toBool());
+ ui.chkEnableZ->setChecked(iniFile.value ( "EnableZ", 1 ).toBool());
ui.spinPortNumber->setValue( iniFile.value ( "PortNumber", 5550 ).toInt() );
iniFile.endGroup ();
@@ -151,10 +156,12 @@ void TrackerControls::save() { QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
iniFile.beginGroup ( "FTNClient" );
- //iniFile.setValue ( "IP-1", ui.spinIPFirstNibble->value() );
- //iniFile.setValue ( "IP-2", ui.spinIPSecondNibble->value() );
- //iniFile.setValue ( "IP-3", ui.spinIPThirdNibble->value() );
- //iniFile.setValue ( "IP-4", ui.spinIPFourthNibble->value() );
+ iniFile.setValue ( "EnableRoll", ui.chkEnableRoll->isChecked() );
+ iniFile.setValue ( "EnablePitch", ui.chkEnablePitch->isChecked() );
+ iniFile.setValue ( "EnableYaw", ui.chkEnableYaw->isChecked() );
+ iniFile.setValue ( "EnableX", ui.chkEnableX->isChecked() );
+ iniFile.setValue ( "EnableY", ui.chkEnableY->isChecked() );
+ iniFile.setValue ( "EnableZ", ui.chkEnableZ->isChecked() );
iniFile.setValue ( "PortNumber", ui.spinPortNumber->value() );
iniFile.endGroup ();
|