Hello, I’m a little fish. Xiaoyu found that many students have the problem of not finding a certain bag in the process of learning and using ROS. The error looks something like this.

How do you check in this situation?

The rospack command displays a list of all packages in the current workspace.

If the library is not in the list, consider whether there is a source environment or installation

If so, you can use rospack to find the specific path of a package and see if it has the instructions you want.

Try it out with the little fish.

View the names and locations of all packages in the current environment

rospack list
Copy the code
(base) ➜ armsim rospack listactionlib/opt/ros/melodic/share/actionlibactionlib_msgs /opt/ros/melodic/share/actionlib_msgsactionlib_tutorials /opt/ros/melodic/share/actionlib_tutorialsamcl /opt/ros/melodic/share/amcl...........Copy the code

I can see a lot of bags, so I want to filter ur5 keywords, how do I do it?

rospack list | grep ur5
Copy the code

The fish tries to run it and finds nothing, which means that the package does not exist in my workspace.

This time the fish found that they forgot the source, you can first source the environment.

source devel/setup.bash
Copy the code

Then try again

(base) ➜ armsim rospack list | grep ur5ur5_moveit_config /home/monster/code/learn/armsim/src/universal_robot/ur5_moveit_configCopy the code
rospack find package-name
Copy the code

Such as

(base) ➜ armsim rospack find turtlesim/opt/ros/melodic/share/turtlesimCopy the code

There are more ways to use it, such as finding all the dependencies of a package.

(base) ➜  armsim rospack depends-on turtlesimturtle_tfturtle_tf2turtle_actionlib
Copy the code

When you manually download and compile a package, you can use rospack to check for dependencies before you install it.

You can use rospack-h to find out more.

I am Xiaoyu, a working robot algorithm engineer

Currently doing the public number, output

Robot algorithm annotation, learning tutorial, work experience, etc

Welcome your attention