Public Member Functions | |
def | __init__ (self, topic, msg_type=None) |
def | callback (self, msg, callbacks=None) |
def | has_subscribers (self) |
def | subscribe (self, client_id, callback) |
def | unregister (self) |
def | unsubscribe (self, client_id) |
def | verify_type (self, msg_type) |
Public Attributes | |
lock | |
msg_class | |
subscriber | |
subscriptions | |
topic | |
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.
Definition at line 47 of file subscribers.py.
def rosbridge_library.internal.subscribers.MultiSubscriber.__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
Definition at line 54 of file subscribers.py.
def rosbridge_library.internal.subscribers.MultiSubscriber.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
Definition at line 150 of file subscribers.py.
def rosbridge_library.internal.subscribers.MultiSubscriber.has_subscribers | ( | self | ) |
Return true if there are subscribers
Definition at line 144 of file subscribers.py.
def rosbridge_library.internal.subscribers.MultiSubscriber.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
Definition at line 118 of file subscribers.py.
def rosbridge_library.internal.subscribers.MultiSubscriber.unregister | ( | self | ) |
Definition at line 96 of file subscribers.py.
def rosbridge_library.internal.subscribers.MultiSubscriber.unsubscribe | ( | self, | |
client_id | |||
) |
Unsubscribe the specified client from this subscriber Keyword arguments: client_id -- the ID of the client to unsubscribe
Definition at line 134 of file subscribers.py.
def rosbridge_library.internal.subscribers.MultiSubscriber.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
Definition at line 101 of file subscribers.py.
rosbridge_library.internal.subscribers.MultiSubscriber.lock |
Definition at line 91 of file subscribers.py.
rosbridge_library.internal.subscribers.MultiSubscriber.msg_class |
Definition at line 93 of file subscribers.py.
rosbridge_library.internal.subscribers.MultiSubscriber.subscriber |
Definition at line 94 of file subscribers.py.
rosbridge_library.internal.subscribers.MultiSubscriber.subscriptions |
Definition at line 90 of file subscribers.py.
rosbridge_library.internal.subscribers.MultiSubscriber.topic |
Definition at line 92 of file subscribers.py.