Defining Custom Messages
From Lofaro Lab Wiki
The majority of the information needed to create a message can be found by viewing the earlier tutorial on msg:
Some other notes:
- The msg file should be added to the msg folder of the package you are creating it for.
- Messages are put into a namespace which matches the name of the package.
For C++, an example would be
#include <std_msgs/String.h> std_msgs::String msg;
For Python:
from std_msgs.msg import String msg = String()
- If you are using a msg from one package (package 1) in another (new package 2), don't forget these changes to your package.xml file of package 2:
<build_depend>name_of_package_1</build_depend> <run_depend>name_of_package_1</run_depend>