mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 17:40:23 +08:00
Refactored graph::getPosesInRadius -> graph::findNearestPoses. Labels can be removed: added Remove label option in MainWindow. In localization mode, label set with id=0 is set to nearest node of current pose.
This commit is contained in:
@@ -194,6 +194,7 @@ protected Q_SLOTS:
|
||||
void postGoal(const QString & goal);
|
||||
void cancelGoal();
|
||||
void label();
|
||||
void removeLabel();
|
||||
void updateCacheFromDatabase();
|
||||
void anchorCloudsToGroundTruth();
|
||||
void selectScreenCaptureFormat(bool checked);
|
||||
|
||||
@@ -354,6 +354,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent, bool sh
|
||||
connect(_ui->actionSend_waypoints, SIGNAL(triggered()), this, SLOT(sendWaypoints()));
|
||||
connect(_ui->actionCancel_goal, SIGNAL(triggered()), this, SLOT(cancelGoal()));
|
||||
connect(_ui->actionLabel_current_location, SIGNAL(triggered()), this, SLOT(label()));
|
||||
connect(_ui->actionRemove_label, SIGNAL(triggered()), this, SLOT(removeLabel()));
|
||||
connect(_ui->actionClear_cache, SIGNAL(triggered()), this, SLOT(clearTheCache()));
|
||||
connect(_ui->actionAbout, SIGNAL(triggered()), _aboutDialog , SLOT(exec()));
|
||||
connect(_ui->actionHelp, SIGNAL(triggered()), this , SLOT(openHelp()));
|
||||
@@ -2300,7 +2301,6 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
|
||||
// update pose only if odometry is not received
|
||||
std::map<int, int> mapIds = _currentMapIds;
|
||||
std::map<int, Transform> groundTruth = _currentGTPosesMap;
|
||||
std::map<int, std::string> labels = _currentLabels;
|
||||
|
||||
mapIds.insert(std::make_pair(stat.getLastSignatureData().id(), stat.getLastSignatureData().mapId()));
|
||||
if(!stat.getLastSignatureData().getGroundTruthPose().isNull() &&
|
||||
@@ -2308,10 +2308,6 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
|
||||
{
|
||||
groundTruth.insert(std::make_pair(stat.getLastSignatureData().id(), stat.getLastSignatureData().getGroundTruthPose()));
|
||||
}
|
||||
for(std::map<int, std::string>::const_iterator iter=stat.labels().begin(); iter!=stat.labels().end(); ++iter)
|
||||
{
|
||||
uInsert(labels, std::pair<int, std::string>(*iter)); // overwrite labels because they could have been modified
|
||||
}
|
||||
|
||||
if(_preferencesDialog->isPriorIgnored() &&
|
||||
_ui->graphicsView_graphView->getWorldMapRotation()==0.0f &&
|
||||
@@ -2413,7 +2409,7 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
|
||||
poses,
|
||||
stat.constraints(),
|
||||
mapIds,
|
||||
labels,
|
||||
stat.labels(),
|
||||
groundTruth,
|
||||
stat.odomCachePoses(),
|
||||
stat.odomCacheConstraints(),
|
||||
@@ -2646,7 +2642,7 @@ void MainWindow::updateMapCloud(
|
||||
std::map<int, Transform> nearestPoses;
|
||||
if(maxNodes > 0)
|
||||
{
|
||||
std::map<int, float> nodes = graph::findNearestNodes(poses, currentPose, maxNodes);
|
||||
std::map<int, float> nodes = graph::findNearestNodes(currentPose, poses, 0, 0, maxNodes);
|
||||
for(std::map<int, float>::iterator iter=nodes.begin(); iter!=nodes.end(); ++iter)
|
||||
{
|
||||
if(altitudeDelta<=0.0 ||
|
||||
@@ -6947,6 +6943,17 @@ void MainWindow::label()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::removeLabel()
|
||||
{
|
||||
UINFO("Removing label...");
|
||||
bool ok = false;
|
||||
QString label = QInputDialog::getText(this, tr("Remove label"), tr("Label: "), QLineEdit::Normal, "", &ok);
|
||||
if(ok && !label.isEmpty())
|
||||
{
|
||||
this->post(new RtabmapEventCmd(RtabmapEventCmd::kCmdRemoveLabel, label.toStdString(), 0));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateCacheFromDatabase()
|
||||
{
|
||||
QString dir = getWorkingDirectory();
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1012</width>
|
||||
<height>21</height>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
@@ -351,6 +351,7 @@
|
||||
<addaction name="actionTrigger_a_new_map"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionLabel_current_location"/>
|
||||
<addaction name="actionRemove_label"/>
|
||||
<addaction name="actionSend_waypoints"/>
|
||||
<addaction name="actionSend_goal"/>
|
||||
<addaction name="actionCancel_goal"/>
|
||||
@@ -1670,6 +1671,11 @@
|
||||
<string>OpenNI2</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRemove_label">
|
||||
<property name="text">
|
||||
<string>Remove label...</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
||||
Reference in New Issue
Block a user