欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ROS学习历程(一)———— ros安装

程序员文章站 2022-03-12 16:33:26
...

首先,ROS需要在Linux系统下运行,读者需要有相对应的系统或者虚拟机(我用的是虚拟机,毕竟没钱那)

虚拟机资源:链接:https://pan.baidu.com/s/1ljKHflO3pb1QHalbiqNXgA 密码:5nch

 

我在这里用的ROS版本是Kinetic 操作系统是Ubuntu,安装步骤可以参考官网的安装步骤,也可以看我下面写的,速度可能快点。

官网安装网址:http://wiki.ros.org/kinetic/Installation/Ubuntu

 

首先打开Ubuntu的这个:

 

 

ROS学习历程(一)———— ros安装

搜索software & Updates

ROS学习历程(一)———— ros安装

将红圈部分全部打钩

因为ros的安装如果直接安装的话会非常慢,所以这里需要换一下源,选择国内的源来进行下载,速度会非常快,虽然下的时间还是比较长,但是已经不错了。

Ctrl+Alt+T打开一个终端:

输入gedit /etc/apt/sources.list

打开source.list文件,里面的内容最好先保存一下(虽然我当时没有保存,但是万一要用到呢)

如何备份文件请自行百度

打开sources.list 将一下内容复制到里面,然后保存退出。

deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties  
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties  
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties  
deb http://mirrors.aliyun.com/ubuntu/ xenial universe  
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe  
deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse  
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse  
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties  
deb http://archive.canonical.com/ubuntu xenial partner  
deb-src http://archive.canonical.com/ubuntu xenial partner  
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties  
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe  
deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse 

设置好源之后,就可以真正的安装ros啦

打开终端,输入:

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

添加秘钥:

sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A389552
3BAEEB01FA116

现在读者已经将ROS版本库地址放在代码列表中,然后更新下软件包

sudo apt-get update && sudo apt-get upgrade -y


安装ros

sudo apt-get install ros-kinetic-desktop-full

内容有点大,需要耐心等待。

安装完之后我们还不能使用,需要配置一下

安装rosdep

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

配置一下环境

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

好了,到这里,你就算是安装完了,来吧,最后再检查一下

打开一个终端,输入roscore,如果出现一下内容,那就恭喜你,安装成功了

... logging to /home/ros/.ros/log/3958fcaa-a3c0-11e8-92cd-000c2965988a/roslaunch-ubuntu-4658.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ubuntu:33967/
ros_comm version 1.12.13


SUMMARY
========

PARAMETERS
 * /rosdistro: kinetic
 * /rosversion: 1.12.13

NODES

auto-starting new master
process[master]: started with pid [4669]
ROS_MASTER_URI=http://ubuntu:11311/

setting /run_id to 3958fcaa-a3c0-11e8-92cd-000c2965988a
process[rosout-1]: started with pid [4682]
started core service [/rosout]

 

相关标签: ros