agilexrobotics / ranger_ros2

ranger_ros2 package
BSD 3-Clause "New" or "Revised" License
13 stars 9 forks source link

ROS2 humble #12

Closed Indro-mostafa closed 10 hours ago

Indro-mostafa commented 8 months ago

I am currently working with ROS 2 Humble and the Ranger Mini V2, and I encountered a compilation error related to the ranger_base package. The error is due to a missing header file tf2_geometry_msgs/tf2_geometry_msgs.h. Here is the full error message:

/home/colcon_ws/src/ranger_ros2/ranger_base/include/ranger_base/ranger_messenger.hpp:28:10: fatal error: tf2_geometry_msgs/tf2_geometry_msgs.h: No such file or directory 22.43 28 | #include <tf2_geometry_msgs/tf2_geometry_msgs.h> ^~~~~~~~~~~

Indro-mostafa commented 8 months ago

i have solved the include problem by adding tf2_geometry_msgs to ament_target_dependencies and changing #include <tf2_geometry_msgs/tf2_geometry_msgs.hpp> but now i am getting a lot of errors /home/mostafa/humble_ws/src/ranger_ros2/ranger_base/src/ranger_messenger.cpp:236:40: error: ‘using element_type = class westonrobot::RangerRobot’ {aka ‘class westonrobot::RangerRobot’} has no member named ‘GetCommonSensorState’ 236 | auto common_sensorstate = robot->GetCommonSensorState();

kelvin926 commented 8 months ago

Our team had the same issue. Several parts of this package include tf2_geometry_msg.h, which can be solved by changing it to .hpp.

Also, even if you switch to .hpp, there may be an error. Files such as ranger_messenger.hpp and kinematics_model.hpp, in which case, it will be resolved by creating absolute path.

Indro-mostafa commented 8 months ago

where should i create the absolute path

Indro-mostafa commented 8 months ago

i changed them to the absolute path but still getting the same errors

we-worker commented 8 months ago

我也遇到了相同的问题,虽然在cmakelist.txt中find_package寻找了tf2_geometry_msgs,但是ament_target没有成功添加上依赖。可以通过以下操作修复 通过修改src/ranger_ros2/ranger_base/CMakeLists.txt中,第54行(目前的版本是这一行)

ament_target_dependencies(ranger_base_node rclcpp tf2 tf2_ros std_msgs nav_msgs sensor_msgs ranger_msgs  ${dependencies})

其中添加上tf2_geometry_msgs包,修复了这个依赖错误。 修改完成后的代码应该如下:

ament_target_dependencies(ranger_base_node rclcpp tf2 tf2_ros std_msgs nav_msgs sensor_msgs ranger_msgs tf2_geometry_msgs ${dependencies})
leo038 commented 1 month ago

我也遇到了相同的问题,虽然在cmakelist.txt中find_package寻找了tf2_geometry_msgs,但是ament_target没有成功添加上依赖。可以通过以下操作修复 通过修改src/ranger_ros2/ranger_base/CMakeLists.txt中,第54行(目前的版本是这一行)

ament_target_dependencies(ranger_base_node rclcpp tf2 tf2_ros std_msgs nav_msgs sensor_msgs ranger_msgs  ${dependencies})

其中添加上tf2_geometry_msgs包,修复了这个依赖错误。 修改完成后的代码应该如下:

ament_target_dependencies(ranger_base_node rclcpp tf2 tf2_ros std_msgs nav_msgs sensor_msgs ranger_msgs tf2_geometry_msgs ${dependencies})

已解决, 谢谢。