Overview
This tutorial describes how to get started using Gazebo Msgs with C++.
We will run through a simple example that populates a message and prints it. Start by creating a bare-bones main file using the editor of your choice.
The easiest way to include Gazebo Msgs is through the gz/msgs.hh
header file. Alternatively, you can include only the header files you need. For this example, we'll take the short and easy approach.
At this point your main file should look like
Now let's create a message to store three points with arbitrary values. We will use the gz::msgs::Vector3
class to store these points and the function DebugString()
to print the content on the terminal.
To compile the code create a CMakeLists.txt
:
Let's start by compiling the examples:
Run the example, you should see something like: