rosserial overview: NodeHandles and Initialization | Messages | Publishers and Subscribers | Time | Logging | Limitations | Protocol

Message generation

Like all ROS Client Libraries, rosserial takes msg files and generates Arduino C/C++ source code for them. The pattern for this is:

  • package_name/msg/Foo.msgpackage_name::Foo

Similarly, srv files also have C/C++ source code generated. The pattern for this is:

  • package_name/srv/Bar.srvpackage_name::Bar

The source for the generated files are in the package_name directory of ros_lib library folder.

Thus, including the std_msgs/String message in your code involves:

   1 #include <std_msgs/String.h>
   2 

and instantiating the message:

   1 std_msgs::String str;

Note that all fields in a message are currently initialized to a default value of 0 (or null pointers for strings and variable-length arrays).

Message Header Generation

When you run make in the rosserial_arduino package, header files are automatically created for many common messages. Please see this tutorial you have additional messages for which you need to create header files.

Wiki: rosserial/Overview/Messages (last edited 2011-06-30 22:37:18 by MichaelFerguson)