ROS2 系統(tǒng)安裝【rolling】
一、設(shè)置安裝源
ubuntu-ports | 鏡像站使用幫助 | 清華大學(xué)開源軟件鏡像站 | Tsinghua Open Source Mirror
https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu-ports/
Ubuntu 的軟件源配置文件是?/etc/apt/sources.list
。將系統(tǒng)自帶的該文件做個(gè)備份,將該文件替換為下面內(nèi)容,即可使用 TUNA 的軟件源鏡像。
選擇你的ubuntu版本:??12.04 LTS?14.04 LTS?16.04 LTS?18.04 LTS?20.04 LTS?21.04?21.10?
本鏡像僅包含 arm64 armhf ppc64el risCV64 s390x 架構(gòu)的軟件包。

樹莓派ubuntu系統(tǒng)是?ubuntu-ports
# 默認(rèn)注釋了源碼鏡像以提高 apt update 速度,如有需要可自行取消注釋
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ hirsute main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ hirsute main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ hirsute-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ hirsute-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ hirsute-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ hirsute-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ hirsute-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ hirsute-security main restricted universe multiverse
# 預(yù)發(fā)布軟件源,不建議啟用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ hirsute-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ hirsute-proposed main restricted universe multiverse

二、開始安裝
1.設(shè)置語言環(huán)境
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.UTF-8
export.UTF-8
2.設(shè)置源
apt-cache policy | grep universe
如果沒有看到類似下面的輸出,則需要啟用 Universe 存儲(chǔ)庫
?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 存儲(chǔ)庫
sudo apt install software-properties-common
sudo add-apt-repository universe
將 ROS 2 apt 存儲(chǔ)庫添加到您的系統(tǒng)中。首先用apt授權(quán)GPG密鑰:
sudo apt update && sudo apt install curl gnupg lsb-release
#使用下面的可能會(huì)出現(xiàn)如下錯(cuò)誤: 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 -?
# 之后再添加源:
sudo sh -c 'echo "deb http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.
2.安裝ROS2
1.更新 apt 存儲(chǔ)庫。
sudo apt update
桌面安裝版:
sudo apt install ros-rolling-desktop
無桌面版:
ROS-Base Install (Bare Bones):通信庫、消息包、命令行工具。沒有 GUI 工具
sudo apt install ros-rolling-ros-base
2.測試安裝是否完成
運(yùn)行如下指令,出來的結(jié)果如圖結(jié)果,則說明安裝成功。
ros2 run demo_nodes_cpp talker

ros2 run demo_nodes_py listener

以上部分參考:https://blog.csdn.net/weixin_42753305/article/details/120723594

如果安裝不了推薦小魚的一鍵安裝?。。。。?/span>
一行代碼-解決人生煩惱
推薦語:一行代碼搭建機(jī)器人開發(fā)環(huán)境(ROS/ROS2/ROSDEP)
開源地址:https://github.com/fishros/install
一鍵安裝指令
wget http://fishros.com/install -O fishros && . fishros
小白的福音!

