O'Reilly logo

Robot Operating System Cookbook by Kumar Bipin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating ROS nodes

In this section, we are going to learn how to create two nodes, where one will publish data and the other will receive this data. This is the most basic way of communicating between two nodes in the ROS system.

We created the ROS package chapter2_tutorials in the earlier section Creating a ROS package and metapackage. Now, we will navigate to the chapter2_tutorials/src/ folder using the following command:

$ roscd chapter2_tutorials/src/

We will create two files with the names example_1a.cpp and example_1b.cpp. The example_1a.cpp file will create a node named example1a, which publishes the data "Hello World!" on the /message topic. Moreover, the example_1b.cpp file will create a node named example1b, which subscribes to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required