D5 – ROSjava – PubSub – Independent

This demo shows how multiple ROS nodes can be represented by one Neural Module, where the Module does not need to have any inputs/outputs.

The demo launches the same Publisher and Subscriber as the Demo 2. But this time, these are launched under one Neural Module, so they are in the same namespace and allowed co communicate directly over the ROS network.

Launching the Script

The demo is launched by the command:

run nr-demo/basic/pubsub_independent.py

The script does the following:

  • Creates one Neural Module
  • Adds Publisher and Subscriber under it
  • Does not define any IO for the Nengo simulator


Note that the communication between the Publisher and the Subscriber stars immediately after running the script, before the Nengo interactive simulation is started – these nodes are running independently of the simulator.

ROS Network

The communication can be seen in ROS Graph visualization:

pubsub_independentWhere the Publisher and Subscriber communicate directly over the ROS network (share the same namespace and use the same name of topic). The default modem, contained in Neural Module, does not include any connections here. This means that no communication with Nengo simulator is exchanged.

However, it is possible to add a:

  • Decoder, which will create origin in the Nengo simulator and will subscribe to given topic. Messages which are published by the Publisher will be received also by this decoder and the corresponding data will appear on the origin.
  • Encoder, which will create termination in the Nengo simulator and will publish to given topic. Data passed onto the termination in Nengo will be published as ROS messages on given topic. The Subscriber will receive messages from two sources: from the Publisher and from Nengo/encoder.