[ROS2] Is there a way for a node to subscribe to existing topics?
It is extremely easy to create a topic, just by publishing a message to a nonexistent topic would cause ROS2 to create that topic for you, as seen in this tutorial
However, is there a way to make an existing node subscribe to an existing topic?
The tutorial above showed a way to create a new node to subscribe to a topic, by simply using the command ros2 topic echo /<TOPIC NAME>
. This created a new node, /_ros2cli_25438
, which I assume is the command line, subscribing to the topic /barbarians
, which is being published to by the existing node /_ros2cli_publisher_std_msgs_String
.
However, is there a command to have an existing node subscribe to an existing topic?