Welcome to ZeROSMQ’s documentation!

ZeROSMQ is a Python library that implements ROS-like inter-process communication by using topics and nodes. The communications are handled by ZeroMQ in the most inefficient way possible.

ZeROSMQ allows Python programs to pass messages to each other, while at the same time decoupling the implementation of the different programs. It is especially suited for data collection applications, where a program can read data from a sensor and broadcast it in real time, so that other, independent programs can receive and process it.

ZeROSMQ’s basic usage is as follows:

# In data publishers
import zerosmq
zerosmq.init("publisher")
zerosmq.register_publish("SOME_TOPIC") # Report intention to publish on topic SOME_TOPIC
while True:
  data=read_some_sensor()
  zerosmq.publish("SOME_TOPIC",data) # Send the sensor data to the topic
  sleep(1) # Sleep for a second


# In data subscribers
import zerosmq
zerosmq.init("subscriber")
zerosmq.subscribe("SOME_TOPIC") # Subscribe to SOME_TOPIC to receive any messages sent to it
while True:
  data=zerosmq.receive("SOME_TOPIC") # Try to receive an update
  if data: # If data is not None, then show it
    print(data)

ZeROSMQ also contains some utilities that aid in debugging and using the library:

  • A program that shows a graph of all nodes and how they communicate (see Graphing nodes for more information).
  • A program that plots the data sent to a topic or group of topics (see Plotting data for more information).

ZeROSMQ’s code is hosted on GitHub.