In this section you have seen how to create your own ROS 2 interfaces, for Topics and Services.

Topics and Services are the communication layer. Interfaces are the actual content that you send.

To recap, here’s how to create a custom interface:

Once you’ve setup your package, adding a new interface is really simple:

Here’s what you can use inside a msg or srv definition:

And now, when you compile the definitions, new interfaces will be created, along with headers/modules ready to be included in your C++ or Python nodes.


You’re almost ready to start your own ROS 2 application! In the next section you’ll see how to add settings to your nodes at run time with ROS 2 parameters.


___________________________________


Download the complete code for this section (this is the code from all previous sections + the current one).