操作系统: Ubuntu 18.04

ROS版本: Melodic

测试时间:2021年06月20日


笔者在进行移动机器人 SLAM 建图仿真时,终端提示

ERROR: cannot launch node of type [gmapping/slam_gmapping]: gmapping

即无法找到相关的 gmapping 依赖,但是之前已经安装过了,此处根据终端提示,对gmapping 进行安装

sudo apt-get install ros-melodic-gmapping

终端反馈如下

The following NEW packages will be installed:
  ros-melodic-gmapping
0 upgraded, 1 newly installed, 0 to remove and 109 not upgraded.
Need to get 241 kB of archives.
After this operation, 1,457 kB of additional disk space will be used.
Err:1 http://packages.ros.org/ros/ubuntu bionic/main amd64 ros-melodic-gmapping amd64 1.4.1-1bionic.20210112.191214
  404  Not Found [IP: 64.50.233.100 80]
E: Failed to fetch http://packages.ros.org/ros/ubuntu/pool/main/r/ros-melodic-gmapping/ros-melodic-gmapping_1.4.1-1bionic.20210112.191214_amd64.deb  404  Not Found [IP: 64.50.233.100 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

笔者首先尝试添加 —fix-missing 进行下载,但下载同样失败。

sudo apt-get install ros-melodic-gmapping --fix-missing

于是尝试先进行 apt-get update更新在进行功能包下载

sudo apt-get update

此时终端反馈错误如下

Err:13 http://packages.ros.org/ros/ubuntu bionic InRelease                     
  The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654 Open Robotics <info@osrfoundation.org>
Err:16 http://packages.ros.org/ros2/ubuntu bionic InRelease                    
  The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654 Open Robotics <info@osrfoundation.org>

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://packages.ros.org/ros/ubuntu bionic InRelease: The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654 Open Robotics <info@osrfoundation.org>
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://packages.ros.org/ros2/ubuntu bionic InRelease: The following signatures were invalid: EXPKEYSIG F42ED6FBAB17C654 Open Robotics <info@osrfoundation.org>
E: The repository 'http://ppa.launchpad.net/v-launchpad-jochen-sprickerhof-de/pcl/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

从终端反馈可以看到其提示我们 EXPKEYSIG F42ED6FBAB17C654

解决方案:

在终端键入如下命令

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys <EXPKEYSIG>

此处笔者已知 EXPKEYSIG F42ED6FBAB17C654,故有

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654

键入命令后终端反馈

Executing: /tmp/apt-key-gpghome.ytw9evYwRY/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654gpg: key F42ED6FBAB17C654: "Open Robotics <info@osrfoundation.org>" 1 new signaturegpg: Total number processed: 1gpg:         new signatures: 1

完成上述步骤后在进行系统更新以及功能包安装即可解决问题

sudo apt-get updatesudo apt-get install ros-melodic-gmapping