October 9, 2007

Wiimote controlled Lego Mindstorms NXT using MSRS

This summer, when I was at Carnegie Mellon University (CMU), for a pre-college program, I took a robotics class, in which we used these awesome $5000 robots made by NASA, called MAX, and we used Microsoft Robotics Studio (MSRS) to control them. Since they were PC-Based Robots, they had a lot of power by themselves, and MSRS enabled us to use many of the Windows APIs, like the Speech SDK, the MSN Messenger SDK and other cool stuff (we had teams of 4 people, and in my team, there was a friend whose name is Ryan, who loved making additional projects, as I did, so he spent some time doing a cool speech controlled robot, or even IM-controlled! That was pretty fun).

MSRS uses so-called 'services', which or basically libraries of reusable code, that can either define a robot's behavior (an MSRS application is a service by itself) or it can do some stuff and send back notifications and results to the top-level service (the app we are writing). There was a guy next to my room who brought a WII with him, but never used it, so I thought we could ask for a wiimote (the controller), which I knew could be used with a computer, via bluetooth, and we told him we would do something cool with it: control our robot by sensing acceleration! He liked the idea, and accepted giving it to us just to have fun.

I was the 'leader' of this project, so I started looking for some libraries on the web for the wiimote, and found the best thing ever for our purpose: a guy named Brian Peek, who wrote many articles on Coding4fun (a blog of Microsoft's), wrote a .NET wiimote library, and, the best part of it, he also make an MSRS service for it!!! That was obviously awesome, because we didn't have to write the service ourselves (we were not yet MSRS experts...). So, after the pain of getting the wiimote connected to the laptop via bluetooth, which didn't work with my drivers (I finally got to use BlueSoleil (google it), which worked well. I love it now!), I started (with Ryan next to me) to write the code to remote control MAX, following the subscriptions MSRS tutorial on MSRS website. The whole thing came pretty fast, and after testing in the simulation environment, we tried it on the real robot: it was awesome!!

Now, I don't have the MAX anymore, so I thought I would try to do the same with the Lego NXT kit. I actually got everything working fine, except the fact that the commands execute quite slowly sometimes, I'm not sure whether it's my slow laptop or the bluetooth connection, or the distance... Anyway, I'll have to change my laptop soon, because it's becoming more and more obsolete...

I'll post more info, pictures and videos when I have a better robot (the little robot I made is pretty horrible and isn't very stable (I'm quite bad at building with Lego, but I just ordered a book on amazon), so I'll probably do it with the Tribot or something else I come up with. I'll also either wait for my sister to get the camera (she left this year to London, so I don't have a camera anymore, except a DV camcorder, which has pretty bad quality...) or till I have a new camera...

I'll keep you updated!


Dave Lee (Microsoft Robotics Studio) said...

This is very cool. Are you using the new LEGO NXT services [1]? They are much easier to use than the originals - especially when using the MSRS Visual Programming Language.

[1] http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2235814&SiteID=1

Al said...

Thank you!
no not yet.
For the moment I'm just using the drive service and the lego NXT tribot manifest.

But I just made a better robot that also has a sonar in Front, so I was thinking I could use it as a bumper, and maybe send a rumble request to the wiimote when the sonarbumper is pressed, or when the distance is too short, so I will have a look at the new services, even though I don't use the VPL. But I've read about the new release on thenxtstep blog and on you site, and it looks pretty cool!