If you have completed the previous chapter successfully, you must be familiar with how ROS-1 uses a simple publish-subscribe model where a master node is used to establish a connection between nodes and communicate data. As we mentioned previously, ROS-2 works in a slightly different way. Since DDS implementation is used in ROS-2, the DDS Interoperability Real-Time Publish-Subscribe Protocol (DDSI-RTPS) is used. The idea is to establish secure and efficient communication between nodes, even in heterogeneous platforms:
As you can see, there are additional components that are involved in this communication method. As we mentioned previously, a node is called a participant in ROS-2. Each participant can have single or multiple DDS topics and these topics are neither publishers nor subscribers, like in ROS-1, but are referred to as code objects in ROS-2.
These DDS topics are available in the global data space. From these topics, DDS publishers and subscribers are created but they do not directly publish to or subscribe to a topic. These are the responsibilities of components called data writers and data readers. Data writers and data readers write or read data in a specialized message type, and this is how communication is achieved in ROS-2. These levels of abstraction are necessary to ensure the secure and efficient transfer of data. A user can set QoS settings at each level to provide the highest granularity of configuration.