Good afternoon!
We are a team of developers currently discussing a possible adaptation of our current framework into ROS2. As a bit of context, we have a decent sized framework for robotics (>100k lines) and we are looking into exporting parts of it into ROS2 packages. Most of the work would be switching our “in the house” communications into ROS2 comms such as nodes, services, and actions.
We want to make sure that the initial structure of the system is correct and high quality before committing to the change. After some research, we have reached a point where we don’t exactly know what would be the best way to proceed, and we have several points where we couldn’t find a clear answer:
In our current framework, the equivalent of ROS2 packages are modules, so I might refer to them as synonyms.
In our framework we have some modules that have basically no dependencies (math modules, control, etc…). We would like to keep these modules “dependency free” for anyone to use inside and outside ROS2. As far as we’ve seen, creating a pure CMake package is not feasible as ament_CMake is used in ROS2, or we haven’t seen any examples at least. Ideally, we would like to maintain them in CMake and then use them in several of our packages without having to introduce them in the sources of all the other packages that use them.
MoveIt2 has a module that they claim to be non-dependent on ROS2 in their README (moveit_core: moveit2/moveit_core at main · ros-planning/moveit2 · GitHub), however, in their files they use the ROS2 logger with the rclcpp dependency which makes us doubt this claim. Are we missing something or is this module still ROS dependent even if they claim it’s not?
Overall, it seems that using pure CMake to create a package to use easily in other packages without copying it everywhere is not easily obtainable. Is this the case? Is there a way to achieve this?
We might have a situation in the future where we have a CMake module where some implementations are done with ROS and others are not (such as an implementation using a ROS2 algorithm). Then we would like to have this module be able to compile standalone and inside a ROS2 workspace. Hopefully, an example will make this clearer:
Imagine a case where we have a module or package called slam_module. Inside this module, we have two implementations. The first one is our personal SLAM algorithm (with no ROS2 dependencies), the second implementation could be a wrapper of a ROS2 package. We would like to use this module inside of a ROS2 workspace but also outside of it (not compiling the ROS2 dependent implementation). This would mean that the main CMake in the module cannot be ROS2 dependent.
Making our modules or packages open-source as of this time is not possible (WIP!), which means that publishing the packages to manage them with rosdep is also not possible yet. These packages are needed by other packages to compile. As far as we understand, we’ll need to manage these dependencies ourselves to ensure all the packages are available before compilation.
It’s not clear to us if using a monolithic repository to store all of our packages is the best practice, or if having several divided repos is preferred. It seems like one repo per package would be ideal, but large packages such as MoveIt2 and Navigation2 have one repo with all the packages inside. Having one repository per package also messes up the pipelines since a multitude of small packages are needed to compile some large packages and dependencies would have to be manually taken care of. Is there some recommended best practice regarding these different structures?
The last option would be to not make our framework fully integrated into ROS2 or just make it compatible with it by changing the comms and generating some bigger packages instead of all the small ones.
We were wondering if any of you encountered these issues and had a clear perspective on how to tackle them.
Thanks for any help or advice!