new Topic(options)
Publish and/or subscribe to a topic in ROS.
Emits the following events:
- 'warning' - If there are any warning during the Topic creation.
- 'message' - The message data from rosbridge.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Source:
Methods
advertise()
Register as a publisher for the topic.
- Source:
publish(message)
Publish the message.
Parameters:
Name | Type | Description |
---|---|---|
message |
Message | A ROSLIB.Message object. |
- Source:
subscribe(callback)
Every time a message is published for the given topic, the callback will be called with the message object.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
callback |
function | Function with the following params: Properties
|
- Source:
toStream(options)
Publish a connected ROS topic to a duplex stream. This stream can be piped to, which will publish to the topic.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Source:
unadvertise()
Unregister as a publisher for the topic.
- Source:
unsubscribe(callbackopt)
Unregister as a subscriber for the topic. Unsubscribing will stop and remove all subscribe callbacks. To remove a callback, you must explicitly pass the callback function in.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
function |
<optional> |
The callback to unregister, if provided and other listeners are registered the topic won't unsubscribe, just stop emitting to the passed listener. |
- Source: