ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Adding a custom ROS package as dependency to another ROS package

asked 2022-12-07 17:19:02 -0500

A_J gravatar image

updated 2022-12-12 08:10:50 -0500

Mike Scheutzow gravatar image

I am new to ROS so apologies if it is obvious. I have multiple ROS packages and currently I use them by linking them to my catkin workspace using symbolic links. What I want to do now is use one CMakeList to call and build the required ROS packages. I have different ROS actions stored as packages in a folder and I link the main folder to the workspace and I can build it. I can even link each ROS action directory separately and build it. But when I use add_subdirectory in the main cmake file I want to call, it gives me an error that catkin should be listed as a buildtool dependency in package.xml, which it is.

My current folder structure looks like this

catkin_ws
--build
--devel
--logs
--src
  --ros_actions
    --action1
      --include
      --src
      --CMakeLists.txt
      --package.xml
    --action2
      --include
      --src
      --CMakeLists.txt
      --package.xml
  --main_file
    --config
    --launch
    --include
    --src
    --CMakeLists.txt
    --package.xml

and I want to have something like

catkin_ws
--build
--devel
--logs
--src
  --main_file
    --actions
      --action1
        --include
        --src
        --CMakeLists.txt
        --package.xml
      --action2
        --include
        --src
        --CMakeLists.txt
        --package.xml
    --config
    --launch
    --include
    --src
    --CMakeLists.txt
    --package.xml

I did try adding "ros_actions" in the CMakelist include_directories and find_package functions but failed. Is there a way to add a custom ROS package as a dependency to another?

Thank you in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-12-12 07:36:24 -0500

Mike Scheutzow gravatar image

updated 2022-12-12 07:42:26 -0500

As far as I know, catkin_make does not support nested ros packages. But you can put multiple ros-packages in a single directory (i.e. side-by-side, like your ros_actions/.) That top-level directory does not need a CMakeLists.txt file, as catkin_make should discover the ros-packages on its own.

If you change your catkin_ws/src/ directory structure, make sure you do a clean build by deleting catkin_ws/build/ and catkin_ws/devel/ directories.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-12-07 17:19:02 -0500

Seen: 43 times

Last updated: Dec 12 '22