mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 01:20:25 +08:00
MainWindow: added "Edit->Anchor clouds to ground truth" action. Graph::importPoses() Fixed error when loading RGBD-SLAM poses.
This commit is contained in:
@@ -285,6 +285,7 @@ bool CameraImages::init(const std::string & calibrationFolder, const std::string
|
|||||||
}
|
}
|
||||||
else if(_groundTruthFormat == 1)
|
else if(_groundTruthFormat == 1)
|
||||||
{
|
{
|
||||||
|
UDEBUG("");
|
||||||
//Match ground truth values with images
|
//Match ground truth values with images
|
||||||
groundTruth_.clear();
|
groundTruth_.clear();
|
||||||
std::map<double, int> stampsToIds;
|
std::map<double, int> stampsToIds;
|
||||||
@@ -339,6 +340,7 @@ bool CameraImages::init(const std::string & calibrationFolder, const std::string
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
UDEBUG("");
|
||||||
groundTruth_ = uValuesList(poses);
|
groundTruth_ = uValuesList(poses);
|
||||||
}
|
}
|
||||||
UASSERT_MSG(groundTruth_.size() == stamps_.size(), uFormat("%d vs %d", (int)groundTruth_.size(), (int)stamps_.size()).c_str());
|
UASSERT_MSG(groundTruth_.size() == stamps_.size(), uFormat("%d vs %d", (int)groundTruth_.size(), (int)stamps_.size()).c_str());
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ bool importPoses(
|
|||||||
std::string str;
|
std::string str;
|
||||||
std::getline(file, str);
|
std::getline(file, str);
|
||||||
|
|
||||||
if(str.at(0) == '#' || str.empty())
|
if(str.empty() || str.at(0) == '#')
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ private slots:
|
|||||||
void updateCacheFromDatabase();
|
void updateCacheFromDatabase();
|
||||||
void downloadAllClouds();
|
void downloadAllClouds();
|
||||||
void downloadPoseGraph();
|
void downloadPoseGraph();
|
||||||
|
void anchorCloudsToGroundTruth();
|
||||||
void clearTheCache();
|
void clearTheCache();
|
||||||
void openPreferences();
|
void openPreferences();
|
||||||
void openPreferencesSource();
|
void openPreferencesSource();
|
||||||
|
|||||||
@@ -770,6 +770,10 @@ void GraphViewer::clearGraph()
|
|||||||
_localPathLinkItems.clear();
|
_localPathLinkItems.clear();
|
||||||
qDeleteAll(_globalPathLinkItems);
|
qDeleteAll(_globalPathLinkItems);
|
||||||
_globalPathLinkItems.clear();
|
_globalPathLinkItems.clear();
|
||||||
|
qDeleteAll(_gtNodeItems);
|
||||||
|
_gtNodeItems.clear();
|
||||||
|
qDeleteAll(_gtLinkItems);
|
||||||
|
_gtLinkItems.clear();
|
||||||
|
|
||||||
_referential->resetTransform();
|
_referential->resetTransform();
|
||||||
_localRadius->resetTransform();
|
_localRadius->resetTransform();
|
||||||
|
|||||||
@@ -316,6 +316,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
|||||||
connect(_ui->actionDownload_all_clouds, SIGNAL(triggered()), this , SLOT(downloadAllClouds()));
|
connect(_ui->actionDownload_all_clouds, SIGNAL(triggered()), this , SLOT(downloadAllClouds()));
|
||||||
connect(_ui->actionDownload_graph, SIGNAL(triggered()), this , SLOT(downloadPoseGraph()));
|
connect(_ui->actionDownload_graph, SIGNAL(triggered()), this , SLOT(downloadPoseGraph()));
|
||||||
connect(_ui->actionUpdate_cache_from_database, SIGNAL(triggered()), this, SLOT(updateCacheFromDatabase()));
|
connect(_ui->actionUpdate_cache_from_database, SIGNAL(triggered()), this, SLOT(updateCacheFromDatabase()));
|
||||||
|
connect(_ui->actionAnchor_clouds_to_ground_truth, SIGNAL(triggered()), this, SLOT(anchorCloudsToGroundTruth()));
|
||||||
connect(_ui->menuEdit, SIGNAL(aboutToShow()), this, SLOT(updateEditMenu()));
|
connect(_ui->menuEdit, SIGNAL(aboutToShow()), this, SLOT(updateEditMenu()));
|
||||||
connect(_ui->actionDefault_views, SIGNAL(triggered(bool)), this, SLOT(setDefaultViews()));
|
connect(_ui->actionDefault_views, SIGNAL(triggered(bool)), this, SLOT(setDefaultViews()));
|
||||||
connect(_ui->actionAuto_screen_capture, SIGNAL(triggered(bool)), this, SLOT(selectScreenCaptureFormat(bool)));
|
connect(_ui->actionAuto_screen_capture, SIGNAL(triggered(bool)), this, SLOT(selectScreenCaptureFormat(bool)));
|
||||||
@@ -345,6 +346,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
|||||||
_ui->actionSave_GUI_config->setShortcut(QKeySequence::Save);
|
_ui->actionSave_GUI_config->setShortcut(QKeySequence::Save);
|
||||||
_ui->actionReset_Odometry->setEnabled(false);
|
_ui->actionReset_Odometry->setEnabled(false);
|
||||||
_ui->actionPost_processing->setEnabled(false);
|
_ui->actionPost_processing->setEnabled(false);
|
||||||
|
_ui->actionAnchor_clouds_to_ground_truth->setEnabled(false);
|
||||||
|
|
||||||
QToolButton* toolButton = new QToolButton(this);
|
QToolButton* toolButton = new QToolButton(this);
|
||||||
toolButton->setMenu(_ui->menuSelect_source);
|
toolButton->setMenu(_ui->menuSelect_source);
|
||||||
@@ -1103,6 +1105,7 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
|
|||||||
if(!stat.getSignatures().at(stat.refImageId()).sensorData().groundTruth().isNull())
|
if(!stat.getSignatures().at(stat.refImageId()).sensorData().groundTruth().isNull())
|
||||||
{
|
{
|
||||||
_currentGTPosesMap.insert(std::make_pair(stat.refImageId(), stat.getSignatures().at(stat.refImageId()).sensorData().groundTruth()));
|
_currentGTPosesMap.insert(std::make_pair(stat.refImageId(), stat.getSignatures().at(stat.refImageId()).sensorData().groundTruth()));
|
||||||
|
_ui->actionAnchor_clouds_to_ground_truth->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int highestHypothesisId = static_cast<float>(uValue(stat.data(), Statistics::kLoopHighest_hypothesis_id(), 0.0f));
|
int highestHypothesisId = static_cast<float>(uValue(stat.data(), Statistics::kLoopHighest_hypothesis_id(), 0.0f));
|
||||||
@@ -1489,6 +1492,26 @@ void MainWindow::updateMapCloud(
|
|||||||
}
|
}
|
||||||
_ui->widget_mapVisibility->setMap(posesIn, posesMask);
|
_ui->widget_mapVisibility->setMap(posesIn, posesMask);
|
||||||
|
|
||||||
|
if(_ui->actionAnchor_clouds_to_ground_truth->isChecked() && _currentGTPosesMap.size())
|
||||||
|
{
|
||||||
|
for(std::map<int, Transform>::iterator iter = poses.begin(); iter!=poses.end(); ++iter)
|
||||||
|
{
|
||||||
|
std::map<int, Transform>::iterator gtIter = _currentGTPosesMap.find(iter->first);
|
||||||
|
if(gtIter!=_currentGTPosesMap.end())
|
||||||
|
{
|
||||||
|
iter->second = gtIter->second;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UWARN("Not found ground truth pose for node %d", iter->first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(_currentGTPosesMap.size() == 0)
|
||||||
|
{
|
||||||
|
_ui->actionAnchor_clouds_to_ground_truth->setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
// Map updated! regenerate the assembled cloud, last pose is the new one
|
// Map updated! regenerate the assembled cloud, last pose is the new one
|
||||||
UDEBUG("Update map with %d locations (currentPose=%s)", poses.size(), currentPose.prettyPrint().c_str());
|
UDEBUG("Update map with %d locations (currentPose=%s)", poses.size(), currentPose.prettyPrint().c_str());
|
||||||
QMap<std::string, Transform> viewerClouds = _ui->widget_cloudViewer->getAddedClouds();
|
QMap<std::string, Transform> viewerClouds = _ui->widget_cloudViewer->getAddedClouds();
|
||||||
@@ -4062,6 +4085,16 @@ void MainWindow::downloadPoseGraph()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::anchorCloudsToGroundTruth()
|
||||||
|
{
|
||||||
|
this->updateMapCloud(
|
||||||
|
std::map<int, Transform>(_currentPosesMap),
|
||||||
|
Transform(),
|
||||||
|
std::multimap<int, Link>(_currentLinksMap),
|
||||||
|
std::map<int, int>(_currentMapIds),
|
||||||
|
std::map<int, std::string>(_curentLabels));
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::clearTheCache()
|
void MainWindow::clearTheCache()
|
||||||
{
|
{
|
||||||
_cachedSignatures.clear();
|
_cachedSignatures.clear();
|
||||||
@@ -5978,6 +6011,8 @@ void MainWindow::changeState(MainWindow::State newState)
|
|||||||
UWARN("Menu File separators have not the same order.");
|
UWARN("Menu File separators have not the same order.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_ui->actionAnchor_clouds_to_ground_truth->setEnabled(!_currentGTPosesMap.empty());
|
||||||
|
|
||||||
switch (newState)
|
switch (newState)
|
||||||
{
|
{
|
||||||
case kIdle: // RTAB-Map is not initialized yet
|
case kIdle: // RTAB-Map is not initialized yet
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1012</width>
|
<width>1012</width>
|
||||||
<height>25</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
@@ -77,6 +77,7 @@
|
|||||||
<addaction name="actionDownload_all_clouds"/>
|
<addaction name="actionDownload_all_clouds"/>
|
||||||
<addaction name="actionDownload_graph"/>
|
<addaction name="actionDownload_graph"/>
|
||||||
<addaction name="actionUpdate_cache_from_database"/>
|
<addaction name="actionUpdate_cache_from_database"/>
|
||||||
|
<addaction name="actionAnchor_clouds_to_ground_truth"/>
|
||||||
<addaction name="actionClear_cache"/>
|
<addaction name="actionClear_cache"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionView_high_res_point_cloud"/>
|
<addaction name="actionView_high_res_point_cloud"/>
|
||||||
@@ -1289,6 +1290,14 @@
|
|||||||
<string>Export images (RGB=*.jpg Depth=*.png)...</string>
|
<string>Export images (RGB=*.jpg Depth=*.png)...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionAnchor_clouds_to_ground_truth">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Anchor clouds to ground truth</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|||||||
Reference in New Issue
Block a user