树莓派Pi2安装ROS Kinetic Kame开发环境(基于Ubuntu 16.04LTS)

1.前期准备

1.1.树莓派及周边硬件准备清单

  • Raspberry Pi 2
  • 内存卡(附带读卡器)
  • 显示屏(附带HDMI线)
  • 鼠标
  • 键盘
  • 供电器(可以插头、移动电源供电,推荐插头)

1.2.软件准备

  • win32 Disk Imager(免费软件百度即可)
  • 压缩软件7-Zip等(免费软件百度即可)

1.3.文件准备

  • Ubuntu 16.04LTS镜像(Raspberry Pi2专用版本https://wiki.ubuntu.com/ARM/RaspberryPi)
  • ROS Kinetic Kame(2016年发布的LTS版,技术支持到2021年)

1.4.参考网站

  • https://wiki.ubuntu.com/ARM/RaspberryPi
  • http://wiki.ros.org/kinetic/Installation/Ubuntu

1.5.Tips(建议)

  • 耐心要足,可能会出现各种问题。
  • 安装或配置失败时,可以重复安装命令或者到网上搜索解决。

2.安装&配置ubuntu16.04LTS

参考网址:https://wiki.ubuntu.com/ARM/RaspberryPi

2.1.把Ubuntu 16.04LTS镜像写入内存卡。

将下载下来的镜像压缩包解压,用win32 Disk Imager把Ubuntu 16.04LTS镜像写入内存卡。此时内存卡的部分空间会被隐藏。

2.2.配置Ubuntu 16.04LTS

按照官方推荐的方法来配置Ubuntu 16.04LTS,以便后期的使用和安装ROS Kinetic Kame。将内存卡插入树莓派中,将树莓派连上电源、屏幕、键盘鼠标、网线,这些外部设备。树莓派连接上电源就会自动开机,顺带提一下关机命令是sudo shutdown -h now

2.2.1.修改密码

开机后的初始状态:Login username is “ubuntu”, password is “ubuntu”,需要立刻修改密码。

2.2.2.安装Optional PPAs

下面是官方的解释文档,可以跳过直接安装:
While the official image includes compatible firmware, bootloader and kernel, there are a few packages available in an unofficial PPA (ppa:ubuntu-raspi2/ppa) which are useful on the Raspberry Pi, including:
* libraspberrypi-bin - VideoCore utilities from https://github.com/raspberrypi/userland such as vcgencmd, raspistill, etc.
* libraspberrypi-bin-nonfree - Binary VideoCore utilities not provided in the open source userland repository, currently vcdbg and edidparser.
* xserver-xorg-video-fbturbo - An accelerated x.org video driver, though this is limited to hardware accelerated window moving/scrolling on the Raspberry Pi.
* hello-dkms - Not strictly to do with the Raspberry Pi, but a small example DKMS project to test building kernel DKMS modules.

To install(安装命令如下两条):
sudo add-apt-repositoryppa:ubuntu-raspi2/ppa
sudo apt-get update

2.2.3.安装可视化桌面

这部分推荐用Xubuntu或者Lubuntu,因为树莓派的性能有限,这两个桌面环境可以相对比较流畅的运行。我这里选择安装Xubuntu。这部分会比较久,因为下载和解压安装需要很长时间。

This is a small ubuntu-server image. If you want a full desktop, go ahead and do so:
选择一条安装命令:
sudo apt-get install xubuntu-desktop # or
sudo apt-get install lubuntu-desktop # or
sudo apt-get install kubuntu-desktop # etc
Ubuntu (Unity) and Ubuntu-GNOME just display a blank screen, presumably because they require 3D compositing. Kubuntu works but is slow unless you turn off desktop effects under System Settings. Xubuntu and Lubuntu work fine out of the box.

3.安装配置ROS Kinetic Kame

参考网址:http://wiki.ros.org/kinetic/Installation/Ubuntu
ROS有很多发行版本,如下图所示。
树莓派Pi2安装ROS Kinetic Kame开发环境(基于Ubuntu 16.04LTS)_第1张图片
最新的延长支持版是ROS Kinetic Kame,刚好可以用于Ubuntu 16.04LTS。网上比较多的是ROS Indigo Igloo + Ubuntu 14.04LTS组合。我这里用的是最新版Ubuntu16.04LTS + ROS Kinetic Kame组合。

3.1.Setup your sources.list(设置资源)

Setup your computer to accept software from packages.ros.org.
设置资源命令是:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

3.2.Set up your keys(设置密钥)

设置密钥的命令是:
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key421C365BD9FF1F717815A3895523BAEEB01FA116
If you experience issues connecting to the keyserver, you can try substituting hkp://pgp.mit.edu:80 or hkp://keyserver.ubuntu.com:80 in the previous command.

3.3.Installation(安装)

First, make sure your Debian package index is up-to-date:
先更新Debian包索引,命令如下:
sudo apt-get update

安装包有很多种,这里推荐树莓派安装ROS-Base,集成了最基础的一些功能,需要其他功能的时候,后期可以在加安装。命令如下:
sudo apt-get install ros-kinetic-ros-base

3.4.Initialize rosdep(初始化)

Before you can use ROS, you will need to initialize rosdep. rosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS.
初始化用下面两条命令:
sudo rosdep init
rosdep update

3.5.Environment setup(环境配置)

It’s convenient if the ROS environment variables are automatically added to your bash session every time a new shell is launched:
环境配置命令:
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

3.6.Dependencies for building packages(构建包的依赖项)

Up to now you have installed what you need to run the core ROS packages. To create and manage your own ROS workspaces, there are various tools and requirements that are distributed separately. For example, rosinstall is a frequently used command-line tool that enables you to easily download many source trees for ROS packages with one command.
To install this tool and other dependencies for building ROS packages, run:
构建包的依赖项安装命令:
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential


至此,树莓派Pi2安装ROS Kinetic Kame开发环境(基于Ubuntu 16.04LTS)成功。开始你的探索之旅吧!

你可能感兴趣的:(机器人,ROS)