MainWindow monitoring mode: Fixed createAndAddCloudToMap() errors when processStatistics() and processRtabmapEvent3DMap() are called at the same time

This commit is contained in:
matlabbe
2015-08-04 13:33:01 -04:00
parent bcac262234
commit e7e55cf904
2 changed files with 11 additions and 3 deletions
+1
View File
@@ -263,6 +263,7 @@ private:
QSet<int> _lastIds; QSet<int> _lastIds;
int _lastId; int _lastId;
bool _processingStatistics; bool _processingStatistics;
bool _processingDownloadedMap;
bool _odometryReceived; bool _odometryReceived;
QString _newDatabasePath; QString _newDatabasePath;
QString _newDatabasePathOutput; QString _newDatabasePathOutput;
+8 -1
View File
@@ -125,6 +125,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
_dataRecorder(0), _dataRecorder(0),
_lastId(0), _lastId(0),
_processingStatistics(false), _processingStatistics(false),
_processingDownloadedMap(false),
_odometryReceived(false), _odometryReceived(false),
_newDatabasePath(""), _newDatabasePath(""),
_newDatabasePathOutput(""), _newDatabasePathOutput(""),
@@ -622,7 +623,7 @@ void MainWindow::handleEvent(UEvent* anEvent)
(localLoopClosureId > 0 && (localLoopClosureId > 0 &&
_ui->actionPause_on_local_loop_detection->isChecked())) _ui->actionPause_on_local_loop_detection->isChecked()))
{ {
if(_state != kPaused && _state != kMonitoringPaused) if(_state != kPaused && _state != kMonitoringPaused && !_processingDownloadedMap)
{ {
if(_preferencesDialog->beepOnPause()) if(_preferencesDialog->beepOnPause())
{ {
@@ -631,9 +632,13 @@ void MainWindow::handleEvent(UEvent* anEvent)
this->pauseDetection(); this->pauseDetection();
} }
} }
if(!_processingDownloadedMap)
{
_processingStatistics = true; _processingStatistics = true;
emit statsReceived(stats); emit statsReceived(stats);
} }
}
else if(anEvent->getClassName().compare("RtabmapEventInit") == 0) else if(anEvent->getClassName().compare("RtabmapEventInit") == 0)
{ {
RtabmapEventInit * rtabmapEventInit = (RtabmapEventInit*)anEvent; RtabmapEventInit * rtabmapEventInit = (RtabmapEventInit*)anEvent;
@@ -2094,6 +2099,7 @@ void MainWindow::processRtabmapEvent3DMap(const rtabmap::RtabmapEvent3DMap & eve
else else
{ {
_processingDownloadedMap = true;
UINFO("Received map!"); UINFO("Received map!");
_initProgressDialog->appendText(tr(" poses = %1").arg(event.getPoses().size())); _initProgressDialog->appendText(tr(" poses = %1").arg(event.getPoses().size()));
_initProgressDialog->appendText(tr(" constraints = %1").arg(event.getConstraints().size())); _initProgressDialog->appendText(tr(" constraints = %1").arg(event.getConstraints().size()));
@@ -2149,6 +2155,7 @@ void MainWindow::processRtabmapEvent3DMap(const rtabmap::RtabmapEvent3DMap & eve
{ {
_cachedSignatures.clear(); _cachedSignatures.clear();
} }
_processingDownloadedMap = false;
} }
_initProgressDialog->setValue(_initProgressDialog->maximumSteps()); _initProgressDialog->setValue(_initProgressDialog->maximumSteps());
} }