GUI: fixed odometry visibility flickering

This commit is contained in:
matlabbe
2016-06-15 14:18:26 -04:00
parent 95f9304f4f
commit ac284ab067
2 changed files with 23 additions and 20 deletions

View File

@@ -174,7 +174,7 @@ private slots:
void takeScreenshot(); void takeScreenshot();
void updateElapsedTime(); void updateElapsedTime();
void processCameraInfo(const rtabmap::CameraInfo & info); void processCameraInfo(const rtabmap::CameraInfo & info);
void processOdometry(const rtabmap::OdometryEvent & odom); void processOdometry(const rtabmap::OdometryEvent & odom, bool dataIgnored);
void applyPrefSettings(PreferencesDialog::PANEL_FLAGS flags); void applyPrefSettings(PreferencesDialog::PANEL_FLAGS flags);
void applyPrefSettings(const rtabmap::ParametersMap & parameters); void applyPrefSettings(const rtabmap::ParametersMap & parameters);
void processRtabmapEventInit(int status, const QString & info); void processRtabmapEventInit(int status, const QString & info);
@@ -211,7 +211,7 @@ private slots:
signals: signals:
void statsReceived(const rtabmap::Statistics &); void statsReceived(const rtabmap::Statistics &);
void cameraInfoReceived(const rtabmap::CameraInfo &); void cameraInfoReceived(const rtabmap::CameraInfo &);
void odometryReceived(const rtabmap::OdometryEvent &); void odometryReceived(const rtabmap::OdometryEvent &, bool);
void thresholdsChanged(int, int); void thresholdsChanged(int, int);
void stateChanged(MainWindow::State); void stateChanged(MainWindow::State);
void rtabmapEventInitReceived(int status, const QString & info); void rtabmapEventInitReceived(int status, const QString & info);

View File

@@ -483,7 +483,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
connect(this, SIGNAL(cameraInfoReceived(rtabmap::CameraInfo)), this, SLOT(processCameraInfo(rtabmap::CameraInfo))); connect(this, SIGNAL(cameraInfoReceived(rtabmap::CameraInfo)), this, SLOT(processCameraInfo(rtabmap::CameraInfo)));
qRegisterMetaType<rtabmap::OdometryEvent>("rtabmap::OdometryEvent"); qRegisterMetaType<rtabmap::OdometryEvent>("rtabmap::OdometryEvent");
connect(this, SIGNAL(odometryReceived(rtabmap::OdometryEvent)), this, SLOT(processOdometry(rtabmap::OdometryEvent))); connect(this, SIGNAL(odometryReceived(rtabmap::OdometryEvent, bool)), this, SLOT(processOdometry(rtabmap::OdometryEvent, bool)));
connect(this, SIGNAL(noMoreImagesReceived()), this, SLOT(notifyNoMoreImages())); connect(this, SIGNAL(noMoreImagesReceived()), this, SLOT(notifyNoMoreImages()));
@@ -776,7 +776,7 @@ void MainWindow::handleEvent(UEvent* anEvent)
if(!_processingOdometry && !_processingStatistics) if(!_processingOdometry && !_processingStatistics)
{ {
_processingOdometry = true; // if we receive too many odometry events! _processingOdometry = true; // if we receive too many odometry events!
emit odometryReceived(*odomEvent); emit odometryReceived(*odomEvent, false);
} }
else else
{ {
@@ -786,7 +786,7 @@ void MainWindow::handleEvent(UEvent* anEvent)
data.setStereoCameraModel(odomEvent->data().stereoCameraModel()); data.setStereoCameraModel(odomEvent->data().stereoCameraModel());
data.setGroundTruth(odomEvent->data().groundTruth()); data.setGroundTruth(odomEvent->data().groundTruth());
OdometryEvent tmp(data, odomEvent->pose(), odomEvent->covariance(), odomEvent->info().copyWithoutData()); OdometryEvent tmp(data, odomEvent->pose(), odomEvent->covariance(), odomEvent->info().copyWithoutData());
emit odometryReceived(tmp); emit odometryReceived(tmp, true);
} }
} }
else if(anEvent->getClassName().compare("ULogEvent") == 0) else if(anEvent->getClassName().compare("ULogEvent") == 0)
@@ -818,7 +818,7 @@ void MainWindow::processCameraInfo(const rtabmap::CameraInfo & info)
_ui->statsToolBox->updateStat("Camera/Time scan_from_depth/ms", (float)info.id, info.timeScanFromDepth*1000.0f); _ui->statsToolBox->updateStat("Camera/Time scan_from_depth/ms", (float)info.id, info.timeScanFromDepth*1000.0f);
} }
void MainWindow::processOdometry(const rtabmap::OdometryEvent & odom) void MainWindow::processOdometry(const rtabmap::OdometryEvent & odom, bool dataIgnored)
{ {
UDEBUG(""); UDEBUG("");
_processingOdometry = true; _processingOdometry = true;
@@ -1039,21 +1039,24 @@ void MainWindow::processOdometry(const rtabmap::OdometryEvent & odom)
} }
} }
} }
if(!cloudUpdated && _cloudViewer->getAddedClouds().contains("cloudOdom")) if(!dataIgnored)
{ {
_cloudViewer->setCloudVisibility("cloudOdom", false); if(!cloudUpdated && _cloudViewer->getAddedClouds().contains("cloudOdom"))
} {
if(!scanUpdated && _cloudViewer->getAddedClouds().contains("scanOdom")) _cloudViewer->setCloudVisibility("cloudOdom", false);
{ }
_cloudViewer->setCloudVisibility("scanOdom", false); if(!scanUpdated && _cloudViewer->getAddedClouds().contains("scanOdom"))
} {
if(!scanUpdated && _cloudViewer->getAddedClouds().contains("scanMapOdom")) _cloudViewer->setCloudVisibility("scanOdom", false);
{ }
_cloudViewer->setCloudVisibility("scanMapOdom", false); if(!scanUpdated && _cloudViewer->getAddedClouds().contains("scanMapOdom"))
} {
if(!featuresUpdated && _cloudViewer->getAddedClouds().contains("featuresOdom")) _cloudViewer->setCloudVisibility("scanMapOdom", false);
{ }
_cloudViewer->setCloudVisibility("featuresOdom", false); if(!featuresUpdated && _cloudViewer->getAddedClouds().contains("featuresOdom"))
{
_cloudViewer->setCloudVisibility("featuresOdom", false);
}
} }
} }