Public Member Functions | |
def | __init__ (self) |
def | add_topic (self, topic, msg_type) |
def | pub (self, topic, message, rate=None) |
def | spin_once (self) |
def | stop (self, topic) |
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 75 of file rate_publishers.py.
def rate_publishers.RatePublishers.__init__ | ( | self | ) |
Definition at line 83 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 86 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 101 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 120 of file rate_publishers.py.
def rate_publishers.RatePublishers.stop | ( | self, | |
topic | |||
) |
Stops repeating any message on the given topic.
Definition at line 114 of file rate_publishers.py.
|
private |
Definition at line 84 of file rate_publishers.py.