樹莓派Pi2安裝ROS Kinetic Kame開發環境(基於Ubuntu 16.04LTS)

1.前期準備

1.1.樹莓派及周邊硬件準備清單

  • Raspberry Pi 2
  • 內存卡(附帶讀卡器)
  • 顯示屏(附帶HDMI線)
  • 鼠標
  • 鍵盤
  • 供電器(可以插頭、移動電源供電,推薦插頭)

1.2.軟件準備

  • win32 Disk Imager(免費軟件百度即可)
  • 壓縮軟件7-Zip等(免費軟件百度即可)

1.3.文件準備

1.4.參考網站

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有很多發行版本,如下圖所示。
ROS發行版本
最新的延長支持版是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)成功。開始你的探索之旅吧!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章