(!) 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.

Adding Custom Messages (Generating Message Header File)

Description: This tutorial shows how to generate message header files for using new message packages with rosserial (i.e. how to add custom message type to your application with rosserial).

Tutorial Level: INTERMEDIATE

Next Tutorial: Measuring Temperature

Overview

This tutorial contains the same information as Generating Message Header File. Message header files 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.

Adding Custom Messages(Generating Message Header File)

New in 0.5.0 In groovy and above, you no longer need to run the make_library script for each package, instead, it is a one-time thing that generates message headers for all packages on your path. The script is also specific to the platform you are using (for instance, rosserial_arduino or rosserial_embedded_linux).

New in 0.2.0 The make_library has moved from rosserial_arduino to rosserial_client.

The rosserial_client package includes a tool for generating the required header files from message definition files.

rosrun rosserial_client make_library.py path_to_libraries your_message_package

For instance, suppose I 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/.

Wiki: rosserial_arduino/Tutorials/Adding Custom Messages (last edited 2019-11-10 07:19:38 by AvneeshMishra)