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))
108 QApplication
app(argc, argv);
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)
126 if(rtabmap.
process(data, pose))
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!");
void processStatistics(const rtabmap::Statistics &stats)
void processOdometry(const SensorData &data, Transform pose, const rtabmap::OdometryInfo &odom)
virtual bool init(const std::string &calibrationFolder=".", const std::string &cameraName="")
void init(const ParametersMap ¶meters, const std::string &databasePath="", bool loadDatabaseParameters=false)
static void setLevel(ULogger::Level level)
int main(int argc, char *argv[])
Transform process(SensorData &data, OdometryInfo *info=0)
SensorData takeImage(CameraInfo *info=0)
static Odometry * create(const ParametersMap ¶meters=ParametersMap())
int getLoopClosureId() const
const Statistics & getStatistics() const
static void setType(Type type, const std::string &fileName=kDefaultLogFileName, bool append=true)
bool process(const SensorData &data, Transform odomPose, const cv::Mat &odomCovariance=cv::Mat::eye(6, 6, CV_64FC1), const std::vector< float > &odomVelocity=std::vector< float >(), const std::map< std::string, float > &externalStats=std::map< std::string, float >())
Main loop of rtabmap.
void uSleep(unsigned int ms)