From 5bc8454190d5e111d3c5e92449fd030e75b7c36e Mon Sep 17 00:00:00 2001 From: Vincenzo Polizzi Date: Mon, 18 Apr 2022 21:37:04 +0200 Subject: [PATCH 1/3] Link x as library and not as a ros package. --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 12f462b..1f67d76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,6 @@ if(NOT ${OpenCV_FOUND}) endif() find_package(catkin REQUIRED COMPONENTS - x cv_bridge image_geometry dynamic_reconfigure @@ -55,6 +54,8 @@ find_package(catkin REQUIRED COMPONENTS std_msgs ) +find_package(x REQUIRED) + # Set build flags, depending on the architecture set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall") @@ -89,6 +90,7 @@ include_directories ( include ${OpenCV_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS} + ${x_LIB_DIR} ) # ROS node executable @@ -107,6 +109,7 @@ add_dependencies(x_vio_ros ${PROJECT_NAME}_gencfg) target_link_libraries(x_vio_ros ${OpenCV_LIBRARIES} ${catkin_LIBRARIES} + ${x_LIBS} ) # Testing From 92eeeb87af481ecd4d67b7a1ff023a7434d25878 Mon Sep 17 00:00:00 2001 From: Vincenzo Polizzi Date: Sat, 7 May 2022 17:43:25 +0200 Subject: [PATCH 2/3] Use standalone x library --- .gitignore | 2 ++ CMakeLists.txt | 67 +++++++++++++++++++++++++------------------------- 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/.gitignore b/.gitignore index 4111900..bdfd62e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ doc # Formatting .clang-format + +cmake-* diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f67d76..8ac654a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ################################################################################ @@ -43,17 +43,18 @@ if(NOT ${OpenCV_FOUND}) endif() find_package(catkin REQUIRED COMPONENTS - 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 + ) + +set(x_DIR /home/viciopoli/JPL/devel/ros2_ws/src/x/install/lib/cmake/x) find_package(x REQUIRED) # Set build flags, depending on the architecture @@ -67,8 +68,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) @@ -78,27 +79,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} - ${x_LIB_DIR} + 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}) @@ -107,10 +108,10 @@ add_dependencies(x_vio_ros ${PROJECT_NAME}_gencfg) # Additional libraries to link against target_link_libraries(x_vio_ros - ${OpenCV_LIBRARIES} - ${catkin_LIBRARIES} - ${x_LIBS} -) + ${OpenCV_LIBRARIES} + ${catkin_LIBRARIES} + ${x_LIBRARIES} + ) # Testing ######### @@ -118,7 +119,7 @@ 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}) endif() From 14ad56fabe0546bb57aba1a1c03c039639fbec66 Mon Sep 17 00:00:00 2001 From: Vincenzo Polizzi Date: Sat, 7 May 2022 18:00:33 +0200 Subject: [PATCH 3/3] Added find package for x --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ac654a..493ffab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,6 @@ find_package(catkin REQUIRED COMPONENTS std_msgs ) -set(x_DIR /home/viciopoli/JPL/devel/ros2_ws/src/x/install/lib/cmake/x) find_package(x REQUIRED) # Set build flags, depending on the architecture @@ -121,5 +120,6 @@ if(CATKIN_ENABLE_TESTING) target_link_libraries(utest_node ${OpenCV_LIBRARIES} ${catkin_LIBRARIES} - ${rostest_LIBRARIES}) + ${rostest_LIBRARIES} + ${x_LIBRARIES}) endif()