ROS messages
ROS nodes communicate with each other by publishing messages to a topic. As we discussed earlier, messages are a simple data structure containing field types. The ROS message supports standard primitive datatypes and arrays of primitive types.
Nodes can also exchange information using service calls. Services are also messages. The service message definitions are defined inside the srv file.
We can access the message definition using the following method. For example, to access std_msgs/msg/String.msg, we can use std_msgs/String. If we are using the roscpp client, we have to include std_msgs/String.h for the string message definition.
In addition to message data type, ROS uses an MD5 checksum comparison to confirm whether the publisher and subscriber exchange the same message data types.
ROS has inbuilt tools called rosmsg to get information about ROS messages. Here are some parameters used along with rosmsg:
- $ rosmsg show [message]: This shows the message description
- $ rosmsg list: This lists all messages
- $ rosmsg md5 [message]: This displays md5sum of a message
- $ rosmsg package [package_name]: This lists messages in a package
- $ rosmsg packages [package_1] [package_2]: This lists packages that contain messages