Tuesday, August 19, 2008

Ubuntu Install via external optical drive

If you have better luck than I, you may be able to install Ubuntu 8.04 from a USB stick. If you read my previous post, you'll know that I can't get that to work.

So here's what to do: beg, buy or borrow a USB2 DVD drive. (I went with "buy"). The helpful guy at the Future Shop sold me a LG 20X Super Multi External DVD Rewriter (GE20), which just happened to be the cheapest USB2-optical device available in my area of the city. He warned me that some computers' BIOS' support booting from USB2 drives and some don't. Given that the eeePC comes with a recovery DVD and support CD, I assumed that it was able to boot from an external optical drive. This turned out to be correct.

So, I booted from the Xubuntu 8.04 Live CD, and lo and behold, the eeePC boots! (It refuses to do so with almost all of the USB drives I tried to create.) Up comes the load screen, and then the Live session begins. I chose to install Xubuntu. I won't go into the details here, because the install failed. I think, in retrospect, this is because I chose to change the partition setup, but I did not click the little "format" checkboxes in the installer. Whatever the reason, the installer fails due to an unspecified I/O error at 53% into the install process (This happened twice in two attempts, at the identical point.)

So I tried booting from the Ubuntu 8.04 CD. The only difference here is that Ubuntu uses the Gnome desktop, and Xubuntu uses the XFCE lightweight desktop.

The Ubuntu live session booted, and I started the install. When asked how I wanted to partition the drive, I chose "manual". In its stock (Xandros) configuration, the drive has 4 partitions on the fast 4Gb motherboard-mounted hard disk and two on the slower 16Gb removable hard disk. The first thing is to select "new partition table" for each drive. For the 4Gb drive, I created one partition, in the ext2 format. The "mount point" is "/", to indicate that the root of the filesystem goes in that drive, with all the system files. Be sure to check the "format" checkbox to ensure that the drive is wiped before installing, as I think omitting that killed the Xubuntu installer. For the 16Gb drive, I made one partition, in ext3 format, mount point "/home", to indicate that the user's files will go on this drive. Again check the "format" checkbox. When you accept the configuration, it will warn you that you have not allocated any swap space. This can affect performance when you use a lot of RAM, but using the SSD drives for swap space can reduce their lifetime, as they have a finite number of writes before they die. I hope the system can function well without swap. We shall see. It also warns that this will wipe any files on the drives. I don't have anything of importance on my machine, but if you do, then don't hit that button until you copy your files somewhere safe.

The rest of the installation went fine. I was worried that Gnome would be too resource-intensive for the eeePC but it runs well, even with some of the graphical effects turned on. I will detail the setup later once I have it working, but suffice to say that within an hour of installing Ubuntu, I had working Wifi, Ethernet, custom keys on the keyboard, installed build-essential, got the camera working, and installed subversion and GTK.

Now that Ubuntu is installed and configured, it's like night and day. I will never go back to the default Xandros OS.

USB-Install hell

So, the consensus among my Linux-savvy friends regarding getting GTK, gcc, glut and opencv working on the eeePC was a resounding "GET RID OF XANDROS!". The rest of the robotics club uses Ubuntu or the lightweight derivative Xubuntu. People have reported various levels of success on eeeUser regarding Ubuntu installs, so I decided to give it a shot.

It was at this point I discovered that I have some sort of curse regarding bootable USB drives. I tried creating bootable Xubuntu, Ubuntu, Kubuntu (all 8.04), and eeeXubuntu (7.??) USB drives to install some favour of Ubuntu on my eeePC.

Here's a list of tutorials that I tried in turn:

First, I made an eeeXubuntu USB install using this tutorial: http://wiki.eeeuser.com/ubuntu:eeexubuntu:home

The tutorial and script work quite well, and I created an eeeXubuntu USB drive which boots on my eeePC. Great, right? Well no. Discussion on the eeeUser forum indicates that eeeXubuntu doesn't work so well on the eee PC 901, the model I have. Apparently it's better to install the vanilla version of the newer 8.04 version of Ubuntu or its derivatives Kubuntu or Xubuntu. Alright. I'll do that:

------------------------------------------------------------

So next I tried these:

http://www.pendrivelinux.com/2008/05/21/usb-xubuntu-804-persistent-install-from-live-cd/
http://www.pendrivelinux.com/2008/05/15/usb-kubuntu-804-persistent-install-via-the-live-cd/
http://www.pendrivelinux.com/2008/05/08/usb-ubuntu-804-persistent-install-via-the-live-cd/

All three of these failed with the same fdisk error: "WARNING: re-reading the partition table failed with error: 22. Invalid Argument."

Also, if you can get past this, the tutorials require downloading syslinux during the Live session, and of course, neither ethernet nor wifi worked during the Live session on any of the three computers I used to attempt this.

------------------------------------------------------------

A helpful person on the eeeUser forum suggested Unetbootin: http://unetbootin.sourceforge.net/

I tried this using a Windows machine, and the process went smoothly. However, the eeePC refused to boot from the USB drive, though my MacBook Pro and a PC tower both would.

------------------------------------------------------------

Next I tried this:
http://www.pendrivelinux.com/2008/04/09/usb-ubuntu-804-installation-from-windows/

This created a working Ubuntu installation as well, but again, the eee PC 901 refused to boot from it.

------------------------------------------------------------

At this point I was just really pissed off and about ready to hurl the Live CDs, USB keys and the rest out the window. I'd probably spent about 12 hours trying to make these various USB installs at this point.

The solution? Get an external USB2 DVD drive.

Sunday, August 17, 2008

GTK woes

The OpenCV library provides image capture, processing, and a display GUI for vision programs. It forms the foundation of my guidance programs. It relies on the GTK interface library for image capture and the GUI elements. The GTK binaries are functional on the eeePC, but the development files necessary to compile GTK support into OpenCV are missing. All attempts to install them (from the libgtk2.0-dev package or others) have failed. I think the writing is on the wall for the built-in Xandros OS. I'm going to try to install eeeXubuntu, the modified Ubuntu distro that's configured for the eeePC. We'll see how that goes. I'm going to try to preserve the restore partition so that I can bring back the Xandros if necessary.

Sunday, August 10, 2008

Arduino setup on Linux

The Arduino site has eeePC-specific instructions for setting up the Arduino environment. It turns out to be as simple as installing a few packages and then uncompressing the Linux Arduino software. Just follow the links:

The Arduino Download page.
Arduino for Linux instructions.
Arduino for eeePC Xandros Linux instructions.

Note: while the instructions say to use the Debian repositories to get your packages, it is better to use the Xandros repositories. If you have not already, go back two entries in this blog to see how to set this up.

A pic for scale

Snowtires and the eeePC

So I pulled the laptop podium off the robot and I'm preparing to make a cradle for the eeePC. Above is a picture for scale. The Stampede's suspension takes the weight easily, unlike the Apple which compressed the springs all the way down.

Thursday, August 7, 2008

Setting up the eee PC

For the eee PC to function as the robot's computer, it needs several things:
  1. A fully-featured development tools set, including gcc, make and the standard libraries. These are not installed by default on the stock eee Xandros system.
  2. A regular Linux desktop, with the ability to easily control settings and active devices.
  3. A working install of OpenCV - the Open Computer Vision library, which forms the basis of all my vision code.
  4. The usual extra tools, like a decent text editor, image editor, and video codecs.
The default eee PC interface is a launcher-style tabbed menu. It has a terminal and a file browser, but it's not well-suited to development use. Fortunately, there's an "Advanced Mode" which is just a version of the KDE linux desktop. Instructions for installing and invoking his mode are on the eeeUser wiki: here. Use method #1, "the Easy Way". Do not use method #4. I tried that first and it prevented the system from booting up properly.

** EDIT: The following turned out to be BAD IDEA. Correction Below. ** [ To install the dev tools, follow the instructions on this blog. The short version is to add the main debian repository for the apt-get package manager. With that as a source, apt-get can download and install the package called build-essential, which contains compilers, linkers, debuggers, build tools, and all that good stuff.] ** End Bad Idea **

Installing Debian packages can cause all sorts of incompatibilities, so don't do the above. Instead, install Xandros packages onto your Xandros-based eeePC. What logic. Anyway, the right instructions are here. Once you've set up apt-get to pull software from the Xandros repositories, you can then use the console to run the following commands:

> sudo apt-get install build-essential
> sudo apt-get install pkg-config

This will install compilers such as gcc, build tools, and all the other stuff you need to write/compile software.

Now that you have gcc and all the rest, you can download the OpenCV source from its page on sourceforge. For me, OpenCV installed without a hitch. The final glitch is that any program that uses OpenCV needs to know where to find the OpenCV runtime libraries. The installer placed the libraries in /usr/local/lib/, so I added the line:

export LD_LIBRARY_PATH=/usr/local/lib

to the end of the file ".bash_profile" in th main user's home directory. This sets up the dynamic link path so that the shell can pass this on to the executable and it can find the libraries. Now your executables will run.

Wednesday, August 6, 2008

eee PC Arrives

It's here. The eee PC finally arrived. It's really cool, really small, and has amazing battery life (with its 6-cell battery). The built-in Xandros-Linux-derived interface is pretty slick, and the included software is cool, but I think a Xubuntu install will get the most out of this little beast. The small keyboard is going to take some getting used to, but my first impressions are good.

With regards to the robot, it remains to be seen how well thi machine stands up to the rigors of vision processing, but it can play back video smoothly and it handles the OpenGL Tux Racer game with aplomb, so I'm not too worried. The vision algorithms work just as well at 320x240 resolution as they do in 640x480, so if this machine can b 1/4 as fast as the Apple it should still work.

Saturday, August 2, 2008

Success


The robot works. It rolled around under its own power for the first time. There is a huge amount of work yet to be done, but this proves to concept. I used my MacBook because the eee PC still hasn't arrived. It looks like Canada lost out when it came to getting part of the first wave of shipments. I had to take the rear shocks and springs out and replace them with solid links to take the weight. Hopefully the eee PC will arrive soon and halve the payload.

Here's a video of the robot following a path marked by green lines. It works fairly well, but it definitely makes errors, as witnessed at the end of the video. I don't have a wheel encoder working yet, so I have to adjust the throttle manually to keep the robot moving as the battery level drops.

video

This is a good moment to thank everyone who's helped me get this project going. Particularly everyone in the UBC Thunderbird Robotics Team, without whose help this project would never have even begun, much less gone anywhere.