Public Member Functions | Public Attributes | List of all members
rosbridge_library.internal.publishers.MultiPublisher Class Reference

Public Member Functions

def __init__ (self, topic, msg_type=None, latched_client_id=None, queue_size=100)
 
def has_clients (self)
 
def publish (self, msg)
 
def register_client (self, client_id)
 
def unregister (self)
 
def unregister_client (self, client_id)
 
def verify_type (self, msg_type)
 

Public Attributes

 clients
 
 latched_client_id
 
 listener
 
 msg_class
 
 publisher
 
 topic
 

Detailed Description

Keeps track of the clients that are using a particular publisher.

Provides an API to publish messages and register clients that are using
this publisher 

Definition at line 117 of file publishers.py.

Constructor & Destructor Documentation

◆ __init__()

def rosbridge_library.internal.publishers.MultiPublisher.__init__ (   self,
  topic,
  msg_type = None,
  latched_client_id = None,
  queue_size = 100 
)
Register a publisher on the specified topic.

Keyword arguments:
topic    -- the name of the topic to register the publisher to
msg_type -- (optional) the type to register the publisher as.  If not
provided, an attempt will be made to infer the topic type
latch    -- (optional) if a client requested this publisher to be latched,
    provide the client_id of that client here

Throws:
TopicNotEstablishedException -- if no msg_type was specified by the
caller and the topic is not yet established, so a topic type cannot
be inferred
TypeConflictException        -- if the msg_type was specified by the
caller and the topic is established, and the established type is
different to the user-specified msg_type

Definition at line 123 of file publishers.py.

Member Function Documentation

◆ has_clients()

def rosbridge_library.internal.publishers.MultiPublisher.has_clients (   self)
Return true if there are clients to this publisher. 

Definition at line 238 of file publishers.py.

◆ publish()

def rosbridge_library.internal.publishers.MultiPublisher.publish (   self,
  msg 
)
Publish a message using this publisher.

Keyword arguments:
msg -- the dict (json) message to publish

Throws:
Exception -- propagates exceptions from message conversion if the
provided msg does not properly conform to the message type of this
publisher

Definition at line 191 of file publishers.py.

◆ register_client()

def rosbridge_library.internal.publishers.MultiPublisher.register_client (   self,
  client_id 
)
Register the specified client as a client of this publisher.

Keyword arguments:
client_id -- the ID of the client using the publisher

Definition at line 216 of file publishers.py.

◆ unregister()

def rosbridge_library.internal.publishers.MultiPublisher.unregister (   self)
Unregisters the publisher and clears the clients 

Definition at line 169 of file publishers.py.

◆ unregister_client()

def rosbridge_library.internal.publishers.MultiPublisher.unregister_client (   self,
  client_id 
)
Unregister the specified client from this publisher.

If the specified client_id is not a client of this publisher, nothing
happens.

Keyword arguments:
client_id -- the ID of the client to remove

Definition at line 225 of file publishers.py.

◆ verify_type()

def rosbridge_library.internal.publishers.MultiPublisher.verify_type (   self,
  msg_type 
)
Verify that the publisher publishes messages of the specified type.

Keyword arguments:
msg_type -- the type to check this publisher against

Throws:
Exception -- if ros_loader cannot load the specified msg type
TypeConflictException -- if the msg_type is different than the type of
this publisher

Definition at line 174 of file publishers.py.

Member Data Documentation

◆ clients

rosbridge_library.internal.publishers.MultiPublisher.clients

Definition at line 161 of file publishers.py.

◆ latched_client_id

rosbridge_library.internal.publishers.MultiPublisher.latched_client_id

Definition at line 162 of file publishers.py.

◆ listener

rosbridge_library.internal.publishers.MultiPublisher.listener

Definition at line 166 of file publishers.py.

◆ msg_class

rosbridge_library.internal.publishers.MultiPublisher.msg_class

Definition at line 164 of file publishers.py.

◆ publisher

rosbridge_library.internal.publishers.MultiPublisher.publisher

Definition at line 165 of file publishers.py.

◆ topic

rosbridge_library.internal.publishers.MultiPublisher.topic

Definition at line 163 of file publishers.py.


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


rosbridge_library
Author(s): Jonathan Mace
autogenerated on Tue Oct 3 2023 02:12:45