Rosject ROS2 Basics in 5 Days(Python): Part 3 No such file or directory

Hello Community,

I am working on the rosject of the course ROS2 Basics in 5 Days(Python).
For part 3 of the rosject, I need to build a custom action interface that looks like below:

---
Point[] list_of_odoms
---
float32 current_total

I noticed that the interface depends on the Point interface, so I guess I have modified the CMakeLists.txt and package.xml.

I have made following changes:

  1. Added find_package(geometry_msgs REQUIRED) in the CMakeLists.txt
  2. Added <depend>geometry_msgs</depend> in the package.xml

However, when I called colcon build to build the custom interface, it shows the following error:

 fatal error: custom_interfaces/msg/detail/point__struct.h: No such file or directory
   41 | #include "custom_interfaces/msg/detail/point__struct.h"


Not sure what I have missed. Are there any additional steps I need to do?

Below is the content of those two files after I edited them.

CMakeLists.txt

cmake_minimum_required(VERSION 3.5)
project(custom_interfaces)

# Default to C99
if(NOT CMAKE_C_STANDARD)
  set(CMAKE_C_STANDARD 99)
endif()

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 14)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
#Added for Point dependency
find_package(geometry_msgs REQUIRED)
find_package(rosidl_default_generators REQUIRED)

rosidl_generate_interfaces(${PROJECT_NAME}
  "srv/Wall.srv"
  "action/OdomRecord.action"
)

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # uncomment the line when a copyright and license is not present in all source files
  #set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # uncomment the line when this package is not in a git repo
  #set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()


ament_package()

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>custom_interfaces</name>
  <version>0.0.0</version>
  <description>TODO: Package description</description>
  <maintainer email="user@todo.todo">user</maintainer>
  <license>TODO: License declaration</license>

  <buildtool_depend>ament_cmake</buildtool_depend>

  <depend>rclcpp</depend>
  <depend>action_msgs</depend>
  <depend>geometry_msgs</depend>
  <depend>rosidl_default_generators</depend>

  <exec_depend>rosidl_default_runtime</exec_depend>
  <member_of_group>rosidl_interface_packages</member_of_group>

  <test_depend>ament_lint_auto</test_depend>
  <test_depend>ament_lint_common</test_depend>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>

Hi Alan,

Can you try using

geometry_msgs/msg/Point[] list_of_odoms

or

geometry_msgs/msg/Point32[] list_of_odoms

in the action definition?

Hi roalgoal,

Thanks for the reply.
I have tried both interfaces you suggested, however, there is still an error.

I am having the same problem here. How did you resolve this?

image This works.

2 Likes

This topic was automatically closed after 2 days. New replies are no longer allowed.