41 #include <QApplication>
42 #include <QPushButton>
43 #include <pcl/console/print.h>
49 "odometryViewer [options]\n"
51 " -driver # Driver number to use: \n"
52 " 0=OpenNI-PCL (Kinect)\n"
53 " 1=OpenNI2 (Kinect and Xtion PRO Live)\n"
54 " 2=Freenect (Kinect)\n"
55 " 3=OpenNI-CV (Kinect)\n"
56 " 4=OpenNI-CV-ASUS (Xtion PRO Live)\n"
57 " 5=Freenect2 (Kinect v2)\n"
58 " 6=DC1394 (Bumblebee2)\n"
59 " 7=FlyCapture2 (Bumblebee2)\n"
62 " 10=Kinect for Windows 2 SDK\n"
64 " 12=Kinect for Azure SDK\n"
66 " -hz #.# Camera rate (default 0, 0 means as fast as the camera can)\n"
67 " -db \"input.db\" Use database instead of camera (recorded with rtabmap-dataRecorder)\n"
68 " -clouds # Maximum clouds shown (default 10, zero means inf)\n"
69 " -sec #.# Delay (seconds) before reading the database (if set)\n"
82 std::string inputDatabase;
87 for(
int i=1;
i<argc; ++
i)
89 if(strcmp(
argv[
i],
"-driver") == 0)
94 driver = std::atoi(
argv[
i]);
95 if(driver < 0 || driver > 13)
106 if(strcmp(
argv[
i],
"-hz") == 0)
123 if(strcmp(
argv[
i],
"-db") == 0)
128 inputDatabase =
argv[
i];
131 printf(
"Database path (%s) should end with \"db\" \n", inputDatabase.c_str());
141 if(strcmp(
argv[
i],
"-clouds") == 0)
146 maxClouds = std::atoi(
argv[
i]);
158 if(strcmp(
argv[
i],
"-sec") == 0)
175 if(strcmp(
argv[
i],
"-help") == 0 || strcmp(
argv[
i],
"--help") == 0)
181 if(inputDatabase.size())
183 UINFO(
"Using database input \"%s\"", inputDatabase.c_str());
187 UINFO(
"Using OpenNI camera");
190 UINFO(
"Camera rate = %f Hz", rate);
191 UINFO(
"Maximum clouds shown = %d", maxClouds);
195 for(rtabmap::ParametersMap::iterator
iter=parameters.begin();
iter!=parameters.end(); ++
iter)
197 UINFO(
" Param \"%s\"=\"%s\"",
iter->first.c_str(),
iter->second.c_str());
201 int regStrategy = rtabmap::Parameters::defaultRegStrategy();
202 int odomStrategy = rtabmap::Parameters::defaultOdomStrategy();
206 float maxDepth = 4.0f;
207 float voxelSize = rtabmap::Parameters::defaultIcpVoxelSize();
209 float normalsRadius = 0.0f;
210 if(regStrategy == 1 || regStrategy == 2)
218 bool pointToPlane = rtabmap::Parameters::defaultIcpPointToPlane();
222 normalsK = rtabmap::Parameters::defaultIcpPointToPlaneK();
224 normalsRadius = rtabmap::Parameters::defaultIcpPointToPlaneRadius();
235 if(odomStrategy == -1)
251 odomViewer.setWindowTitle(
"Odometry view");
252 odomViewer.resize(1280, 480+QPushButton().minimumHeight());
255 if(inputDatabase.size())
267 UERROR(
"Not built with OpenNI2 support...");
276 UERROR(
"Not built with Freenect support...");
285 UERROR(
"Not built with OpenNI from OpenCV support...");
294 UERROR(
"Not built with OpenNI from OpenCV support...");
303 UERROR(
"Not built with Freenect2 support...");
312 UERROR(
"Not built with dc1394 support...");
321 UERROR(
"Not built with FlyCapture2/Triclops support...");
330 UERROR(
"Not built with ZED sdk support...");
335 else if (driver == 9)
339 UERROR(
"Not built with RealSense support...");
344 else if (driver == 10)
348 UERROR(
"Not built with Kinect for Windows 2 SDK support...");
353 else if (driver == 11)
357 UERROR(
"Not built with RealSense2 SDK support...");
362 else if (driver == 12)
366 UERROR(
"Not built with Kinect for Azure SDK support...");
371 else if (driver == 13)
375 UERROR(
"Not built with Mynt Eye S support...");
382 UFATAL(
"Camera driver (%d) not found!", driver);
389 if(
camera->isCalibrated())
393 cameraThread.
setScanParameters(
icp, decimation<1?1:decimation, 0, maxDepth, voxelSize, normalsK, normalsRadius);
396 cameraThread.
start();
400 cameraThread.
join(
true);
401 odomThread.
join(
true);
405 printf(
"The camera is not calibrated! You should calibrate the camera first.\n");
411 printf(
"Failed to initialize the camera! Please select another driver (see \"--help\").\n");