#include #include #include #include #include #include #include #include #include using namespace rtabmap; void showUsage() { printf("\nUsage:\n" "dataRecorder [options] output.db\n" "Options:\n" " -hide Don't display the current cloud recorded.\n" " -debug Set debug level for the logger.\n" " -rate #.# Input rate Hz (default 0=inf)\n" " -openni Use openni camera instead of the usb camera.\n" " -openni2 Use openni2 camera instead of the usb camera.\n"); exit(1); } rtabmap::CameraThread * cam = 0; QApplication * app = 0; // catch ctrl-c void sighandler(int sig) { printf("\nSignal %d caught...\n", sig); if(cam) { cam->join(true); } if(app) { QMetaObject::invokeMethod(app, "quit"); } } int main (int argc, char * argv[]) { ULogger::setType(ULogger::kTypeConsole); ULogger::setLevel(ULogger::kInfo); // parse arguments QString fileName; bool show = true; bool openni = false; bool openni2 = false; float rate = 0.0f; if(argc < 2) { showUsage(); } for(int i=1; iprocessEvents(); } if(cam->init()) { cam->start(); app->exec(); UINFO("Closing..."); recorder.close(); } else { UERROR("Cannot initialize the camera!"); } } else { UERROR("Cannot initialize the recorder! Maybe the path is wrong: \"%s\"", fileName.toStdString().c_str()); } if(cam) { delete cam; } return 0; }