When we compile the software, we often get an error, indicating that the software package is missing, but the prompt is usually the keyword of the package, not the complete package name, and we don’t know the complete package name of the package when installing the software. Use the following command to Find the full name of the package.
sudo apt-cache search keywords
Case 1
sudo apt-cache search diagnostic_updater
ros2@ubuntu:~$ sudo apt-cache search diagnostic_updater
[sudo] ros2 的密码:
ros-noetic-diagnostic-updater - diagnostic_updater contains tools for easily updating diagnostics.
ros-foxy-diagnostic-updater - diagnostic_updater contains tools for easily updating diagnostics.
ros-galactic-diagnostic-updater - diagnostic_updater contains tools for easily updating diagnostics.
ros-rolling-diagnostic-updater - diagnostic_updater contains tools for easily updating diagnostics.
Use this command to find the full name of the package: ros-foxy-diagnostic-updater
sudo apt install ros-foxy-diagnostic-updater //installation package
Case reference:
Case 2
Install the robot navigation package, the installation command in the document: sudo apt install ros-<ros2-distro>-navigation2
This command is selected with a version, not a complete package name, and needs to be searched with apt-cache search:
apt-cache search navigation2
#输出
ros-foxy-nav2-bringup - Bringup scripts and configurations for the navigation2 stack
ros-foxy-nav2-core - A set of headers for plugins core to the navigation2 stack
ros-foxy-nav2-gazebo-spawner - Package for spawning a robot model into Gazebo for navigation2
ros-foxy-nav2-msgs - Messages and service files for the navigation2 stack
ros-foxy-navigation2 - ROS2 Navigation Stack
ros-foxy-turtlebot3-navigation2 - ROS 2 launch scripts for navigation2
ros-galactic-navigation2 - ROS2 Navigation Stack
ros-galactic-turtlebot3-navigation2 - ROS 2 launch scripts for navigation2
The full package name should be: ros-foxy-navigation2
sudo apt install ros-foxy-navigation2 #installation command
The installation is complete.