## page was copied from ROS/Tutorials/DefiningCustomMessages #################################### ##FILL ME IN #################################### ## links to any required tutorials ## note.0= [[ROS/Tutorials| ROS tutorials]] ## descriptive title for the tutorial ## title = Defining Custom Messages ## multi-line description to be displayed in search ## description = This tutorial will show you how to define your own custom message data types using the ROS [[ROS/Message_Description_Language| Message Description Language]]. ## the next tutorial description ## next = ## links to next tutorial ## next.0.link= [[WritingTutorials|Writing a Tutorial]] ## next.1.link= ## what level user is this tutorial for ## level= INTERMEDIATE ## choose the correct category (this tag will be searched over it must be here) ## IntermediateCategory #################################### <<IncludeCSTemplate(TutorialCSHeaderTemplate)>> <<TOC(4)>> <<Buildsystem()>> == Generating Messages == Generating a message is easy. Simply place a .msg file inside the msg directory in a package. Please follow [[ROS/Tutorials/CreatingMsgAndSrv#Creating_a_msg|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 == === C++ === Messages are put into a namespace that matches the name of the package. ie. {{{#!cplusplus #include <std_msgs/String.h> std_msgs::String msg; }}} === Python === {{{#!python from std_msgs.msg import String msg = String() }}} == Dependencies == If you are using the new custom message defined in a different package, remember to add: {{{{{#!wiki buildsystem rosbuild to `manifest.xml`: {{{ <depend package="name_of_package_containing_custom_msg"/> }}} }}}}} {{{{{#!wiki buildsystem catkin to [[catkin/package.xml|package.xml]]: {{{ <build_depend>name_of_package_containing_custom_msg</build_depend> <run_depend>name_of_package_containing_custom_msg</run_depend> }}} }}}}} The [[ROSNodeTutorialPython|ROSNodeTutorialPython]] tutorial shows an example of the previously described talker and listener tutorials using a custom message, with implementations in C++ and Python. ##ROSTutorialCategory