38 #include <pcl/filters/filter.h> 39 #include <pcl/io/ply_io.h> 40 #include <pcl/io/obj_io.h> 41 #include <pcl/common/common.h> 42 #include <pcl/surface/poisson.h> 51 "rtabmap-detectMoreLoopClosures [options] database.db\n" 53 " -r # Cluster radius (default 1 m).\n" 54 " -a # Cluster angle (default 30 deg).\n" 55 " -i # Iterations (default 1).\n" 56 " --intra Add only intra-session loop closures.\n" 57 " --inter Add only inter-session loop closures.\n" 66 printf(
"\nSignal %d caught...\n", sig);
73 virtual bool callback(
const std::string & msg)
const 76 printf(
"%s \n", msg.c_str());
95 float clusterRadius = 1.0f;
96 float clusterAngle = CV_PI/6.0f;
98 bool intraSession =
false;
99 bool interSession =
false;
100 for(
int i=1; i<argc-1; ++i)
102 if(std::strcmp(argv[i],
"--help") == 0)
106 else if(std::strcmp(argv[i],
"--intra") == 0)
114 else if(std::strcmp(argv[i],
"--inter") == 0)
122 else if(std::strcmp(argv[i],
"-r") == 0)
134 else if(std::strcmp(argv[i],
"-a") == 0)
139 clusterAngle =
uStr2Float(argv[i])*CV_PI/180.0f;
146 else if(std::strcmp(argv[i],
"-i") == 0)
161 std::string dbPath = argv[argc-1];
164 printf(
"Database %s doesn't exist!\n", dbPath.c_str());
167 printf(
"\nDatabase: %s\n", dbPath.c_str());
168 printf(
"Cluster radius = %f m\n", clusterRadius);
169 printf(
"Cluster angle = %f deg\n", clusterAngle*180.0
f/CV_PI);
172 printf(
"Intra-session only\n");
174 else if(interSession)
176 printf(
"Inter-session only\n");
179 if(!intraSession && !interSession)
195 UERROR(
"Cannot open database %s!", dbPath.c_str());
201 printf(
"Initialization...\n");
202 uInsert(parameters, inputParams);
203 rtabmap.
init(parameters, dbPath);
206 printf(
"Detecting...\n");
207 int detected = rtabmap.
detectMoreLoopClosures(clusterRadius, clusterAngle, iterations, intraSession, interSession, &progress);
212 printf(
"Detection interrupted. Loop closures found so far (if any) are not saved.\n");
216 printf(
"Loop closure detection failed!\n");
int UTILITE_EXP uStr2Int(const std::string &str)
int detectMoreLoopClosures(float clusterRadius=0.5f, float clusterAngle=M_PI/6.0f, int iterations=1, bool intraSession=true, bool interSession=true, const ProgressState *state=0)
static const char * showUsage()
static ParametersMap parseArguments(int argc, char *argv[], bool onlyParameters=false)
float UTILITE_EXP uStr2Float(const std::string &str)
std::map< std::string, std::string > ParametersMap
void init(const ParametersMap ¶meters, const std::string &databasePath="", bool loadDatabaseParameters=false)
Basic mathematics functions.
static void setLevel(ULogger::Level level)
bool openConnection(const std::string &url, bool overwritten=false)
Wrappers of STL for convenient functions.
void close(bool databaseSaved=true, const std::string &ouputDatabasePath="")
virtual bool callback(const std::string &msg) const
void closeConnection(bool save=true, const std::string &outputUrl="")
static void setType(Type type, const std::string &fileName=kDefaultLogFileName, bool append=true)
int main(int argc, char *argv[])
static DBDriver * create(const ParametersMap ¶meters=ParametersMap())
ParametersMap getLastParameters() const
void uInsert(std::map< K, V > &map, const std::pair< K, V > &pair)