Professional Documents
Culture Documents
cpp
#include
#include
#include
#include
#include
#include
#include
#include
#include
"rtabmap/core/Rtabmap.h"
"rtabmap/core/RtabmapThread.h"
"rtabmap/core/CameraRGBD.h"
"rtabmap/core/CameraThread.h"
"rtabmap/core/Odometry.h"
"rtabmap/core/OdometryThread.h"
"rtabmap/utilite/UEventsManager.h"
<QApplication>
<stdio.h>
#include "MapBuilder.h"
void showUsage()
{
printf("\nUsage:\n"
"rtabmap-rgbd_mapping driver\n"
" driver
Driver number to use: 0=OpenNI-PCL, 1=OpenNI2, 2=Freenect,
3=OpenNI-CV, 4=OpenNI-CV-ASUS\n\n");
exit(1);
}
using namespace rtabmap;
int main(int argc, char * argv[])
{
ULogger::setType(ULogger::kTypeConsole);
ULogger::setLevel(ULogger::kWarning);
int driver = 0;
if(argc < 2)
{
showUsage();
}
else
{
driver = atoi(argv[argc-1]);
if(driver < 0 || driver > 4)
{
UERROR("driver should be between 0 and 4.");
showUsage();
}
}
// Here is the pipeline that we will use:
// CameraOpenni -> "CameraEvent" -> OdometryThread -> "OdometryEvent" -> RtabmapThread ->
"RtabmapEvent"
// Create the OpenNI camera, it will send a CameraEvent at the rate specified.
// Set transform to camera so z is up, y is left and x going forward
Camera * camera = 0;
Transform opticalRotation(0,0,1,0, -1,0,0,0, 0,-1,0,0);
if(driver == 1)
{
if(!CameraOpenNI2::available())
{
-1-
C:\Users\KHOAND_VN\Desktop\1.cpp
// GUI stuff, there the handler will receive RtabmapEvent and construct the map
// We give it the camera so the GUI can pause/resume the camera
QApplication app(argc, argv);
MapBuilder mapBuilder(&cameraThread);
// Create an odometry thread to process camera events, it will send OdometryEvent.
OdometryThread odomThread(new OdometryBOW());
-2-
C:\Users\KHOAND_VN\Desktop\1.cpp
-3-