Skip to Main Content
Robot Operating System Cookbook
book

Robot Operating System Cookbook

by Kumar Bipin
June 2018
Intermediate to advanced content levelIntermediate to advanced
484 pages
11h 36m
English
Packt Publishing
Content preview from Robot Operating System Cookbook

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Advanced Robotic Vehicles Programming: An Ardupilot and Pixhawk Approach

Advanced Robotic Vehicles Programming: An Ardupilot and Pixhawk Approach

Julio Alberto Mendoza-Mendoza, Victor Javier Gonzalez-Villela, Gabriel Sepulveda-Cervantes, Mauricio Mendez-Martinez, Humberto Sossa-Azuela
Effective Robotics Programming with ROS - Third Edition

Effective Robotics Programming with ROS - Third Edition

Anil Mahtani, Luis Sánchez, Enrique Fernández, Aaron Martinez
Mobile Intelligent Autonomous Systems

Mobile Intelligent Autonomous Systems

Jitendra R. Raol, Ajith K. Gopal

Publisher Resources

ISBN: 9781783987443Supplemental Content