ubuntu版本 | ros1版本 | ros2版本 |
16.04 | kinetic | ardent |
18.04 | melodic | dashing |
20.04 | noetic | foxy |
?
1、打開軟件與更新,切換ubuntu軟件源(國內(nèi)中科大源)
2、打開終端,添加ros軟件源(中科大鏡像站)
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
3、配置公鑰
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
?
4、更新軟件源
sudo apt update
sudo apt upgrade
?
5、安裝ros系統(tǒng)(ps:命令中的noetic根據(jù)自己的ros版本名更換)
sudo apt install ros-noetic-desktop-full
?
6、初始化rosdep
sudo apt install python3-rosdep2
sudo gedit /etc/hosts
?
在打開文件中添加下面這一條內(nèi)容保存后關(guān)閉
199.232.28.133 raw.githubusercontent.com
?
sudo rosdep init
?
7、更新rosdep
rosdep update
?
8、設(shè)置環(huán)境變量(ps:命令中的noetic根據(jù)自己的ros版本名更換)
sudo echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
?
9、使環(huán)境變量生效
source ~/.bashrc
?
10、安裝依賴
sudo apt install python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
?
?11、安裝roslaunch
sudo apt install python3-roslaunch
sudo apt install ros-noetic-roslaunch
?
12、啟動ros系統(tǒng)
roscore
?
13、驗證ros
另外再打開一個終端窗口安裝ros-noetic-ros-tutorials(ps:命令中的noetic根據(jù)自己的ros版本名更換)
sudo apt-get install ros-noetic-ros-tutorials
?
安裝ros-noetic-rosbash(ps:命令中的noetic根據(jù)自己的ros版本名更換)
sudo apt install ros-noetic-rosbash
?
啟動小海龜仿真器
rosrun turtlesim turtlesim_node
?
另外再打開一個終端窗口啟動小海龜控制節(jié)點
rosrun turtlesim turtle_teleop_key
?
14、創(chuàng)建工作站,配置vscode
進(jìn)入官網(wǎng)下載vscode
下載很慢可以將鏈接中的/stable前面的域名換成vscode.cdn.azure.cn即可實現(xiàn)加速下載
進(jìn)入下載目錄在終端打開進(jìn)行安裝
sudo dpkg -i code*.deb
?
安裝好后打開vscode
安裝擴(kuò)展chinese中文簡體,cmake tools,c/c++,ros
也可以直接導(dǎo)入我的配置(設(shè)置-->配置文件-->導(dǎo)入配置文件)
https://vscode.dev/profile/github/ddb4a40e535ed44b2cfae8b316caa7e6
?
在home目錄下新建catkin_ws文件夾,進(jìn)入該文件夾新建src,build,include文件夾
打開終端進(jìn)入src文件夾
cd ~/catkin_ws/src
?
克隆wpr_simulation(克隆很慢就執(zhí)行注釋的代碼)
git clone https://github.com/6-robot/wpr_simulation.git
#git clone https://ghproxy.com/https://github.com/6-robot/wpr_simulation.git
?
執(zhí)行安裝腳本
cd ~/catkin_ws/src/wpr_simulation/scripts
./install_for_noetic.sh
?
編譯運行
cd ~/catkin_ws
catkin_make
?
設(shè)置環(huán)境變量,指定載入空間
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
?
使環(huán)境變量生效
source ~/.bashrc
?
打開VS Code,從文件夾打開選擇~/catkin_ws文件夾
按住Ctrl+Shift+B,選擇catkin_make:build
等待編譯完成,再次按住Ctrl+Shift+B,點擊catkin_make:build旁邊的設(shè)置齒輪圖標(biāo)
在打開的task.json文件中將"group"那一行換成下面的
"group": {"kind":"build","isDefault": true},
?文章來源:http://www.zghlxwxcb.cn/news/detail-471720.html
保存以后每次編譯只需要按住Ctrl+Shift+B即可文章來源地址http://www.zghlxwxcb.cn/news/detail-471720.html
到了這里,關(guān)于ubuntu20.4安裝配置ros系統(tǒng)(noetic)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!