Archive for the ‘Personal’ Category

Playlist Synchronisation for Portable Devices

I have recently been attempting to properly set up synchronisation between Windows Media Player and my portable music player (which happens to be my phone). Though I found that the Windows Media Player synchronisation tool does the job pretty well, it does fail in one respect: it cannot copy over playlist (WPL) files. For me, this was a bit of a nuisance, since I rely very much on playlists to categorise my music collection.

The solution for me was to write my own tool that synchronises a given set of playlists with a portable device that is compatible with WMP (Windows Media Player) – as I believe many devices tend to be. The tool works simply by finding the appropiate place on the device to which to copy the playlist files (a known XML descriptor file on the device should specify this), and then copying over these files, with the locations of the media files updated to point to those on the device.

Naturally, my choice of technology with which to write the thing was .NET/C# – this does mean that it’s not a fully standalone application, though it does only consist of a single EXE. However, thanks to a few particularly convenient features of the language/framework (primarily LINQ to XML), the code was largely trivial to write, and the majority of the ~200 lines is in fact error handling.

You can download the program here. As mentioned, it requires the Microsoft .NET Framework 3.5 (SP1) to run, which is not installed on any current version of Windows by default, so it will need to be downloaded and installed firstly if you don’t yet have it. Also, if anyone is curious to see the code, I may be able to upload that at some point.

The tool should be run from the command line, and would seem to be very straightforward to use. (Run the program with no arguments to see the help information.) An example command line to syncrhonise the playlists in the standard location of your user profile with a portable device on drive F might be:

pps F “C:\Users\username\Music\Playlists”

That’s all it takes. The task should finish within a matter of seconds  and then report some general information about the playlists it found and what it managed to successfully synchronised; else return an error message.

NB: If you’re wondering how the synchroniser matches the media files on the device with those in the playlist, I have a small admission to make. Because the directory structure is not guaranteed to be the same on the device as at the location of the source media, the current version simply matches media items by file name. This works perfectly well for me, though there is clearly a caveat. I am looking for an improvement on this method, and while I have a few ideas, I haven’t finalised my decision yet. Any recommendations by someone more knowledgeable on the subject would be appreciated.

Now, this program was designed primarily for my own use, but I did consciously attempt to make it usable with any WMP-compatible portable device, so hopefully people shouldn’t have any major problems using it.

Finally, it would be nice to hear any feedback regarding this little tool of mine, so please feel free to drop me a message (even if it’s just to say you’re using it). If I hear any suggestion for a worthwhile feature to add (or of course a valid bug report), I will gladly update the program.

My Guide to Science Fiction and Fantasy

Note: This guide is currently partially incomplete. I will try to get around to expanding the summaries at some time in the near future (in particular in the Fantasy section). Not to mention that almost undoubtedly, there will have been one or two books I will have wholly forgotten, to my future disbelief.


This post is a summary of my recommendations regarding fiction; specifically, in the genres of science fiction and fantasy, which have proven to be the types that have typically attracted my interest, though not quite the only types. Certainly, I feel that I have read enough of a variety within these areas now, that I can produce something of a useful guide for anyone interested in finding the real gems of these forms of literature. It is important to realise that the summaries that I have provided are not meant to be synopses or reviews of the books, but rather brief overviews of my personal takes on them, as well as suggestions relating to why you might be interested in them.

So without further preamble, here is my guide. I’ve listed my current favourites (by that I mean both most enjoyable and having greatest creative and literary merit) at the top, with others in a fairly arbitrary order.

Science Fiction

  • Dune and the Dune series by Frank Herbert
    In my opinion (and seemingly that of many others), perhaps the greatest science fiction novel ever written. The scope and storyline are truly unparalleled by anything else within the genre, and maybe anything else in the entire body of 20th century literature. In a certain respect, this work almost belongs within the fantasy genre because of its nature and some of the motifs – it’s much more of a superb story than superb speculative science, with a bit of philosophy thrown in. Of course, it still very much deserves the categorisation of sci-fi, mainly because of the interstellar travel (run by the monopolistic Spacing Guild) as well as the ecology/terraforming ideas that are involved. Overall, I might think that classifying it as a planetary romance does it maximum justice, though in all fairness there’s no real way to get a decent understanding of its unique style and grand themes without reading the work in its entirity. It is certainly not so-called “hard sci-fi”, but that’s not especially what I’m interested in to be honest, and no-one who has a proper interest in literature should care either. I don’t way to say too much more about this book, since I think everyone with an interest in sci-fi should read this once (and preferably reread it) from a fresh perspective and to experience its wonder for themself. Now if you make it through the original Dune novel (I’m not sure how you can finish it and be anything less than stunned), then I would without hesistance suggest that you also pick up the second and third of the series (Dune Messiah and Children of Dune), which are excellent reads in their own rights, if not actually masterpieces. After that, I’m afraid to say that the standard of writing and storyline declines to a certain degree (with a short resurgence in the latter half of Heretics of Dune). The rest of it does tend to get slightly crazy (not helped by Herbert’s unusual and sometimes slightly opaque writing style), and even verges on becoming somewhat raunchy at times. Still, they are by no means poor works, albeit ones that I would only recommend to serious fans of Frank Herbert. (More precisely, they are still works of high quality, but only to a much diminished subset of people.) So that I don’t end on a seemingly sour note, I shall repeat and reinforce my statement that the the original Dune, written in 1965, is a piece of literature that should not be missed by anyone with an interest in speculative fiction.
  • Foundation series by Isaac Asimov
    The original Foundation is perhaps the first truly epic sci-fi ever created, and to some extent the precursor of Dune and ultimately inspirational to the Star Wars universe (arguably alongside Dune itself). Unlike Herbert’s series, however, this one peaks somewhere in the middle, with both the head and tail ends being only marginally diminished in standard. Although it may not contain a single book that is the equal of Dune, the series as a whole is probably unbeatable. Its pace and sheer scale rarely drops, and there’s always a sense of the unexpected (though a few can be predicted, Ibelieve it was intended very purposely). Again, similarly to Dune, this book is what it is because of its storyline, although there is undoubtedly a greater emphasis on the science, not surprisingly given that Asimov is in fact a scientist (chemist) by training. It contains some genuinitely interesting and imaginative scientific concepts (as well as a few strange and outdated ones, having been written in the 50s), both in terms of hard science (mainly physics and astronomy) and soft science (psychohistory being the main one). The latter is particularly intriguing, as it demonstrates (albeit in superficial detail) an entire new branch of science, which is in essence a blend of history, sociology, and psychology turned into a mathematical study of analysis and prediction of the macro-events of the human race. As a matter of fact, I do believe that Asimov is showing some foresight in this respect. Though the level to which he proposes the usage of his psychohistory may not be very realistic, the core idea gets me thinking seriously about the possibility of such a field opening up in the future. To summarise, he explores a number of both scientific an human themes with exceptional insight, yet some amount of subtlety too. So if you want something that is enormous in scope, besides superb entertainment (yes, these novels even include a bit of humour!), you assuredly cannot go wrong with this series.
  • Space Odyssey series by Arthur C. Clarke
    2001: A Space Odyssey
    was one of the first proper science fiction novels I read (as a young teenager), and probably what really grabbed my fascination with the genre. As a novel written alongside a (faithful) film script, the storyline in fact ended up producing both a fantastic book and film, and counts for much of what made the Clarke the celebrity he was. Sadly, the great author passed away less than a year ago now, though he continued to write with much of his former skill well into the 21st century. Clarke’s works have always had the tendency to focus on space, the universe, and other intelligent species, and though they are perhaps not as grand in style as Dune or Foundation (he is clearly a realist opposed to the more romantic styles of the other two authors), they do have astoundingly good (hard) science, as well an undeniable element of suspense, which is present throughout almost all of his creations. The Space Odyssey series as a whole is one definitely worth reading to the end. If I remember rightly, only one of the four in the series (the others have the same names, replaced by the years 2010, 2061, and 3001) is a slight letdown, though the remainder (importantly, including the first and the last) are most enjoyable indeed. The first of the series I must however single out and include among my “big three” of sci-fi, the others being the original dune Dune and Foundation (despite a number of excellent sequels), as you might have suspected by now.
  • Rendezvous with Rama and the Rama series by Arthur C. Clarke
    Belonging almost as much in mystery/thriller category as it does in science fiction, it is nevertheless an astonishing read. The highly unique view that this story offers in relating the first contact of humans with other intelligent life (of a much more advanced form in this case) may not be an especially grand one, but the imagination that went into this creation was surely immense. Being a mystery, I’m not going to comment any more about the book, even in vague terms. (Or maybe I’m just not too sure what to think of it as a whole.) Specifically, I would recommend that if your introduction to the works of Arthur C. Clarke is (or has already been) a pleasant one beginning with with 2001: A Space Odyssey, then this should definitely be next thing on your reading list. Most unfortunately however, akin to the Dune series, the quality of successive books  does deteriorate a certain amount. (I can confidently say that the second is worth a read, though, while the subsequent ones lose some, if not all, of their novelty.) If you need any more convincing, let me point out that Rendezvous with Rama won both of the highest commendations in science fiction, the Hugo Award and the Nebula Award, a feat that the original Dune similarly achieved.
  • Brave New World by Aldous Huxley
    Who hasn’t heard of this work alongside The War of the Worlds as a prime example of classic science fiction? Again, not celebrated so much for its scientific content as the eloquent manner in which it conveys certain philosophical and speculative ideas. I won’t deny that this is a bit of a depressing read in some ways, but its philosophical and socilogical implications are beyond doubt not only captivating but also quite relevant to modern society. Perhaps I do have something of a penchant for philosophical prophecy in literature, but I don’t think anyone can finish this book not having had their own thoughts and outlook on life and society sincerely provoked, if not disturbed by this powerful portrayal of a dystopian world in the near future.
  • Farennheit 451 by Ray Bradbury
    A curious title, let alone book, and perhaps science fiction is not the most obvious classification for this work, though I think in a sociological sense it is so speculative and strikingly relevant regarding our future that it should be deemed so. This book has many parallels with Brave New World, the evident ones being the examination of dystopian societies (albeit two different forms) and philosophical warnings with undeniable precautionary overtones. They are both surely championing the freedom of independent thought and behaviour over the horrors that extreme conformism might bring. And finally: a book about the destruction of books – is there not a wonderful irony (perhaps even mockery) in this predominant theme?

There are additionally a few books about which I have heard very positive reports but unfortunately haven’t gotten around to reading yet. I’ll update the summaries when I do get around to reading at least some of these books, which will most probably be some time over the coming summer break.

  • Childhood’s End by Arthur C. Clarke
    [Summary to come.]
  • The Robot series by Isaac Asimov
    [Summary to come.] For the time being, maybe pointing out that the film I, Robot was based on Asimov’s book of the same name will be enough to convince some to read it?

Fantasy

  • The Lord of the Rings trilogy and The Hobbit, or There and Back Again by J.R.R. Tolkien
    How much do I need to say about this one? That it most likely surpasses all of the others in both of the categories I have listed here should say enough about my particularly high opinion of the works. (I am a self-confessed Tolkien fanatic, after all) In fact, if you need convincing to read this epic, then I would suggest that you stop reading this list now (not that I would have expected you to get this far anyway)! I’ve mainly just included this entry for completeness, not because it’s going to be of any supreme help to anyone. As a side note, The Hobbit, or There and Back Again (commonly simply referred to as The Hobbit) should without doubt be read alongside the trilogy – whether before or after ought not make much of a difference to its impact, at least as I see it. Though I’m not sure to what extent this perception exists, I will nonetheless suggest that you dispell all notions of this being a story for chlidren – indeed it is no less suitable for adults than it is for a child, despite its comparative light-heartedness, which has possibly given it such a reputation. While I, as many others, read the novel first when I was quite young, it has not since lost its endearing quality to me, and see no reason why it should for anyone else.
  • The Silmarillion by J.R.R. Tolkien
    The epic historical prequel to The Hobbit and The Lord of the Rings, this may not be the easiest read when you first pick it up. (At least, it wasn’t for me, though perhaps that was because I was much younger at the time and the somewhat archaic language didn’t help – yet I can only say it adds to the character and feeling of the story nowadays.) Nonetheless, I would argue it is almost more magnificent than The Lord of the Rings in certain ways, being an true archetype of epic literature. (Though I haven’t read it myself, the Anglo-Saxon poem Beowulf may give some impression of its style; unsurprising, given that Tolkien was a professor who taught such works of literature.) To be honest, if you’re not immeresed in it by the half-way point, then put it down, but I suspect this will not be the case for any lover of The Lord of the Rings, and you will hopefully become immersed as I did by the histories.
  • The Wheel of Time series by Robert Jordan
    This is a series that I’ve actually not managed to finish yet. (My excuse is that it’s composed of 12 books, each ranging from roughly 700 to 1000 pages. I’m never one to race through a book or series [at least not since I was younger], and in any case I’m at least getting some enjoyment out of the reading.) Influenced to large amounts by both Tolkien and Herbert’s works (and I didn’t even know this when I started reading it!), I believe this series will given time become as renowned as those two in its own right. This is the series to read if you’re looking for fantasy that is both entertaining and has great depth to its characters, something that arguably even the great Tolkien’s works were at times missing.
  • Shannara series by Terry Brooks
    Shannara is Brook’s most well-known (and as of yet) unfinished series. With a total of 14 books (a set composed over individual stories and series in their own right), this beats even The Wheel of Time in that respect, though the fact that the various storylines are disparate to a large degree makes it significantly more manageable. Being epic high fantasy very much in the style of Tolkien (though not direct plagarism, as some critics were too keen to codemn The Sword of Shannara). In my opinion, this series needs to be read at least until the conclusion of the second book (The Elfstones of the Shannara), which is in my mind still the best fantasy work outside of Tolkien’s collection, since I initially read it seven years ago.
  • The Word and the Void trilogy by Terry Brooks
    This is Brook’s lesser known series, though in fact considered by a sizable minority to be his best writing. With a dark, modern setting, this certainly isn’t his typical style (or at least the one by which he gained his reputation), though it is perhaps his most creative composition. It is additonally notable in representing his final break-away from the influence of Tolkien (not that I can deem this a wholly undersirable event), and really includes some very original content to its plot. Even if you were turned off by Shannara (or simply not particularly impressed), I would firstly respond in shock, but then suggest that this trilogy is worth a try regardless of your opinion.

Now, before some indignant Harry Potter fanboy comments on the absence of the series from my list (this is of course presuming I have any reading this post), I should stress that these are not books that have just slipped my mind. I’ve read them all (some more than once when I was a bit younger), and plainly, they are decent light entertainment, but nothing worth putting alongside the other greats, I’m afraid.

To end, I would only like to say that it would be very gratifying to hear whether anyone is making use of these recommendations. It would honestly be quite interesting just to gauge whether you as fellow fans of these genres concur with at least some of the views presented here, or conversely how you might view my summaries contrastingly. If not, I think I can still convince myself that I enjoyed writing this guide for its own sake!

Numerical Analysis for .NET

During my ongoing work on a computational project for university, I recently discovered the need to perform some serious numerical analysis from my C# code.  Unfortunately, I must admit that the .NET world only now seems to be catching up in terms of the free and open source libraries it offers for various tasks, and initially I was disheartened to find that there seemed to be nothing available for doing calculations on large (sparse) matrices. After a fair deal of searching, only a couple of somewhat incomplete and no longer maintained matrix libraries turned up. Being an avid user of StackOverflow, however, I decided that if anyone was aware of some library that could do what I needed, I would most likely find them there.

The result was much better than for what I was even hoping. dnAnalytics is a general-purpose package for numerical analysis in .NET that does almost everything for which I might possibly ask – and from my first impressions, does it very well indeed. This wonderful find is a well-maintained, fully open-source, library with great API documentation (not a wholly unexpected thing, but surprisingly uncommon among so many open source projects). There are several features that stand out as particularly impressive. One undoubtedly is I/O classes for Matlab and delimited files (among other formats). What is more, the library seems to offer both a fully managed version and one that wraps the Intel® Math Kernel Library. I’m not sure how the performance compares between the two (I haven’t yet tried the latter), but it is surely nice to have the pair of options available, quite similarly to how you have alternatives of cryptographic algorithms in the .NET BCL, that is to say, a) a fully managed version, v) a version based on top of the Windows Crypto API, c) a version that uses the CNG (Next Generation) API introduced with Vista. Perhaps what appeals to me the greatest about this library is that the developers have clearly gone to an effort to make it user-friendly, not only with regards to the documentation, but also by adding an interface friendly to F# coders (likely to be a language of choice for future mathematical/scientific programming), and even visual debuggers for Visual Studio (possibly the only library to date I’ve seen include them).

My particular usage of the library requires me to use the linear algebra (specifically, sparse matrix) classes. Although I must point out that the specific algorithm that I was intending to employ for the project was not available (see my later discussion), it did include a host of other ones, primarily focusing on direct and iterative matrix decomposition, which would appear to be quite handy in many circumstances. I haven’t yet had a chance to play with the other areas of the library, but I have noticed that it offers some statistical functions and methods as well as a number of modern pseudo-RNG algorithms such as the Mersenne Twister.

To conclude, I should come back to the point that the most important part of the analysis I require was not (at least direclty) contained by the library – finding the eigenvalues or eigendecomposition of large (1000s of rows/columns) matrices, which happens to be in relation to spectral theory, in case you’re curious. Even so, being such a complex field and one fraught with difficulties when it comes to implementation (numerical instability is a huge problem), I was not surprised to find that an implementation of the Arnoldi or Lanczos algorithm was not present. Fortunately, after a bit more searching around (by this point I knew specifically what I was looking for), I came across the ARPACK library, written in the archaic Fortran77 language. It did however seem to be exactly what I was looking for: a set of fast routines to find the eigenvalues of large (either dense or sparse) matrices of various types. After only a small amount of pain messing about with MinGW, I managed to get the code compiled nicely into a DLL. At this point, I am of course perfectly able just to use the P/Invoke capabilities of .NET and do some hackery to integrate the ARPACK stuff with my existing code and dnAnalytics. Yet, I am also inclined to do this whole task properly and basically write a managed wrapper for ARPACK that is tightly conforms with dnAnalytics. I could then perhaps submit these wrapper types (along with a few unit tests?) as a repository patch to the dnAnalytics team in the hope that they’ll take it and add it to the next release. As with most other projects at this time, I will have to see what time permits me, though I would certainly hope to contribute something substantial to what truly is a terrific project that I would love to see expand further.

RCSU Science Challenge 2009

The Royal College of Science Challenge is an annual competition open to all students of Imperial College London, and something I’ve decided to enter this year. At the present time, the midnight deadline has just passed and I’ve just taken a huge sigh of relief… As is my habit with most things (writings or otherwise), I ended up not even starting work on the submission until the past Friday, which has indeed turned out to be a very unwise decision. Anyway, the good news for me is that I did finally manage to get the essay completed and uploaded at a panicky 11:53 pm. (At this point I half-expected MS Word/Firefox/Vista to crash spectacularly, but my fortune in fact held out for a crucial 15 minutes!)

Now to the contest itself. I should note that everyone, irrespective of year and department, was able to pick any one of the four proposed questions and then proceed to write a 800 word essay on the subject. A disheartening thought if considered for too, but something told me it was worth a shot anyway. My choice was the following (third) question:

Will Homo Sapiens continue to evolve? If so, how?

For those who don’t know, I am currently studying for a Physics here, and haven’t taken biology for several years now – so it may initially seem rather silly for me to ignore the others and tackle the least physics-based topic of them all. (In actual fact, it figured that I had far too much to say and the awfully low word limit was the source of much exasperation for me!) An interesting short article in the January issue of this year’s Scientific American had gotten my pondering the issue lightly before I even new of the contest, which is probably half the reason. Although I’m sure I could have done a decent job of one or two of the others (certainly the one on the LHC, I would think), I guess the open-ended scope of the evolution one caught my fancy at the moment. Enough said – I do at least feel pretty satisfied with the end result. In getting there, I must also mention the kind assistance of my friend David in repeatedly proof-reading it and making some quite insightful suggestions.

Without further ado, here is my entry.

Each year, the infamous Darwin awards are given out in order to “salute the improvement of the human genome by honoring those who accidentally remove themselves from it (1). This “award” is of course proclaiming to recognise those people who supposedly perform supreme acts of stupidity and thus assist the process of natural selection in the human race, first described by Charles Darwin in the 19th century. Behind this purely ironic prize is however a much deeper question: have we, as members of humanity, changed significantly over the recent past, and will we perhaps evolve into something quite different in the near or distant future?

It is commonly believed that our bodies have remained static from at least the time of the birth of civilization around 7,000 years ago. The greatest period of “recent” alteration occurred as the species branched off from those of other primates hundreds of thousands to millions of years ago. A recent study by American two universities[1], however, threatens to entirely reshape this perception of our evolution. It contends that a minimum of 7% of the human genome has changed over the past 5,000 years or so. These scientists even go as far as asserting that “humans have evolved as much as 100 times faster than any other time” (2).

One thing is agreed upon pretty much for sure: human evolution, however significant, will follow a radically path in our future than it has for most of our past. Firstly, it is generally believed that our brain size is not likely to increase anything like it has done in our early history. This is not to say that human behaviour will not be transformed – rather, it is considered one of the most probable of man’s characteristics to do so, thanks to the rapidly changing nature of society and growth of technology. Conceivably the most extraordinary course for our evolution to take is some form of symbiosis with machines. Even presently, human dependence on machines is immense. Economies, societies, and even many individuals require them merely to survive. Perhaps the merging of mind and machine is but the next step in a natural progression? Symbiosis, if chosen by most people, would likely add selection pressure towards purely functional behaviour. The thought of abandoning many of the pleasures of human life may be enough to prevent us from following this route, though it does not remove the prospect that one day our species might seriously consider it. The ultimate human stimulus for evolution may in fact be space travel: such a scattering of the species would be liable to produce great diversification and force adaptation.

Perhaps the most astounding change in the manner of our evolution will come as a result of human intelligence. We are now beginning to understand properly the process of evolution on both macroscopic and microscopic levels. The very fact that we are aware of such a process working upon ourselves is exceedingly likely to alter the “natural” course of evolution, maybe even unintentionally. Our efforts to perform artificial selection have already begun and are currently highly controversial issues (often in such guises of genetic engineering or “designer babies”). These ideas and associated fears are certainly not new; science fiction has long speculated on possible paths that we might take in our search for a “better world”. Aldous Huxley’s classic novel Brave New World, written in 1931, describes a future dystopian society where people are engineered to fulfil certain roles within society, reproduction being an entirely artificial, state-controlled operation. Somewhat differently, Frank Herbert’s Dune series explores a universe in which a powerful organization of women operates a long-term secretive breeding program that aims to produce a man with supreme mental capabilities. The common theme in these works is an important one; namely, that there must exist some relatively small group of individuals who possess the authority to direct the course of evolution and the workings of society. Indeed, we all know to where eugenics can lead. Now let us ask ourselves whether, as inherently fallible human beings, we can be trusted with this sort of power?

The future path of human evolution is an uncertain thing, to say the least. If modern research hints anything at what is to come, we should undoubtedly expect huge change. That we may soon have the opportunity, at least in part, to direct our own evolution, will make it especially unpredictable. Yet if we can make sensible decisions and learn to accept what it outside of our control, we may find ourselves transformed into something rather new and astonishing. After all, why should our species, one so devoted to expansion and improvement, suddenly remain static?

Bibliography

1. Darwin Awards. The Darwin Awards. [Online] [Cited: 28 2 2009.] http://www.darwinawards.com/darwin/.

2. What will become of Homo Sapiens? Ward, Peter. January 2009, Scientific American, Vol. 300, pp. 68-73.

3. Huxley, Aldous. Brave New World. London : Chatto and Windus, 1932. ISBN 0-06-080983-3.

4. Herbert, Frank. Dune. s.l. : Chilton Books, 1965.


[1] Teams headed by Henry C. Harpending at the University of Utah and John Hawks at the University of Wisconsin-Madison.

I now only await the news of the shortlist, with some little hope that few enough students of science would bothered to voluntarily enter an essay competition. (Yes, this is a purely unscientific hypothesis.) Regardless, it will soon be seen whether such expectation is in vain.

RoboChamps World Finals

About a month ago now I happened to receive a rather surprising email from Microsoft. Having read that I was invited to the Microsoft RoboChamps World Finals in Barcelona, I quite nearly dismissed it as spam until I read a bit further. It soon became obvious that it was in fact a real event for four “world finalists” to compete by programming robots to fight in a “Sumo ring” (essentially a physical version of the online Sumo challenge from the same competition). My disbelief was mainly due to the fact that RoboChamps wasn’t something I had devoted a huge amount of time to before then. I had watched some videos on MSDN Channel 9 and played around with a couple of the challenges downloaded from the website, but that was about it. Not before long I had encountered various bugs and issues in the SDK/challenges, quickly making me lose interest and move on to something completely new, as is often my tendency. (I might have anticipated the problems given that it was Microsoft beta software). Admittedly, the idea of programming robots in a simulated environment using the .NET framework sounded pretty cool, but I was busy enough at the time to (temporarily) forget about it. Back to my point: I soon found out that I had gained a wildcard place by my (comparatively) active participation in the forums, which at least clarified matters. So it came down to a free week-long holiday in the middle of the university term, simply to play around with robots (and win a guaranteed prize!) – how could I not accept such an opportunity?

I arrived in Spain late on Sunday after far too many hours travelling by aeroplane/train (and then getting lost and having to rely on my paltry knowledge of Spanish for directions to the hotel in the dark). Still, I did manage to arrive at the conference centre on time for the keynote (opening) speech of the yearly EMEA TechEd developer conference, which was acting as host to the RoboChamps finals. Unfortunately I wasn’t able to attend any of the other talks given at the conference during the week. (The ones on the new F# language [see this post] and the future of C# looked reasonably interesting, but as contestants we were coding and testing literally from sunrise to sunset some days!) The keynote itself was all about the next version of Visual Studio (VS 2010), including a few live demos, which overall looked very promising. I haven’t actually downloaded the CTP for it yet, so I won’t go into the details here. I may however wait for the next release, given that the IDE crashed within about 30 seconds after startup on the first demo – quite unsurprising really, but still rather amusing in what was essentially a big promotional talk.

The competition proper started that afternoon, when I met the three other contestants as well as the guy from Microsoft who was organising everything for us. They were Jackson, a professor of robotics from Brazil, David, and Doug, both two American engineers with many years of experience… I thought it would be difficult simply not to embarrass myself, but contrary to expectations the contest turned out to be surprisingly close (possibly due to the severe time constraints). We were firstly given our individual robots, two shared practice rings on which to test, a reference book for Microsoft Robotics Studio, and a brief explanation of how the event would be run before we then set to work. The robots were in fact just iRobot Create models (very similar to do the Roomba vacuum cleaner) with an embedded box running Windows CE and a webcam attached. In addition, since I was without a laptop, I was kindly given one to use throughout the course of the event, with nothing less than a pre-released version of Windows 7 installed. This ought to be the topic of another (short) post, but suffice to say now that I was quite impressed with some of the updates from Vista. I even hear that a slimmed-down version is being developed, which means people may have rather more luck running it on EEE PCs and other less powerful machines.

There were initially (that is the whole of the first two days) some horrible issues trying to run even the sample program on the robots. To start I had the bad fortune of being unable to deploy my program to the embedded box (which took rather long to realise and resolve with Visual Studio displaying a “Deploy Successful” message, despite my wondering why my program was still behaving like the sample one). Still, it seemed that everyone had their fair share of problems over the week, both hardware and software related. The fact that half of the robots were originally broken in some way (and some never fixed), together with the low charge on all the battery packs meant that I spent the first two days doing all too little. I should however mention that we did have plenty of assistance in trying to fix everything as soon as possible. (Microsoft did want a good contest after all, especially since the fight on Thursday was being publicised to any conference-goer who walked near.)

Eventually when I did get my program running, things turned out to be a lot of fun and it the challenge became one of strategy rather than debugging. I started by tweaking the code for the sample program and improving upon the vision processing, with a limited degree of success. My hopes to use the SIFT algorithm (its virtues preached to me by David [my aforementioned friend, not opponent]) for feature detection and estimating the location of the robot’s self/opponent immediately vanished once I had run a few speed tests on the embedded device, showing about a 100x slowdown compared to my moderately fast desktop. Noticing that my opponents were using relatively straightforward algorithms for machine vision was however a big relief. (SIFT was largely magic to me anyway, having tried to learn it only the previous week from Wikipedia and some of David’s old lecture notes.) I ended up taking the general structure and motor-control code from the sample program (as I believe the others did too) and using my own code for handling the sensor data, in particular the camera frames. The essence of my vision processing algorithm was some fine-tuned colour segmentation (using a flood fill function I ported from a previous project). I also updated the motor control code to use proportional feedback. Most else was quite trivial.

We finally came to the afternoon of the competition, with barely a day and a half of serious development behind me (and little more, if any, for the others). Despite the evidently enormous amount of work everyone put into the competition, it was great to be with such casual, open, and friendly competitors, and we were sharing ideas even until the last few hours. The format of the rounds was very simple: the winners of the two semi-finals progressed to the finals, and the losers played for 3rd place, where each round was the best of three 60 second bouts. The first semi-final between Jackson and Doug began at 1:00pm (see the video recording of it here) and I was beginning to panic slightly, realising that the recent versions of my program were strangely intent on running the robot out of the ring by itself and not easily resolvable. (I had recently done some 3 or 4 hours coding without any testing, which would explain…) A bit foolishly, I also had no sort of version control on my code (unless you count the poor man’s version control of copying/pasting the source directory every so often). When it came to my semi-final round against David, his robot needed only to watch mine drive full speed out of the ring after about 15 seconds. Fail, indeed. Crucially I had a couple of hours before the 3rd place play-off, which meant I could at least revert to a backed-up version (of unknown behaviour in the ring) and do some tweaking/testing. This somehow won me the round against Doug (though my robot only succeeded in avoiding being pushed off) to finish 3rd overall. I did get the feeling that perhaps I would have faired rather much better on first round had I only been less intent on using my latest version, but I was nonetheless happy to settle for 3rd given the overall situation.

We had all agreed earlier in week that we would let the winner choose first whichever prize he wishes, followed by the others in rank order. (This was mainly due to the lack of fondness for the RoboDog, which was originally going to be the 1st place prize.) When it came to decision time Jackson was very generous in deferring his choice to the rest of us, which means I was lucky enough to receive one of the two laptops. I still am not aware of its precise specs, but hearing that it was a high-end Alienware gaming laptop was enough to sell me. The Corobot ended up going to Jackson and the RoboDog to Doug, but everyone seemed reasonably pleased (the robots were . In the end I don’t think I could have hoped for a better experience (minus the hardware issues perhaps). Now that it’s apparent this was both the first and last RoboChamps competition (it has already been merged with the Imagine Cup), I feel particularly fortunate to have been invited. (The Imagine Cup, inspite of being for students, seems to attract far too many Eastern European hackers to give many people a chance.)

On a final note to this absurdly long post, Microsoft Robotics Developer Studio 2008 has just been released. You can download the Express version here for free, but there’s now also a commercial Standard version. I suppose the focus on hobbyists had to come to an end at some point, although the free version still looks quite capable. Also, I should point out that the release of the Mars Rover challenge (an especially interesting one) is now imminent in case anyone fancies giving RoboChamps a go – there will most likely be some pretty nice prizes for the winner/runners-up too, as with the previous challenges.