From 558491c9ee7262b4f84e192b0627194a39e884dc Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 15 Aug 2016 13:44:42 +0200 Subject: tracker/pt: make calibration less confusing in dialog - change button text to "stop calibration" and "start calibration" respectively. - gray out the values while calibration is running - run calibration at 10 Hz on a separate timer from dialog update Issue: #416 --- tracker-pt/FTNoIR_PT_Controls.ui | 2 +- tracker-pt/ftnoir_tracker_pt_dialog.cpp | 23 ++++++++++++++++++++--- tracker-pt/ftnoir_tracker_pt_dialog.h | 5 ++--- 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 @@ false - Toggle calibration + Start calibration true 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 -#include +#include "compat/camera-names.hpp" #include #include -#include "compat/camera-names.hpp" #include +#include +#include +#include //----------------------------------------------------------------------------- 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; -- cgit v1.2.3