flexbe_core.proxy.proxy_subscriber_cached module

A proxy for subscribing topics that caches and buffers received messages.

Provides a single point for comminications for all states in behavior

class flexbe_core.proxy.proxy_subscriber_cached.ProxySubscriberCached(topics=None, qos=None, inst_id=-1)

Bases: object

A proxy for subscribing topics that caches and buffers received messages.

classmethod destroy_subscription(sub, topic)

Handle subscription destruction from within the executor threads.

classmethod disable_buffer(topic)

Disable the buffer on the given topic.

@type topic: string @param topic: The topic of interest.

classmethod enable_buffer(topic)

Enable the buffer on the given topic.

@type topic: string @param topic: The topic of interest.

classmethod get_from_buffer(topic)

Pop the oldest buffered message of the given topic.

@type topic: string @param topic: The topic of interest.

classmethod get_last_msg(topic)

Return the latest cached message of the given topic.

@type topic: string @param topic: The topic of interest.

classmethod has_buffered(topic)

Determine if the given topic has any messages in its buffer.

@type topic: string @param topic: The topic of interest.

classmethod has_msg(topic)

Determine if the given topic has a message in its cache.

@type topic: string @param topic: The topic of interest.

static initialize(node)

Initialize ROS setup for proxy subscriber.

classmethod is_available(topic)

Check if the subscriber on the given topic is available.

@type topic: string @param topic: The topic of interest.

classmethod make_persistant(topic)

Make the given topic persistant which means messages can no longer be removed.

Remove_last_msg will have no effect, only overwritten by a new message.

@type topic: string @param topic: The topic of interest.

classmethod remove_last_msg(topic, clear_buffer=False)

Remove the cached message of the given topic and optionally clears its buffer.

@type topic: string @param topic: The topic of interest.

@type topic: boolean @param topic: Set to true if the buffer of the given topic should be cleared as well.

classmethod set_callback(topic, callback, inst_id=-1)

Add the given callback to the topic subscriber.

@type topic: string @param topic: The topic to add the callback to.

@type callback: function @param callback: The callback to be added.

@type inst_id: int @param inst_id: identifier of instance creating subscription

static shutdown()

Shut down this proxy by unregistering all subscribers.

classmethod subscribe(topic, msg_type, callback=None, buffered=False, qos=None, inst_id=-1)

Add a new subscriber to the proxy.

@type topic: string @param topic: The topic to subscribe.

@type msg_type: a message class @param msg_type: The type of messages of this topic.

@type callback: function @param callback: A function to be called when receiving messages.

@type buffered: boolean @param buffered: True if all messages should be buffered,

False if only the last message should be cached.

@type inst_id: int @param inst_id: identifier of instance creating subscription

classmethod unsubscribe_topic(topic, inst_id=-1)

Remove the given topic from the list of subscribed topics.

@type topic: string @param topic: The topic of interest.

@type inst_id: int @param inst_id: identifier of instance creating subscription