flexbe_core.proxy.proxy_publisher module

A proxy for publishing topics.

Provides a single point for comminications for all states in behavior

class flexbe_core.proxy.proxy_publisher.ProxyPublisher(topics=None, qos=None, **kwargs)

Bases: object

A proxy for publishing topics.

classmethod createPublisher(topic, msg_type, qos=None, **kwargs)

Add a new publisher to the proxy.

@type topic: string @param topic: The topic to publish on.

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

classmethod destroy_publisher(pub, topic)

Handle publisher destruction from within the executor threads.

static initialize(node)

Initialize ROS setup for proxy publisher.

classmethod is_available(topic)

Check if the publisher on the given topic is available.

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

classmethod number_of_subscribers(topic)

Return the current number of active subscribers to a given topic.

@param topic name of topic @return number of subscribers, or -1 if topic is not available

classmethod publish(topic, msg)

Publish a message on the specified topic.

@type topic: string @param topic: The topic to publish on.

@type msg: message class (defined when created publisher) @param msg: The message to publish.

static shutdown()

Shuts this proxy down by reseting all publishers.

classmethod wait_for_any(topic, timeout=5.0)

Block until there are any subscribers to the given topic.

@type topic: string @param topic: The topic to publish on.

@type timeout: float @param timeout: How many seconds should be the maximum blocked time.