If, for example, you have a plugin that is used within a rclcpp::Node but needs to create it’s own publishers or subscribers (or timers, or clients, etc.) what is the correct way for said plugin to do that. It seems simple enough to just pass a reference or pointer to the node (*this or this) to the plugin so that it can just call create_subscriber or whatever else it needs to
But… objects like ImageTransport require a rclcpp::Node::SharedPtr and have a rather convoluted internal process for creating subscriptions, etc.
So two questions:
-
Is there any particular reason why you would only want to pass a Node::SharedPtr? Classes like AsyncParameterClient have a constructor version that takes just a Node*.
-
Is there a reason you would not want to just call methods like create_subscription from plugins, but use the Node interface pointers instead?