Added PrintLoopClosureIDs action to Edit menu

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@664 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2012-12-11 19:41:44 +00:00
parent 2836d4c48c
commit 1efc675521
6 changed files with 41 additions and 7 deletions

View File

@@ -90,6 +90,7 @@ private slots:
void startDetection();
void pauseDetection();
void stopDetection();
void printLoopClosureIds();
void generateMap();
void generateLocalMap();
void deleteMemory();
@@ -175,6 +176,9 @@ private:
QString _graphSavingFileName;
QString _autoScreenCaptureFormat;
QVector<int> _refIds;
QVector<int> _loopClosureIds;
};
}

View File

@@ -41,7 +41,7 @@ public:
virtual ~ConsoleWidget();
public slots:
void appendMsg(const QString & msg, int level);
void appendMsg(const QString & msg, int level = 1);
signals:
void msgReceived(const QString &, int);

View File

@@ -189,6 +189,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
connect(_ui->actionDump_the_prediction_matrix, SIGNAL(triggered()), this, SLOT(dumpThePrediction()));
connect(_ui->actionClear_cache, SIGNAL(triggered()), this, SLOT(clearTheCache()));
connect(_ui->actionAbout, SIGNAL(triggered()), _aboutDialog , SLOT(exec()));
connect(_ui->actionPrint_loop_closure_IDs_to_console, SIGNAL(triggered()), this, SLOT(printLoopClosureIds()));
connect(_ui->actionGenerate_map, SIGNAL(triggered()), this , SLOT(generateMap()));
connect(_ui->actionGenerate_local_map, SIGNAL(triggered()), this, SLOT(generateLocalMap()));
connect(_ui->actionDelete_memory, SIGNAL(triggered()), this , SLOT(deleteMemory()));
@@ -492,6 +493,7 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
int rejectedHyp = bool(uValue(stat.data(), Statistics::kLoopRejectedHypothesis(), 0.0f));
float highestHypothesisValue = uValue(stat.data(), Statistics::kLoopHighest_hypothesis_value(), 0.0f);
int matchId = 0;
if(highestHypothesisId > 0)
{
bool show = true;
@@ -504,6 +506,7 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
_ui->label_stats_loopClosuresReactivatedDetected->setText(QString::number(_ui->label_stats_loopClosuresReactivatedDetected->text().toInt() + 1));
}
_ui->label_matchId->setText(QString("Match ID = %1").arg(stat.loopClosureId()));
matchId = stat.loopClosureId();
}
else if(rejectedHyp && highestHypothesisValue >= _preferencesDialog->getLoopThr())
{
@@ -547,6 +550,8 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
}
}
}
_refIds.push_back(stat.refImageId());
_loopClosureIds.push_back(matchId);
if(_ui->imageView_loopClosure->items().size() || stat.loopClosureId()>0)
{
@@ -1222,6 +1227,25 @@ void MainWindow::stopDetection()
}
}
void MainWindow::printLoopClosureIds()
{
_ui->dockWidget_console->show();
QString msgRef;
QString msgLoop;
for(int i = 0; i<_refIds.size(); ++i)
{
msgRef.append(QString::number(_refIds[i]));
msgLoop.append(QString::number(_loopClosureIds[i]));
if(i < _refIds.size() - 1)
{
msgRef.append(" ");
msgLoop.append(" ");
}
}
_ui->widget_console->appendMsg(QString("IDs = [%1];").arg(msgRef));
_ui->widget_console->appendMsg(QString("LoopIDs = [%1];").arg(msgLoop));
}
void MainWindow::generateMap()
{
if(_graphSavingFileName.isEmpty())
@@ -1395,6 +1419,8 @@ void MainWindow::clearTheCache()
_ui->label_stats_loopClosuresDetected->setText("0");
_ui->label_stats_loopClosuresReactivatedDetected->setText("0");
_ui->label_stats_loopClosuresRejected->setText("0");
_refIds.clear();
_loopClosureIds.clear();
}
void MainWindow::updateElapsedTime()

View File

@@ -102,7 +102,7 @@
<x>0</x>
<y>0</y>
<width>1056</width>
<height>25</height>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
@@ -137,6 +137,7 @@
<addaction name="separator"/>
<addaction name="actionDump_the_memory"/>
<addaction name="actionDump_the_prediction_matrix"/>
<addaction name="actionPrint_loop_closure_IDs_to_console"/>
<addaction name="actionGenerate_map"/>
<addaction name="actionGenerate_local_map"/>
<addaction name="actionReset_the_memory"/>
@@ -510,7 +511,7 @@
<number>0</number>
</property>
<item>
<widget class="rtabmap::ConsoleWidget" name="widget" native="true"/>
<widget class="rtabmap::ConsoleWidget" name="widget_console" native="true"/>
</item>
</layout>
</widget>
@@ -751,6 +752,11 @@
<string>Generate local map...</string>
</property>
</action>
<action name="actionPrint_loop_closure_IDs_to_console">
<property name="text">
<string>Print loop closure IDs to console</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>