Module roslua.publisher
Topic publisher. This module contains the Publisher class to publish to a ROS topic. The class is used to publish messages to a specified topic. It is created using the function roslua.publisher()
.
The main interaction for applications is using the publish()
method to send new messages. The publisher spins automatically when created using roslua.publisher()
.
Copyright© Tim Niemueller, Carnegie Mellon University, Intel Research Pittsburgh
Release: Released under BSD license
Functions
Publisher:finalize () | Finalize instance. |
Publisher:get_stats () | Get statistics about this publisher. |
Publisher:new (topic, type) | Constructor. |
Publisher:publish (message) | Publish message to topic. |
Publisher:spin () | Spin function. |
Publisher:start_server () | Start the internal TCP server to accept ROS subscriber connections. |
Publisher:wait_for_subscriber () | Wait for a subscriber to connect. |
Functions
- Publisher:finalize ()
- Finalize instance.
- Publisher:get_stats ()
-
Get statistics about this publisher.
Return value:
an array containing the topic name as the first entry, and another array as the second entry. This array contains itself tables with four fields each: the remote caller ID of the connection, the number of bytes sent, number of messages sent and connection aliveness (always true). Suitable for getBusStats of slave API. - Publisher:new (topic, type)
-
Constructor. Create a new publisher instance.
Parameters
- topic: topic to publish to
- type: type of the topic
- Publisher:publish (message)
-
Publish message to topic. The messages are sent immediately. Busy or bad network connections or a large number of subscribers can slow down this method.
Parameters
- message: message to publish
- Publisher:spin ()
- Spin function. While spinning the publisher accepts new connections.
- Publisher:start_server ()
- Start the internal TCP server to accept ROS subscriber connections.
- Publisher:wait_for_subscriber ()
- Wait for a subscriber to connect.