mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 09:30:25 +08:00
New rtabmap-reduceGraph CLI tool (#1655)
* New rtabmap-reduceGraph CLI tool * fixed some edge cases * Regenerating optimized map if there was one before reducing the graph * addMoreLoopClosures: refactored how ctrl-c is handled to stop faster when no loop closures are added * Added kilted status * Make offline tool always propagate neighbor merged links * removed a parameter * fixed disconnected graph * fixed --help * Added error log on Kp/NNStrategy not compatible with huge vocabulary. ReduceGraph/DetectMoreLoopClosures: Make sure original parameters are saved back on closing. g2o: fixing optimizer to Levenberg for SBA to avoid [SetJac] infinite jac fatal error. * exposing neighbor merged ratio parameter to the tool * show param in log * refactored detectMoreLoopClosures to ignore too close nodes in terms of neighbor links based on Mem/STMSize parameter. Reduce graph: added direction parameter. * Simplified: removed ratio parameter, removed recursive reduction. Just don't reduce if a NM link is longer than maxDistance. * Removed NNStrategy override, as it was still done on closing when we changed back to original params * DBViewer: show missing links when showing OptimizedPoses in GraphView, fixed clicking on landmark links * DetectMoreLoopClosures: Added support for min graph distance option in MainWindow and DbViewer * slight renaming of ROS jobs * reprocess: added option --params_last
This commit is contained in:
@@ -63,14 +63,7 @@ void showUsage()
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// catch ctrl-c
|
||||
bool g_loopForever = true;
|
||||
void sighandler(int sig)
|
||||
{
|
||||
printf("\nSignal %d caught...\n", sig);
|
||||
g_loopForever = false;
|
||||
}
|
||||
|
||||
class PrintProgressState : public ProgressState
|
||||
{
|
||||
public:
|
||||
@@ -86,6 +79,15 @@ public:
|
||||
private:
|
||||
double stamp_;
|
||||
};
|
||||
PrintProgressState progress;
|
||||
|
||||
// catch ctrl-c
|
||||
void sighandler(int sig)
|
||||
{
|
||||
printf("\nSignal %d caught...\n", sig);
|
||||
g_loopForever = false;
|
||||
progress.setCanceled(true);
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
@@ -94,7 +96,7 @@ int main(int argc, char * argv[])
|
||||
signal(SIGINT, &sighandler);
|
||||
|
||||
ULogger::setType(ULogger::kTypeConsole);
|
||||
ULogger::setLevel(ULogger::kError);
|
||||
ULogger::setLevel(ULogger::kWarning);
|
||||
|
||||
if(argc < 2)
|
||||
{
|
||||
@@ -195,7 +197,7 @@ int main(int argc, char * argv[])
|
||||
|
||||
// Add some optimizations (soft set, can be overriden by arguments)
|
||||
inputParams.insert(ParametersPair(Parameters::kMemLoadVisualLocalFeaturesOnInit(), "false")); // don't need features already loaded in RAM
|
||||
inputParams.insert(ParametersPair(Parameters::kKpNNStrategy(), "3")); // don't need flann index
|
||||
inputParams.insert(ParametersPair(Parameters::kMemIncrementalMemory(), "true")); // should be incremental to update links
|
||||
|
||||
std::string dbPath = argv[argc-1];
|
||||
if(!UFile::exists(dbPath))
|
||||
@@ -245,6 +247,7 @@ int main(int argc, char * argv[])
|
||||
Rtabmap rtabmap;
|
||||
printf("Initialization...\n");
|
||||
UTimer timer;
|
||||
ParametersMap originalParameters = parameters;
|
||||
uInsert(parameters, inputParams);
|
||||
rtabmap.init(parameters, dbPath);
|
||||
printf("Initialization... done! (%f sec)\n", timer.ticks());
|
||||
@@ -267,7 +270,6 @@ int main(int argc, char * argv[])
|
||||
printf("From/To Session ID = %d%s\n", fromToMapId, last?" (last session)":"");
|
||||
}
|
||||
|
||||
PrintProgressState progress;
|
||||
printf("Detecting...\n");
|
||||
int detected = rtabmap.detectMoreLoopClosures(clusterRadiusMax, clusterAngle, iterations, intraSession, interSession, &progress, clusterRadiusMin, fromToMapId);
|
||||
if(detected < 0)
|
||||
@@ -306,6 +308,9 @@ int main(int argc, char * argv[])
|
||||
}
|
||||
}
|
||||
|
||||
// Restore original parameters before saving back the database
|
||||
rtabmap.parseParameters(originalParameters);
|
||||
|
||||
rtabmap.close();
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user