Skip to content

Build fails on ROS 2 due to missing tf2_sensor_msgs dependency #9

@hermanumrao

Description

@hermanumrao
Image

When building ndt_localization on ROS 2 (tested on Humble), compilation fails with:

fatal error: tf2_sensor_msgs/tf2_sensor_msgs.h: No such file or directory

The header is included in ndt_localization.h, but tf2_sensor_msgs is not properly declared as a dependency in CMakeLists.txt and package.xml.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b7f0276..51d2e11 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,7 @@ endif()
 
 find_package(ament_cmake_auto REQUIRED)
 find_package(Eigen3 REQUIRED)
+find_package(tf2_sensor_msgs REQUIRED)
 find_package(PCL REQUIRED)
 ament_auto_find_build_dependencies()
 
diff --git a/package.xml b/package.xml
index 3b77218..59aa5aa 100644
--- a/package.xml
+++ b/package.xml
@@ -18,6 +18,7 @@
   <depend>tf2</depend>
   <depend>tf2_eigen</depend>
   <depend>ndt_omp</depend>
+  <depend>tf2_sensor_msgs</depend>
 
   <export>
     <build_type>ament_cmake</build_type>

resolves the issue.

I can submit a PR if this change is acceptable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions