In the following, the steps to carry out the installation and compilation of the LSD-SLAM project are described:
1- Once ROS has been installed and configured and we have created a Catkin Workspace, we open a terminal on Ubuntu and we navigate to the folder that we are using as the Catkin Workspace by running the following command:
cd <path_to_catkin_ws>/src
In the preceding command, where <path_to_catkin_ws> appears one must put the location in which the Catkin Workspace is found within the Ubuntu file-system.
2- Within the Workspace we clone the principal "branch" of the LSD-SLAM project with the command: git clone https://github.com/tum-vision/lsd_slam.git
3- In the following, we change to the Catkin "branch" of the LSD-SLAM project with these commands:
cd lsd_slam/
4- With the preceding commands, we should already have available in the Workspace the code of the LSD-SLAM "branch" of Catkin, but even so we next perform a simple manual verification to prove that the structure of the project files that we have in our Workspace is in correspondence with the Catkin "branch" of the LSD-SLAM project.
We run the command: ls
The response that we should receive should be the following:
LICENSE lsd_slam lsd_slam_core lsd_slam_viewer README.md
5- At this point, it would only remain for us to install the dependencies that the project needs in order to be compiled.
We must install the following libraries:
ros-indigo-libg2o ros-indigo-cv-bridge liblapack-dev libblas-dev freeglut3-dev libqglviewer-dev libsuitesparse-dev libx11-dev
The installation of these libraries carried out with the following single command:
sudo apt-get install ros-indigo-libg2o ros-indigo-cv-bridge liblapack-dev libblas-dev freeglut3-dev libqglviewer-dev libsuitesparse-dev libx11-dev
6) At this point, we try to perform the compilation. For that, we first of all change to the Catkin Workspace with the instruction: cd <path_to_catkin_ws>
Next we run the command that performs the compilation: catkin_make
In case the compilation is successful, you can go to step 11 to perform the execution test of the project, being able to visualize that way that the whole system works correctly.
7- If the compilation has failed, this is probably because some configuration files of the project are not set up properly for compilation in ROS Indigo with Catkin Workspace. First of all, we open the file "package.xml" both in the folder "lsd_slam/lsd_slam_viewer" and in the folder "lsd_slam/lsd_slam_core". Once both files are open, we will verify that inside them there are the two following instructions:
...
<build_depend>cmake_modules</build_depend>
...
<run_depend>cmake_modules</run_depend>
...
In case they don't exist, we will introduce them in the following way:
The instruction <build_depend>cmake_modules</build_depend> will go right after all of the instructions of type <build_depend>
The instruction <run_depend>cmake_modules</run_depend> will go just after all of the instructions of type <run_depend>.
8- We continue verification of the configuration files. Now we will open the file "CMakeFiles.txt" both in the folder "lsd_slam/lsd_slam_viewer" and in the folder "lsd_slam/lsd_slam_core" and we will verify that in both files there is the following instruction:
...
find_package(cmake_modules REQUIRED)
...
In case it doesn't exist, we introduce it just before the first instruction of the type "find_package".
9- We will finish the test of the configuration files by opening the file "CMakeLists.txt" in the folder "lsd_slam/lsd_slam_core" and verifying that the following instruction exists:
...
target_link_libraries(lsdslam ${FABMAP_LIB} ${G2O_LIBRARIES} ${catkin_LIBRARIES} csparse cxsparse X11)
...
In case the preceding instruction doesn't exist, there must exist another similar one without the added library "X11", therefore the only thing that we would have to do would be to add the library "X11" to the instruction "target_link_libraries" as is shown in the instruction above.
10- At this point we return to compiling the project as explained in step 6. The commands for compiling are the following:
cd <path_to_catkin_ws>
catkin_make
In this case the compilation ought to be performed correctly since all of the configuration files are adapted for the compilation in ROS Indigo with Catkin Workspace.
11) At this point, once we have already succeeded in compiling the project, we will carry out a small test of the system with the aid of one of the ".bag" files that the creators of the project provide to test the LSD_SLAM system.
The ".bag" file that we will utilize can be downloaded here: LSD_room.bag.zip
Once the file "LSD_room.bag.zip" is downloaded, it will have to be decompressed.
In the following, we will begin to start the nodes needed to execute the test.
We will open a new terminal and enter the following command to start the ROS CORE: roscore
We open a new terminal and enter the following command to execute the LSD-SLAM visualization node: rosrun lsd_slam_viewer viewer
We open a new terminal and enter the following command to execute the main LSD-SLAM node: rosrun lsd_slam_core live_slam image:=/image_raw camera_info:=/camera_info
At this point it only remains for us to execute the file "LSD_room.bag" with the following instruction: rosbag play <path>/LSD_room.bag
In the command above, <path> would be the location in the Ubuntu file-system where the file "LSD_room.bag" is stored.
The result would be something like this:
Final note: If on execution the "viewer" produces some error, make sure that you have the latest drivers of the graphics card and have installed all the software updates of Ubuntu.
In case of Ubuntu being virtualized with VirtualBox, make sure that you have installed all the software updates of Ubuntu and also have installed "Guest Additions", and if there are still errors appearing that don't abort execution of the node, they don't matter because they are minor problems of the virtualization that don't hinder the correct execution of the "viewer".
References:
Official page of the LSD-SLAM project: vision.in.tum.de/research/lsdslam
Official page of the LSD-SLAM project code: github.com/tum-vision/lsd_slam
Official documentation of "Catkin": catkin/conceptual_overview
Official tutorial of installation and ROS configuration: InstallingandConfiguringROSEnvironment Official tutorial for creation of the Catkin Workspace: catkin/Tutorials/create_a_workspace