Skip to content

Commit

Permalink
Setting global full opt by default, updated preferences defaulting to…
Browse files Browse the repository at this point in the history
… g2o or gtsam if one or the other is unavailable
  • Loading branch information
matlabbe committed Dec 15, 2024
1 parent 473322d commit 6e9c2c3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
41 changes: 31 additions & 10 deletions guilib/src/PreferencesDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4871,22 +4871,43 @@ void PreferencesDialog::setParameter(const std::string & key, const std::string
{
if(valueInt==1 && combo->objectName().toStdString().compare(Parameters::kOptimizerStrategy()) == 0)
{
UWARN("Trying to set \"%s\" to g2o but RTAB-Map isn't built "
"with g2o. Keeping default combo value: %s.",
combo->objectName().toStdString().c_str(),
combo->currentText().toStdString().c_str());
ok = false;
if(Optimizer::isAvailable(Optimizer::kTypeGTSAM)) {
UWARN("Trying to set \"%s\" to g2o but RTAB-Map isn't built "
"with g2o. Falling back to GTSAM.",
combo->objectName().toStdString().c_str());
valueInt = 2;
}
else
{
UWARN("Trying to set \"%s\" to g2o but RTAB-Map isn't built "
"with g2o. Keeping default combo value: %s.",
combo->objectName().toStdString().c_str(),
combo->currentText().toStdString().c_str());
ok = false;
}
}
}
if(!Optimizer::isAvailable(Optimizer::kTypeGTSAM))
{
if(valueInt==2 && combo->objectName().toStdString().compare(Parameters::kOptimizerStrategy()) == 0)
{
UWARN("Trying to set \"%s\" to GTSAM but RTAB-Map isn't built "
"with GTSAM. Keeping default combo value: %s.",
combo->objectName().toStdString().c_str(),
combo->currentText().toStdString().c_str());
ok = false;
#ifndef RTABMAP_ORB_SLAM
if(Optimizer::isAvailable(Optimizer::kTypeG2O))
#endif
{
UWARN("Trying to set \"%s\" to GTSAM but RTAB-Map isn't built "
"with GTSAM. Falling back to g2o.",
combo->objectName().toStdString().c_str());
valueInt = 1;
}
else
{
UWARN("Trying to set \"%s\" to GTSAM but RTAB-Map isn't built "
"with GTSAM. Keeping default combo value: %s.",
combo->objectName().toStdString().c_str(),
combo->currentText().toStdString().c_str());
ok = false;
}
}
}
if(ok)
Expand Down
4 changes: 2 additions & 2 deletions tools/Export/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ int main(int argc, char * argv[])
}
if(optimizationApproach <= 1)
{
std::string optimizationApproachStr = optimizationApproach==0?"Iterative global optimization":"Full global optimization";
std::string optimizationApproachStr = optimizationApproach==1?"Iterative global optimization":"Full global optimization";
printf("Optimizing the map (%s)...\n", optimizationApproachStr.c_str());
if(odomPoses.empty())
{
Expand Down Expand Up @@ -1193,7 +1193,7 @@ int main(int argc, char * argv[])
{
optimizedPoses = optimizer->optimize(odomPoses.lower_bound(1)->first, posesOut, linksOut);
}
printf("Optimizing the map (%s)... done (%fs, poses=%d).\n", optimizationApproachStr.c_str(), timer.ticks(), (int)optimizedPoses.size());
printf("Optimizing the map (%s)... done (%fs, poses=%d, links=%d).\n", optimizationApproachStr.c_str(), timer.ticks(), (int)optimizedPoses.size(), (int)linksOut.size());
}

if(optimizedPoses.empty())
Expand Down

0 comments on commit 6e9c2c3

Please sign in to comment.