Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Defining custom interfaces (msg srv)
Defining custom interfaces (msg/srv)
While we encourage reuse of existing "standard" message and service definitions wherever possible, there are plenty of cases in which you'll need to define your own custom messages and/or services for a particular application.
The first step in defining a custom message or service is to write the
.srv file, which you do using the ROS interface definition language.
.msg files go into a package subdirectory called
.srv files go into a package subdirectory called
srv (you can pick different locations, but we recommend following the convention).
Having written your
.srv files, you need to add some code to your package's
CMakelists.txt file to make the code generators run over your definitions. In lieu of a more complete tutorial on this topic, consult the pendulum_msgs package as an example. You can see the relevant CMake calls in that packages's CMakeLists.txt file.
Note that the
package.xml format must equal 3 for this to build, this is because the
member_of_group command requires format 3. ROS2s create package generates the
package.xml with a default format of 2.