MainWindow: Re-added rotation of the map on the graph view based on gps, if used and if priors are ignored by optimizer

This commit is contained in:
matlabbe
2019-01-16 20:25:14 -05:00
parent d45b77c0b7
commit c13267599e
3 changed files with 21 additions and 0 deletions

View File

@@ -271,6 +271,7 @@ public:
bool isSLAMMode() const; bool isSLAMMode() const;
bool isRGBDMode() const; bool isRGBDMode() const;
int getKpMaxFeatures() const; int getKpMaxFeatures() const;
bool isPriorIgnored() const;
//specific //specific
bool isStatisticsPublished() const; bool isStatisticsPublished() const;

View File

@@ -1905,6 +1905,22 @@ void MainWindow::processStats(const rtabmap::Statistics & stat)
uInsert(labels, std::pair<int, std::string>(*iter)); // overwrite labels because they could have been modified 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 &&
stat.getLastSignatureData().sensorData().gps().stamp()!=0.0 &&
stat.poses().find(stat.getLastSignatureData().id())!=stat.poses().end())
{
float bearing = (float)((-(stat.getLastSignatureData().sensorData().gps().bearing()-90))*M_PI/180.0);
float gpsRotationOffset = stat.poses().at(stat.getLastSignatureData().id()).theta()-bearing;
_ui->graphicsView_graphView->setWorldMapRotation(gpsRotationOffset);
}
else if(!_preferencesDialog->isPriorIgnored() &&
_ui->graphicsView_graphView->getWorldMapRotation() != 0.0f)
{
_ui->graphicsView_graphView->setWorldMapRotation(0.0f);
}
std::map<int, Transform> poses = stat.poses(); std::map<int, Transform> poses = stat.poses();
UDEBUG("time= %d ms", time.restart()); UDEBUG("time= %d ms", time.restart());

View File

@@ -5422,6 +5422,10 @@ int PreferencesDialog::getKpMaxFeatures() const
{ {
return _ui->surf_spinBox_wordsPerImageTarget->value(); return _ui->surf_spinBox_wordsPerImageTarget->value();
} }
bool PreferencesDialog::isPriorIgnored() const
{
return _ui->graphOptimization_priorsIgnored->isChecked();
}
/*** SETTERS ***/ /*** SETTERS ***/
void PreferencesDialog::setInputRate(double value) void PreferencesDialog::setInputRate(double value)