Installing ROS 2 on Ubuntu20.04 Linux
Installing ROS 2 on Ubuntu20.04 Linux
1. Binary packages
We provide ROS 2 binary packages for the following platforms:
-
Ubuntu Linux - Focal Fossa (20.04)
-
Debian packages
-
“fat” archive
-
-
macOS
-
Windows
2. Building from source
We support building ROS 2 from source on the following platforms:
-
Ubuntu Linux
-
macOS
-
Windows
3. System requirements
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
4. System setup
4.1 Set locale
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-8sudo 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-8locale # verify settings一次不成功,建議重復多次
4.2 Add the ROS 2 apt repository
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'4.3 Install ROS 2 packages
(1)更新源
# 執(zhí)行更新后,出現(xiàn)問題了 sudo apt updateN: 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# 打開文本后出現(xiàn): 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如果更新出現(xiàn)問題,多試幾次
(2)安裝ROS2
推薦安裝ROS2桌面版本(包括ROS、RViz、demos、tutorials)
sudo apt install ros-foxy-desktop如果出現(xiàn)問題,重復試幾次
4.4 Environment setup
(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 的環(huán)境變量。
總結
以上是生活随笔為你收集整理的Installing ROS 2 on Ubuntu20.04 Linux的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Altium Designer 的使用笔
- 下一篇: 在 ubuntu 20.04 LTS 上