Asimo – The Humanoid Robot

I went to see Asimo the humanoid robot created by Honda yesterday down at Darling Harbour.  I have to say it’s really amazing technology and very impressive.  The show goes for 1/2 and hour, and is essentially (as you’d expect for a free show) an ad for Honda, but it’s still worth going to see I think anyway.  Next week it will be in Parramatta, so if you want to see it check it out there.  The details are on the associated website.  Note however that to get tickets you have to be really early.  I got there 45 minutes early but the tickets were all gone (you can only get tickets in the 2 hours before the show).  However I did hop in the reserve queue and managed to get in that way.  I think that although they have tickets, they still provide a lot of space for those without tickets – the reserve queue was quite long and a fair number of those behind me appeared to have been let in anyway.

Unfortunately as I guess the show’s just meant to be for entertainment for all levels (down to pre-schoolers), there’s not much said about how the robot works (it was more what it does than how).  You might be a bit underwhelmed if you don’t understand the complexities of what the robot has to deal with in order to function, and how far it has come over the last 20 years.  The Tech Guide on the website is well worth reading as it fills in a lot more details on how it operates.  I guess I’m just a nerd and like to know how things work.

At uni (I studies Computer Systems Engineering at UTS in Sydney) there were 2 related subjects (called Computer Systems Analysis and Computer Systems Design) which provided my only real experience with robots.  We had to analyse, design, and write the software for the robots in a “chocolate factory” – a massive project for a bunch of students to do in a semester (there were a lot of late nights) ,which has given me a lot of appreciation for dealing with robotics and the issues you have to deal with just to do something simple.

In the show Asimo walks, runs, dances, interacts with an audience member (shaking their hand, copying what they do),  and picks up a tray of coffees and takes it to another location.  Asimo does walk a little bit as if he were constipated, but it is damn impressive.  Running (considering the definition of running is having both feet off the ground at the same time) and landing smoothly for the next takeoff is even more impressive.  “He”can do this at 6km an hour – not bad!  Also the recognition of the (I can only assume) unscripted movements of the chosen audience member (I also assume there is no human involvement in this recognition either) such that he can copy it is extremely impressive.

So fair to say I am very impressed by the technology.  Just if you do go to a show, expect a half hour ad for Honda, and don’t expect to be hit with many details on the technology.  But worth the effort anyway.


Into The Wild – Movie

A couple of weeks ago I entered a competition in the JJJ email newsletter for preview tickets to the new movie “Into The Wild”, but then promptly forgot about it.  On Monday when I got my mail there were the tickets, for the preview showing last night.  I went along and it was a really beautiful and moving movie – I definitely recommend it.  It’s quite long at 2 1/2 hours, but the subject matter is facinating and very well told (it’s essentially about removing all burdens, going into the wild, and becoming self reliant).  Based upon the true story of Christopher McCandless, it takes us from the time he was an unwilling part of society, to disappearing suddenly to leave everything behind, through to his death from starvation in the Alaskan wilderness.  The great thing about the theme is I think it resonates with a lot of people, where they can relate in wishing in some way to be less burdened by material possessions and/or debt (which society these days is built upon) and instead take each day as it comes – providing a sense of freedom.  I don’t necessarily agree with how he went about doing this, but you have to say it took guts to do what he did.

The acting was great all round, it was well shot, it’s funny at surprising times, and has a fantastic soundtrack (by Eddie Vedder of Pearl Jam fame, who plays every instrument himself apparently).

The only negative is that there are a lot of flashbacks, where I think that it might possibly have had more impact if the story was told in a more sequential fashion.  However, more than a day later the movie is still in the back of my mind which is definitely an indicator of how powerful a movie I found it.

Decoding MPEG2 Information

As part of a personal project I have been working on I needed to estimate the size of an MPEG2 file (.mpg) once it was DivXed, following the formula:

Estimated KB = (Video bitrate + Audio bitrate) X (Runtime/8)

Based upon the above equation I thought it would be a pretty easy task.  I was wrong.  I just needed the result of this simple equation so I could have a progress bar to display how far through the DivXing process it was.  It wasn’t exactly a major feature of the program, so I didn’t expect it to take so much effort.  I had all the information I needed except for one variable – the runtime of the video.  I did a bit of searching to try and dig up some C# code that would give me this information, but came up pretty empty handed.  The only code I came up with was a C# port of a part of the mpgtx project here – but its duration calculation did not give even a remotely correct answer.

I expanded my search to look for code in any programming language that showed how to get this information, but found very little there either.  Most were wrapped up in such convoluted projects that I’d have more luck reverse engineering the MPEG file myself than the code I found.  I did find a file on this site (MpegInfo.c in the MPEG Decoder project) that helped a little and gave me a basis to work from, but my code has ended up working very differently to the way it does (I think Nic’s has a minor bug in the timestamp calculation that can put it a few seconds out, which mine doesn’t appear to have).

Of course at this point I could have just said stuff it and not bothered with a progress bar for this part of the process.  But like the nerd I am I saw a challenge and I couldn’t walk away without having a try at writing a class to parse an MPEG file myself.  Several late nights later I’ve come up with something that works and have decided others might find it useful too.

Some background info: the duration of an MPEG file isn’t stored in a header anywhere.  To calculate the duration of the video you actually have to search for the first timestamp (usually 0:00:00) and the last timestamp (from the end of the file or it could take ages to search through the whole file for it).  You can then subtract the first timestamp from the last timestamp and you get the duration of the video.  It isn’t foolproof as the timestamps can be affected by various problems, but it’s usually a pretty good indicator of the video length without having to parse the entire file.

The MPEG file has a header in which it stored various information like the picture width/height, the aspect ratio, the bit rate, the frame rate, and more.  The file then is delimited by GOP (Group Of Pictures) stream markers which are followed by a timestamp.  This data is encoded into bits which you can extract using some bit shifting and masking.  You can mask then shift the bits or vice versa.  I masked then shifted – I thought it was a bit more understandable that way.  It’s a bit difficult working out the structures of these headers and markers, but in the end I found a great source with the structure of the MPEG headers and stream markers – I wish I had found it earlier!

I’ve wrapped the functionality into a C# class which provides the duration along with some other properties (including picture width/height, frame rate, and aspect ratio), which you can download from here:

Download MPEGVideoInfo.cs

To use the class just instantiate it with the path to the .mpg file as a parameter to its constructor, and then you can use the properties immediately.  I’ve commented it fairly well so the code should be pretty easy to follow.  Feel free to use it in your own projects (it’s LGPL) and I’d love to hear about where you use it and any additions you make to it.  Enjoy!

*I’ve been rather surprised by the amount of interest this has had since it’s been up – in fact it’s one of the most popular downloads from my blog.  I didn’t think it would be of interest to many people, so please leave a comment on where you’ve used it – I’m really interested to know!

The Sideshow Audience

Well this blog post is a couple of days late, but better late than never :).  I went to see the filming of The Sideshow (ABC, Saturday nights) on Thursday night and it was a lot of fun.  I actually wish I had gone before, and was surprised how easy it was to get tickets – I thought it would be hard but all I did was send an email and 2 tickets were mine!  Considering how much entertainment value you get (for free!) I’m surprised not more people do it.  I had been planning to go see a filming of Good News Week (years ago) and then The Glasshouse but both shows were axed before I got organised enough to go (not that I wasn’t given ample opportunity).  Luckily I made it just in time as The Sideshow too has been axed with 1 show left. 😦

You get to see a lot of behind the scenes stuff and Paul McDermott and the band certainly made it entertaining for us between filming segments.  Then when it’s over we were told by Paul in no uncertain terms to (f*** off :).  You get practically a front row view to the acts, and they often come into the audience to watch the show with you (I saw members of Tripod standing in the crowd at times).  You’d normally be lucky if you got front row tickets at a Tripod show (yes, I am a big Tripod fan).

If anyone wants to go see the filming of the final show (filming 29th November) let me know!  Note that you very possibly may end up on TV (either a good thing or a bad thing) – I spotted myself very clearly in one of the audience shots when I watched it last night.

The Nerd Handbook

James pointed out this blog post titled The Nerd Handbook to me today.  I think this should be required reading of anyone who interacts with nerds – it describes us and our delicate personalities perfectly.  I’m writing this while at my computer, sitting in my cave, watching a couple of TV shows at once and working on a programming project in the background.  I think if this description is to go by I’m most definitely a nerd.

Topfields On Special

I just visited the Topfield website today and noticed they had them on special with what looked like significant price reductions.  For those not in the know a Topfield device is a twin tuner hard disk TV recorder (which you might say are pretty popular now – but Topfields are the top shelf variety).  For the nerdy folks (like me) you can program it too, allowing you to write custom programs (called TAPs) to run on it.  This is one of my favourite features because lots of people (there is a fairly hardcore community around the device) have written really useful programs that you can load onto it (EPG’s, management tools, games, etc).  There is a USB 2.0 port at the back so you can copy tv programs off and onto DVD (or DivX them like I do).  I’ll have a blog post about doing this shortly when I release a program I wrote to handle the whole DivXing process for you.

Negatives?  The user interface on the device I guess is a little primitive these days compared to media centre PC’s, but I think the functionality provided is far greater since this is a purpose built device.  A couple of functions could have been better designed, but this can be overcome with Andy Cullen’s excellent ProgressBarKeys TAP which I use.  Otherwise it is a great device.

2 1/2 years ago I bought a TF5000PVRT model and it is seriously one of the best purchases I have ever made, changing the way I watch TV completely.  I paid $790 for it then (talking them down from > $1000 thanks to people on the Topfield forum), now you can get it for $399 new (or $329 refurbished).  To me it was worth every cent of the $790 I paid, so it certainly is worth the $399.  My VCR became completely redundant immediately.

If you are thinking about getting one and wondering which model to get go here to find out more info on the models.  I have a TF5000PVRT, and I seriously recommend getting at least that level (ignore the TF4400PVRT – you can’t run TAP’s on it).

So I thought I’d pass this on as I am soon releasing some software I have been developing in relation to the device (it will be open source), so the more people with one the merrier.  I also hope to finish some TAPs I was working on at one stage but never quite finished and release them too.

PS. I am not an employee of Topfield or associated with them in any way.  Just a happy user!