SohaibAJ
SohaibAJ

Reputation: 83

Adding a custom ROS package as dependency to another ROS package

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.

Upvotes: 1

Views: 1214

Answers (1)

leandro souza rosa
leandro souza rosa

Reputation: 327

What you want is probably a metapackage

Otherwise, you can leave everything in the same level and have the dependencies specifies in the package.xml file.

The folder structure:

my_ws/
  build
  devel
  main_package/
    src/
    package.xml
    CMakeLists.txt
  library_1/
    src/
    package.xml
    CMakeLists.txt
  library_2/
    src/
    package.xml
    CMakeLists.txt

Upvotes: 0

Related Questions