赞
踩
ros官网安装指导:
https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html
locale # check for UTF-8
sudo apt update && sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
locale # verify settings
(1)确保 Ubuntu Universe 存储库已启用
apt-cache policy | grep universe
# 显示结果和下面类似表明已启动
500 http://us.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
release v=20.04,o=Ubuntu,a=focal,n=focal,l=Ubuntu,c=universe,b=amd64
如果没有看到像上面那样的输出结果,使用下以命令启用 Universe 存储库
sudo apt install software-properties-common
sudo add-apt-repository universe
(2)授权GPG密钥
sudo apt update && sudo apt install curl gnupg lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
(3)添加ros2 存储库到源列表
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
(1)更新缓存库
# 更新apt存储库缓存
sudo apt update
# 升级系统软件包
sudo apt upgrade
(2)ros2安装
# 包含ros2 galactic版 仿真工具rviz ros2默认demo 海龟模拟器 tutorials
sudo apt install ros-galactic-desktop
# 通信库、消息包、命令行工具安装
sudo apt install ros-galactic-ros-base
注意:ros2是区分版本的 下载时注意不同的版本ros包安装命令不同
# galactic版
sudo apt install ros-galactic-desktop
sudo apt install ros-galactic-ros-base
# humble版
sudo apt install ros-humble-desktop
sudo apt install ros-humble-ros-base
# foxy版
sudo apt install ros-foxy-desktop python3-argcomplete
sudo apt install ros-foxy-ros-base python3-argcomplete
在官网查看当前版本的安装指导
echo "source /opt/ros/galactic/setup.bash" >> ~/.bashrc
# ros2默认安装在这个目录 /opt/ros
# 加载环境变量准确来说依赖于ros安装的位置,如果执行这条指令没有生效建议检查下ros安装路径 对上面路径进行替换
验证安装结果
ros2 --help
报错:
W: GPG error: https://repo.huaweicloud.com/ros2/ubuntu focal InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY F42ED6FBAB17C654
E: The repository ‘https://repo.huaweicloud.com/ros2/ubuntu focal InRelease’ is not signed.
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.
解决办法:添加缺少的公钥
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654 # 换成提示的key
解决办法:
查询被墙网址对应ip地址
进入网站 https://www.ipaddress.com/ 查询 raw.githubusercontent.com映射的ip地址
在本地host文件中添加ip地址的映射关系
sudo vim /etc/hosts
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。