Ubuntu20.04配置安装ros并简单运⾏详细步骤1.更新apt源为国内源(已更新的忽略,以阿⾥源为例)
1.1 备份原⽂件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bat
1.2 查看版本代号
lsb_release -c
1.3 每个版本对应的代号如下:
活出个样来给自己看伴奏
Ubuntu 15.04 代号为:vivid
Ubuntu 16.04代号为:xenial
Ubuntu 17.04代号为:zesty
张馨予露全乳有多大
Ubuntu 18.04代号为:bionic
Ubuntu 19.04代号为:disco
Ubuntu 20.04代号为:noetic
1.4 编辑sources.list⽂件
sudo vim /etc/apt/sources.list
原始的sources.list内容为:
#deb cdrom:[Ubuntu 20.04.2.0 LTS _Focal Fossa_ - Release amd64 (20210209.1)]/ focal main restricted
# See help.ubuntu/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb cn.archive.ubuntu/ubuntu/ focal main restricted
# deb-src cn.archive.ubuntu/ubuntu/ focal main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb cn.archive.ubuntu/ubuntu/ focal-updates main restricted
# deb-src cn.archive.ubuntu/ubuntu/ focal-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb cn.archive.ubuntu/ubuntu/ focal universe
# deb-src cn.archive.ubuntu/ubuntu/ focal universe
deb cn.archive.ubuntu/ubuntu/ focal-updates universe
# deb-src cn.archive.ubuntu/ubuntu/ focal-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb cn.archive.ubuntu/ubuntu/ focal multiverse
# deb-src cn.archive.ubuntu/ubuntu/ focal multiverse
李晨老婆赵琼deb cn.archive.ubuntu/ubuntu/ focal-updates multiverse
# deb-src cn.archive.ubuntu/ubuntu/ focal-updates multiverse
有点甜 歌词
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb cn.archive.ubuntu/ubuntu/ focal-backports main restricted universe multiverse
# deb-src cn.archive.ubuntu/ubuntu/ focal-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb archive.canonical/ubuntu focal partner
# deb-src archive.canonical/ubuntu focal partner
deb security.ubuntu/ubuntu focal-security main restricted
追追追# deb-src security.ubuntu/ubuntu focal-security main restricted
deb security.ubuntu/ubuntu focal-security universe
# deb-src security.ubuntu/ubuntu focal-security universe
deb security.ubuntu/ubuntu focal-security multiverse
# deb-src security.ubuntu/ubuntu focal-security multiverse
# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.
更新为阿⾥源后的sources.list内容:
deb mirrors.aliyun/ubuntu/ focal main restricted universe multiverse
deb-src mirrors.aliyun/ubuntu/ focal main restricted universe multiverse
deb mirrors.aliyun/ubuntu/ focal-security main restricted universe multiverse
deb-src mirrors.aliyun/ubuntu/ focal-security main restricted universe multiverse
deb mirrors.aliyun/ubuntu/ focal-updates main restricted universe multiverse
deb-src mirrors.aliyun/ubuntu/ focal-updates main restricted universe multiverse
deb mirrors.aliyun/ubuntu/ focal-backports main restricted universe multiverse
deb-src mirrors.aliyun/ubuntu/ focal-backports main restricted universe multiverse
deb mirrors.aliyun/ubuntu/ focal-proposed main restricted universe multiverse
deb-src mirrors.aliyun/ubuntu/ focal-proposed main restricted universe multiverse
修改完毕后保存退出。
1.5 更新软件列表
sudo apt-get update
sudo apt-get upgrade
2.配置ros
2.1 添加sources.list
sudo sh -c 'echo "deb /ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
2.2 添加keys
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
2.3 更新
sudo apt update
2.4 安装桌⾯完整版 : 包含ROS、rqt、rviz、机器⼈通⽤库、2D/3D 模拟器、导航以及2D/3D感知。(
注意:根据不同linux版本安装不同的ros,ubuntu20.04对应noetic,其余版本⾃⾏修改下⾯代码。
sudo apt install ros-noetic-desktop-full
2.5 您必须在使⽤ROS的每个bash终端中获取此脚本的源代码。
source /opt/ros/noetic/setup.bash
2.6 环境配置
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
2.7 查看环境配置
env | grep ROS
3.⼩海龟测试
⼩海龟测试需要依次打开三个新的命令⾏窗⼝:
窗⼝1:打开新窗⼝快捷键:Ctrl + Alt +T
roscore
窗⼝2:此时会跳出⼀个TurtleSim ⼩乌龟的控制窗⼝
rosrun turtlesim turtlesim_node
窗⼝3:
调⽤键盘控制。使⽤键盘⽅向键对⼩海龟进⾏控制。
切记,⿏标光标⼀定要聚焦在下⽅的3窗⼝中,⽅能通过键盘控制乌龟动起来哦rosrun turtlesim turtle_teleop_key
实操键盘⽅向键,如下演⽰:
许巍曾经的你吉他谱⽂章参考: