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

Support for X library stand alone #4

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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ doc

# Formatting
.clang-format

cmake-*
66 changes: 35 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# User build settings

set(DUAL_THREAD true) # Set true to process image and inertial data on different
# threads
# threads
set(VERBOSE true) # Set false to disable all publishing and standard output
# stream, except pose at update rate. That will improve runtime.
# stream, except pose at update rate. That will improve runtime.
set(PROFILING false) # Set true to disable compiler flags which are not
# compatible with Callgrind profiling tool.
# compatible with Callgrind profiling tool.
set(UNIT_TESTS false) # Set true to enable unit tests

################################################################################
Expand Down Expand Up @@ -43,17 +43,18 @@ if(NOT ${OpenCV_FOUND})
endif()

find_package(catkin REQUIRED COMPONENTS
x
cv_bridge
image_geometry
dynamic_reconfigure
image_transport
roscpp
tf
message_generation
sensor_msgs
std_msgs
)
cv_bridge
image_geometry
dynamic_reconfigure
image_transport
roscpp
tf
message_generation
sensor_msgs
std_msgs
)

find_package(x REQUIRED)

# Set build flags, depending on the architecture
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
Expand All @@ -66,8 +67,8 @@ if (CMAKE_BUILD_TYPE MATCHES Release)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") # tested on Jetson TX2
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8-a+crypto -mcpu=cortex-a57+crypto -flto -ffast-math -fvect-cost-model=unlimited")
#elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch32") # uncomment with correct check for Snapdragon Flight Pro
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=softfp -flto -ffast-math -fvect-cost-model=unlimited")
#elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch32") # uncomment with correct check for Snapdragon Flight Pro
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=softfp -flto -ffast-math -fvect-cost-model=unlimited")
endif()

if (${PROFILING} MATCHES false)
Expand All @@ -77,26 +78,27 @@ endif()

# Configure this package
generate_dynamic_reconfigure_options(
cfg/xvio.cfg
cfg/xvio.cfg
)

catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS dynamic_reconfigure
INCLUDE_DIRS include
CATKIN_DEPENDS dynamic_reconfigure
)

include_directories (
include
${OpenCV_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
include
${OpenCV_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
${x_INCLUDE_DIRS}
)

# ROS node executable
#####################
set (SOURCE
src/x_vio_ros/node.cpp
src/x_vio_ros/main.cpp
)
src/x_vio_ros/node.cpp
src/x_vio_ros/main.cpp
)

add_executable (x_vio_ros ${SOURCE})

Expand All @@ -105,17 +107,19 @@ add_dependencies(x_vio_ros ${PROJECT_NAME}_gencfg)

# Additional libraries to link against
target_link_libraries(x_vio_ros
${OpenCV_LIBRARIES}
${catkin_LIBRARIES}
)
${OpenCV_LIBRARIES}
${catkin_LIBRARIES}
${x_LIBRARIES}
)

# Testing
#########
if(CATKIN_ENABLE_TESTING)
find_package(rostest REQUIRED)
add_rostest_gtest(utest_node test/test_vio.test test/utest.cpp)
target_link_libraries(utest_node
${OpenCV_LIBRARIES}
${catkin_LIBRARIES}
${rostest_LIBRARIES})
${OpenCV_LIBRARIES}
${catkin_LIBRARIES}
${rostest_LIBRARIES}
${x_LIBRARIES})
endif()