Wednesday, December 19, 2012

How to successfully compile rgbdslam_freiburg package under ROS

This article was posted in Dec 2012. Later versions of rgbdslam package may differ from our post. I will try to make this post up-to-date and more detailed.

We have been working on rgbdslam package for more than one week to make it compile successfully. The answers in the ROS forum is plentiful, so at the same time it is hard to find out the exact one fits your problem. That is why I am going to compose this article. Since currently I cannot contribute to ROS wiki, and it is not proper to post a tutorial on answer.ros.org, just post a detailed procedure and the problems we encountered here, hope can be helpful for those who are working on the same thing.

Part.I Basic Settings. ROS installation


We are using Ubuntu 12.04 (Precision) and ROS fuerte, on 32 bit system.First you need to follow the instructions on http://www.ros.org/wiki/rgbdslam. If you are new to ROS, better spend at least one week time on the ROS basic things. Keeping in mind that every time downloading packages using svn, you need to enter the /ros_workspace (may differ according to your configuration, mine is /fuerte_workspace) first. Just type 'roscd' in terminal, it should bring you there.

If it brings you into the /opt/ros/fuerte/... something like that, means your ROS_PACKAGE_PATH is not set properly. It is a system environment variable, your can change it in setup.sh. In my case, I added

export ROS_PACKAGE_PATH=~/fuerte_workspace:$ROS_PACKAGE_PATH

to the file. If you still have problem, check .bashrc in your home folder. you can just type

gedit ~/.bashrc

and add 

source ~/fuerte_workspace/setup.bash

Appended on 15 March 2013

I should include this long time ago, about using the rosws command to perform the basic settings for packages and stacks in fuerte.

First, create the overlay and read through the rosws tutorial.
http://www.ros.org/wiki/fuerte/Installation/Overlays
http://mirror.umd.edu/roswiki/doc/independent/api/rosinstall/html/rosws_ros_tutorial.html


So check out the rgbdslam package using svn in the fuerte_workspace. 

svn co http://alufr-ros-pkg.googlecode.com/svn/trunk/rgbdslam_freiburg

Though it is possible to link the package with its source, I do not recommend you to do this. As we know ros is an actively maintained system and many packages are updating frequently. But for most of the users, we only aim for an stable version and do not want to make any change after we successfully integrate it with our own system.

Set rgbdslam_freiburg to a workspace, you should stay in your fuerte_workspace folder.

rosws set rgbdslam_freiburg 

Remember to restart your terminal or source the setup.sh. Try roscd rgbdslam, does it work?

Part.II Install all the dependencies


In fuerte and electric, the command to install all the dependencies are different. Though on wiki, the documentation is well distinguished, on the website answer.ros.org, some replies may be misled. We did not use any command other than provided by the wiki.

Remember to install QT first, it deals with GUI. Install it from Ubuntu software center. Install the QT Creator.

When running

rosdep update

rosdep install rgbdslam_freiburg


it may give you some error. If you are installing QT...then wait until finished. Ubuntu can only install one software at one time. If it says missing package rgbdslam, means you did not download the software in the correct path or your ROS_PACKAGE_PATH not set..go to PART. I...

Any other dependencies missing, you need to check manifest.xml. We simply explain the meaning of the scripts.

<depend package="g2o"/>

means you need to have a ros package, namely g2o, it will compile this package when you compiles the rgbdslam.

<rosdep name="libg2o">

means you need to install a library. So rosdep install rgbdslam_freiburg will install all the libraries.

Problem for eigen, you need to change package to library. When I downloaded the source, it had changed already. See this link http://answers.ros.org/question/38989/rgbdslam-with-ros-fuerte-installed/

A lot of rgbdslam users mentioned change g2o library to package. We explain this in detail in next part.

Part. III g2o, manifest.xml, CMakeLists.txt


Need to say that we spend several days working on these three files.. Following ROS wiki we cannot get it work.. We have read a lot of posts at first beginning, but we missed the useful info because we do not have an idea what problems we were facing.

I think currently most of the people have the same problems as us who failed to do a rosmake. It is because of g2o. If we are using <rosdep name="libg2o"> in the manifest.xml, there is an error"configuring incomplete" when rosmake rgbdslam using<depend package="g2o">, we get an error during compiling g2o package. Same error occurs if we compile g2o separately.

Three main problems we resolved to make the package work are as follows.

A. Follow http://ros.org/wiki/g2o, make sure that you can use roscd g2o to access the folder. Try to rosmake the package, it gives an certificate verification error...Due to the svn command. Actually the ros g2o package need to use svn to download code from openslam and compile it. Check this link http://answers.ros.org/question/50745/rgbdslam-error-trust-certificate-g2o-problem/


I think the author commented out the wrong line in the g2o makefile https://code.ros.org/svn/ros-pkg/stacks/vslam/trunk/g2o/Makefile, or maybe due to different configurations.


Change the corresponding local makefile to

SVN_CMDLINE = svn --no-auth-cache --trust-server-cert --non-interactive


#SVN_CMDLINE = svn --non-interactive --config-dir $(TOP_DIR)/svnconf

rosmake the g2o package again. It should work now. Takes quite a long time cos it needs to perform the svn task...

B. Modify the manifest.xml in rgbdslam package.

Change the g2o to package setting. Means change this line

<rosdep name="libg2o"> 

to

<depend package="g2o"/>


Not sure what is the problem with libg2o. One guy mentioned that you'd better remove the libg2o from software center during rosmake the rgbdslam to avoid conflicts.

C.Modify the CMakeLists.txt in rgbdslam

Remove the line

find_package(g2o REQUIRED)

And compile again. Because the removed line conflicts with the package g2o.
Useful info can be found in these two posts
http://answers.ros.org/question/46669/rgbdslam-on-electric-compiling-error/
http://answers.ros.org/question/46048/couldnt-find-executable-named-rgbdslam/
Seems electric and fuerte got same error..

Now it should be no problem to compile rgbdslam package. I hope this article can be useful for those who are still struggling with rgbdslam package compiling. Leave me a message if you think anything need to be improved.