-
Notifications
You must be signed in to change notification settings - Fork 0
InstallationBBB
#Installation of Ubuntu Trusty Tahr (14.04) and ROS Indigo Igloo on a BeagleBone Black#
##Install Ubuntu on an SD Card##
###Download and Copy to SD Card###
-
Begin by downloading an armhf port of Ubuntu Trusty (14.04).
-
After you have downloaded the .img.xz file, extract the image. For Windows, use a program such as 7zip. (Once 7zip is installed, right click on .img.xz file you just downloaded and click 7zip > Extract Here, to extract the .img file.) For OSX, you can use The Unarchiver. (Once The Unarchiver is installed, run it once to associate the file type .xz with it. Then just double click on the .img.xz file and click Extract.)
-
Insert the micro SD card into your computer. In Windows, use Win32 Disk Imager to write the image onto your micro SD card. (Select the .img file that you extracted in the previous step under "Image File". Select the drive of your micro SD card under "Device". Click "Write".) In linux, use 'dd'. You can follow this example. Feel free to update with specifics if you get this to work. I believe you can do this in Disk Utility on a Mac. Again, feel free to update.
-
Remove the micro SD card from your computer.
###Boot into Ubuntu on the BeagleBone Black###
-
After you've written the Ubuntu image to a micro SD card as described above, insert the micro SD card into the powered-off BeagleBone Black. Connect a mouse, keyboard, display, and Ethernet as needed.
-
Locate the "boot" button next to the micro SD card slot. It is labeled "S2" on Rev. C. While holding down this button, apply power to the board. Continue to hold the 'boot' button until the USER LEDs begin to flash. It is recommended that you use a 5V external power source. USB power may not be sufficient.
-
After about a minute your screen should show the login prompt. Sign in.
User: ubuntu
Password: ubuntu
- You should now have Ubuntu terminal. Remember that any time you want to boot from micro SD you may have to hold down the 'boot' button. If you don't the BBB may just boot from whatever is on the eMMC.
###Expand the Partition on the MicroSD Card###
The linux parition on that you just installed on the microSD card will not fill up all the space. Therefore, you might run into some problems as you install other programs. In order to minimize the chances of this happening, we will expand the partition to fill more of the card.
- Start by using
fdisk
to edit the partitions on the microSD card.
fdisk /dev/mmcblk0
When you type p
, you will see the following:
Command (m for help): p
Disk /dev/mmcblk0: 8270 MB, 8270118912 bytes
4 heads, 16 sectors/track, 252384 cylinders, total 16152576 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x80000000
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 * 2048 4095 1024 1 FAT12
/dev/mmcblk0p2 4096 3751935 1873920 83 Linux
Command (m for help):
Depending on your setup and microSD card size, you may see different numbers. Next, enter d
to delete a partition and then enter 2
for partition 2 (/dev/mmcblk0p2
). Entering p
again will show that you have deleted /dev/mmcblk0p2
.
Now create a new partition by entering n
then p
and then 2
. You should hit enter to have your default start sector used. You can make your end sector whatever you want in case you don't want to use your whole micro SD but you can just hit enter to use the default. The terminal will look something like this:
Command (m for help): n
Partition type:
p primary (1 primary, 0 extended, 3 free)
e extended
Select (default p): p
Partition number (1-4, default 2): 2
First sector (4096-16152576, default 4096):
Using default value 4096
Last sector, +sectors or +size{K,M,G} (4096-16152576, default 16152576):
Using default value 16152576
If you are satisfied with your changes at this point you can enter w
to commit to your changes. If you want to cancel or restart just enter <CTRL>+Z
.
To finalize the changes, press the 'boot' button next to the microSD card slot and reboot the system. Holding the 'boot' button will make sure that the BeagleBone Black boots using the microSD card and not the on board memory.
sudo reboot
Lastly, after your BeagleBone Black reboots, you need to expand the file system. Enter the command df -h
. You should see something resembling the following:
Filesystem 1K-blocks Used Available Use% Mounted on
rootfs 1811704 441152 1276856 26% /
/dev/root 1811704 441152 1276856 26% /
devtmpfs 253716 0 253920 0% /dev
tmpfs 50772 252 50600 1% /run
tmpfs 5120 0 5120 0% /run/lock
tmpfs 101540 0 101540 0% /run/shm
/dev/mmcblk0p1 1004 472 532 48% /boot/uboot
The run resize2fs
to resize the partition.
sudo resize2fs /dev/mmcblk0p2
This will take about a minute to complete. Entering df
again will show a change in percentage of use for the file system. The file system of your OS on your micro SD card should now be expanded to use your card to it's full potential. You should now have room to install desktops such as ubuntu-desktop, xubuntu-desktop or Gnome-desktop.
##Install Ubuntu on the Onboard eMMC##
This process is an alternative to the previous instructions. With these instructions, instead of booting from the micro SD card, the image will be written to the local eMMC storage on the BeagleBone Black. At that point, the micro SD card is no longer needed.
-
Follow the instructions above, except download the version of Ubuntu with the eMMC flasher. The difference between this file and the previous image is that this comes with scripts that will flash the eMMC and perform some basic setup. Otherwise, they are the same.
-
When booting the BeagleBone Black with this micro SD card, pause at the login screen for about 10 minutes. You can release the "boot" button. During this time the image will be flashed to the eMMC.
-
After about 10 minutes have passed the 4 LEDs should be solid and not flickering. Remove the power, remove the mirco SD, and then re-apply power to the board.
-
After about a minute your screen should show the login prompt. Sign in.
User: ubuntu
Password: temppwd
- You should now have Ubuntu terminal. The micro SD card is no longer needed.
##Install ROS Indigo## This will guide you in the installation of ROS Indigo. An installation of Ubuntu 14.04 as described above is necessary to proceed. Boot up the BeagleBone Black, log in, and make sure you are connected to the internet. To check this, type
ifconfig eth0
There should be a line that says inet addr:
followed by an IP address. Once this is working, proceed from the command prompt.
###1. Set your Local### Boost and some of the ROS tools require that the system local be set. You can set it with:
sudo update-locale LANG=C LANGUAGE=C LC_ALL=C LC_MESSAGES=POSIX
###2. Setup your sources.list### Setup your computer to accept software from the ARM mirror on packages.ros.org.
sudo sh -c 'echo "deb http://packages.namniart.com/repos/ros trusty main" > /etc/apt/sources.list.d/ros-latest.list'
###3. Set up your keys###
wget http://packages.namniart.com/repos/namniart.key -O - | sudo apt-key add -
###4. Installation### First, make sure your Debian package index is up-to-date:
sudo apt-get update
There are many different libraries and tools in ROS. Most of the default configurations do not yet compile fully on ARM. We will install only the base packages to begin with. You can always install ROS packages individually.
ROS-Base: (Bare Bones) ROS package, build, and communication libraries. No GUI tools.
sudo apt-get install ros-indigo-ros-base
Individual Package: You can install a specific ROS package (replace underscores with dashes of the package name):
sudo apt-get install ros-indigo-PACKAGE
To find available packages, use:
apt-cache search ros-indigo
###5. Initialize rosdep### Before you can use ROS, you will need to install and 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.
Note: Do not run rosdep update
with sudo. It is not required and will result in permission errors later on
sudo apt-get install python-rosdep
sudo rosdep init
rosdep update
###6. 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/indigo/setup.bash" >> ~/.bashrc
source ~/.bashrc
###7. Getting rosinstall### rosinstall is a frequently used command-line tool in ROS that is distributed separately. It enables you to easily download many source trees for ROS packages with one command.
To install this tool on Ubuntu, run:
sudo apt-get install python-rosinstall
###8. Verifying OS name### Make sure your OS name defined at /etc/lsb-release is as the following. Since ros does not recognize Linaro as an OS, this is necessary.
nano /etc/lsb-release
The following is for Ubuntu 14.04, trusty. Modify the release number and name as per your target.
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"
###9. Install g++ and git###
And you will need first line to actually compile code! The second line gives you the ability to use git
which will come in handy when managing your code!
sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential
sudo apt-get install git-all
If git-all
is too big, try git-flow
-- It should pull in what you need much faster.
###10a. Install a Desktop Environment (Optional)### If using a mouse and clicking on things makes you feel more comfortable, feel free to install desktop environment, like the light-weight xfce.
sudo apt-get install xfce4
and start it by typing
startxfce4
###10b. Install a Console Environment (Optional)### If you don't have a display attached to the beaglebone black, there is no need to install a graphical interface. There are tools that make working with your beaglebone black over a network connection much easier. Foremost is GNU screen, which provides a persistent detachable & re-attachable console session and a load of powerful features like a searchable scrollback buffer.
sudo apt-get install screen
Here is a nice configuration file, which you can write to ~/.screenrc
startup_message off
autodetach on
vbell on
shell -${SHELL}
defscrollback 4096
attrcolor b ".I"
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E38;5;%dm'
defbce on
hardstatus on
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m/%d %{W}%c %{g}]'
Some basic screen commands can be found here or with a dash of google.
###10c. Setup Beaglebone black GPIO, I2C, and SPI (Optional)### In order to use the low-level electrical capabilities of the BBB from a high-level language like python, you can use the Adafruit Python GPIO libraries. Easy installation steps can be found on the adafruit site, but to paraphrase:
sudo ntpdate pool.ntp.org
sudo apt-get update
sudo apt-get install build-essential python-dev python-pip -y
sudo pip install Adafruit_BBIO
That should install it, but it may not work. In such an event, you can thank the owner of this github repo. Here are the steps modified for a user not named debian (replace ubuntu
with your username):
git clone https://github.com/cnobile2012/RobotControl.git
cd RobotControl/contrib
sudo cp 80-gpio.rules /etc/udev/rules.d/
sed -i 's/debian/ubuntu/' fix_udev_gpio.sh
-
sudo cp fix_udev_gpio.sh /bin/
# the .sh file should be executable! -
sudo groupadd gpio
# Creates a group namedgpio
. -
sudo adduser ubuntu gpio
# Add yourself to thegpio
group.
To enable SPI, (and YMMV on this one so please add your experience) append this line to the /boot/uEnv.txt
file:
optargs=capemgr.enable_partno=BB-SPIDEV0
Also, add this line in /etc/rc.local
:
chmod a+w /sys/devices/bone_capemgr.9/slots
Finally, reboot the Beagle Bone: sudo reboot
.
You can test GPIO with some examples here, and test SPI with a quick program listed here.
###11. Start programming!### Try out Project 0! In this short tutorial you will learn about the basic functionality of ROS by creating nodes that publish messages to and subscribe to messages from topics. You will also learn how to use some of the built-in ROS tools to interact with these nodes and topics.