mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 17:40:23 +08:00
The graph is also sent in appearance-only mode. Added posterior hypotheses color on the graph view. Some minor fixes.
This commit is contained in:
@@ -519,26 +519,6 @@ void MainWindow::handleEvent(UEvent* anEvent)
|
||||
this->pauseDetection();
|
||||
}
|
||||
}
|
||||
UDEBUG("stat.rawLikelihood().size()=%d", stats.rawLikelihood().size());
|
||||
// Performance issue: don't process the pdf and likelihood if the last event is
|
||||
// not yet completely processed, to avoid an unresponsive GUI when events accumulate.
|
||||
if(_processingStatistics || !_ui->dockWidget_posterior->isVisible())
|
||||
{
|
||||
stats.setPosterior(std::map<int, float>());
|
||||
}
|
||||
if(_processingStatistics || !_ui->dockWidget_likelihood->isVisible())
|
||||
{
|
||||
stats.setLikelihood(std::map<int, float>());
|
||||
}
|
||||
if(_processingStatistics || !_ui->dockWidget_rawlikelihood->isVisible())
|
||||
{
|
||||
stats.setRawLikelihood(std::map<int, float>());
|
||||
}
|
||||
if(_processingStatistics || (!_ui->dockWidget_posterior->isVisible() && !_ui->dockWidget_likelihood->isVisible()))
|
||||
{
|
||||
stats.setWeights(std::map<int,int>());
|
||||
}
|
||||
|
||||
emit statsReceived(stats);
|
||||
}
|
||||
else if(anEvent->getClassName().compare("RtabmapEventInit") == 0)
|
||||
@@ -1058,6 +1038,13 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
|
||||
UDEBUG("time= %d ms", time.restart());
|
||||
}
|
||||
}
|
||||
|
||||
// update posterior on the graph view
|
||||
if(_preferencesDialog->isPosteriorGraphView() && _ui->graphicsView_graphView->isVisible() && stat.posterior().size())
|
||||
{
|
||||
_ui->graphicsView_graphView->updatePosterior(stat.posterior());
|
||||
}
|
||||
|
||||
UDEBUG("");
|
||||
}
|
||||
else if(!stat.extended() && stat.loopClosureId()>0)
|
||||
@@ -1082,6 +1069,8 @@ void MainWindow::updateMapCloud(
|
||||
const std::map<int, int> & mapIdsIn,
|
||||
bool verboseProgress)
|
||||
{
|
||||
UDEBUG("posesIn=%d constraints=%d mapIdsIn=%d currentPose=%s",
|
||||
(int)posesIn.size(), (int)constraints.size(), (int)mapIdsIn.size(), currentPose.prettyPrint().c_str());
|
||||
if(posesIn.size())
|
||||
{
|
||||
_currentPosesMap = posesIn;
|
||||
@@ -1243,10 +1232,6 @@ void MainWindow::updateMapCloud(
|
||||
QApplication::processEvents();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UERROR("transform is null!?");
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
@@ -1299,7 +1284,7 @@ void MainWindow::updateMapCloud(
|
||||
}
|
||||
|
||||
// Update occupancy grid map in 3D map view and graph view
|
||||
if(_ui->graphicsView_graphView->isVisible() && constraints.size())
|
||||
if(_ui->graphicsView_graphView->isVisible())
|
||||
{
|
||||
_ui->graphicsView_graphView->updateGraph(posesIn, constraints);
|
||||
}
|
||||
@@ -1377,6 +1362,7 @@ void MainWindow::updateMapCloud(
|
||||
|
||||
void MainWindow::createAndAddCloudToMap(int nodeId, const Transform & pose, int mapId)
|
||||
{
|
||||
UASSERT(!pose.isNull());
|
||||
std::string cloudName = uFormat("cloud%d", nodeId);
|
||||
if(_ui->widget_cloudViewer->getAddedClouds().contains(cloudName))
|
||||
{
|
||||
@@ -1602,18 +1588,45 @@ void MainWindow::processRtabmapEventInit(int status, const QString & info)
|
||||
!_emptyNewDatabase)
|
||||
{
|
||||
// Temp database used, automatically backup with unique name (timestamp)
|
||||
QString newName = _preferencesDialog->getWorkingDirectory()+QDir::separator()+(QString("rtabmap_%1.db").arg(QDateTime::currentDateTime().toString("yyMMdd-hhmmsszzz")));
|
||||
if(QFile::rename(_openedDatabasePath, newName))
|
||||
QString newName = QDateTime::currentDateTime().toString("yyMMdd-hhmmsszzz");
|
||||
bool ok = false;
|
||||
newName = QInputDialog::getText(this, tr("Saving database..."), tr("Database name:"), QLineEdit::Normal, newName, &ok);
|
||||
while(ok)
|
||||
{
|
||||
std::string msg = uFormat("Database saved to \"%s\".", newName.toStdString().c_str());
|
||||
UINFO(msg.c_str());
|
||||
QMessageBox::information(this, tr("Database saved!"), QString(msg.c_str()));
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string msg = uFormat("Failed to rename temporary database from \"%s\" to \"%s\".", _openedDatabasePath.toStdString().c_str(), newName.toStdString().c_str());
|
||||
UERROR(msg.c_str());
|
||||
QMessageBox::critical(this, tr("Closing failed!"), QString(msg.c_str()));
|
||||
QString newPath = _preferencesDialog->getWorkingDirectory()+QDir::separator()+newName+".db";
|
||||
if(QFile::exists(newPath))
|
||||
{
|
||||
QMessageBox::StandardButton b = QMessageBox::question(this,
|
||||
tr("Saving database..."),
|
||||
tr("Database \"%1\" already exists, do you want to overwrite?").arg(newName+".db"),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||
if(b == QMessageBox::Yes && QFile::remove(newPath))
|
||||
{
|
||||
UINFO("Deleted database \"%s\".", newPath.toStdString().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
if(b == QMessageBox::Yes)
|
||||
{
|
||||
UERROR("Failed to erase database \"%s\"! Asking for new name...", newPath.toStdString().c_str());
|
||||
}
|
||||
newName = QInputDialog::getText(this, tr("Saving database..."), tr("Database name:"), QLineEdit::Normal, newName, &ok);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(QFile::rename(_openedDatabasePath, newPath))
|
||||
{
|
||||
std::string msg = uFormat("Database saved to \"%s\".", newPath.toStdString().c_str());
|
||||
UINFO(msg.c_str());
|
||||
QMessageBox::information(this, tr("Database saved!"), QString(msg.c_str()));
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string msg = uFormat("Failed to rename temporary database from \"%s\" to \"%s\".", _openedDatabasePath.toStdString().c_str(), (newName+".db").toStdString().c_str());
|
||||
UERROR(msg.c_str());
|
||||
QMessageBox::critical(this, tr("Closing failed!"), QString(msg.c_str()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
_openedDatabasePath.clear();
|
||||
@@ -1751,6 +1764,10 @@ void MainWindow::applyPrefSettings(PreferencesDialog::PANEL_FLAGS flags)
|
||||
{
|
||||
UDEBUG("General settings changed...");
|
||||
setupMainLayout(_preferencesDialog->isVerticalLayoutUsed());
|
||||
if(!_preferencesDialog->isPosteriorGraphView() && _ui->graphicsView_graphView->isVisible())
|
||||
{
|
||||
_ui->graphicsView_graphView->clearPosterior();
|
||||
}
|
||||
}
|
||||
|
||||
if(flags & PreferencesDialog::kPanelCloudRendering)
|
||||
@@ -1758,7 +1775,11 @@ void MainWindow::applyPrefSettings(PreferencesDialog::PANEL_FLAGS flags)
|
||||
UDEBUG("Cloud rendering settings changed...");
|
||||
if(_currentPosesMap.size())
|
||||
{
|
||||
this->updateMapCloud(_currentPosesMap, Transform(), _currentLinksMap, _currentMapIds);
|
||||
this->updateMapCloud(
|
||||
std::map<int, Transform>(_currentPosesMap),
|
||||
Transform(),
|
||||
std::multimap<int, Link>(_currentLinksMap),
|
||||
std::map<int, int>(_currentMapIds));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3105,7 +3126,7 @@ void MainWindow::postProcessing()
|
||||
_initProgressDialog->incrementStep();
|
||||
|
||||
_initProgressDialog->appendText(tr("Updating map..."));
|
||||
this->updateMapCloud(optimizedPoses, Transform(), _currentLinksMap, _currentMapIds, false);
|
||||
this->updateMapCloud(optimizedPoses, Transform(), std::multimap<int, Link>(_currentLinksMap), std::map<int, int>(_currentMapIds), false);
|
||||
_initProgressDialog->appendText(tr("Updating map... done!"));
|
||||
|
||||
_initProgressDialog->setValue(_initProgressDialog->maximumSteps());
|
||||
|
||||
Reference in New Issue
Block a user