Sunday, February 17, 2008

OSes/2

In my previous post I described a tangible interface that I made for Google Earth, using Arduino and Python. A couple of days after that, I had the chance to take my prototype in to school to try and get it running on one of the student's laptops.

I had pretty high hopes. She had a beautiful new machine. It had only taken me a few minutes to move the project from one of my Win XP computers to another. I had even burned a disk with installation files of all of the software I'd need. She turned on her computer and we waited. And waited. I remembered how disappointing it was the first time I tried Windows 1.0 on my DOS machine. We waited. I remembered how long it had taken for my Win 95 and Win 98 machines to boot. We waited. We made small talk. I asked her how long she'd had her computer (less than a year). I asked her if she liked it. She said plaintively, "I think I want a Mac." We waited some more.

Things went downhill from there. I spent about an hour and a half trying to install my software. Every few minutes, the screen would darken and I would get a security message. Occasionally, a window would open with a long list of processes that needed to be killed. I would then hunt them down one-by-one, try to figure out what they did, and stop them. Unfortunately, the process IDs weren't very useful because they don't appear uniformly in the different tabs of the default display of the task manager. Once in a while I would get an error message with no way to rectify the situation, other than to accept it. Eventually I got to a point where it seemed like I was going to damage something, so I spent another hour trying to undo my earlier actions. Up until a few days ago, I hadn't seen Vista, but had assumed that it couldn't be as bad as the "Hi, I'm a Mac--And I'm a PC" ads made it sound. I took a quick poll of the students and found that about a fifth of them have Macs, and the rest have new Vista machines. I decided to bring in a few old machines running XP to use for their exhibits this year.

I had a lot of time to think while I was sitting there. I have almost $200K to spend on computers for myself, my colleagues and students over the next few years. I had assumed that I'd be buying a few Linux machines for power users and Windows machines for the rest. I just can't see that happening now. I'm beginning to think that the non-Linux machines in our new computer labs might be more useful for everyone if they have an OS that is built on top of Unix.

Tags:

Monday, February 11, 2008

Prototyping a Tangible Interface for Google Earth

As I mentioned in a previous post, students in my digital history grad class this year are working in teams to create interactive exhibits that involve physical computing. Since none of the students have much prior experience with programming or electronics, I'm providing a bit of the scaffolding to help them realize their designs.

The design. One of the groups imagined an interface consisting of a handheld globe. As you touch a point on the surface of the globe, a computer display responds by orienting a corresponding digital globe to focus on that place, and then opens some panels with information about an event that happened there. They decided that Google Earth would make a good software platform. I left them to the task of creating their exhibit materials in the XML-based Keyhole Markup Format (KML) that Google Earth uses.

Hardware. The exhibit will be mounted on a laptop running Windows. For the tangible interface we're using an Arduino microcontroller board. Normally-open pushbutton switches are connected to the digital inputs on the Arduino with 10K pull-down resistors. We debounced the switches in software, by reading their value twice at 10ms intervals. The Processing program that runs on the Arduino is here. It maintains the state of the last button pressed, and sends it repeatedly over a serial connection to the PC. (If you'd like to try making something like this yourself, Lady Ada's Arduino Tutorial is a great place to start).



Python glue. We needed a program to sit in between the Arduino and Google Earth, collecting information from the former and using it to control the latter. Python is ideal for this. First we installed the Python for Windows extensions and the Python Serial Library. We were then able to control Google Earth via the COM API. Our Python test program is here. It first defines two functions, one to orient Google Earth to the main gates of the University of Western Ontario, and one to orient it to Uluru (Ayers Rock) in Australia. The program then initializes the serial port and Google Earth. Finally it enters an infinite loop, reading the serial port and calling one of the two navigation functions when the corresponding button is pressed. (If you'd like to use Python to control Google Earth, François Schnell has a very useful page.)

Testing. I was quite impressed with how crisply the whole system works together. To get it running, you go through the following steps.

  1. Build and test the button circuit, then connect it to the Arduino.
  2. Start the Arduino software on the PC.
  3. Compile the Arduino program and download it to the board.
  4. Run the Python program. It will start Google Earth automatically in full screen mode.
  5. Once Google Earth has finished initializing, you can press the buttons to navigate within the program.


The final exhibit for our class will be mounted in April. You will be able to read more about it on the students' blogs and at the exhibit website. I'll write about some of the other components in future posts.

Tags: | | | | |

Monday, February 04, 2008

Freedom of Expression

I've been working pretty hard for a couple of months on The Programming Historian, and almost all of the code that I'm writing is going directly into the book, rather than appearing here in lightly-documented bits and pieces. Over the next year I expect to find a balance between hacking in expository mode (the book) and hacking for its own sake. Each, of course, informs the other.

In other news, I recently picked up a diminutive and very inexpensive Asus Eee PC and have to say that I'm quite impressed with it. Part of my enthusiasm is no doubt for Linux, which I'm just getting around to exploring. But the machine itself is pretty sweet, too.

If you're a regular reader of my blog, you might've found that last bit about Linux surprising or disillusioning or something, so I probably should explain. When I started programming, the IBM PC hadn't been invented yet, and machines like the Commodore PET, TRS-80 and Apple/Apple II were just becoming available to elementary school kids. By an accident of school-district purchasing, we had Commodores rather than Apples. When I was in high school, I talked my way into my first job at the community college (teaching at a "computer camp" for little kids) by claiming to know how to use IBM PCs. I borrowed a DOS manual and memorized commands over the weekend. I was only a little embarrassed when I couldn't actually turn on a PC the following Monday morning. I was looking all over the keyboard for the power switch, which turned out to be a huge red toggle on the side of the case. (If you look at this picture you can get a sense of my frustration... the power switch is on the back right, hidden by the manuals.) That summer I became trilingual, adding Logo to my knowledge of BASIC and assembly language. This is getting to be a pretty long story, so let me skip through the VAX years and my enduring love for LISP/Scheme and functional programming, and get to the early to mid 1990s, which I spent working in a Unix shop. Right around the time that Linux was taking off, however, I began working with a succession of graduate supervisors (and later colleagues) who were based firmly in the Windows world. And that's how I missed Linux. Until now.

It's surprising to me how fast my Unix experience came back when I popped open a shell and started typing commands. That part is neither here nor there. What's really great about open source, however, is that I am free to fix anything that is bugging me. As soon as I had that feeling of freedom, it all came back to me again. Why would anyone give that up? How had I ended up in a situation where I didn't feel that way?

Tags: | | |