32 #include <pcl/visualization/cloud_viewer.h>
34 #include <QApplication>
42 "rtabmap-noEventsExample camera_rate odom_update map_update calibration_dir calibration_name path_left_images path_right_images\n"
44 " camera_rate Rate (Hz) of the camera.\n"
45 " odom_update Do odometry update each X camera frames.\n"
46 " map_update Do map update each X odometry frames.\n"
49 " (with images from \"https://github.com/introlab/rtabmap/wiki/Stereo-mapping#process-a-directory-of-stereo-images\") \n"
50 " $ rtabmap-noEventsExample 20 2 10 stereo_20Hz stereo_20Hz stereo_20Hz/left stereo_20Hz/right\n"
51 " Camera rate = 20 Hz\n"
52 " Odometry update rate = 10 Hz\n"
53 " Map update rate = 1 Hz\n");
68 int cameraRate = atoi(
argv[argIndex++]);
71 printf(
"camera_rate should be > 0\n");
74 int odomUpdate = atoi(
argv[argIndex++]);
77 printf(
"odom_update should be > 0\n");
80 int mapUpdate = atoi(
argv[argIndex++]);
83 printf(
"map_update should be > 0\n");
87 printf(
"Camera rate = %d Hz\n", cameraRate);
88 printf(
"Odometry update rate = %d Hz\n", cameraRate/odomUpdate);
89 printf(
"Map update rate = %d Hz\n", (cameraRate/odomUpdate)/mapUpdate);
91 std::string calibrationDir =
argv[argIndex++];
92 std::string calibrationName =
argv[argIndex++];
93 std::string pathLeftImages =
argv[argIndex++];
94 std::string pathRightImages =
argv[argIndex++];
102 if(
camera.
init(calibrationDir, calibrationName))
111 QApplication::processEvents();
114 int cameraIteration = 0;
115 int odometryIteration = 0;
116 printf(
"Press \"Space\" in the window to pause\n");
117 while(
data.isValid() && mapBuilder.isVisible())
119 if(cameraIteration++ % odomUpdate == 0)
124 if(odometryIteration++ % mapUpdate == 0)
129 if(
rtabmap.getLoopClosureId() > 0)
131 printf(
"Loop closure detected!\n");
139 QApplication::processEvents();
141 while(mapBuilder.
isPaused() && mapBuilder.isVisible())
144 QApplication::processEvents();
151 if(mapBuilder.isVisible())
153 printf(
"Processed all frames\n");
159 UERROR(
"Camera init failed!");