Public Member Functions | |
def | __init__ |
def | add_topic |
def | pub |
def | spin_once |
def | stop |
Private Attributes | |
_publishers |
A class for managing several ROS publishers repeating messages with different rates. The main purpose of this class is for unit testing.
Definition at line 72 of file rate_publishers.py.
def rate_publishers.RatePublishers.__init__ | ( | self | ) |
Definition at line 80 of file rate_publishers.py.
def rate_publishers.RatePublishers.add_topic | ( | self, | |
topic, | |||
msg_type | |||
) |
Adds a topic for future publication. This creates a rospy.Publisher internally. Note that the publisher will latch the topic; if that wasn't the case, clients might need to sleep before publishing something for the first time to give subscribers enough time to connect.
Definition at line 83 of file rate_publishers.py.
def rate_publishers.RatePublishers.pub | ( | self, | |
topic, | |||
message, | |||
rate = None |
|||
) |
Publishes `message' on the given topic. If `rate' is not None, the message will be repeated at the given rate (expected to be in Hz) until pub() or stop() are invoked again. Note that `rate' may also be a function, in which case it'll be invoked for each publication to obtain the message.
Definition at line 98 of file rate_publishers.py.
def rate_publishers.RatePublishers.spin_once | ( | self | ) |
Publishes any scheduled messages and returns the amount of time until it should be called again.
Definition at line 117 of file rate_publishers.py.
def rate_publishers.RatePublishers.stop | ( | self, | |
topic | |||
) |
Stops repeating any message on the given topic.
Definition at line 111 of file rate_publishers.py.
Definition at line 80 of file rate_publishers.py.