Re: use RTABMAP with c++
Posted by
matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/use-RTABMAP-with-c-tp1005p1006.html
Hi,
You should put your project outside the rtabmap source tree. Rtabmap should be also installed ($ make install) so that your project can find it with CMake.
Example:
$ cd rtabmap/build
$ cmake ..
$ make
$ sudo make install
(by default rtabmap is installed in "/usr/local")
$ cd
~$ mkdir test
~$ cd test
~/test$ wget https://raw.githubusercontent.com/wiki/introlab/rtabmap/doc/Tutorials/CplusplusExampleRGBD/CMakeLists.txt
~/test$ wget https://raw.githubusercontent.com/introlab/rtabmap/master/examples/RGBDMapping/main.cpp
~/test$ wget https://raw.githubusercontent.com/introlab/rtabmap/master/examples/RGBDMapping/MapBuilder.h
~/test$ cmake .
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- checking for module 'eigen3'
-- found eigen3, version 3.2.0
-- Found eigen: /usr/include/eigen3
-- Boost version: 1.54.0
-- Found the following Boost libraries:
-- system
-- filesystem
-- thread
-- date_time
-- iostreams
-- serialization
-- checking for module 'openni-dev'
-- package 'openni-dev' not found
-- Found openni: /usr/lib/libOpenNI.so
-- Found libusb-1.0: /usr/include
-- checking for module 'flann'
-- found flann, version 1.8.4
-- Found Flann: /usr/lib/x86_64-linux-gnu/libflann_cpp_s.a
-- checking for module 'openni-dev'
-- package 'openni-dev' not found
-- Found qhull: /usr/lib/x86_64-linux-gnu/libqhull.so
-- checking for module 'openni-dev'
-- package 'openni-dev' not found
-- looking for PCL_COMMON
-- Found PCL_COMMON: /usr/lib/libpcl_common.so
-- looking for PCL_OCTREE
-- Found PCL_OCTREE: /usr/lib/libpcl_octree.so
-- looking for PCL_IO
-- Found PCL_IO: /usr/lib/libpcl_io.so
-- looking for PCL_KDTREE
-- Found PCL_KDTREE: /usr/lib/libpcl_kdtree.so
-- looking for PCL_SEARCH
-- Found PCL_SEARCH: /usr/lib/libpcl_search.so
-- looking for PCL_SAMPLE_CONSENSUS
-- Found PCL_SAMPLE_CONSENSUS: /usr/lib/libpcl_sample_consensus.so
-- looking for PCL_FILTERS
-- Found PCL_FILTERS: /usr/lib/libpcl_filters.so
-- looking for PCL_FEATURES
-- Found PCL_FEATURES: /usr/lib/libpcl_features.so
-- looking for PCL_KEYPOINTS
-- Found PCL_KEYPOINTS: /usr/lib/libpcl_keypoints.so
-- looking for PCL_GEOMETRY
-- Found PCL_GEOMETRY: /usr/include/pcl-1.7
-- looking for PCL_SEGMENTATION
-- Found PCL_SEGMENTATION: /usr/lib/libpcl_segmentation.so
-- looking for PCL_VISUALIZATION
-- Found PCL_VISUALIZATION: /usr/lib/libpcl_visualization.so
-- looking for PCL_OUTOFCORE
-- Found PCL_OUTOFCORE: /usr/lib/libpcl_outofcore.so
-- looking for PCL_REGISTRATION
-- Found PCL_REGISTRATION: /usr/lib/libpcl_registration.so
-- looking for PCL_RECOGNITION
-- Found PCL_RECOGNITION: /usr/lib/libpcl_recognition.so
-- looking for PCL_SURFACE
-- Found PCL_SURFACE: /usr/lib/libpcl_surface.so
-- looking for PCL_PEOPLE
-- Found PCL_PEOPLE: /usr/lib/libpcl_people.so
-- looking for PCL_TRACKING
-- Found PCL_TRACKING: /usr/lib/libpcl_tracking.so
-- looking for PCL_APPS
-- Found PCL_APPS: /usr/lib/libpcl_apps.so
-- Found PCL: ....
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found
-- Found Qt4: /usr/bin/qmake (found version "4.8.6")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mathieu/test
~/test$ make
[ 33%] Generating moc_MapBuilder.cxx
Scanning dependencies of target rgbd_example
[ 66%] Building CXX object CMakeFiles/rgbd_example.dir/main.cpp.o
[100%] Building CXX object CMakeFiles/rgbd_example.dir/moc_MapBuilder.cxx.o
Linking CXX executable rgbd_example
[100%] Built target rgbd_example
~/test$ ./rgbd_example
Usage:
rtabmap-rgbd_mapping driver
driver Driver number to use: 0=OpenNI-PCL, 1=OpenNI2, 2=Freenect, 3=OpenNI-CV, 4=OpenNI-CV-ASUS
cheers,
Mathieu