Getting Started with ROS on Embedded Systems - User Guide - C++ - Messages
Getting Started with ROS on Embedded Systems RidgeRun documentation is currently under development. |
Getting Started with ROS on Embedded Systems | |
---|---|
![]() | |
ROS on Embedded Systems Basics | |
|
|
Getting Started | |
|
|
C++ User Guide | |
|
|
Examples | |
|
|
Performance | |
|
|
Contact Us |
Contents
Introduction
This wiki is based on the following ROS page: http://wiki.ros.org/msg
Messages are the main form of communication in a topic, in which the publisher will push a message of some defined type and the subscriber will use that same kind of message in the reception.
These messages are normally described in a simplified file that is then used by ROS to generate C++ (and another languages) code with them (which ends up being a simple struct). Message descriptions are located inside the msg/ folder in the package, and end with .msg extension.
Message types are referred to using package resource names. For example, the file rr_msgs/msg/RRMessage.msg is commonly referred to as rr_msgs/RRMessage.
Message description
Messages have two parts in the .msg file: fields and constants
Message fields
Fields are the data sent inside the message, this is defined in the messages as pairs of key and value:
type1 name1 type2 name2 type3 name3
Types
The types can be primitive:
bool, int8, uint8, int16, uint16, int32, uint32, int64, uint64, float32, float64, string, time, duration
Or they can be arrays too:
Names
The names for the fields determines how to get the data on the target language, just as one would do using structs. Field names must be translated to multiple languages, so their names are restricted to the following pattern: [a-zA-Z][a-zA-Z1-9_]*.
Creating a message
Create a message package
Adding message generation
Using message from another nodes
See current topics:
rostopic list