We provide ROS 2 binary packages for the following platforms:
Ubuntu Linux - Focal Fossa (20.04)
Debian packages
“fat” archive
macOS
Windows
We support building ROS 2 from source on the following platforms:
Ubuntu Linux
macOS
Windows
The current Debian-based target platforms for Foxy Fitzroy are:
Tier 1: Ubuntu Linux - Focal Fossa (20.04) 64-bit
Tier 3: Debian Linux - Buster (10) 64-bit
Other Linux platforms with varying support levels include:
Arch Linux, see alternate instructions
Fedora Linux, see alternate instructions
OpenEmbedded / webOS OSE, see alternate instructions
Make sure you have a locale which supports UTF-8. If you are in a minimal environment (such as a docker container), the locale may be something minimal like POSIX. We test with the following settings. However, it should be fine if you’re using a different UTF-8 supported locale.
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
一次不成功,建议重复多次
You will need to add the ROS 2 apt repositories to your system. To do so, first authorize our GPG key with apt like this:
sudo apt update && sudo apt install curl gnupg2 lsb-release
# 下面这条语句,我的输出错误: gpg: no valid OpenPGP data found,可能你们还会有其他问题
# sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
# 解决上面的问题,可以换成下面这条语句:
curl http://repo.ros2.org/repos.key | sudo apt-key add -
And then add the repository to your sources list:
# 我添加的源
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
# 官方源
sudo sh -c 'echo "deb http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list'
# 执行更新后,出现问题了
sudo apt update
N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'http://packages.ros.org/ros2/ubuntu focal InRelease' doesn't support architecture 'i386'
参照 ROS 2 安装后BUG,解决方法是:
$ cd /etc/apt/sources.list.d
$ sudo gedit ros2-latest.list
# 打开文本后出现:
deb http://packages.ros.org/ros2/ubuntu bionic main
# 在deb后插入[arch=amd64]变成:
deb [arch=amd64] http://packages.ros.org/ros2/ubuntu bionic main
# 保存并关闭
# 再次更新即可
sudo apt update
如果更新出现问题,多试几次
推荐安装ROS2桌面版本(包括ROS、RViz、demos、tutorials)
sudo apt install ros-foxy-desktop
如果出现问题,重复试几次
(1)使用脚本来设置
如果你的 SHELL
是用 bash
,就是:
source /opt/ros/foxy/setup.bash
如果你的 SHELL
是用 zsh
的,就是:
source /opt/ros/foxy/setup.zsh
以后每次打开终端都需要输入一次上面的语句,比较麻烦。以 zsh
为例,解决方法:
echo "source /opt/ros/foxy/setup.zsh" >> ~/.zshrc
source ~/.zshrc
这样,以后每次新打开终端,就不需要输入这条语句了 source /opt/ros/foxy/setup.zsh
,终端会自动帮你加载这条语句,设置好 ROS2
的环境变量。