Public Member Functions | Private Attributes | List of all members
rate_publishers.RatePublishers Class Reference
Inheritance diagram for rate_publishers.RatePublishers:
Inheritance graph
[legend]

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

def rate_publishers.RatePublishers.__init__ (   self)

Definition at line 83 of file rate_publishers.py.

Member Function Documentation

◆ add_topic()

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.

◆ pub()

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.

◆ spin_once()

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.

◆ stop()

def rate_publishers.RatePublishers.stop (   self,
  topic 
)
Stops repeating any message on the given topic.

Definition at line 114 of file rate_publishers.py.

Member Data Documentation

◆ _publishers

rate_publishers.RatePublishers._publishers
private

Definition at line 84 of file rate_publishers.py.


The documentation for this class was generated from the following file:


twist_mux
Author(s): Enrique Fernandez , Siegfried-A. Gevatter Pujals
autogenerated on Wed Oct 26 2022 02:14:17