## for a custom note with links:
## note =
## for the canned note of "This tutorial assumes that you have completed the previous tutorials:" just add the links
## note.0= [[rosserial_arduino/Tutorials/Arduino IDE Setup|Arduino IDE Setup]]
## descriptive title for the tutorial
## title = Generating Message Header File
## multi-line description to be displayed in search
## description = This tutorial shows how to generate message header files for using new message packages with rosserial.
## the next tutorial description (optional)
## next =
## links to next tutorial (optional)
## next.0.link=
## next.1.link=
## what level user is this tutorial for
## level= IntermediateCategory
## keywords =
####################################
<<IncludeCSTemplate(TutorialCSHeaderTemplate)>>

<<TableOfContents(4)>>

##startpage
== Overview ==
Software running in embedded systems like [[rosserial_arduino]] or [[rosserial_embeddedlinux]] needs a definition of all messages passed between it and ROS nodes. It cannot directly use the C++ header files that are part of ROS because they depend on Boost libraries, which likely aren't available on the embedded system. The solution is to generate simplified C++ header files for the embedded environment from the same message definitions used by the rest of ROS.

These simplified message header files in C++ are generated for many important message types when you install [[rosserial]]. If you need to use other message types, or you have your own custom message types, you will need to generate the appropriate headers for both the embedded system and the ROS nodes that will use your message types.

== Generating Message Header Files ==

The [[rosserial_client]] package includes a tool - make_library.py - for generating the required header files from [[Messages|message definition files]]. It regenerates all the standard messages (e.g. std_msgs, geometry_msgs, etc) as well as any messages you've defined in packages you specify on the command line, and places them in a directory you specify.

{{{
rosrun rosserial_client make_library.py path_to_libraries your_message_package
}}}

For instance, suppose you need to generate headers for message definitions contained in my `crazy_msgs` package, and ''ros_lib'' is located at '~/sketchbook/libraries/ros_lib':

{{{
rosrun rosserial_client make_library.py ~/sketchbook/libraries crazy_msgs
}}}

This command will create the headers, and locate them in `~/sketchbook/libraries/ros_lib/crazy_msgs/`. 

The make_library.py program generates the headers for all the standard messages, but you may only need to transfer your custom message headers to another environment (for example, a PC running the Arduino IDE). 

If you use custom messages, generate ROS message headers for them, in addition to the simplified rosserial headers. Use the technique described in the [[ROS/Tutorials/DefiningCustomMessages|DefiningCustomMessages]] tutorial to generate standard ROS headers.

== Using Custom Messages ==

Your custom message definitions must be available to all software that uses them, including the rosserial_python proxy node and any ROS C++ or python nodes. All that's required to enable rosserial_python to find your custom message definition is to add the path to the package that defines it to your PYTHONPATH environment variable. When the rosserial_python proxy receives a subscriber or publisher or service registration from the embedded system, it searches $PYTHONPATH looking for packages with a msg directory that contains a matching message definition. 

The [[ROSNodeTutorialPython]] tutorial shows how to include the ROS definition of your custom messages into a ROS C++ or python node.

##endpage
## AUTOGENERATED DO NOT DELETE
## TutorialCategory
## FILL IN THE STACK TUTORIAL CATEGORY HERE