Classes - Beard

You are here: start » robot_soccer » 2017 » raspberry_pi


|

Meta

Introduction

This page will guide you through setting up a Raspberry Pi with Ubuntu Mate, ROS, and a static IP address.

Installing Ubuntu Mate Image

Download the Ubuntu Mate image for the Raspberry Pi 3 from https://ubuntu-mate.org/blog/ubuntu-mate-for-raspberry-pi-3/. Open up a terminal and navigate to your Downloads folder. Enter in the following command in the terminal to rename the image and decompress it.

$ unxz ubuntu-mate-16.04-desktop-armhf-raspberry-pi.img.xz
$ mv ubuntu-mate-16.04-desktop-armhf-raspberry-pi.img mate.img

The next step is to identify the SD card drive on your computer. Before inserting the SD card, run the command in the terminal to see all of the disks attached to your computer.

$ df -h

Now insert your SD card and run the above command. You should now nee a new disk attached to your computer. In my case it is /dev/sdb. Be sure to identify the correct disk or you might overwrite an important disk.

Once you have your disk identified, you can install the image using dd, ddrescue, or other methods. I will show you using ddresuce. Begin by installing the gddresuce library using the command

$ sudo apt-get install gddrescue

Once installed, you can install the image onto the SD card. The output file is the location of the SD card. In my case it is /dev/sdb.

$  sudo ddrescue -D -d --force ~/Downloads/ubuntu.img <output file>

After it installs, make sure that all processes are finished before ejecting the SD card by using the command.

$ sync
$ sync
$ sync
$ sync

Eject the SD card and put it in the Raspberry Pi.

Set Static IP

Now that the image is installed, connect a monitor, keyboard, and mouse to the Raspberry Pi, and turn it on. Ubuntu-Mate will guide you through the installation process. Once installed, reboot the system to connect to wifi. Click on the wifi icon in the upper right corner and connect to the network RobotSoccer. The password is soccer2015. After connecting, click on the wifi icon and select Edit Connections. Under Wi-Fi, select RobotSoccer and click Edit and a new window will open up. Navigate to the tab IPv4 Settings. Under the method options select manual. You should now see a table with the columns: Address, Netmask, Gateway. Clck Add to add a static wifi IP. Under Address insert an address from 192.168.1.2-192.168.1.255 that is not being used by another team. Under the Netmask column enter 255.255.255.0, and under the Gateway column enter 192.168.1.1. And example is shown below

Address Network Gateway
192.168.1.250 255.255.255.0 192.168.1.1

In the DNS server box enter

8.8.8.8

If the information is valid, you should be able to hit the save button. Once completed, reboot the system for the changes to take affect. If you don't want to reboot the system, you can disconnect the wifi and re-connect to it.

To verify that it worked, open up a terminal and enter

$ ifconfig

This will print out the network connection information. Verify that your IP address is the one you enter.

Install ROS

Follow the installation instructions on http://wiki.ros.org/kinetic/Installation/Ubuntu to install ROS Kinetic on the Raspberry Pi. Be sure to install the full package.

Install Python Pip

Pip allows you to easily install python modules that you may need to use later. To install pip, enter the following command in a terminal.

$ sudo apt install python-pip

To practice using pip, lets download the module pyserial.

$ pip install pyserial
Set Up Keys and Host names