Tuesday, October 21, 2008

eeePC up and running

Lately I've been a bit busy, but there's been some progress. The eeePC now has full functionality and can operate the vehicle in place of the Macbook Pro. Here are some pics:

First, the eeePC with the screen shut on its new aluminium tray on the Stampede. Note the webcam between the two front springs. It's a USB2 Logitech Quickcam Deluxe for Notebooks. It's got a glass lens and no autofocus. (Autofocus can play havoc with vision software, as autofocus will change the image's focus without warning.)

This shot shows the eeePC with the screen open. This setup means that I can walk behind the robot and see what it's seeing: this is very useful for debugging the guidance. The grey USB cable goes to the microcontroller. The black USB cable goes to the camera.

The chassis remains largely unchanged. The computer tray attaches to the four body posts that used to hold the lexan truck body on. It can be removed by taking out the four retaining clips. A piece of scrap lexan from a keyboard's packaging makes a small tray to hold the Arduino microcontroller (blue, on right side of vehicle) and the wire breakout board (green, left side of vehicle).

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.