5. Writing Nodes#
In Chapter 3, we explored important concepts such as nodes and topics. In this chapter, we will delve deeper into these ideas by learning how to write nodes. As a refresher, nodes are independent processes that perform specific computations. One of the core functionalities of nodes in ROS2 is to compute some information, publish it to a topic, and allow another node to subscribe to that topic and use the information for further computation. This model of behavior is known as the publisher-subscriber model. In this chapter, we will learn how to write nodes that follow this model, along with exploring additional concepts.