ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
However, is there a way to make an existing node subscribe to an existing topic?
A node can subscribe to a topic whether it exists or not. If it doesn't, then after the node subscribes it will effectively exist.
However, is there a command to have an existing node subscribe to an existing topic?
If a node's source is not written so that it subscribes to a topic, then no, you can't make it subscribe to a topic via an external command.
If you want to write a node that can subscribe to a topic on demand, then you can do that with the following steps:
std_msgs/String topic_name
The above makes some assumptions:
rospy
and have written your callback such that it can handle in some way any message type that arrives.2 | No.2 Revision |
However, is there a way to make an existing node subscribe to an existing topic?
A node can subscribe to a topic whether it exists or not. If it doesn't, then after the node subscribes it will effectively exist.
However, is there a command to have an existing node subscribe to an existing topic?
If a node's source is not written so that it subscribes to a topic, then no, you can't make it subscribe to a topic via an external command.
If you want to write a node that can subscribe to a topic on demand, then you can do that with the following steps:
std_msgs/String topic_name
The above makes some assumptions:
rospyrclpy
and have written your callback such that it can handle in some way any message type that arrives.3 | No.3 Revision |
However, is there a way to make an existing node subscribe to an existing topic?
A node can subscribe to a topic whether it exists or not. If it doesn't, then after the node subscribes it will effectively exist.
However, is there a command to have an existing node subscribe to an existing topic?
If a node's source is not written so that it subscribes to a topic, then no, you can't make it subscribe to a topic via an external command.
If you want to write a node that can subscribe to a topic on demand, then you can do that with the following steps:
std_msgs/String topic_name
rostopic
pub /blag std_msgs/String The above makes some assumptions:
rclpy
and have written your callback such that it can handle in some way any message type that arrives.