安装并配置ROS环境

1、安装ROS

1.1、配置Ubuntu存储库

配置Ubuntu存储库允许"restricted," "universe," and "multiverse."。

配置可参考:http://www.360doc.com/content/18/0417/15/54525756_746389833.shtml

1.2、配置sources.list

设置计算机软件源来自packages.ros.org。按照对应Ubuntu版本选择ROS版本和软件源

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

1.3、设置KEY

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

如果在连接密钥服务器时遇到问题,可以尝试在上一个命令中替换hkp://pgp.mit.edu:80或hkp://keyserver.ubuntu.com:80。

1.4、安装

1.4.1、更新软件源

sudo apt-get update

1.4.2、任选其一即可

Desktop-Full Install: (推荐) : ROS, rqtrviz, robot-generic libraries, 2D/3D simulators and 2D/3D perception

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

Desktop Install: ROS, rqtrviz, and robot-generic libraries

sudo apt-get install ros-melodic-desktop

ROS-Base: (Bare Bones) ROS package, build, and communication libraries. No GUI tools.

sudo apt-get install ros-melodic-ros-base

Individual Package: You can also install a specific ROS package (replace underscores with dashes of the package name):

sudo apt-get install ros-melodic-PACKAGE

eg:

sudo apt-get install ros-melodic-slam-gmapping

寻找可用的软件包:

apt-cache search ros-melodic

1.5、初始化rosdep

在使用ROS之前,您需要初始化rosdep。rosdep使您可以轻松地为要编译的源安装系统依赖项,并且需要在ROS中运行一些核心组件。

sudo rosdep init
rosdep update

1.6、环境设置

每次启动新shell时ROS环境变量自动添加到bash会话

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

如果安装了多个ROS分发,~/.bashrc必须只能对你当前正在使用的版本source操作

如果您只想更改当前shell的环境,而不是上面的类型,则可以键入:

source /opt/ros/melodic/setup.bash

如果使用zsh而不是bash,则需要运行以下命令来设置shell:

echo "source /opt/ros/melodic/setup.zsh" >> ~/.zshrc
source ~/.zshrc

1.7、构建包的依赖关系

到目前为止,您已经安装了运行核心ROS软件包所需的内容。要创建和管理自己的ROS工作区,可以单独分发各种工具和要求。例如,rosinstall是一种常用的命令行工具,使您可以使用一个命令轻松下载ROS包的许多源树。要安装此工具和其他依赖项以构建ROS包,请运行:

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

1.8、Build farm status

The packages that you installed were built by the ROS build farm. You can check the status of individual packages here.

2、可以接下来的教程了

http://wiki.ros.org/ROS/Tutorials

(翻译将会持续进行更新)

猜你喜欢

转载自blog.csdn.net/Leroi_Liu/article/details/82352961