Our company is in a very similar boat - looking to slowly migrate parts of our in-house framework (beginning with comms) to use ROS 2.
It is important for us to maintain our current approach as we have large projects mid-development, while allowing for “experimentation” with ROS. We have found the following:
- Packages that are pure CMake work fine
- Packages that are fully ROS (built with ament) work fine
- Packages that we want to be able to build both without ROS and with ROS (e.g. to include constructors/casts to ROS types, which are macro’d out for non-ROS builds) are a real mess since we need to toggle between using
ament
functions and the regular CMake functions (e.g.target_link_libraries
and similar).
We ended up writing a CMake macro to handle it all as well as a few other things that we were doing for every package which cleaned it up a bit.
Interested to see how others have tackled similar issues.