ROS Commands – ROS Message Information
Since, topics handle information through messages. Therefore, it is important to
learn the commands to get the information about messages. Here, we will go
through the commands that are directly related to ROS messages.
ROS Message Command “rosmsg”
First we will check the options which can be used with the command “rosmsg”.
Run following command in the terminal
rosmsg -h
We can see the options that can be used with “rosmsg” command in figure below.
Now we will go through these commands one by one.
Note: The order of the commands in above list may be different from the order of the commands in our description. This is because, we will follow the order which is convenient to execute the commands.
Close all terminals, and open three new terminals to run the following three commands in each terminal separately
roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key
“rosmsg list” command
The “rosmsg list” command displays the the list of all messages which are currently installed.
Open a new terminal and run the command
rosmsg list
You can see a long list of messages that are listed alphabetically. Since the list is very long, we are showing only few of them in figure below.
We can use the “rosmsg list” command combined with “grep” to get a list of relevant messages (For more information about “grep”, see Linux Commands blogs). e.g. if we want to get the messages for turtlebot3, we can run the following command.
rosmsg list | grep turtlebot3
To view the installed messages for turtlesim, run following command rosmsg list | grep turtlesim
we can see the list of installed messages for turtlebot3 and turtlesim in figure below
“rosmsg show” command
The “rosmsg show” commands display the information of a specific message. The structure of the command is as follows
rosmsg show [Message_Name]
For example, we can visualize the information of turtlesim/Pose message.
Run the command
rosmsg show turtlesim/Pose
Remember “P” is capital for Pose in “turtlesim/Pose”, and it is same for other messages.
We can see the message information in figure below
“rosmsg package” command
The “rosmsg package” command is used to view the messages used in a specific package.
The structure of the command is as follows
rosmsg package [Package_Name]
Run in terminal
rosmsg package turtlesim
“rosmsg packages” command
There is another similar command “rosmsg packages”, which is used to display the list of all packages that use messages.
We run the command to see the result
rosmsg packages
Remember the command “rosmsg package turtlesim” will display the messages used in the package “turtlesim”, while the command “rosmsg packages” will display all packages that use the messages.
As show in figure below
“rosmsg info” command
The “rosmsg info” command is Alias for “rosmsg show”, and does exactly the same thing as show in the figure below
The command “rosmsg md5” is used to verify the integrity of the message. However, it is not commonly used. We are not discussing it here. Anyone can read about it on wikipedia if needed.