From 23384182c1298f523e3fa285adc34caadb2330d2 Mon Sep 17 00:00:00 2001 From: matlabbe Date: Tue, 11 Dec 2012 20:21:22 +0000 Subject: [PATCH] Fixed a crash when posterior is empty (on bad signature) MainWindow: Show in console a neato example with the generated map git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@665 f169173b-cf89-36c8-b27e-44dbe73f0c83 --- corelib/src/Rtabmap.cpp | 3 ++- guilib/src/MainWindow.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/corelib/src/Rtabmap.cpp b/corelib/src/Rtabmap.cpp index 308e3f76..15238bd8 100644 --- a/corelib/src/Rtabmap.cpp +++ b/corelib/src/Rtabmap.cpp @@ -1021,7 +1021,8 @@ void Rtabmap::process() refWordsCount = signature->getWords().size(); refUniqueWordsCount = uUniqueKeys(signature->getWords()).size(); - float vpHypothesis = posterior.at(Memory::kIdVirtual); + // Posterior is empty if a bad signature is detected + float vpHypothesis = posterior.size()?posterior.at(Memory::kIdVirtual):0.0f; // only prepare statistics if required or when there is a loop closure Statistics * stat = 0; diff --git a/guilib/src/MainWindow.cpp b/guilib/src/MainWindow.cpp index 532c0904..5694e8b7 100644 --- a/guilib/src/MainWindow.cpp +++ b/guilib/src/MainWindow.cpp @@ -1259,6 +1259,9 @@ void MainWindow::generateMap() RtabmapEventCmd * event = new RtabmapEventCmd(RtabmapEventCmd::kCmdGenerateGraph); event->setStr(path.toStdString()); this->post(event); // The event is automatically deleted by the EventsManager... + + _ui->dockWidget_console->show(); + _ui->widget_console->appendMsg(QString("Graph saved... Tip:\nneato -Tpdf \"%1\" -o out.pdf").arg(_graphSavingFileName).arg(_graphSavingFileName)); } } @@ -1298,6 +1301,9 @@ void MainWindow::generateLocalMap() QString str = path + QString(";") + QString::number(id) + QString(";") + QString::number(margin); event->setStr(str.toStdString()); this->post(event); // The event is automatically deleted by the EventsManager... + + _ui->dockWidget_console->show(); + _ui->widget_console->appendMsg(QString("Graph saved... Tip:\nneato -Tpdf \"%1\" -o out.pdf").arg(_graphSavingFileName).arg(_graphSavingFileName)); } } }