ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org

Questions on ament, ament.py, ament_cmake and dependency resolvers

I am trying to write ament packages to adopt pieces of code to ament_cmake. Here is something strange I got.

  • It is supposed that ‘ament’ performs like ‘catkin’ with which dependencies could be resolved by declaring in ‘package.xml’. However, it seems that ‘ament’ cannot do this job. In an ‘ament’ package, dependencies should be declared explicitly in CMakeLists.txt with ‘find_package’ macro. Moreover, *_INCLUDE_DIRS or _LIBRARIES variables have to be add into target_link() macros explicitly too. Is this designed on purpose?

  • An ‘ament’ package could be compiled by ‘ament.py’ with ‘build_pkg’ parameter. It seems that the python script actually doesn’t check whether its dependencies are built. It this what could be expected? I am just using it in a wrong way?

just responding to the above bit: Catkin does not resolve dependencies using the package manifest. That would be rosdep's job.

This is also the reason why you have to declare dependencies twice: once in your manifest, and once in the find_package(catkin .. COMPONENTS ..) call in your build script.

Catkin does not resolve dependencies using the package manifest. That would be rosdep’s job.

Is there a tool in ‘ament’ like ‘rosdep’ ?

Yes, using the COMPONENTS keyword when finding catkin to enumerate additional packages has several drawbacks and was therefore not provided in ament_cmake.

To maintain a similar level of convenience as in catkin you can call ament_target_dependencies(…) after finding all packages separately. The function will do the “heavy lifting” for you and “use” all common variables from the package names you pass for the passed target name.

It does exactly what you described - it builds only the single one package. It does not build any other packages. You should use build for that. build_pkg should commonIy not be used by users.

ROS 2 uses rosdep the same as ROS 1 does.