Defining custom interfaces (msg srv)

EpicZa edited this page Sep 23, 2018 · 3 revisions

Defining custom interfaces (msg/srv)

INCOMPLETE

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 .msg or .srv file, which you do using the ROS interface definition language. By convention, .msg files go into a package subdirectory called msg and .srv files go into a package subdirectory called srv (you can pick different locations, but we recommend following the convention).

Having written your .msg and/or .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.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.