Important ROS Commands – ROS Package Commands
ROS package commands are used to manage ROS packages, for example to view information of packages and to install related packages.
ROS Package Command “rospack”
The “rospack” command is used to handle packages. It is a combination of “ros + pack (package)” similar to previously discussed commands such as rostopic, rosnode, rosparam etc.
General structure of the command is as follows
rospack [option] [Package_Name]
Various important options that can be used with “rospack” command are “list”, “find”, “depends”, “depends-on”, “profile”, etc.
“rospack list” command
The “rospack list” command shows all available packages. Let’s try this command to view the list of packages.
Run in the terminal
rospack list
We can see a long list of packages. Few of the packages are show in figure below, because we cut the image as the original list is very long.
Since the list of packages is very long, we can combine “rospack list” command with Linux search command “grep” to find the packages that we are looking for.
Run in the terminal
rospack list | grep turtle
Now only those results will be displayed which have “turtle” word in them as shown in figure below
“rospack find” command
The command “rospack find” is used to show the saved location of a specific package. The structure of the command is as follows
rospack find [Package_Name]
For example, run the command in terminal
rospack find turtlesim
We can see that the path of the package “turtlesim” is displayed. We can go to given path (or location) to view or modify the package files.
“rospack depends” command
The “rospack depends” command is used to display the dependency packages that will be needed to run a specific package.
The structure of the command is as follows
rospack depends [Specific Package_Name]
For example, Run the command in terminal
rospack depends turtlesim
it will show on what packages, the package “turtlesim” depends.
“rospack depends-on” command
The command “rospack depends-on” is used to show the packages that are using the specific package.
The structure of the command is as follows
rospack depends-on [Specific Package_Name]
For example, run following command in terminal
rospack depends-on turtlesim
We can see that the following packages are using the package “turtlesim”
turtle_tf2 turtle_tf turtle_actionlib
“rospack profile” command
The command “rospack profile” checks the package information and working folders in order to re-index the packages. The command is not frequently used. However, you can use it after a newly added package, especially when the package is not being accessed by “roscd” command.
Run the command in terminal
rospack profile
“rosdep” command
The “rosdep” command is used to check and install the dependency files for a specific package. The options that can be used for “rosdep” command include “init”, “update”, “check”, “update” etc.
“rosdep can be initiated and updated using following commands
Run in the terminal
sudo resdep init
Also run
rosdep update
This will update and enable “rosdep” command to function properly.
“rosdep check” command
The command “rosdep check” will check the dependency of a specific package.
The structure of the command is
rosdep check [Specific Package_Name]
Run in the terminal
rosdep check turtlesim
It will tell whether all system dependencies have been satisfied or there is any remaining dependencies to be installed.
“rosdep install” command
The command “rosdep install” installs dependency packages for a specific package.
The structure of the command is as follows
rosdep install [Specific Package_Name]
Run in the terminal
rosdep install turtlesim
This will install dependency packages for “turtlesim” package.
Our series of ROS Commands blogs is completed here. We will welcome your comments/ suggestions to improve the blogs. In next blogs we will discuss other aspects of Robot Operating System and related topics.