ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

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 http://wiki.ros.org/kinetic/Installation/Ubuntu

sudo su

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

sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --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

catkin_make

4. Clone rgbdslam from github (https://github.com/felixendres/rgbdslam_v2)

cd ~/catkin_ws/src

git clone https://github.com/felixendres/rgbdslam_v2

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

wget http://bitbucket.org/eigen/eigen/get/3.2.10.tar.bz2

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 https://github.com/felixendres/rgbdslam_v2

cd ~/src

git clone https://github.com/felixendres/g2o.git

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 ${EIGEN3_INCLUDE_DIR} CACHE PATH "Directory of Eigen3")

to:

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 ../

make

sudo make install

(installs to /usr/local/lib)

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

cd ~/src

wget https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.0.tar.gz

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()):

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

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)

to:

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

make

16. Build rgbdslam

cd ~/catkin_ws

vi src/rgbdslam_v2/CMakeLists.txt

Add the following line to the bottom of the file:

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

catkin_make

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

~/catkin_ws/devel/lib/rgbdslam/rgbdslam

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 http://vision.in.tum.de/data/datasets/rgbd-dataset/download

cd ~/catkin_ws/src/rgbdslam_v2/test

wget http://vision.in.tum.de/rgbd/dataset/freiburg1/rgbd_dataset_freiburg1_xyz.bag

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"

Comments

    0 of 8192 characters used
    Post Comment

    • profile image

      Sam Jayen 

      4 months ago

      Hi!

      In Step 19. when I try to source ~/catkin_ws/install/setup.bash I get the message "No such file or directory". There is no setup.bash file in there.

      Can you please help me out?

      It would really be a shame to get stuck at penultimate step after successfully doing all the previous steps.

      Thank you in advance.

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://hubpages.com/privacy-policy#gdpr

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)