|Note: This tutorial assumes that you have completed the previous tutorials: ROS tutorials.|
|Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.|
Defining Custom MessagesDescription: This tutorial will show you how to define your own custom message data types using the ROS Message Description Language.
Next Tutorial: Using a C++ class in Python
Generating a message is easy. Simply place a .msg file inside the msg directory in a package. Please follow previous tutorial about creating .msg files (don't forget to choose build system type at the top of the page there).
Including or Importing Messages
Messages are put into a namespace that matches the name of the package. ie.
If you are using the new custom message defined in a different package, remember to add:
and you will need to add this to your CMakeList.txt:
findPackage(message_generation) catkin_package(CATKIN_DEPENDS message_runtime) add_message_files(FILE your_msg_file.msg)
The ROSNodeTutorialPython tutorial shows an example of the previously described talker and listener tutorials using a custom message, with implementations in C++ and Python.