domingo, 30 de noviembre de 2014

Tutorial -- Building of LSD-SLAM on ROS with Catkin Workspace (ROS Indigo + Ubuntu 14.04 [64-bit]) (English)

In this tutorial, we'll see how to compile the LSD-SLAM project on Ubuntu 14.04 using the ROS (Robot Operating System) framework in its "Indigo Igloo" version and specifically using "Catkin", which is currently the official building system of ROS and has become the successor of the original ROS building system known as "Rosbuild".   

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/   
git checkout catkin

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 

29 comentarios:

  1. I got an error message:

    make[2]: *** No rule to make target `/usr/lib/x86_64-linux-gnu/libopencv_video.so.2.4.8', needed by `/home/morzh/catkin_ws/devel/lib/lsd_slam_viewer/viewer'. Stop.

    ResponderEliminar
    Respuestas
    1. actually i've got seceral error messages, all about libopencv_video.so.2.4.8
      But opnecv libs are in /usr/local/lib, not in /usr/lib/x86_64-linux-gnu/. How to solve this problem ?

      Eliminar
    2. Hello, are you running Linux in virtual box or other machine virtual system?

      Eliminar
    3. @enriquesaiz: Is there any problem running LSD SLAM on Ubuntu in Virtualbox?

      Eliminar
    4. Hello @Anton were you able to solve this problem, I am having the same issue. Please let me know

      Eliminar
  2. I do not use virtual box. Just "ordinary" installation. Btw, one more question: I did not find CMakeFiles.txt in LSD_SLAM, just edited CMakeLists.txt instead

    ResponderEliminar
    Respuestas
    1. Hello,

      1- You need to update the Graphic Drivers.

      2- I believe that the Indigo branch has been updated and these files have been deleted. The project works correctly without these files.

      Best Regards.

      Eliminar
    2. Where is the Indigo branch of LSD_SLAM, I see only three branches: master, catkin and catkin-mac.

      Eliminar
  3. I have a problem. The color-coded depth didn't show after running live_slam node and playing the bag file. Why?

    ResponderEliminar
  4. Note, you need to patch the CMakelists.txt to include "find_package(cmake_modules REQUIRED)" or you'll get a compilation error on Indigo.

    ResponderEliminar
  5. Unfortunately, compilation still fails for me with: ROSOutput3DWrapper.cpp:28:46: fatal error: lsd_slam_viewer/keyframeGraphMsg.h: No such file or directory
    #include "lsd_slam_viewer/keyframeGraphMsg.h"

    ResponderEliminar
  6. whenever I run
    "rosrun lsd_slam_viewer viewer"
    I got an error message
    "[rosrun] Couldn't find executable named viewer below /home/moon/catkin_ws/src/lsd_slam/lsd_slam_viewer"
    Do you have any idea for my problem??

    ResponderEliminar
  7. Este comentario ha sido eliminado por el autor.

    ResponderEliminar
  8. i got an error after catkin_make saying:-----

    Invoking "make -j4 -l4" failed

    ResponderEliminar
  9. successfully run LSD-SLAM but i want to go in coding and try some experiment (white-box testing).. i am new for this platform, i don't know how to do that. If any one knows please let me know.

    ResponderEliminar
  10. I followed the instructions and had an error saying that LSDParamsConfig.h and LSDDebugParamsConfig.h were not found. To build these, I first ran the rosmake instructions, which generated the file. Then I copied it to to the folder //src/lsd_slam/lsd_slam_core/src/IOWrapper/ROS/lsd_slam_core

    Then catkin_make worked out fine.

    ResponderEliminar
    Respuestas
    1. Este comentario ha sido eliminado por el autor.

      Eliminar
    2. This worked well, but the target live_slam was built in another directory (devel/lib/lsd_slam_core) I had to copy the built binary live_slam from there to the folder src/lsd_slam/lsd_slam_core/bin. Now it seems to work...

      Eliminar
  11. Followed the instruction and sucessfully ran the source code. Thank you very much

    ResponderEliminar
  12. Hello everybody! I'm new to LSD SLAM and I'm using ROS indigo on Ubuntu 14.04.3. I am having the sam issue that @Unknown:fatal error: lsd_slam_core/LSDParamsConfig.h: No such file or directory #include "lsd_slam_core/LSDParamsConfig.h"
    I followed his instructions:
    1. Run rosmake lsd_slam ---> successfully

    ResponderEliminar
  13. 2. Run catkin_make --> failed
    haidara@haidara-virtual-machine:~/catkin_ws$ catkin_make
    [ 67%] Building CXX object lsd_slam/lsd_slam_core/CMakeFiles/dataset.dir/src/main_on_images.cpp.o
    In file included from /home/haidara/catkin_ws/src/lsd_slam/lsd_slam_core/src/main_on_images.cpp:34:0:
    /home/haidara/catkin_ws/src/lsd_slam/lsd_slam_core/src/IOWrapper/ROS/rosReconfigure.h:25:43: fatal error: lsd_slam_core/LSDParamsConfig.h: No such file or directory
    #include "lsd_slam_core/LSDParamsConfig.h"
    ^
    compilation terminated.
    make[2]: *** [lsd_slam/lsd_slam_core/CMakeFiles/dataset.dir/src/main_on_images.cpp.o] Error 1
    make[1]: *** [lsd_slam/lsd_slam_core/CMakeFiles/dataset.dir/all] Error 2
    make: *** [all] Error 2
    Invoking "make -j1 -l1" failed

    ResponderEliminar
  14. After I am trying to run LSD_SLAM visualization, LSD_SLAM node and LSD_room.bag operations runs as follows:
    I open my 1st terminal : roscore
    2nd terminal: rosrun lsd_slam_viewer viewer ---> successfully run
    haidara@haidara-virtual-machine:~$ rosrun lsd_slam_viewer viewer
    Started QApplication thread
    Started ROS thread
    [ INFO] [1496188297.980113596]: lsd_slam_viewer started

    ResponderEliminar
  15. 3rd terminal: rosrun lsd_slam_core dataset_slam _files:= _hz:= _calib:= ---> failed run
    haidara@haidara-virtual-machine:~/catkin_ws/src$ rosrun lsd_slam_core dataset_slam _files:=/home/haidara/catkin_ws/src/lsd_slam/images _hz:=0 _calib:=/home/haidara/catkin_ws/src/lsd_slam/cameraCalibration.cfg
    [rosrun] Couldn't find executable named dataset_slam below /home/haidara/catkin_ws/src/lsd_slam/lsd_slam_core

    ResponderEliminar
  16. 4th terminal:rosbag play ~/LSD_room.bag ---> successfully run
    haidara@haidara-virtual-machine:~/catkin_ws/src$ rosbag play /home/haidara/catkin_ws/src/lsd_slam/LSD_room.bag
    [ INFO] [1496188710.258080164]: Opening /home/haidara/catkin_ws/src/lsd_slam/LSD_room.bag
    Waiting 0.2 seconds after advertising topics... done.
    Hit space to toggle paused, or 's' to step.
    [RUNNING] Bag Time: 1400002262.214285 Duration: 0.000000 / 55.334465 [RUNNING] Bag Time: 1400002262.214350 Duration: 0.000065 / 55.334465
    .
    .
    Duration: 55.232139 / 55.334465 [RUNNING] Bag Time: 1400002317.467412 Duration: 55.253127 / 55.334465 [RUNNING] Bag Time: 1400002317.488689 Duration: 55.274404 / 55.334465 [RUNNING] Bag Time: 1400002317.508446 Duration: 55.294161 / 55.334465
    Done.

    ResponderEliminar
  17. Any ideas on what might be wrong? I followed the installation procedure as in the README and any help would be much appreciated.

    ResponderEliminar
  18. I get this error while compiling:

    CMake Error at /opt/ros/indigo/share/catkin/cmake/catkin_workspace.cmake:95 (message):
    This workspace contains non-catkin packages in it, and catkin cannot build
    a non-homogeneous workspace without isolation. Try the
    'catkin_make_isolated' command instead.
    Call Stack (most recent call first):
    CMakeLists.txt:63 (catkin_workspace)


    -- Configuring incomplete, errors occurred!
    See also "/home/wehubs/catkin_ws/build/CMakeFiles/CMakeOutput.log".
    See also "/home/wehubs/catkin_ws/build/CMakeFiles/CMakeError.log".
    make: *** [cmake_check_build_system] Error 1
    Invoking "make cmake_check_build_system" failed

    ResponderEliminar
  19. When I run -- rosrun lsd_slam_core live_slam image:=/image_raw camera_info:=/camera_info
    I get the following error:
    double free or corruption (out)
    Aborted (core dumped)
    Any idea what might be wrong ?

    ResponderEliminar