skbot.ignition.Subscriber

class skbot.ignition.Subscriber(topic, *, parser=None)[source]

Subscribe and listen to Ignition messages.

Ignition uses ZMQ to pass around protocol buffers as means of communication. This subscriber enabels python to receive copies of these buffers. For more information on the messages published by ignition, and how it works, check out the Ign-Msgs documentation as well as the Ign-Transport documentation.

__init__(topic, *, parser=None)[source]

Initialize a new subscriber for the given topic.

Creates an object that uses a context manager to subscribe to ign-transport topics and receive messages from it.

Parameters
topicstr

The name of the topic to subscribe to as shown by ign topic -l.

parserfunction

A function that deserializes the message. The signature of the parser function is fn(zmq_message) -> result where zmq_message is a 3-tuple of the form (zmq_topic, protobuf_message, message_type). If None, the subscriber will use a default parser that converts protobuf_message into a skbot.ignition.message.<message_type> data object.

Returns
selfSubscriber

A object that can subscribe to ign-transport within a context manager

Methods

__init__(topic, *[, parser])

Initialize a new subscriber for the given topic.

recv([blocking, timeout])

Receive a message from the topic