Skip to content
Snippets Groups Projects
Commit 0227a76e authored by Damon Kohler's avatar Damon Kohler
Browse files

Added PublisherListener example to documentation.

parent 52fb1b23
No related branches found
No related tags found
No related merge requests found
Advanced topics
===============
Listeners
---------
Because rosjava provides a primarily asynchronous API, many classes which allow
you to provide event listeners. For example,
:javadoc:`org.ros.node.topic.PublisherListener`\s allow you to react to
lifecycle events of a :javadoc:`org.ros.node.topic.Publisher`. The snippet
below adds a :javadoc:`org.ros.node.topic.PublisherListener` that will log a
warning message if the :javadoc:`org.ros.node.topic.Publisher` fails to
register with the master. ::
Node node;
Publisher<std_msgs.String> publisher;
...
publisher.addListener(new DefaultPublisherListener() {
@Override
public void onMasterRegistrationFailure(Publisher<std_msgs.String> registrant) {
node.getLog().warn("Publisher failed to register: " + registrant);
}
});
Messages as BLOBs
-----------------
......@@ -20,4 +43,3 @@ little endian. ::
.newMessageDeserializer(sensor_msgs.PointCloud._TYPE)
.deserialize(buffer);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment