summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tracker-pt/FTNoIR_PT_Controls.ui2
-rw-r--r--tracker-pt/ftnoir_tracker_pt_dialog.cpp23
-rw-r--r--tracker-pt/ftnoir_tracker_pt_dialog.h5
3 files changed, 23 insertions, 7 deletions
diff --git a/tracker-pt/FTNoIR_PT_Controls.ui b/tracker-pt/FTNoIR_PT_Controls.ui
index 75190a5e..54628964 100644
--- a/tracker-pt/FTNoIR_PT_Controls.ui
+++ b/tracker-pt/FTNoIR_PT_Controls.ui
@@ -1074,7 +1074,7 @@
<bool>false</bool>
</property>
<property name="text">
- <string>Toggle calibration</string>
+ <string>Start calibration</string>
</property>
<property name="checkable">
<bool>true</bool>
diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.cpp b/tracker-pt/ftnoir_tracker_pt_dialog.cpp
index 307be1f2..88465c42 100644
--- a/tracker-pt/ftnoir_tracker_pt_dialog.cpp
+++ b/tracker-pt/ftnoir_tracker_pt_dialog.cpp
@@ -8,12 +8,13 @@
#include "ftnoir_tracker_pt_dialog.h"
-#include <QMessageBox>
-#include <QDebug>
+#include "compat/camera-names.hpp"
#include <opencv2/core/core.hpp>
#include <memory>
-#include "compat/camera-names.hpp"
#include <vector>
+#include <QMessageBox>
+#include <QString>
+#include <QDebug>
//-----------------------------------------------------------------------------
TrackerDialog_PT::TrackerDialog_PT()
@@ -73,6 +74,9 @@ TrackerDialog_PT::TrackerDialog_PT()
connect(&timer,SIGNAL(timeout()), this,SLOT(poll_tracker_info()));
connect(ui.camera_settings, SIGNAL(clicked()), this, SLOT(camera_settings()));
timer.start(250);
+
+ connect(&calib_timer, &QTimer::timeout, this, &TrackerDialog_PT::trans_calib_step);
+ calib_timer.setInterval(100);
}
void TrackerDialog_PT::camera_settings()
@@ -88,6 +92,7 @@ void TrackerDialog_PT::startstop_trans_calib(bool start)
if (start)
{
qDebug()<<"TrackerDialog:: Starting translation calibration";
+ calib_timer.start();
trans_calib.reset();
trans_calib_running = true;
s.t_MH_x = 0;
@@ -96,6 +101,7 @@ void TrackerDialog_PT::startstop_trans_calib(bool start)
}
else
{
+ calib_timer.stop();
qDebug()<<"TrackerDialog:: Stopping translation calibration";
trans_calib_running = false;
{
@@ -105,6 +111,15 @@ void TrackerDialog_PT::startstop_trans_calib(bool start)
s.t_MH_z = tmp[2];
}
}
+ ui.tx_spin->setEnabled(!start);
+ ui.ty_spin->setEnabled(!start);
+ ui.tz_spin->setEnabled(!start);
+ ui.tcalib_button->setText(progn(
+ if (start)
+ return QStringLiteral("Stop calibration");
+ else
+ return QStringLiteral("Start calibration");
+ ));
}
void TrackerDialog_PT::poll_tracker_info()
@@ -145,6 +160,8 @@ void TrackerDialog_PT::trans_calib_step()
Affine X_CM = tracker->pose();
trans_calib.update(X_CM.R, X_CM.t);
}
+ else
+ startstop_trans_calib(false);
}
void TrackerDialog_PT::save()
diff --git a/tracker-pt/ftnoir_tracker_pt_dialog.h b/tracker-pt/ftnoir_tracker_pt_dialog.h
index 49e8f1b0..c13c1216 100644
--- a/tracker-pt/ftnoir_tracker_pt_dialog.h
+++ b/tracker-pt/ftnoir_tracker_pt_dialog.h
@@ -28,19 +28,18 @@ public:
void register_tracker(ITracker *tracker) override;
void unregister_tracker() override;
void save();
- void trans_calib_step();
-
public slots:
void doOK();
void doCancel();
void startstop_trans_calib(bool start);
+ void trans_calib_step();
void poll_tracker_info();
void camera_settings();
private:
settings_pt s;
Tracker_PT* tracker;
- QTimer timer;
+ QTimer timer, calib_timer;
TranslationCalibrator trans_calib;
bool trans_calib_running;