mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
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:
@@ -59,6 +59,7 @@ private slots:
|
|||||||
void exportDatabase();
|
void exportDatabase();
|
||||||
void extractImages();
|
void extractImages();
|
||||||
void generateLocalGraph();
|
void generateLocalGraph();
|
||||||
|
void generateTOROGraph();
|
||||||
void view3DMap();
|
void view3DMap();
|
||||||
void generate3DMap();
|
void generate3DMap();
|
||||||
void sliderAValueChanged(int);
|
void sliderAValueChanged(int);
|
||||||
|
|||||||
@@ -75,9 +75,12 @@ DatabaseViewer::DatabaseViewer(QWidget * parent) :
|
|||||||
connect(ui_->actionExtract_images, SIGNAL(triggered()), this, SLOT(extractImages()));
|
connect(ui_->actionExtract_images, SIGNAL(triggered()), this, SLOT(extractImages()));
|
||||||
connect(ui_->actionGenerate_graph_dot, SIGNAL(triggered()), this, SLOT(generateGraph()));
|
connect(ui_->actionGenerate_graph_dot, SIGNAL(triggered()), this, SLOT(generateGraph()));
|
||||||
connect(ui_->actionGenerate_local_graph_dot, SIGNAL(triggered()), this, SLOT(generateLocalGraph()));
|
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_->actionView_3D_map, SIGNAL(triggered()), this, SLOT(view3DMap()));
|
||||||
connect(ui_->actionGenerate_3D_map_pcd, SIGNAL(triggered()), this, SLOT(generate3DMap()));
|
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_A->setTracking(false);
|
||||||
ui_->horizontalSlider_B->setTracking(false);
|
ui_->horizontalSlider_B->setTracking(false);
|
||||||
ui_->horizontalSlider_A->setEnabled(false);
|
ui_->horizontalSlider_A->setEnabled(false);
|
||||||
@@ -290,6 +293,8 @@ void DatabaseViewer::updateIds()
|
|||||||
ui_->spinBox_optimizationsFrom->setValue(memory_->getLastWorkingSignature()->id());
|
ui_->spinBox_optimizationsFrom->setValue(memory_->getLastWorkingSignature()->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui_->actionGenerate_TORO_graph_graph->setEnabled(false);
|
||||||
|
graphes_.clear();
|
||||||
neighborLinks_.clear();
|
neighborLinks_.clear();
|
||||||
loopLinks_.clear();
|
loopLinks_.clear();
|
||||||
for(std::multimap<int, rtabmap::Link>::iterator iter = links_.begin(); iter!=links_.end(); ++iter)
|
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()
|
void DatabaseViewer::view3DMap()
|
||||||
{
|
{
|
||||||
if(!ids_.size() || !memory_)
|
if(!ids_.size() || !memory_)
|
||||||
@@ -899,6 +924,7 @@ void DatabaseViewer::updateGraphView()
|
|||||||
|
|
||||||
std::map<int, rtabmap::Transform> finalPoses;
|
std::map<int, rtabmap::Transform> finalPoses;
|
||||||
graphes_.push_back(poses_);
|
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);
|
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)
|
// Modify IDs using the margin from the current signature (TORO root will be the last signature)
|
||||||
|
|||||||
@@ -280,6 +280,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<addaction name="actionGenerate_graph_dot"/>
|
<addaction name="actionGenerate_graph_dot"/>
|
||||||
<addaction name="actionGenerate_local_graph_dot"/>
|
<addaction name="actionGenerate_local_graph_dot"/>
|
||||||
|
<addaction name="actionGenerate_TORO_graph_graph"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionClean_database"/>
|
<addaction name="actionClean_database"/>
|
||||||
<addaction name="actionClean_local_graph"/>
|
<addaction name="actionClean_local_graph"/>
|
||||||
@@ -458,7 +459,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionGenerate_graph_dot">
|
<action name="actionGenerate_graph_dot">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Generate graph (.dot) ...</string>
|
<string>Generate graph (*.dot) ...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionGenerate_graph_only_weighted_locations">
|
<action name="actionGenerate_graph_only_weighted_locations">
|
||||||
@@ -488,7 +489,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionGenerate_3D_map_pcd">
|
<action name="actionGenerate_3D_map_pcd">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Export 3D map (.pcd) ...</string>
|
<string>Export 3D map (*.pcd) ...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionExport">
|
<action name="actionExport">
|
||||||
@@ -506,6 +507,11 @@
|
|||||||
<string>View 3D map...</string>
|
<string>View 3D map...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionGenerate_TORO_graph_graph">
|
||||||
|
<property name="text">
|
||||||
|
<string>Generate TORO graph (*.graph)...</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|||||||
Reference in New Issue
Block a user