Go to the documentation of this file.
40 #include <pcl/filters/filter.h>
41 #include <pcl/io/ply_io.h>
42 #include <pcl/io/obj_io.h>
43 #include <pcl/common/common.h>
44 #include <pcl/surface/poisson.h>
53 "rtabmap-detectMoreLoopClosures [options] database.db\n"
55 " -r # Cluster radius (default 1 m).\n"
56 " -rx # Cluster radius min (default 0 m).\n"
57 " -a # Cluster angle (default 30 deg).\n"
58 " -i # Iterations (default 1).\n"
59 " --intra Add only intra-session loop closures.\n"
60 " --inter Add only inter-session loop closures.\n"
69 printf(
"\nSignal %d caught...\n", sig);
76 virtual bool callback(
const std::string & msg)
const
79 printf(
"%s \n",
msg.c_str());
98 float clusterRadiusMin = 0.0f;
99 float clusterRadiusMax = 1.0f;
100 float clusterAngle = CV_PI/6.0f;
102 bool intraSession =
false;
103 bool interSession =
false;
104 for(
int i=1;
i<argc-1; ++
i)
106 if(std::strcmp(
argv[
i],
"--help") == 0)
110 else if(std::strcmp(
argv[
i],
"--intra") == 0)
118 else if(std::strcmp(
argv[
i],
"--inter") == 0)
126 else if(std::strcmp(
argv[
i],
"-r") == 0)
138 else if(std::strcmp(
argv[
i],
"-rx") == 0)
150 else if(std::strcmp(
argv[
i],
"-a") == 0)
162 else if(std::strcmp(
argv[
i],
"-i") == 0)
177 std::string dbPath =
argv[argc-1];
180 printf(
"Database %s doesn't exist!\n", dbPath.c_str());
183 printf(
"\nDatabase: %s\n", dbPath.c_str());
184 printf(
"Cluster radius min = %f m\n", clusterRadiusMin);
185 printf(
"Cluster radius max = %f m\n", clusterRadiusMax);
186 printf(
"Cluster angle = %f deg\n", clusterAngle*180.0
f/CV_PI);
189 printf(
"Intra-session only\n");
191 else if(interSession)
193 printf(
"Inter-session only\n");
196 if(!intraSession && !interSession)
212 UERROR(
"Cannot open database %s!", dbPath.c_str());
216 for(ParametersMap::iterator
iter=inputParams.begin();
iter!=inputParams.end(); ++
iter)
218 printf(
" Using parameter \"%s=%s\" from arguments\n",
iter->first.c_str(),
iter->second.c_str());
223 printf(
"Initialization...\n");
224 uInsert(parameters, inputParams);
225 rtabmap.init(parameters, dbPath);
227 float xMin, yMin, cellSize;
228 bool haveOptimizedMap = !
rtabmap.getMemory()->load2DMap(xMin, yMin, cellSize).empty();
231 printf(
"Detecting...\n");
232 int detected =
rtabmap.detectMoreLoopClosures(clusterRadiusMax, clusterAngle, iterations, intraSession, interSession, &progress, clusterRadiusMin);
237 printf(
"Detection interrupted. Loop closures found so far (if any) are not saved.\n");
241 printf(
"Loop closure detection failed!\n");
244 else if(detected > 0 && haveOptimizedMap)
246 printf(
"The database has a global occupancy grid, regenerating one with new optimized graph!\n");
249 std::map<int, Transform> optimizedPoses =
rtabmap.getLocalOptimizedPoses();
250 for(std::map<int, Transform>::iterator
iter=optimizedPoses.lower_bound(0);
iter!=optimizedPoses.end(); ++
iter)
253 data.uncompressData();
254 cache.
add(
iter->first,
data.gridGroundCellsRaw(),
data.gridObstacleCellsRaw(),
data.gridEmptyCellsRaw(),
data.gridCellSize(),
data.gridViewPoint());
256 grid.
update(optimizedPoses);
257 cv::Mat map = grid.
getMap(xMin, yMin);
260 printf(
"Could not generate the global occupancy grid!\n");
264 rtabmap.getMemory()->save2DMap(map, xMin, yMin, cellSize);
265 printf(
"Save new global occupancy grid!\n");
ParametersMap getLastParameters() const
bool openConnection(const std::string &url, bool overwritten=false)
virtual bool callback(const std::string &msg) const
static ParametersMap parseArguments(int argc, char *argv[], bool onlyParameters=false)
static void setLevel(ULogger::Level level)
std::map< std::string, std::string > ParametersMap
int main(int argc, char *argv[])
Basic mathematics functions.
void uInsert(std::map< K, V > &map, const std::pair< K, V > &pair)
bool update(const std::map< int, Transform > &poses)
static void setType(Type type, const std::string &fileName=kDefaultLogFileName, bool append=true)
cv::Mat getMap(float &xMin, float &yMin) const
void add(int nodeId, const cv::Mat &ground, const cv::Mat &obstacles, const cv::Mat &empty, float cellSize, const cv::Point3f &viewPoint=cv::Point3f(0, 0, 0))
static const char * showUsage()
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
int UTILITE_EXPORT uStr2Int(const std::string &str)
iterator iter(handle obj)
Wrappers of STL for convenient functions.
float UTILITE_EXPORT uStr2Float(const std::string &str)
void closeConnection(bool save=true, const std::string &outputUrl="")
static DBDriver * create(const ParametersMap ¶meters=ParametersMap())
rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:12