mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-01 17:10:26 +08:00
Merged pcl_integration branch to trunk
git-svn-id: http://rtabmap.googlecode.com/svn/trunk/rtabmap@1014 f169173b-cf89-36c8-b27e-44dbe73f0c83
This commit is contained in:
@@ -4,8 +4,14 @@ ADD_SUBDIRECTORY( ImagesJoiner )
|
||||
ADD_SUBDIRECTORY( ImagesDbExtractor )
|
||||
ADD_SUBDIRECTORY( VocabularyComparison )
|
||||
|
||||
IF(TARGET rtabmap_guilib)
|
||||
ADD_SUBDIRECTORY( viewer )
|
||||
#On linux, we use ros package as OpenniCamera
|
||||
IF(WIN32 OR APPLE)
|
||||
ADD_SUBDIRECTORY( OdometryViewer )
|
||||
ADD_SUBDIRECTORY( DataRecorder )
|
||||
ENDIF(WIN32 OR APPLE)
|
||||
|
||||
IF(TARGET rtabmap_gui)
|
||||
ADD_SUBDIRECTORY( DatabaseViewer )
|
||||
ADD_SUBDIRECTORY( EpipolarGeometry )
|
||||
ELSE()
|
||||
MESSAGE(STATUS "RTAB-Map GUI lib is not built, the databaseViewer and epipolarGeometry programs will not be built...")
|
||||
|
||||
@@ -9,19 +9,23 @@ SET(INCLUDE_DIRS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${OpenCV_INCLUDE_DIRS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include
|
||||
${PCL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
SET(LIBRARIES
|
||||
${OpenCV_LIBRARIES}
|
||||
${PCL_LIBRARIES}
|
||||
)
|
||||
|
||||
add_definitions(${PCL_DEFINITIONS})
|
||||
|
||||
# Make sure the compiler can find include files from our library.
|
||||
INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||
|
||||
# Add binary called "consoleApp" that is built from the source file "main.cpp".
|
||||
# The extension is automatically found.
|
||||
ADD_EXECUTABLE(consoleApp ${SRC_FILES})
|
||||
TARGET_LINK_LIBRARIES(consoleApp rtabmap_corelib rtabmap_utilite ${LIBRARIES})
|
||||
TARGET_LINK_LIBRARIES(consoleApp rtabmap_core rtabmap_utilite ${LIBRARIES})
|
||||
|
||||
SET_TARGET_PROPERTIES( consoleApp
|
||||
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-console)
|
||||
|
||||
@@ -357,11 +357,11 @@ int main(int argc, char * argv[])
|
||||
Camera * camera = 0;
|
||||
if(UDirectory::exists(path))
|
||||
{
|
||||
camera = new CameraImages(path, startAt, false, 1/rate, false, imageWidth, imageHeight, framesDropped);
|
||||
camera = new CameraImages(path, startAt, false, 1/rate, imageWidth, imageHeight, framesDropped);
|
||||
}
|
||||
else
|
||||
{
|
||||
camera = new CameraVideo(path, 1/rate, false, imageWidth, imageHeight, framesDropped);
|
||||
camera = new CameraVideo(path, 1/rate, imageWidth, imageHeight, framesDropped);
|
||||
}
|
||||
|
||||
if(!camera || !camera->init())
|
||||
@@ -418,7 +418,7 @@ int main(int argc, char * argv[])
|
||||
}
|
||||
if(rtabmap.getWM().size() || rtabmap.getSTM().size())
|
||||
{
|
||||
printf("[Warning] RTAB-Map database is not empty (%s)\n", (rtabmap.getWorkingDir()+Rtabmap::kDefaultDatabaseName).c_str());
|
||||
printf("[Warning] RTAB-Map database is not empty (%s)\n", (rtabmap.getWorkingDir()+Parameters::getDefaultDatabaseName()).c_str());
|
||||
}
|
||||
printf("\nProcessing images...\n");
|
||||
|
||||
|
||||
34
tools/DataRecorder/CMakeLists.txt
Normal file
34
tools/DataRecorder/CMakeLists.txt
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
SET(SRC_FILES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
SET(INCLUDE_DIRS
|
||||
${PROJECT_SOURCE_DIR}/corelib/include
|
||||
${PROJECT_SOURCE_DIR}/utilite/include
|
||||
${PROJECT_SOURCE_DIR}/guilib/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${PCL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
|
||||
SET(LIBRARIES
|
||||
${PCL_LIBRARIES}
|
||||
${QT_LIBRARIES}
|
||||
)
|
||||
|
||||
add_definitions(${PCL_DEFINITIONS})
|
||||
|
||||
INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||
|
||||
IF(MINGW)
|
||||
ADD_EXECUTABLE(dataRecorder WIN32 ${SRC_FILES})
|
||||
ELSE()
|
||||
ADD_EXECUTABLE(dataRecorder ${SRC_FILES})
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES(dataRecorder rtabmap_core rtabmap_gui rtabmap_utilite ${LIBRARIES})
|
||||
|
||||
SET_TARGET_PROPERTIES( dataRecorder
|
||||
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-dataRecorder)
|
||||
|
||||
166
tools/DataRecorder/main.cpp
Normal file
166
tools/DataRecorder/main.cpp
Normal file
@@ -0,0 +1,166 @@
|
||||
|
||||
#include <rtabmap/utilite/ULogger.h>
|
||||
#include <rtabmap/core/CameraOpenni.h>
|
||||
#include <rtabmap/core/Camera.h>
|
||||
#include <rtabmap/core/CameraThread.h>
|
||||
#include <rtabmap/gui/DataRecorder.h>
|
||||
#include <QtGui/QApplication.h>
|
||||
#include <signal.h>
|
||||
|
||||
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");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
rtabmap::CameraOpenni * openniCamera = 0;
|
||||
rtabmap::CameraThread * cam = 0;
|
||||
QApplication * app = 0;
|
||||
// catch ctrl-c
|
||||
void sighandler(int sig)
|
||||
{
|
||||
printf("\nSignal %d caught...\n", sig);
|
||||
if(openniCamera)
|
||||
{
|
||||
openniCamera->kill();
|
||||
}
|
||||
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;
|
||||
float rate = 0.0f;
|
||||
|
||||
if(argc < 2)
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
for(int i=1; i<argc-1; ++i)
|
||||
{
|
||||
if(strcmp(argv[i], "-rate") == 0)
|
||||
{
|
||||
++i;
|
||||
if(i < argc)
|
||||
{
|
||||
rate = std::atof(argv[i]);
|
||||
if(rate < 0.0f)
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-debug") == 0)
|
||||
{
|
||||
ULogger::setLevel(ULogger::kDebug);
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-hide") == 0)
|
||||
{
|
||||
show = false;
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-openni") == 0)
|
||||
{
|
||||
openni = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("Unrecognized option : %s\n", argv[i]);
|
||||
showUsage();
|
||||
}
|
||||
fileName = argv[argc-1]; // the last is the output path
|
||||
|
||||
UINFO("Output = %s", fileName.toStdString().c_str());
|
||||
UINFO("Show = %s", show?"true":"false");
|
||||
UINFO("Openni = %s", openni?"true":"false");
|
||||
UINFO("Rate =%f Hz", rate);
|
||||
|
||||
app = new QApplication(argc, argv);
|
||||
|
||||
// Catch ctrl-c to close the gui
|
||||
// (Place this after QApplication's constructor)
|
||||
signal(SIGABRT, &sighandler);
|
||||
signal(SIGTERM, &sighandler);
|
||||
signal(SIGINT, &sighandler);
|
||||
|
||||
if(openni)
|
||||
{
|
||||
openniCamera = new rtabmap::CameraOpenni("", rate, rtabmap::Transform(0,0,1,0, -1,0,0,0, 0,-1,0,0));
|
||||
}
|
||||
else
|
||||
{
|
||||
cam = new rtabmap::CameraThread(new rtabmap::CameraVideo(0, rate));
|
||||
}
|
||||
|
||||
DataRecorder recorder;
|
||||
|
||||
if(recorder.init(fileName))
|
||||
{
|
||||
recorder.registerToEventsManager();
|
||||
if(show)
|
||||
{
|
||||
recorder.setWindowTitle("Cloud viewer");
|
||||
recorder.setMinimumWidth(500);
|
||||
recorder.setMinimumHeight(300);
|
||||
recorder.showNormal();
|
||||
app->processEvents();
|
||||
}
|
||||
|
||||
if(openni?openniCamera->init():cam->init())
|
||||
{
|
||||
openni?openniCamera->start():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(openniCamera)
|
||||
{
|
||||
delete openniCamera;
|
||||
}
|
||||
if(cam)
|
||||
{
|
||||
delete cam;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -21,8 +21,13 @@ SET(LIBRARIES
|
||||
|
||||
INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||
|
||||
ADD_EXECUTABLE(databaseViewer WIN32 ${SRC_FILES})
|
||||
TARGET_LINK_LIBRARIES(databaseViewer rtabmap_corelib rtabmap_guilib rtabmap_utilite ${LIBRARIES})
|
||||
IF(MINGW)
|
||||
ADD_EXECUTABLE(databaseViewer WIN32 ${SRC_FILES})
|
||||
ELSE()
|
||||
ADD_EXECUTABLE(databaseViewer ${SRC_FILES})
|
||||
ENDIF()
|
||||
|
||||
TARGET_LINK_LIBRARIES(databaseViewer rtabmap_core rtabmap_gui rtabmap_utilite ${LIBRARIES})
|
||||
|
||||
SET_TARGET_PROPERTIES( databaseViewer
|
||||
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-databaseViewer)
|
||||
@@ -28,6 +28,12 @@ int main(int argc, char * argv[])
|
||||
|
||||
QApplication * app = new QApplication(argc, argv);
|
||||
DatabaseViewer * mainWindow = new DatabaseViewer();
|
||||
|
||||
if(argc == 2)
|
||||
{
|
||||
mainWindow->openDatabase(argv[1]);
|
||||
}
|
||||
|
||||
mainWindow->showNormal();
|
||||
|
||||
// Now wait for application to finish
|
||||
@@ -22,7 +22,7 @@ SET(LIBRARIES
|
||||
INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||
|
||||
ADD_EXECUTABLE(epipolar_geometry WIN32 ${SRC_FILES})
|
||||
TARGET_LINK_LIBRARIES(epipolar_geometry rtabmap_corelib rtabmap_guilib rtabmap_utilite ${LIBRARIES})
|
||||
TARGET_LINK_LIBRARIES(epipolar_geometry rtabmap_core rtabmap_gui rtabmap_utilite ${LIBRARIES})
|
||||
|
||||
SET_TARGET_PROPERTIES( epipolar_geometry
|
||||
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-epipolar_geometry)
|
||||
|
||||
@@ -13,15 +13,17 @@
|
||||
#include "rtabmap/core/Features2d.h"
|
||||
#include "rtabmap/core/EpipolarGeometry.h"
|
||||
#include "rtabmap/core/VWDictionary.h"
|
||||
#include "rtabmap/gui/UCv2Qt.h"
|
||||
|
||||
#include "rtabmap/gui/ImageView.h"
|
||||
#include "rtabmap/gui/qtipl.h"
|
||||
#include "rtabmap/gui/KeypointItem.h"
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QGraphicsLineItem>
|
||||
#include <QtGui/QGraphicsPixmapItem>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtCore/QTime>
|
||||
#include <QtGui/QGraphicsEffect>
|
||||
|
||||
|
||||
using namespace rtabmap;
|
||||
@@ -47,13 +49,23 @@ public:
|
||||
this->layout()->setSpacing(0);
|
||||
this->layout()->setContentsMargins(0,0,0,0);
|
||||
this->layout()->addWidget(view1_);
|
||||
IplImage img1 = image1;
|
||||
IplImage img2 = image2;
|
||||
view1_->setSceneRect(0,0,(float)image1.cols, (float)image1.rows);
|
||||
view1_->setLinesShown(true);
|
||||
view1_->setFeaturesShown(false);
|
||||
view1_->scene()->addPixmap(QPixmap::fromImage(Ipl2QImage(&img1,128)))->setVisible(view1_->isImageShown());
|
||||
view1_->scene()->addPixmap(QPixmap::fromImage(Ipl2QImage(&img2,128)))->setVisible(view1_->isImageShown());
|
||||
|
||||
QGraphicsPixmapItem * item1 = view1_->scene()->addPixmap(QPixmap::fromImage(uCvMat2QImage(image1)));
|
||||
QGraphicsPixmapItem * item2 = view1_->scene()->addPixmap(QPixmap::fromImage(uCvMat2QImage(image2)));
|
||||
|
||||
QGraphicsOpacityEffect * effect1 = new QGraphicsOpacityEffect();
|
||||
QGraphicsOpacityEffect * effect2 = new QGraphicsOpacityEffect();
|
||||
effect1->setOpacity(0.5);
|
||||
effect2->setOpacity(0.5);
|
||||
item1->setGraphicsEffect(effect1);
|
||||
item2->setGraphicsEffect(effect2);
|
||||
|
||||
item1->setVisible(view1_->isImageShown());
|
||||
item2->setVisible(view1_->isImageShown());
|
||||
|
||||
drawKeypoints(words1, words2, status);
|
||||
}
|
||||
protected:
|
||||
|
||||
@@ -9,17 +9,21 @@ SET(INCLUDE_DIRS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${UTILITE_INCLUDE_DIRS}
|
||||
${OpenCV_INCLUDE_DIRS}
|
||||
${PCL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
SET(LIBRARIES
|
||||
${UTILITE_LIBRARIES}
|
||||
${OpenCV_LIBRARIES}
|
||||
${PCL_LIBRARIES}
|
||||
)
|
||||
|
||||
add_definitions(${PCL_DEFINITIONS})
|
||||
|
||||
INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||
|
||||
ADD_EXECUTABLE(imagesDbExtractor ${SRC_FILES})
|
||||
TARGET_LINK_LIBRARIES(imagesDbExtractor rtabmap_corelib rtabmap_utilite ${LIBRARIES})
|
||||
TARGET_LINK_LIBRARIES(imagesDbExtractor rtabmap_core rtabmap_utilite ${LIBRARIES})
|
||||
|
||||
SET_TARGET_PROPERTIES( imagesDbExtractor
|
||||
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-imagesDbExtractor)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <rtabmap/utilite/UConversion.h>
|
||||
#include <rtabmap/utilite/UDirectory.h>
|
||||
#include "rtabmap/core/Memory.h"
|
||||
#include "rtabmap/core/util3d.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
@@ -41,7 +42,7 @@ int main(int argc, char** argv)
|
||||
std::set<int> ids = memory->getAllSignatureIds();
|
||||
for(std::set<int>::iterator iter=ids.begin(); iter!=ids.end(); ++iter)
|
||||
{
|
||||
cv::Mat image = memory->getImage(*iter);
|
||||
cv::Mat image = rtabmap::util3d::uncompressImage(memory->getImage(*iter));
|
||||
std::string fileName = uFormat("%d.png", *iter);
|
||||
cv::imwrite(saveDirectory+fileName, image);
|
||||
UINFO("Saved %s", (saveDirectory+fileName).c_str());
|
||||
|
||||
34
tools/OdometryViewer/CMakeLists.txt
Normal file
34
tools/OdometryViewer/CMakeLists.txt
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
SET(SRC_FILES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
SET(INCLUDE_DIRS
|
||||
${PROJECT_SOURCE_DIR}/corelib/include
|
||||
${PROJECT_SOURCE_DIR}/utilite/include
|
||||
${PROJECT_SOURCE_DIR}/guilib/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${PCL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
|
||||
SET(LIBRARIES
|
||||
${PCL_LIBRARIES}
|
||||
${QT_LIBRARIES}
|
||||
)
|
||||
|
||||
add_definitions(${PCL_DEFINITIONS})
|
||||
|
||||
INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||
|
||||
IF(MINGW)
|
||||
ADD_EXECUTABLE(odometryViewer WIN32 ${SRC_FILES})
|
||||
ELSE()
|
||||
ADD_EXECUTABLE(odometryViewer ${SRC_FILES})
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES(odometryViewer rtabmap_core rtabmap_gui rtabmap_utilite ${LIBRARIES})
|
||||
|
||||
SET_TARGET_PROPERTIES( odometryViewer
|
||||
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-odometryViewer)
|
||||
|
||||
387
tools/OdometryViewer/main.cpp
Normal file
387
tools/OdometryViewer/main.cpp
Normal file
@@ -0,0 +1,387 @@
|
||||
|
||||
#include <rtabmap/utilite/ULogger.h>
|
||||
#include <rtabmap/utilite/UEventsManager.h>
|
||||
#include <rtabmap/core/Odometry.h>
|
||||
#include <rtabmap/gui/OdometryViewer.h>
|
||||
#include <rtabmap/core/CameraOpenni.h>
|
||||
#include <QtGui/QApplication.h>
|
||||
|
||||
void showUsage()
|
||||
{
|
||||
printf("\nUsage:\n"
|
||||
"odometryViewer [options]\n"
|
||||
"Options:\n"
|
||||
" -bow # Use bag-of-words odometry (default 0): 0=SURF, 1=SIFT\n"
|
||||
" -bin Use binary odometry (FAST+BRIEF)\n"
|
||||
" -icp Use ICP odometry\n"
|
||||
"\n"
|
||||
" -in #.# Inliers maximum distance (default 0.005 m)\n"
|
||||
" -max # Max features used for matching (default 0=inf)\n"
|
||||
" -min # Minimum inliers to accept the transform (default 20)\n"
|
||||
" -depth #.# Maximum features depth (default 5.0 m)\n"
|
||||
" -i # RANSAC/ICP iterations (default 100)\n"
|
||||
" -lu # Linear update (default 0.0 m)\n"
|
||||
" -au # Angular update (default 0.0 radian)\n"
|
||||
" -reset # Reset countdown (default 0 = disabled)\n"
|
||||
" -d # ICP decimation (default 4)\n"
|
||||
" -v # ICP voxel size (default 0.005)\n"
|
||||
" -s # ICP samples (default 0, not used if voxel is set.)\n"
|
||||
" -f #.# ICP fitness (default 0.01)\n"
|
||||
" -debug Log debug messages\n"
|
||||
"\n"
|
||||
"Examples:\n"
|
||||
" odometryViewer -bow 0 SURF example\n"
|
||||
" odometryViewer -bow 1 SIFT example\n"
|
||||
" odometryViewer -bin FAST/BRIEF example\n"
|
||||
" odometryViewer -icp -in 0.05 -i 30 ICP example\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main (int argc, char * argv[])
|
||||
{
|
||||
ULogger::setType(ULogger::kTypeConsole);
|
||||
ULogger::setLevel(ULogger::kInfo);
|
||||
|
||||
// parse arguments
|
||||
int odomType = 0; // 0=bow 1=bin 2=ICP
|
||||
int bowType = 0;
|
||||
float distance = 0.005;
|
||||
int maxWords = 0;
|
||||
int minInliers = 20;
|
||||
float maxDepth = 5.0f;
|
||||
int iterations = 100;
|
||||
float linearUpdate = 0.0f;
|
||||
float angularUpdate = 0.0f;
|
||||
int resetCountdown = 0;
|
||||
int decimation = 4;
|
||||
float voxel = 0.005;
|
||||
int samples = 10000;
|
||||
float fitness = 0.01f;
|
||||
|
||||
for(int i=1; i<argc; ++i)
|
||||
{
|
||||
if(strcmp(argv[i], "-bow") == 0)
|
||||
{
|
||||
++i;
|
||||
if(i < argc)
|
||||
{
|
||||
bowType = std::atoi(argv[i]);
|
||||
odomType = 0;
|
||||
if(bowType < 0 || bowType > 1)
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-in") == 0)
|
||||
{
|
||||
++i;
|
||||
if(i < argc)
|
||||
{
|
||||
distance = std::atof(argv[i]);
|
||||
if(distance <= 0)
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-max") == 0)
|
||||
{
|
||||
++i;
|
||||
if(i < argc)
|
||||
{
|
||||
maxWords = std::atoi(argv[i]);
|
||||
if(maxWords < 0)
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-min") == 0)
|
||||
{
|
||||
++i;
|
||||
if(i < argc)
|
||||
{
|
||||
minInliers = std::atoi(argv[i]);
|
||||
if(minInliers < 0)
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-depth") == 0)
|
||||
{
|
||||
++i;
|
||||
if(i < argc)
|
||||
{
|
||||
maxDepth = std::atof(argv[i]);
|
||||
if(maxDepth < 0)
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-i") == 0)
|
||||
{
|
||||
++i;
|
||||
if(i < argc)
|
||||
{
|
||||
iterations = std::atoi(argv[i]);
|
||||
if(iterations <= 0)
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-lu") == 0)
|
||||
{
|
||||
++i;
|
||||
if(i < argc)
|
||||
{
|
||||
linearUpdate = std::atof(argv[i]);
|
||||
if(linearUpdate < 0.0f)
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-au") == 0)
|
||||
{
|
||||
++i;
|
||||
if(i < argc)
|
||||
{
|
||||
angularUpdate = std::atof(argv[i]);
|
||||
if(angularUpdate < 0.0f)
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-reset") == 0)
|
||||
{
|
||||
++i;
|
||||
if(i < argc)
|
||||
{
|
||||
resetCountdown = std::atoi(argv[i]);
|
||||
if(resetCountdown < 0)
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-d") == 0)
|
||||
{
|
||||
++i;
|
||||
if(i < argc)
|
||||
{
|
||||
decimation = std::atoi(argv[i]);
|
||||
if(decimation < 1)
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-v") == 0)
|
||||
{
|
||||
++i;
|
||||
if(i < argc)
|
||||
{
|
||||
voxel = std::atof(argv[i]);
|
||||
if(voxel < 0)
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-s") == 0)
|
||||
{
|
||||
++i;
|
||||
if(i < argc)
|
||||
{
|
||||
samples = std::atoi(argv[i]);
|
||||
if(samples < 0)
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-f") == 0)
|
||||
{
|
||||
++i;
|
||||
if(i < argc)
|
||||
{
|
||||
fitness = std::atof(argv[i]);
|
||||
if(fitness < 0.0f)
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
showUsage();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-bin") == 0)
|
||||
{
|
||||
odomType = 1;
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-icp") == 0)
|
||||
{
|
||||
odomType = 2;
|
||||
continue;
|
||||
}
|
||||
if(strcmp(argv[i], "-debug") == 0)
|
||||
{
|
||||
ULogger::setLevel(ULogger::kDebug);
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("Unrecognized option : %s\n", argv[i]);
|
||||
showUsage();
|
||||
}
|
||||
|
||||
UINFO("Odometry used = %s", odomType==0?bowType==0?"Bag-of-words SURF":"Bag-of-words SIFT":odomType==1?"Binary (FAST+BRIEF)":"ICP");
|
||||
UINFO("Inlier/ICP maximum correspondences distance = %f", distance);
|
||||
UINFO("Max features = %d", maxWords);
|
||||
UINFO("Min inliers = %d", minInliers);
|
||||
UINFO("RANSAC/ICP iterations = %d", iterations);
|
||||
UINFO("Max depth = %f", maxDepth);
|
||||
UINFO("Linear update = %f", linearUpdate);
|
||||
UINFO("Angular update = %f", angularUpdate);
|
||||
UINFO("Reset odometry coutdown = %d", resetCountdown);
|
||||
UINFO("Cloud decimation = %d", decimation);
|
||||
UINFO("Cloud voxel size = %f", voxel);
|
||||
UINFO("Cloud samples = %d", samples);
|
||||
UINFO("Cloud fitness = %f", fitness);
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
rtabmap::CameraOpenni camera("", 0, rtabmap::Transform(0,0,1,0, -1,0,0,0, 0,-1,0,0));
|
||||
rtabmap::Odometry * odom = 0;
|
||||
|
||||
if(odomType == 0)
|
||||
{
|
||||
odom = new rtabmap::OdometryBOW(
|
||||
bowType,
|
||||
distance,
|
||||
maxWords,
|
||||
minInliers,
|
||||
iterations,
|
||||
maxDepth,
|
||||
linearUpdate,
|
||||
angularUpdate,
|
||||
resetCountdown);
|
||||
}
|
||||
else if(odomType == 1)
|
||||
{
|
||||
odom = new rtabmap::OdometryBinary(
|
||||
distance,
|
||||
maxWords,
|
||||
minInliers,
|
||||
iterations,
|
||||
maxDepth,
|
||||
linearUpdate,
|
||||
angularUpdate,
|
||||
resetCountdown);
|
||||
}
|
||||
else // ICP
|
||||
{
|
||||
odom = new rtabmap::OdometryICP(
|
||||
decimation,
|
||||
voxel,
|
||||
samples,
|
||||
distance,
|
||||
iterations,
|
||||
fitness,
|
||||
maxDepth,
|
||||
linearUpdate,
|
||||
angularUpdate,
|
||||
resetCountdown);
|
||||
}
|
||||
rtabmap::OdometryThread odomThread(odom);
|
||||
rtabmap::OdometryViewer odomViewer(100, 2, 0.0);
|
||||
UEventsManager::addHandler(&odomThread);
|
||||
UEventsManager::addHandler(&odomViewer);
|
||||
|
||||
odomViewer.setWindowTitle("Odometry viewer");
|
||||
odomViewer.setMinimumWidth(500);
|
||||
odomViewer.setMinimumHeight(300);
|
||||
odomViewer.showMaximized();
|
||||
|
||||
app.processEvents();
|
||||
|
||||
if(camera.init())
|
||||
{
|
||||
odomThread.start();
|
||||
camera.start();
|
||||
|
||||
app.exec();
|
||||
|
||||
camera.kill();
|
||||
odomThread.join(true);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -12,7 +12,7 @@ SET(LIBRARIES
|
||||
INCLUDE_DIRECTORIES(${INCLUDE_DIRS})
|
||||
|
||||
ADD_EXECUTABLE(vocabularyComparison main.cpp)
|
||||
TARGET_LINK_LIBRARIES(vocabularyComparison rtabmap_corelib rtabmap_utilite ${LIBRARIES})
|
||||
TARGET_LINK_LIBRARIES(vocabularyComparison rtabmap_core rtabmap_utilite ${LIBRARIES})
|
||||
|
||||
SET_TARGET_PROPERTIES( vocabularyComparison
|
||||
PROPERTIES OUTPUT_NAME ${PROJECT_PREFIX}-vocabularyComparison)
|
||||
|
||||
Reference in New Issue
Block a user