Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

MacOSX and Ubuntu stand-alone build #176

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ and one window showing the 3D map (from viewer). If for some reason the initiali


# 2. Installation
We tested LSD-SLAM on two different system configurations, using Ubuntu 12.04 (Precise) and ROS fuerte, or Ubuntu 14.04 (trusty) and ROS indigo. Note that building without ROS is not supported, however ROS is only used for input and output, facilitating easy portability to other platforms.
We tested LSD-SLAM on four different system configurations, using Ubuntu 12.04 (Precise) and ROS fuerte, Ubuntu 14.04 (trusty) and ROS indigo,
Ubuntu 14.04 stand-alone, and MacOSX Yosemite stand-alone. Since ROS is used for input and output, the stand-alone builds do not install any
front-end executable programs.


## 2.1 ROS fuerte + Ubuntu 12.04
Expand Down Expand Up @@ -91,9 +93,37 @@ Compile the two package by typing:



## 2.3 Stand-alone CMake build
Install system-wide dependencies through your package manager (brew, apt-get - as above, but omitting ros-related packages) or
manually. The command to install dependencies with Homebrew (http://brew.sh) is given below.

brew install eigen suite-sparse opencv cmake

## 2.3 openFabMap for large loop-closure detection [optional]
Clone and build g2o in the directory of your choice.

git clone https://github.com/RainerKuemmerle/g2o
cd g2o
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=../install
make -j8
make install

Continue as you would for any other cmake build. The only difference is that you will only build lsd_slam_core, and that you will
probably have to provide the BUILD_WITHOUT_ROS, EXTRA_LIB_DIRS, and EXTRA_INCLUDE_DIRS variables to cmake.

git clone https://github.com/tum-vision/lsd_slam.git lsd_slam
cd lsd_slam/lsd_slam_core
mkdir build
cd build
cmake -DEXTRA_LIB_DIRS=/path/to/g2o/lib/ -DEXTRA_INCLUDE_DIRS=/path/to/g2o/include -DBUILD_WITHOUT_ROS=ON ../
make -j8

Please note that this process only builds the lsd_slam library, and no programs with which you can test it. This build method could be
useful in integrating lsd_slam with other projects.


## 2.4 openFabMap for large loop-closure detection [optional]
If you want to use openFABMAP for large loop closure detection, uncomment the following lines in `lsd_slam_core/CMakeLists.txt` :

#add_subdirectory(${PROJECT_SOURCE_DIR}/thirdparty/openFabMap)
Expand Down
100 changes: 65 additions & 35 deletions lsd_slam_core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
cmake_minimum_required(VERSION 2.8.7)
project(lsd_slam_core)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
if(NOT BUILD_WITHOUT_ROS)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

# Set the build type. Options are:
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage
# Debug : w/ debug symbols, w/o optimization
# Release : w/o debug symbols, w/ optimization
# RelWithDebInfo : w/ debug symbols, w/ optimization
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries
set(ROS_BUILD_TYPE Release)
# Set the build type. Options are:
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage
# Debug : w/ debug symbols, w/o optimization
# Release : w/o debug symbols, w/ optimization
# RelWithDebInfo : w/ debug symbols, w/ optimization
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries
set(ROS_BUILD_TYPE Release)

rosbuild_init()
rosbuild_init()
endif()

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
Expand All @@ -27,20 +29,25 @@ find_package(X11 REQUIRED)
#add_definitions("-DHAVE_FABMAP")
#set(FABMAP_LIB openFABMAP )

# Dynamic Reconfigure Services
rosbuild_find_ros_package(dynamic_reconfigure)
include(${dynamic_reconfigure_PACKAGE_PATH}/cmake/cfgbuild.cmake)
gencfg()

# SSE flags
rosbuild_check_for_sse()
add_definitions("-DUSE_ROS")
if(NOT BUILD_WITHOUT_ROS)
# Dynamic Reconfigure Services
rosbuild_find_ros_package(dynamic_reconfigure)
include(${dynamic_reconfigure_PACKAGE_PATH}/cmake/cfgbuild.cmake)
gencfg()

# SSE flags
rosbuild_check_for_sse()
add_definitions("-DUSE_ROS")
else()
find_package(Boost REQUIRED COMPONENTS thread system)
find_package(OpenCV REQUIRED)
endif()
add_definitions("-DENABLE_SSE")

# Also add some useful compiler flag
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${SSE_FLAGS} -march=native -std=c++0x"
)
)

# Set source files
set(lsd_SOURCE_FILES
Expand All @@ -65,34 +72,57 @@ set(lsd_SOURCE_FILES
${PROJECT_SOURCE_DIR}/src/GlobalMapping/g2oTypeSim3Sophus.cpp
${PROJECT_SOURCE_DIR}/src/GlobalMapping/TrackableKeyFrameSearch.cpp
)

if(NOT BUILD_WITHOUT_ROS)
set(ADDITIONAL_ROS_SOURCES
${PROJECT_SOURCE_DIR}/src/IOWrapper/ROS/ROSImageStreamThread.cpp
${PROJECT_SOURCE_DIR}/src/IOWrapper/ROS/ROSOutput3DWrapper.cpp
)
endif()
set(SOURCE_FILES
${lsd_SOURCE_FILES}
${PROJECT_SOURCE_DIR}/src/IOWrapper/ROS/ROSImageStreamThread.cpp
${PROJECT_SOURCE_DIR}/src/IOWrapper/ROS/ROSOutput3DWrapper.cpp
${PROJECT_SOURCE_DIR}/src/IOWrapper/OpenCV/ImageDisplay_OpenCV.cpp
${ADDITIONAL_ROS_SOURCES}
)

# The variables EXTRA_INCLUDE_DIRS and EXTRA_LIB_DIRS can be used to
# inject non-standard library paths for local builds of libraries that
# aren't in system directories - for example, g2o
include_directories(
${EIGEN3_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/thirdparty/Sophus
${CSPARSE_INCLUDE_DIR} #Has been set by SuiteParse
${CHOLMOD_INCLUDE_DIR} #Has been set by SuiteParse
${EXTRA_INCLUDE_DIRS}
)
link_directories(${EXTRA_LIB_DIRS})


# build shared library.
rosbuild_add_library(lsdslam SHARED ${SOURCE_FILES})
target_link_libraries(lsdslam ${FABMAP_LIB} g2o_core g2o_stuff csparse cxsparse g2o_solver_csparse g2o_csparse_extension g2o_types_sim3 g2o_types_sba X11)
rosbuild_link_boost(lsdslam thread)


# build live ros node
rosbuild_add_executable(live_slam src/main_live_odometry.cpp)
target_link_libraries(live_slam lsdslam)


# build image node
rosbuild_add_executable(dataset_slam src/main_on_images.cpp)
target_link_libraries(dataset_slam lsdslam)

# build shared library.
if (BUILD_WITHOUT_ROS)
set(PLATFORM_SPECIFIC_LIBRARIES ${Boost_LIBRARIES}
${OpenCV_LIBS}
)
add_library(lsdslam SHARED ${SOURCE_FILES})
else()
set(PLATFORM_SPECIFIC_LIBRARIES X11)
rosbuild_add_library(lsdslam SHARED ${SOURCE_FILES})
rosbuild_link_boost(lsdslam thread)
endif()

target_link_libraries(lsdslam ${FABMAP_LIB} g2o_core g2o_stuff cxsparse g2o_solver_csparse g2o_csparse_extension g2o_types_sim3 g2o_types_sba
${PLATFORM_SPECIFIC_LIBRARIES}
)


if(NOT BUILD_WITHOUT_ROS)
# build live ros node
rosbuild_add_executable(live_slam src/main_live_odometry.cpp)
target_link_libraries(live_slam lsdslam)


# build image node
rosbuild_add_executable(dataset_slam src/main_on_images.cpp)
target_link_libraries(dataset_slam lsdslam)
endif()
Loading