database viewer: added method generateTOROGraph()

git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1253 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
matlabbe
2014-02-27 17:00:46 +00:00
parent 24eeec3e26
commit 669e7363cc
3 changed files with 35 additions and 2 deletions

View File

@@ -59,6 +59,7 @@ private slots:
void exportDatabase();
void extractImages();
void generateLocalGraph();
void generateTOROGraph();
void view3DMap();
void generate3DMap();
void sliderAValueChanged(int);

View File

@@ -75,9 +75,12 @@ DatabaseViewer::DatabaseViewer(QWidget * parent) :
connect(ui_->actionExtract_images, SIGNAL(triggered()), this, SLOT(extractImages()));
connect(ui_->actionGenerate_graph_dot, SIGNAL(triggered()), this, SLOT(generateGraph()));
connect(ui_->actionGenerate_local_graph_dot, SIGNAL(triggered()), this, SLOT(generateLocalGraph()));
connect(ui_->actionGenerate_TORO_graph_graph, SIGNAL(triggered()), this, SLOT(generateTOROGraph()));
connect(ui_->actionView_3D_map, SIGNAL(triggered()), this, SLOT(view3DMap()));
connect(ui_->actionGenerate_3D_map_pcd, SIGNAL(triggered()), this, SLOT(generate3DMap()));
ui_->actionGenerate_TORO_graph_graph->setEnabled(false);
ui_->horizontalSlider_A->setTracking(false);
ui_->horizontalSlider_B->setTracking(false);
ui_->horizontalSlider_A->setEnabled(false);
@@ -290,6 +293,8 @@ void DatabaseViewer::updateIds()
ui_->spinBox_optimizationsFrom->setValue(memory_->getLastWorkingSignature()->id());
}
ui_->actionGenerate_TORO_graph_graph->setEnabled(false);
graphes_.clear();
neighborLinks_.clear();
loopLinks_.clear();
for(std::multimap<int, rtabmap::Link>::iterator iter = links_.begin(); iter!=links_.end(); ++iter)
@@ -413,6 +418,26 @@ void DatabaseViewer::generateLocalGraph()
}
}
void DatabaseViewer::generateTOROGraph()
{
if(!graphes_.size() || !links_.size())
{
QMessageBox::warning(this, tr("Cannot generate a TORO graph"), tr("No poses or no links..."));
return;
}
bool ok = false;
int id = QInputDialog::getInt(this, tr("Which iteration?"), tr("Iteration (0 -> %1)").arg(graphes_.size()-1), graphes_.size()-1, 0, graphes_.size()-1, 1, &ok);
if(ok)
{
QString path = QFileDialog::getSaveFileName(this, tr("Save File"), pathDatabase_+"/constraints" + QString::number(id) + ".graph", tr("TORO file (*.graph)"));
if(!path.isEmpty())
{
rtabmap::util3d::saveTOROGraph(path.toStdString(), uValueAt(graphes_, id), links_);
}
}
}
void DatabaseViewer::view3DMap()
{
if(!ids_.size() || !memory_)
@@ -899,6 +924,7 @@ void DatabaseViewer::updateGraphView()
std::map<int, rtabmap::Transform> finalPoses;
graphes_.push_back(poses_);
ui_->actionGenerate_TORO_graph_graph->setEnabled(true);
std::map<int, int> ids = memory_->getNeighborsId(ui_->spinBox_optimizationsFrom->value(), 0, -1, true);
// Modify IDs using the margin from the current signature (TORO root will be the last signature)

View File

@@ -280,6 +280,7 @@
</property>
<addaction name="actionGenerate_graph_dot"/>
<addaction name="actionGenerate_local_graph_dot"/>
<addaction name="actionGenerate_TORO_graph_graph"/>
<addaction name="separator"/>
<addaction name="actionClean_database"/>
<addaction name="actionClean_local_graph"/>
@@ -458,7 +459,7 @@
</action>
<action name="actionGenerate_graph_dot">
<property name="text">
<string>Generate graph (.dot) ...</string>
<string>Generate graph (*.dot) ...</string>
</property>
</action>
<action name="actionGenerate_graph_only_weighted_locations">
@@ -488,7 +489,7 @@
</action>
<action name="actionGenerate_3D_map_pcd">
<property name="text">
<string>Export 3D map (.pcd) ...</string>
<string>Export 3D map (*.pcd) ...</string>
</property>
</action>
<action name="actionExport">
@@ -506,6 +507,11 @@
<string>View 3D map...</string>
</property>
</action>
<action name="actionGenerate_TORO_graph_graph">
<property name="text">
<string>Generate TORO graph (*.graph)...</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>