Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

running version for creating map from /tf, /tf_static and point cloud… #81

Open
wants to merge 4 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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ open3d_catkin/tmp
/open3d_slam_ros/data/*
!/open3d_slam_ros/data/.gitkeep
documentation/build

ros/examples_standalone/open3d_rosbag_mapper_mesher/data/
268 changes: 122 additions & 146 deletions open3d_catkin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,162 +4,138 @@ project(open3d_catkin)
find_package(catkin REQUIRED)

set(CATKIN_PACKAGE_DEPENDENCIES
roscpp
roslib
roscpp
roslib
)

find_package(catkin REQUIRED COMPONENTS
${CATKIN_PACKAGE_DEPENDENCIES}
${CATKIN_PACKAGE_DEPENDENCIES}
)

# Check whether open3d can be found
find_package(Open3D QUIET)

# Color
if(NOT WIN32)
string(ASCII 27 Esc)
set(ColourReset "${Esc}[m")
set(BoldMagenta "${Esc}[1;35m")
set(Magenta "${Esc}[35m")
endif()
if (NOT WIN32)
string(ASCII 27 Esc)
set(ColourReset "${Esc}[m")
set(BoldMagenta "${Esc}[1;35m")
set(Magenta "${Esc}[35m")
endif ()

# 1 - Check whether variable is set -----------------------------------------------------------
if(DEFINED ENV{Open3D_DIR})
set(Open3D_DIR ENV{Open3D_DIR})
find_package(Open3D CONFIG REQUIRED)
message("${BoldMagenta}INFO: Found manually set path to Open3D. Using version located at $ENV{Open3D_DIR}.${ColourReset}")
set(Open3D_INCLUDE_DIR_MAN "${Open3D_DIR}/../../../include/")
message("Open3D include path: ${Open3D_INCLUDE_DIRS} , ${Open3D_INCLUDE_DIR_MAN}")
message("Open3D libs: ${Open3D_LIBRARIES}")
catkin_package(
INCLUDE_DIRS
${Open3D_INCLUDE_DIRS}
${Open3D_INCLUDE_DIR_MAN}
LIBRARIES
${Open3D_LIBRARIES}
CATKIN_DEPENDS
${CATKIN_PACKAGE_DEPENDENCIES}
DEPENDS
Open3D
)
# 2 - Check whether open3d is installed -------------------------------------------------------
elseif(Open3D_FOUND)
message("${BoldMagenta}INFO: Found Open3D.${ColourReset}")

# Path differs whether installed from PPA or (locally) from source
if(EXISTS "${Open3D_DIR}/../../../../include/")
set(Open3D_INCLUDE_DIR_MAN "${Open3D_DIR}/../../../../include/")
else()
if (DEFINED ENV{Open3D_DIR})
set(Open3D_DIR ENV{Open3D_DIR})
find_package(Open3D CONFIG REQUIRED)
message("${BoldMagenta}INFO: Found manually set path to Open3D. Using version located at $ENV{Open3D_DIR}.${ColourReset}")
set(Open3D_INCLUDE_DIR_MAN "${Open3D_DIR}/../../../include/")
endif()

message("Open3D libraries: ${Open3D_LIBRARIES}")
message("Open3D include path: ${Open3D_INCLUDE_DIRS} , ${Open3D_INCLUDE_DIR_MAN}")

# FMT
find_package(fmt QUIET)
if(fmt_FOUND)
message("Linking fmt into open3d_catkin")
catkin_package(
INCLUDE_DIRS
${Open3D_INCLUDE_DIRS}
${Open3D_INCLUDE_DIR_MAN}
LIBRARIES
${Open3D_LIBRARIES}
fmt::fmt
CATKIN_DEPENDS
${CATKIN_PACKAGE_DEPENDENCIES}
DEPENDS
Open3D
message("Open3D include path: ${Open3D_INCLUDE_DIRS} , ${Open3D_INCLUDE_DIR_MAN}")
message("Open3D libs: ${Open3D_LIBRARIES}")
catkin_package(
INCLUDE_DIRS
${Open3D_INCLUDE_DIRS}
${Open3D_INCLUDE_DIR_MAN}
LIBRARIES
${Open3D_LIBRARIES}
CATKIN_DEPENDS
${CATKIN_PACKAGE_DEPENDENCIES}
DEPENDS
Open3D
)
else()
message("fmt not found. If you get linking errors try installing libfmt with sudo apt install libfmt-dev")
catkin_package(
INCLUDE_DIRS
${Open3D_INCLUDE_DIRS}
${Open3D_INCLUDE_DIR_MAN}
LIBRARIES
${Open3D_LIBRARIES}
CATKIN_DEPENDS
${CATKIN_PACKAGE_DEPENDENCIES}
DEPENDS
Open3D
)
endif()

# Linking other packages
catkin_package(
INCLUDE_DIRS
${Open3D_INCLUDE_DIRS}
${Open3D_INCLUDE_DIR_MAN}
LIBRARIES
${Open3D_LIBRARIES}
CATKIN_DEPENDS
${CATKIN_PACKAGE_DEPENDENCIES}
DEPENDS
Open3D
)


# 3 - Compile in catkin workspace -------------------------------------------------------------
else()
message("${BoldMagenta}INFO: Neither variable Open3d_DIR is set, nor could Open3D be found, hence compiling in workspace.${ColourReset}")
message("${BoldMagenta}INFO: This automatic compilation from source requires CMAKE>3.18.${ColourReset}")

# Newer version of CMake is required
cmake_minimum_required(VERSION 3.18)

# Catkinization of open3D
include(ExternalProject)
file(MAKE_DIRECTORY ${CATKIN_DEVEL_PREFIX}/include)

ExternalProject_Add(open3d
GIT_REPOSITORY "https://github.com/isl-org/Open3D"
GIT_TAG "v0.15.1"
GIT_PROGRESS "true"
CMAKE_CACHE_ARGS "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true"
PREFIX "${CMAKE_SOURCE_DIR}"
SOURCE_DIR "${CMAKE_SOURCE_DIR}/open3d"
BINARY_DIR "${CMAKE_SOURCE_DIR}/tmp"
CMAKE_ARGS
-DBUILD_SHARED_LIBS=ON
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DUSE_SYSTEM_EIGEN3=OFF
-DGLIBCXX_USE_CXX11_ABI=ON
-DBUILD_PYTHON_MODULE=OFF
-DCMAKE_INSTALL_PREFIX=${CATKIN_DEVEL_PREFIX}
INSTALL_COMMAND make install && bash "-c" "cp -r ${CMAKE_SOURCE_DIR}/tmp/fmt/include/ ${CATKIN_DEVEL_PREFIX} && cp ${CMAKE_SOURCE_DIR}/tmp/fmt/lib/*.a ${CATKIN_DEVEL_PREFIX}/lib/"
)

catkin_package(
INCLUDE_DIRS
${CATKIN_DEVEL_PREFIX}/include
LIBRARIES
${CATKIN_DEVEL_PREFIX}/lib/libOpen3D.so
${CATKIN_DEVEL_PREFIX}/lib/libfmt.a
CATKIN_DEPENDS
)

#############
## INSTALL ##
#############

install(DIRECTORY ${CATKIN_DEVEL_PREFIX}/include/
DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}
)

install(DIRECTORY ${CATKIN_DEVEL_PREFIX}/lib/
DESTINATION ${CATKIN_GLOBAL_LIB_DESTINATION}
)

if(${MAKE_LOCAL_INSTALL})
message("${BoldMagenta}INFO: Making a local install.${ColourReset}")
add_custom_command (OUTPUT run_install_script___OK
COMMAND ${CMAKE_SOURCE_DIR}/local_install.sh "${CMAKE_SOURCE_DIR}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/)
add_custom_target(
RunInstallScript ALL
DEPENDS run_install_script___OK)
endif()

endif()
# 2 - Check whether open3d is installed -------------------------------------------------------
elseif (Open3D_FOUND)
message("${BoldMagenta}INFO: Found Open3D.${ColourReset}")

# Path differs whether installed from PPA or (locally) from source
if (EXISTS "${Open3D_DIR}/../../../../include/")
set(Open3D_INCLUDE_DIR_MAN "${Open3D_DIR}/../../../../include/")
else ()
set(Open3D_INCLUDE_DIR_MAN "${Open3D_DIR}/../../../include/")
endif ()

message("Open3D libraries: ${Open3D_LIBRARIES}")
message("Open3D include path: ${Open3D_INCLUDE_DIRS} , ${Open3D_INCLUDE_DIR_MAN}")

# FMT
find_package(fmt QUIET)
if (fmt_FOUND)
message("Found fmt.")
else ()
message("fmt not found. If you get linking errors try installing libfmt with sudo apt install libfmt-dev")
endif ()

# Catkinization of open3D
catkin_package(
INCLUDE_DIRS
${Open3D_INCLUDE_DIRS}
${Open3D_INCLUDE_DIR_MAN}
LIBRARIES
${Open3D_LIBRARIES}
CATKIN_DEPENDS
${CATKIN_PACKAGE_DEPENDENCIES}
DEPENDS
Open3D
)

# 3 - Compile in catkin workspace -------------------------------------------------------------
else ()
message("${BoldMagenta}INFO: Neither variable Open3d_DIR is set, nor could Open3D be found, hence compiling in workspace.${ColourReset}")
message("${BoldMagenta}INFO: This automatic compilation from source requires CMAKE>3.18.${ColourReset}")

# Newer version of CMake is required
cmake_minimum_required(VERSION 3.18)

# Catkinization of open3D
include(ExternalProject)
file(MAKE_DIRECTORY ${CATKIN_DEVEL_PREFIX}/include)

ExternalProject_Add(open3d
GIT_REPOSITORY "https://github.com/isl-org/Open3D"
GIT_TAG "v0.15.1"
GIT_PROGRESS "true"
CMAKE_CACHE_ARGS "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true"
PREFIX "${CMAKE_SOURCE_DIR}"
SOURCE_DIR "${CMAKE_SOURCE_DIR}/open3d"
BINARY_DIR "${CMAKE_SOURCE_DIR}/tmp"
CMAKE_ARGS
-DBUILD_SHARED_LIBS=ON
-DCMAKE_BUILD_TYPE=RelWithDebInfo
-DUSE_SYSTEM_EIGEN3=OFF
-DGLIBCXX_USE_CXX11_ABI=ON
-DBUILD_PYTHON_MODULE=OFF
-DCMAKE_INSTALL_PREFIX=${CATKIN_DEVEL_PREFIX}
INSTALL_COMMAND make install && bash "-c" "cp -r ${CMAKE_SOURCE_DIR}/tmp/fmt/include/ ${CATKIN_DEVEL_PREFIX} && cp ${CMAKE_SOURCE_DIR}/tmp/fmt/lib/*.a ${CATKIN_DEVEL_PREFIX}/lib/"
)

catkin_package(
INCLUDE_DIRS
${CATKIN_DEVEL_PREFIX}/include
LIBRARIES
${CATKIN_DEVEL_PREFIX}/lib/libOpen3D.so
${CATKIN_DEVEL_PREFIX}/lib/libfmt.a
CATKIN_DEPENDS
)

#############
## INSTALL ##
#############

install(DIRECTORY ${CATKIN_DEVEL_PREFIX}/include/
DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION}
)

install(DIRECTORY ${CATKIN_DEVEL_PREFIX}/lib/
DESTINATION ${CATKIN_GLOBAL_LIB_DESTINATION}
)

if (${MAKE_LOCAL_INSTALL})
message("${BoldMagenta}INFO: Making a local install.${ColourReset}")
add_custom_command(OUTPUT run_install_script___OK
COMMAND ${CMAKE_SOURCE_DIR}/local_install.sh "${CMAKE_SOURCE_DIR}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/)
add_custom_target(
RunInstallScript ALL
DEPENDS run_install_script___OK)
endif ()

endif ()
85 changes: 85 additions & 0 deletions ros/examples_standalone/open3d_rosbag_mapper_mesher/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
cmake_minimum_required(VERSION 3.5)
project(open3d_rosbag_mapper_mesher)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_compile_options(-O3)

# Source Files in this Project
set(SRC_FILES
src/lib/RosbagMapperRos.cpp
src/lib/MapMesher.cpp
)

# Catkin Dependencies
set(CATKIN_PACKAGE_DEPENDENCIES
roscpp
roslib
open3d_conversions
open3d_slam
open3d_slam_ros
eigen_conversions
tf
tf2
tf2_msgs
tf2_ros
tf2_geometry_msgs
rosbag
interactive_markers
open3d_slam_lua_io
)

# CMake Dependencies
find_package(Eigen3 REQUIRED)
find_package(OpenMP QUIET)
if (OpenMP_FOUND)
add_compile_options("${OpenMP_CXX_FLAGS}")
add_definitions(-Dopen3d_slam_ros_OPENMP_FOUND=${OpenMP_FOUND})
endif ()
find_package(catkin REQUIRED COMPONENTS
${CATKIN_PACKAGE_DEPENDENCIES}
)

# Main Catkin Package
catkin_package(
INCLUDE_DIRS
include
LIBRARIES
yaml-cpp
${PROJECT_NAME}
CATKIN_DEPENDS
${CATKIN_PACKAGE_DEPENDENCIES}
DEPENDS
)

# Include Directories
include_directories(
include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
${YAML_CPP_INCLUDE_DIR}
${OpenMP_CXX_INCLUDE_DIRS}
)

# Main Library
add_library(${PROJECT_NAME}
${SRC_FILES}
)

add_dependencies(${PROJECT_NAME}
${catkin_EXPORTED_TARGETS}
)

target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES}
yaml-cpp
${OpenMP_CXX_LIBRARIES}
)

# Main Node
add_executable(${PROJECT_NAME}_node
src/main_node.cpp)
target_link_libraries(${PROJECT_NAME}_node
${catkin_LIBRARIES}
${PROJECT_NAME}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* MapMesher.h
*
* Created on: Nov 19, 2024
* Author: nubertj
*/

#pragma once

namespace o3d_slam {

} // namespace o3d_slam
Loading