Note: This tutorial assumes that you have completed the previous tutorials: C++ Node Tutorial, Python Node Tutorial.
(!) Please ask about problems and questions regarding this tutorial on Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Combining C++/Python Publisher/Subscriber

Description: This tutorial shows how to mix publishers and subscribers written in C++ and Python.

Keywords: parameter server, dynamic reconfigure, publisher, subscriber

Tutorial Level: INTERMEDIATE

Combining C++ and Python Publishers/Subscribers with Dynamic Reconfigure and Parameter Server

Previously, we created C++ and Python publishers and subscribers. It is possible to run all four nodes at the same time.

Starting the Nodes

The command

roslaunch node_example node_example.launch

will start all of the nodes -- talker, listener, and -- as well as a dynamic reconfigure GUI and rxconsole. In the launch file, make sure that all of the nodes are using the same topic. The output of the nodes can be seen in rxconsole and the thing to notice when running this launch file is that both listeners are subscribed to both talkers. This works because they all the nodes are using the same custom message.

Possible Combinations

Note that the following combination of nodes will work:

  • C++ publisher -> C++ listener

  • C++ publisher -> Python listener

  • C++ publisher -> C++ AND Python listeners

  • Python publisher -> C++ listener

  • Python publisher -> Python listener

  • Python publisher -> C++ AND Python listeners

Playing Around

Use the dynamic reconfigure GUI to select different publishers and change the messages or numbers and see the results in rxconsole. Then, modify the nodes to suit your own needs.

Wiki: ROSNodeTutorialC++Python (last edited 2011-09-10 00:44:14 by ThomasDenewiler)