Topics are the basic way of communicating between two nodes. In this section, we can see how the topics works. We are going to create two ROS nodes for publishing a topic and subscribing the same. Navigate to the mastering_ros_demo_pkg folder, joining the /src subdirectory for the source code. demo_topic_publisher.cpp and demo_topic_subscriber.cpp are the two sets of code that we are going to discuss.
Working with ROS topics
Get Mastering ROS for Robotics Programming - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.