虚拟机下Ubuntu安装ROS系统

此教程仅适用于Ubuntu 14.04,indigo版ROS。

在操作过程中,建议使用有线网络。

此教程是“虚拟机安装Ubuntu”的后续教程

配置 Ubuntu 软件仓库

配置你的 Ubuntu 软件仓库(repositories) 以允许 "restricted"、"universe" 和 "multiverse"这三种安装模式。

系统设置》软件和更新》Ubuntu软件,将设置修改成如下图所示:

系统设置》软件和更新》其它软件,将设置修改成如下图所示:

点击 关闭(C) 按钮,等待缓存更新完成。

配置ROS的apt源

ROS的apt源有官方源、国内 USTC 源或新加坡源可供选择, 选择其一就可以了,建议使用国内 USTC 源或新加坡源,安装速度会快很多。

  • 方式一:官方源
$ 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://pool.sks-keyservers.net --recv-key 0xB01FA116
$ sudo apt-get update
$ 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'
$ sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xB01FA116
$ sudo apt-get update
$ sudo sh -c '. /etc/lsb-release && echo "deb http://mirror-ap.packages.ros.org/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
$ sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xB01FA116
$ sudo apt-get update

sudo apt-get update 执行更新有时因为网络原因可能出现错误(若不是ros安装源错误均继续 ros 安装操作),可重新执行命令进行更新。

安装ROS软件包

$ sudo apt-get install ros-indigo-desktop-full
$ sudo apt-get install python-rosinstall

升级了 71 个软件包,新安装了 799 个软件包,要卸载 0 个软件包,有 314 个软件包未被升级。 需要下载 390 MB 的软件包。 解压缩后会消耗掉 1,620 MB 的额外空间。

配置环境变量

$ sudo rosdep init
$ rosdep update

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

测试ROS安装是否成功

在终端输入 roscore -h ,输出如下图所示,表示安装成功。

$ roscore -h
Usage: roscore [options]

roscore will start up a ROS Master, a ROS Parameter Server and a rosout
logging node

Options:
  -h, --help            show this help message and exit
  -p PORT, --port=PORT  master port. Only valid if master is launched
  -v                    verbose printing

See http://www.ros.org/wiki/roscore

在终端输入 roscore ,输出如下图所示,表示环境配置成功,ros正常运行。

eaibot@eaibot:~$ roscore
... logging to /home/eaibot/.ros/log/45d93ed8-a23a-11e6-99b1-4437e63de0fc/roslaunch-eaibot-3460.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://eaibot:35377/
ros_comm version 1.11.20


SUMMARY
========

PARAMETERS
 * /rosdistro: indigo
 * /rosversion: 1.11.20

NODES

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

setting /run_id to 45d93ed8-a23a-11e6-99b1-4437e63de0fc
process[rosout-1]: started with pid [3485]
started core service [/rosout]

results matching ""

    No results matching ""