November 24, 2024

How to See if ROS2 Package is Installed and How to Search for ROS2 Package

In this brief tutorial, we learn how to investigate if a ROS2 package is installed and how to search for a ROS2 package. In our case, we are using ROS2 Iron Irwini, however, with minor modifications everything explained in this tutorial applies to other ROS2 versions.

Open a new Linux terminal, and source the environment. In our case since we are using Iron Irwini, the source command is

source /opt/ros/iron/setup.bash

The package called “std_msgs” should come with every ROS2 distribution. Let us verify that this package is installed and that it exists on our system. To do that, we type

ros2 pkg prefix std_msgs

If the package is installed, you should get the path

/opt/ros/iron

as an output (or a similar path in the case of other distributions). If the package is not installed, the message will be “Package not found”.

To list all the packages installed in ROS2, you need to type:

ros2 pkg list

This will list all the installed ROS2 packages.