參考博客:ROS 安裝詳細(xì)教程 —— Ubuntu22.0.4 LTS 安裝
Part 0. 準(zhǔn)備
首先,我們需要一個(gè)Ubuntu系統(tǒng)。
Part 1. 調(diào)整Ubuntu系統(tǒng)中的相關(guān)配置
step 1. 設(shè)置語言
終端輸入指令:
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
step 2. 設(shè)置鏡像源
從ubuntu系統(tǒng)界面進(jìn)行設(shè)置:
設(shè)置->軟件升級(jí)->Ubuntu software-> source code 為source code選擇國內(nèi)鏡像源
確定鏡像源可用
通過檢查此命令的輸出,確保已啟用Ubuntu Universe存儲(chǔ)庫。apt-cache policy | grep universe
如果輸出 “500:亂七八糟一堆” ,說明可行。
如果沒有上述輸出,則需要執(zhí)行指令:sudo apt install software-properties-common
sudo add-apt-repository universe
step 3. 從github下載相關(guān)文件
終端指令:
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
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
step 4. 將上述配置更新至系統(tǒng)
指令:sudo apt-get update
指令:sudo apt-get upgrade
Part 2. 安裝ROS2-humble系統(tǒng)
step 1. 下載ROS系統(tǒng)
指令:sudo apt install ros-humble-desktop
注1:humble表示版本名稱,不同的Ubuntu系統(tǒng)需要下載對(duì)應(yīng)的不同的版本名稱,ubuntu22.04對(duì)應(yīng)版本humble,其余版本可以登陸ROS官網(wǎng)自行查看;
注2:desktop表示桌面版本,即完整版本,自動(dòng)安裝我們常用的功能。
step 2. 調(diào)整配置
終端指令: source /opt/ros/humble/setup.bash echo " source /opt/ros/humble/setup.bash" >> ~/.bashrc
Part 3. 檢測(cè)ROS2-humble系統(tǒng)是否可以正常運(yùn)行
通信測(cè)試
打開一個(gè)終端,指令:ros2 run demo_nodes_cpp talker
另開一個(gè)終端,指令:ros2 run demo_nodes_py listener
如果listenner可以正常顯示talker發(fā)出的信號(hào),即表示正常。
小海龜仿真測(cè)試
一個(gè)終端,指令:ros2 run turtlesim turtlesim_node
啟動(dòng)海龜仿真器
另一個(gè)終端,指令:ros2 run turtlesim turtle_teleop_key
啟動(dòng)鍵盤控制節(jié)點(diǎn)
如果可以通過鍵盤正常操控小海龜移動(dòng),即表示正常。文章來源:http://www.zghlxwxcb.cn/news/detail-860365.html
Part 4. ROS2系統(tǒng)文件位置
在文件目錄:/opt/ros/humble中查詢文章來源地址http://www.zghlxwxcb.cn/news/detail-860365.html
Part 5. 開發(fā)者工具下載
colcon編譯器
sudo apt install python3-colcon-common-extensions
到了這里,關(guān)于【ROS系統(tǒng)】Ubuntu22.04系統(tǒng)中安裝ROS2系統(tǒng)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!