ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If you make two different classes that derive from rclcpp::Node and create instances of both of them then you will have two different nodes. That is sometimes a valid pattern but it sounds like you probably don't want to do that from your first sentence.

Now for an object to have its own subscriptions the class needs to inherit from rclcpp::Node

This is not accurate, it only needs to have access to a Node object when creating the subscriptions. You could easily create the node object and then pass it to the constructor of these other subscription-holding objects, which would then manage the subscriptions as needed.