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

You cannot subscribe to part of a message. The publisher and subscriber types must match, and you have to subscribe to the whole topic.

(rostopic echo make it seems like you can subscribe to one field, but it's actually subscribing to the entire message and only printing part of it. This is the exception; no other parts of ROS can do this.)

If you have a subscriber that accepts a particular topic type, you must publish a topic with that type. That might mean modifying your existing publisher to publish a second topic, or writing a very small relay node which subscribes to the entire topic and republishes on a new topic with the desired type and data.

You cannot subscribe to part of a message. The publisher and subscriber types must match, and you have to subscribe to the whole topic.

(rostopic echo and rqt_plot make it seems like you can subscribe to one field, but it's they're actually subscribing to the entire message and only printing part of it. This is the exception; no very few other parts of ROS can do this.)

If you have a subscriber that accepts a particular topic type, you must publish a topic with that type. That might mean modifying your existing publisher to publish a second topic, or writing a very small relay node which subscribes to the entire topic and republishes on a new topic with the desired type and data.