【Ubuntu20.04安装ROS1】

Ubuntu20.04安装ROS1

  • 1.更换软件源
  • 2.更新软件列表
  • 3.添加ros软件源
  • 4.添加软件密钥
  • 5.更新软件源
  • 6.安装ROS桌面版
  • 7.初始化rosdep(科学上网)
  • 8.设置环境变量
  • 9.测试可行性

1.更换软件源

	更换软件源,以阿里源为例,编辑sources.list文件,使用如下内容替换该文件的原内容

(1)打开文件

sudo gedit /etc/apt/sources.list

(2)打开文件

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

2.更新软件列表

sudo apt-get update
sudo apt-get upgrade

3.添加ros软件源

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

4.添加软件密钥

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

5.更新软件源

sudo apt update

6.安装ROS桌面版


sudo apt-get install ros-noetic-desktop-full
sudo apt update --fix-missing

7.初始化rosdep(科学上网)

使用如下指令完成初始化

sudo rosdepc init
rosdepc update
cd /etc/ros/rosdep/sources.list.d
sudo gedit 20-default.list

20-default.list使用如下信息:

# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
 
# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte
 
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

8.设置环境变量


echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

9.测试可行性


roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key

你可能感兴趣的:(C++,ubuntu,小技巧,ros,ubuntu,linux,运维)