class documentation

class MultiSubscriber:

Constructor: MultiSubscriber(topic, msg_type)

View In Hierarchy

Handles multiple clients for a single subscriber.

Converts msgs to JSON before handing them to callbacks. Due to subscriber callbacks being called in separate threads, must lock whenever modifying or accessing the subscribed clients.

Method __init__ Register a subscriber on the specified topic.
Method callback Callback for incoming messages on the rospy.Subscriber
Method has_subscribers Return true if there are subscribers
Method subscribe Subscribe the specified client to this subscriber.
Method unregister Undocumented
Method unsubscribe Unsubscribe the specified client from this subscriber
Method verify_type Verify that the subscriber subscribes to messages of this type.
Instance Variable lock Undocumented
Instance Variable msg_class Undocumented
Instance Variable subscriber Undocumented
Instance Variable subscriptions Undocumented
Instance Variable topic Undocumented
def __init__(self, topic, msg_type=None):

Register a subscriber on the specified topic.

Keyword arguments: topic -- the name of the topic to register the subscriber on msg_type -- (optional) the type to register the subscriber as. If not provided, an attempt will be made to infer the topic type

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

def callback(self, msg, callbacks=None):

Callback for incoming messages on the rospy.Subscriber

Passes the message to registered subscriber callbacks.

Keyword Arguments: msg - the ROS message coming from the subscriber callbacks - subscriber callbacks to invoke

def has_subscribers(self):

Return true if there are subscribers

def subscribe(self, client_id, callback):

Subscribe the specified client to this subscriber.

Keyword arguments: client_id -- the ID of the client subscribing callback -- this client's callback, that will be called for incoming messages

def unregister(self):

Undocumented

def unsubscribe(self, client_id):

Unsubscribe the specified client from this subscriber

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

def verify_type(self, msg_type):

Verify that the subscriber subscribes to messages of this type.

Keyword arguments: msg_type -- the type to check this subscriber 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

lock =

Undocumented

msg_class =

Undocumented

subscriber =

Undocumented

subscriptions: dict =

Undocumented

topic =

Undocumented