ROS1 -> ROS2: Migration standard
HI,
I'm trying to migrate a project from ROS1 Melodic to ROS2 now that it is getting a "LTS" release in May. I've followed tutorials, did some tests and simple packages, and I wanted now to migrate some "simple" packages to ROS2.
I have a big question regarding standards though. Let me try with an example:
(All this is ROS1 current code) I have a package called sensors_manager that, well, manages the sensors data. The code is split in 2 parts:
- sensor.cpp: Class that has a NodeHandle, a subscriber for raw sensor data, another for a trigger to report to a file, and a method to filter and report to a file.
- sensors_manager_node.cpp: Main function that inits a ros node, instantiates a bunch of sensor class, and spins
When trying to convert to ROS2, I'm not getting clear what's the desired standard to use. I've though about 2 solutions:
- Delete the NodeHandle and subscribers of sensor.cpp Class. Add them to the manager, and use each instantiated sensor member function as subscriber callback.
- Convert sensor class to Node, instantiate a bunch of nodes in sensor_manager, add them to executor and spin. (composition?)
Is there any other way of doing it that ROS2 intends to 'prioritize'? I'm not getting the second one, because what if there's 20 sensors, are we creating 20 nodes?