Skip to content

Commit 9dc931a

Browse files
Julian/feature/less ament (#10)
* add ros2 pkgs * temporaliy edit cmakelist and package xml * noetic docker setup * first non running version of graph_msf_catkin * Add initial implementation of smb_estimator_graph_ros2 package * Update CMakeLists.txt to reference the correct constants header for smb_estimator_graph_ros2 * Refactor includes to use smb_estimator_graph_ros2 namespace for consistency across files * Refactor SmbEstimator and SmbStaticTransforms classes to use ROS 2 conventions, including updated includes, parameter handling, and subscription methods. Transition from ros::NodeHandle to rclcpp::Node and adjust message types accordingly for improved compatibility with ROS 2 architecture. * Update CMakeLists.txt to include GTSAM package and clean up dependencies. * Fix CMakeLists.txt to use project name variable in target_link_libraries for improved maintainability. * Refactor SmbStaticTransforms constructor to remove dependency on StaticTransforms and simplify initialization with only the node pointer. * Replace XML launch files with Python launch files for smb_estimator_graph and smb_estimator_graph_replay, enhancing maintainability and aligning with ROS 2 conventions. * Refactor remove_map_and_odom_from_bag.py to utilize rosbag2 API for reading and writing bags, improving performance and compatibility with ROS 2 conventions. * Enhance error handling and logging in remove_tf_from_bag.py * Enhance plotting functionality and logging in plot_latest_quantitites_in_folder.py, adding support for covariance data and improving error handling. * Add new parameters for marginals computation and alignment in readParams function * Refactor setup.py to use setuptools, adding package metadata and entry points for console scripts. Introduce new resource file for graph_msf_ros2. * Refactor manual_pose_files_to_tf_and_odom_bag.py to improve file processing and logging. * Update package name in smb_estimator_graph.launch.py to smb_estimator_graph_ros2 * Enhance CMakeLists.txt by adding GTSAM_UNSTABLE package * Add export section to package.xml for launch file configuration * Add export for include directories in CMakeLists.txt to improve package integration * Update parameter declarations in GraphMsfRos2.cpp to include new settings for Cholesky factorization and marginals computation, while commenting out the center reference frames parameter. * Update parameter names and add new logging options in GraphMsfRos2 setup and readParams functions * Refactor YAML configuration files for smb_estimator_node to include parameters under ros__parameters section * Add launch file for smb_estimator_graph_ros2 to configure simulation parameters and node execution * Update IMU frame parameter in core_extrinsic_params.yaml from 'imu' to 'imu_link' * first almost compiling version, just issue with one symbol and libmetis * running version, full separation of graph msf and build system * moving of examples inside ros and ros2 folders * fix two more examples, now full graph_msf_ros_examples meta package is building * make sure the gtsam libaries can be found * update to holistic_fusion * building with colcon without any ament specific package in graph_msf using modern cmake * remove unnecessary ament dependency messing up catkin build * remove ros2 code --------- Co-authored-by: dishtaweera <[email protected]>
1 parent 0d17500 commit 9dc931a

File tree

4 files changed

+74
-28
lines changed

4 files changed

+74
-28
lines changed

graph_msf/CMakeLists.txt

Lines changed: 59 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.16)
22
project(graph_msf)
33

4-
message("Building graph_msf library -----------------------------")
4+
message("Building ${PROJECT_NAME} library -----------------------------")
55

66
## Compile as C++17, supported in ROS Noetic and newer
77
add_compile_options(-std=c++17)
@@ -22,11 +22,19 @@ message("CMAKE_BUILD_INCLUDE_DIR: ${CMAKE_BUILD_INCLUDE_DIR}")
2222

2323
# Find dependencies ----------------------------------------------------------------------------------------------------
2424
find_package(Eigen3 REQUIRED)
25-
message("Eigen Version::" ${EIGEN3_VERSION_STRING})
26-
message("Eigen Path::" ${Eigen3_DIR})
25+
find_package(GTSAM REQUIRED)
26+
find_package(GTSAM_UNSTABLE REQUIRED)
27+
find_package(Python3 REQUIRED COMPONENTS Development)
28+
find_package(tf2_eigen REQUIRED)
29+
30+
message("Eigen Version:: ${EIGEN3_VERSION_STRING}")
31+
message("Eigen Path:: ${EIGEN3_DIR}")
32+
message("GTSAM Include Path:: ${GTSAM_INCLUDE_DIRS}")
2733

28-
# Color
29-
if (NOT WIN32)
34+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
35+
36+
# Color settings for terminal output
37+
if(NOT WIN32)
3038
string(ASCII 27 Esc)
3139
set(ColourReset "${Esc}[m")
3240
set(BoldMagenta "${Esc}[1;35m")
@@ -76,45 +84,69 @@ target_link_libraries(${PROJECT_NAME}
7684
metis-gtsam
7785
)
7886

87+
# Include directories for the library
88+
target_include_directories(${PROJECT_NAME}
89+
PUBLIC
90+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
91+
$<INSTALL_INTERFACE:include>
92+
)
93+
7994
# Add clang tooling
8095
find_package(cmake_clang_tools QUIET)
8196
if (cmake_clang_tools_FOUND AND NOT DEFINED NO_CLANG_TOOLING)
8297
add_clang_tooling(
83-
TARGET ${PROJECT_NAME}
84-
SOURCE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/include
85-
CT_HEADER_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
86-
CF_FIX
98+
TARGET ${PROJECT_NAME}
99+
SOURCE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/include
100+
CT_HEADER_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include
101+
CF_FIX
87102
)
88-
endif (cmake_clang_tools_FOUND AND NOT DEFINED NO_CLANG_TOOLING)
103+
endif()
89104

90105
#############
91106
## Install ##
92107
#############
93108

94109
# Export the include directories and linked libraries
95-
install(TARGETS ${PROJECT_NAME}
96-
EXPORT ${PROJECT_NAME}-targets # Export the target for downstream usage
97-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
98-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
99-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
110+
install(
111+
TARGETS ${PROJECT_NAME}
112+
EXPORT ${PROJECT_NAME}Targets # Export the target for downstream usage
113+
ARCHIVE DESTINATION lib
114+
LIBRARY DESTINATION lib
115+
RUNTIME DESTINATION bin
116+
)
117+
118+
# Install the include directory
119+
install(DIRECTORY include/
120+
DESTINATION include
100121
)
101122

102123
# Install the export file for downstream projects
103-
install(EXPORT ${PROJECT_NAME}-targets
104-
FILE ${PROJECT_NAME}Config.cmake
105-
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
124+
install(EXPORT ${PROJECT_NAME}Targets
125+
FILE ${PROJECT_NAME}Targets.cmake
126+
NAMESPACE ${PROJECT_NAME}::
127+
DESTINATION share/${PROJECT_NAME}/cmake
106128
)
107129

108-
# Install the include directory
109-
install(DIRECTORY include/${PROJECT_NAME}/
110-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
130+
# Version
131+
include(CMakePackageConfigHelpers)
132+
write_basic_package_version_file(
133+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
134+
VERSION 1.0.0
135+
COMPATIBILITY SameMajorVersion
136+
)
137+
138+
# Configure
139+
configure_package_config_file(
140+
"${PROJECT_NAME}Config.cmake.in"
141+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
142+
INSTALL_DESTINATION share/${PROJECT_NAME}/cmake
111143
)
112144

113-
# Add GTSAM include directories to the exported interface
114-
target_include_directories(${PROJECT_NAME} PUBLIC
115-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
116-
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}>
117-
${EIGEN3_INCLUDE_DIR}
145+
# Files
146+
install(FILES
147+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
148+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
149+
DESTINATION share/${PROJECT_NAME}/cmake
118150
)
119151

120-
message("Finished building graph_msf library -----------------------------")
152+
message("Finished building ${PROJECT_NAME} library -----------------------------")

graph_msf/graph_msfConfig.cmake.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@PACKAGE_INIT@
2+
3+
include("${CMAKE_CURRENT_LIST_DIR}/graph_msfTargets.cmake")
4+
5+
# Optionally set legacy-style variables (only if needed)
6+
# set(graph_msf_INCLUDE_DIRS "@CMAKE_INSTALL_INCLUDEDIR@")
7+
8+
# Set up version compatibility (optional if you use a version file)
9+
# include("${CMAKE_CURRENT_LIST_DIR}/graph_msfConfigVersion.cmake")

graph_msf/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
<exec_depend>Eigen3</exec_depend>
2020
<exec_depend>GTSAM</exec_depend>
2121

22-
</package>
22+
</package>

ros/graph_msf_catkin/package.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,10 @@
88
<license>BSD</license>
99
<author email="[email protected]">Julian Nubert</author>
1010

11+
<!-- Required for any ROS 1 catkin-cmake package -->
1112
<buildtool_depend>catkin</buildtool_depend>
13+
14+
<!-- Optional: list native dependencies here if you want ROS 2 to manage them -->
15+
<depend>gtsam</depend>
16+
<depend>eigen</depend>
1217
</package>

0 commit comments

Comments
 (0)