ubuntu18.04安装ROS

一、选择版本

根据博客最新(2019年)ROS各个发行版本适用的Linux操作系统平台以及语言工具要求
选择Melodic Morenia (May 2018 - May 2023)版本ROS。

二、安装

推荐博文:
在Ubuntu 18.04 LTS安装ROS Melodic版机器人操作系统(2019年10月更新MoveIt! 1.0 ROS 2.0 Dashing)
Ubuntu18.04下安装ROS

1、配置软件库

允许 “restricted,” “universe,” and “multiverse.”

在这里插入图片描述

2、更改软件包源为国内

可查看我的博文更新软件源为阿里源

3、将电脑设置为接受来自packages.ros.org的软件

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'

4、设置密钥

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

5、安装

sudo apt-get update
sudo apt-get install ros-melodic-desktop-full

遇到问题
无法修复缺失的软件包。 E: 无法下载 http://cn.archive.ubuntu.com/ubuntu/pool/universe/o/opencv/libopencv3.2-java_3.2.0+dfsg-4ubuntu0.1_all.deb 无法连接上 117.128.6.21:80 (117.128.6.21),连接超时。。。
解决:
在这里插入图片描述
如图所示位置添加

deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse

在终端中

sudo apt-get update

然后再回到安装的那一步,重装。
然后安装python-rosdep

sudo apt install python-rosdep

6、初始化

sudo rosdep init
rosdep update

遇到问题

error loading sources list:the read operation timed out

解决
用手机开热点,而且需要是移动的热点,我这里联通信号差…

7、添加环境变量

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

8、安装插件

sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential

9、测试

一共开三个终端,分别输入:

roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key

get!
在这里插入图片描述

发布了32 篇原创文章 · 获赞 7 · 访问量 2163

猜你喜欢

转载自blog.csdn.net/def_init_myself/article/details/105322002