ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Materials & Industrial Technology

Instructions for Compiling Rgbdslam (V2) on a Fresh Ubuntu 16.04 Install (Ros Kinetic) in Virtualbox

Updated on April 28, 2017

1. Preparing your VirtualBox Image

RAM: Allocating 2.5 gigs of ram to virtualbox was not sufficient to compile the point cloud library. Upping it to 4.5 gigs worked though.

VIRTUAL DISK: A disk size of 16GB is too small. Ran out of space 2/3rds of the way through compiling PCL. 40GB easily does the job, though. I used a fixed size virtual disk.

2. Installing ROS Kinetic as per instructions at

sudo su

sudo sh -c 'echo "deb $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

sudo apt-key adv --keyserver hkp:// --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

sudo apt-get update

sudo apt-get install ros-kinetic-desktop-full

sudo rosdep init

hit Ctrl-d to stop being root (if you "sudo su"'d above)

rosdep update

echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc

source ~/.bashrc

sudo apt-get install python-rosinstall

3. Create a catkin workspace to download rgbdslam into

mkdir -p ~/catkin_ws/src

cd ~/catkin_ws


4. Clone rgbdslam from github (

cd ~/catkin_ws/src

git clone

5. If not using a fresh Ubuntu install, check to make sure you don't already have conflicting version of g2o installed

dpkg -l | grep [Gg]2[Oo]

ls /usr/local/lib

ls /usr/lib | grep [Gg]2[Oo]

possibly also check /opt/ros/kinetic/lib?

6. install packages that g2o fork will need to work properly

sudo apt-get install libsuitesparse-dev

this will prevent errors mentioning "cholmod" or variations thereof

note: g2o will compile without doing this, but you'll have the above error later.

7. Download and extract eigen 3.2.10 header files -- eigen consists only of header files, no binary libs to compile or link against

mkdir ~/src

cd ~/src


mkdir eigen

tar -xvjf 3.2.10.tar.bz2 -C eigen --strip-components 1

note: no need to make or make install. we'll use the header files in place.

8. download g2o fork as per instructions at

cd ~/src

git clone

cd ~/src/g2o

mkdir ~/src/g2o/build

cd ~/src/g2o/build

9. Configure g2o fork to use eigen 3.2.10 header files instead of system header files

vi ~/src/g2o/CMakeLists.txt

change line 251 from:



SET(G2O_EIGEN3_INCLUDE "<absolute path of your home directory>/src/eigen" CACHE PATH "Directory of Eigen3")

save the file and exit (:wq)

note: check to make sure the system eigen3 headers are in /usr/include/eigen3

10. Build & install g2o fork -- this will fail with errors if you're using the system eigen headers.

cd ~/src/g2o/build

cmake ../


sudo make install

(installs to /usr/local/lib)

11. Download PCL 1.8 (instead of using system PCL 1.7)

cd ~/src


tar -xvzf pcl-1.8.0.tar.gz

12. Configure PCL to compile with C++ 2011 support

We need to compile pcl with c++ 2011 support because we're going to be compiling rdbgslam with c++ 2011 support and if we don't, rgbdslam will segfault on startup.

the PCL 1.7 library that comes installed with ubuntu 16.04 is not compiled with c++ 2011 support.

cd ~/src/pcl-pcl-1.8.0

vi CMakeLists.txt

add the following to line #146 of CMakeLists.txt (right after endif()):


save the file and exit (:wq)

13. Compile and install PCL

This will take forever - 2.5gig ram was insufficient for the task in virtualbox. 4.5gig works.

mkdir build

cd build

cmake ../

To ensure that c++ 2011 support is being compiled into PCL, run:

make VERBOSE=1

and then copy some compiler output to a text file and search it to see if it contains "-stdc++11"

If you can't find -stdc++11 in the output, then you probably inserted it into the wrong place in the CMakeLists.txt

perhaps press ctrl-c and restart the build with just 'make' to clean up the output

sudo make install

14. Configure rgbdslam

cd ~/catkin_ws/src/rgbdslam_v2

vi CMakeLists.txt

change line 79 from:

find_package(PCL 1.7 REQUIRED COMPONENTS common io)


find_package(PCL 1.8 REQUIRED COMPONENTS common io)

sudo vi /opt/ros/kinetic/share/pcl_ros/cmake/pcl_rosConfig.cmake

on line 112, for each pcl library "libpcl<xxx>.so", replace the path prefix "/usr/lib/x86_64-linux" with "/usr/local/lib".. Some helpful vi macros to speed things up:

:map . /libpcl^M (^M is typed by pressing Ctrl-v then Ctrl-Enter)

:map , 21h21xilocal/lib/^[ (^[ is typed by pressing Ctrl-v then Ctrl-Escape)

now you can use '.' to advance to the next pcl library
and ',' to replace "/usr/lib/x86_64-linux" with "/usr/local/lib"

save the file and exit (:wq)

15. Build siftgpu library (bundled with rgbdslam)

cd ~/catkin_ws/src/rgbdslam_v2/external/SiftGPU

sudo apt-get install libglew-dev

sudo apt-get install libdevil1c2 libdevil-dev


16. Build rgbdslam

cd ~/catkin_ws

vi src/rgbdslam_v2/CMakeLists.txt

Add the following line to the bottom of the file:



Once you've gottem through the cmake configuration and are actually compiling cpp files, hit Ctrl-C.

cd build/rgbdslam_v2

make VERBOSE=1

check that the compiler output contains the flag "-std=c++11"

Hit Ctrl-C and then type "make" to clean up the console output.

On the final linking of the rgbdslam executable, you may wish to do another 'make VERBOSE=1' to ensure that the compiler is finding our custom compiled libpcl* libraries in /usr/local/lib. Although it probably isn't necessary.

make install

17 Test rgbdslam executable

start roscore in another terminal


rgbdslam seems to segfault on exit sometimes but otherwise seems to work fine.

18. Complete building rgbdslam package & copy launch files into it

cp ~/catkin_ws/devel/lib/rgbdslam/rgbdslam ~/catkin_ws/install/share/rgbdslam/

mkdir ~/catkin_ws/install/share/rgbdslam/launch

cp ~/catkin_ws/src/rgbdslam_v2/launch/* ~/catkin_ws/install/share/rgbdslam/launch/

cp ~/catkin_ws/src/rgbdslam_v2/test/*.launch ~/catkin_ws/install/share/rgbdslam/launch/

cp -R ~/catkin_ws/src/rgbdslam_v2/rgbd_benchmark ~/catkin_ws/install/share/rgbdslam/

19. Update ROS package path to include packages in ~/catkin_ws/install/share/

source ~/catkin_ws/install/setup.bash

(you'll need to do this each time you open a new terminal... put in ~/.bashrc?)

20. Test run

note: more datasets available at

cd ~/catkin_ws/src/rgbdslam_v2/test


make sure roscore is running in another terminal

roslaunch rgbdslam test_settings.launch bagfile_name:="/home/<your username>/catkin_ws/src/rgbdslam_v2/test/rgbd_dataset_freiburg1_xyz.bag"


    0 of 8192 characters used
    Post Comment

    No comments yet.