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

vectornav_msgs ROS2 node does not build without linking tf2_geometry_msgs #58

Open
jfinken opened this issue Apr 9, 2021 · 4 comments

Comments

@jfinken
Copy link

jfinken commented Apr 9, 2021

Sensor details:

  • Model: VN-200T-CR
  • Firmware Version: 2.0.0.1
  • Hardware Version : 3

ROS2 version:

  • ros2-foxy built from source

Symptom:

  • colcon build results in the below header file not found error

Example:

$ colcon build --symlink-install
...
vectornav/vectornav/src/vn_sensor_msgs.cc:24:10: fatal error: tf2_geometry_msgs/tf2_geometry_msgs.h: No such file or directory
 #include "tf2_geometry_msgs/tf2_geometry_msgs.h"
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This can be resolved with this change to CMakeLists.txt (effectively adding tf2_geometry_msgs):

diff --git a/vectornav/CMakeLists.txt b/vectornav/CMakeLists.txt
index 0cf42c8..2af957a 100644
--- a/vectornav/CMakeLists.txt
+++ b/vectornav/CMakeLists.txt
@@ -35,7 +35,7 @@ target_link_libraries(${PROJECT_NAME} vncxx )

 # vn_sensor_msgs
 add_executable(vn_sensor_msgs src/vn_sensor_msgs.cc)
-ament_target_dependencies(vn_sensor_msgs rclcpp sensor_msgs vectornav_msgs)
+ament_target_dependencies(vn_sensor_msgs rclcpp sensor_msgs vectornav_msgs tf2_geometry_msgs)

I'd be happy to submit a PR to the ros2 branch if interested. Thanks!

@dawonn
Copy link
Owner

dawonn commented Apr 9, 2021 via email

@jjbrl
Copy link

jjbrl commented Jun 8, 2023

I will note that an almost identical build error has surfaced due to the include change made in #114 . Older ROS2 distros (ex. Foxy) only provide tf2_geometry_msgs.h and not a .hpp. The solution involves either changing the .hpp include back to a .h on line 24 of vn_sensor_msgs.cc, or manually adding the newer .hpp header to the tf2_geometry_msgs package.

@mehradmrt
Copy link

Thank you, I had the same issue and this helped!

@lorenzohess
Copy link

I will note that an almost identical build error has surfaced due to the include change made in #114 . Older ROS2 distros (ex. Foxy) only provide tf2_geometry_msgs.h and not a .hpp. The solution involves either changing the .hpp include back to a .h on line 24 of vn_sensor_msgs.cc, or manually adding the newer .hpp header to the tf2_geometry_msgs package.

On commit 2859fe1, I had to make the following two changes:

---
 vectornav/src/vn_sensor_msgs.cc  | 2 +-
 vectornav/src/vn_sensor_msgs.hpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/vectornav/src/vn_sensor_msgs.cc b/vectornav/src/vn_sensor_msgs.cc
index bcfd1e3..0f42b7f 100644
--- a/vectornav/src/vn_sensor_msgs.cc
+++ b/vectornav/src/vn_sensor_msgs.cc
@@ -16,7 +16,7 @@
 #include <rclcpp_components/register_node_macro.hpp>
 #include <string>
 
-#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp"
+#include "tf2_geometry_msgs/tf2_geometry_msgs.h"
 
 using namespace std::chrono_literals;
 
diff --git a/vectornav/src/vn_sensor_msgs.hpp b/vectornav/src/vn_sensor_msgs.hpp
index 2c32a5d..ab278fa 100644
--- a/vectornav/src/vn_sensor_msgs.hpp
+++ b/vectornav/src/vn_sensor_msgs.hpp
@@ -22,7 +22,7 @@
 #include <sensor_msgs/msg/temperature.hpp>
 #include <sensor_msgs/msg/time_reference.hpp>
 #include <string>
-#include <tf2_geometry_msgs/tf2_geometry_msgs.hpp>
+#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
 #include <vectornav_msgs/msg/attitude_group.hpp>
 #include <vectornav_msgs/msg/common_group.hpp>
 #include <vectornav_msgs/msg/gps_group.hpp>
-- 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants