Kinect Manager available for download

Kinect Mgr Demo
You’d think I’d look more pleased that it is working…..

Today I finished all the chapters for my upcoming book about the Kinect SDK. As part of the book I’ve made a wrapper class that makes it a little easier to use the classes in the Kinect for Windows SDK. You can use it to start a Kinect running and then bind to events that driver generates when new frames are available. The frame events are processed on a “round robin” basis so that the driver will not get new data from the sensor until it has been processed by your application. This makes it work well even on low performance machines that might not be able to keep up with the events generated by the Kinect sensor. The manager also generates status messages.

You can download the class, along with a program that demonstrates it, from here. For it to work you must have installed the Kinect for Windows SDK from here. And of course you’ll need a Kinect sensor – either the Xbox 360 one or the Windows one will work fine.

Campfire Fun and Games

Campfire Audience

A great audience to die in front of…

Did my keynote session today at Campfire. It was great fun, once I’d got over my nerves and lack of sleep.Pretty much everything worked as it should, apart from my “bomb proof” Kinect driver wrappers blowing up. Oh well. I said I’d put some resources up here for you to take a look at:

Slides and (mostly working) code from the presentations today - here
C# Yellow Book, Windows Phone Blue book and other free stuff - here
.NET Micro Framework embedded development - here
Gadgeteer embedded development -  here
Three Thing Game student madness – here
Windows Phone development - here
Dreamspark, free software for students - here
Microsoft Robotics Developer Studio – here
Kinect For Windows SDK – here

I think that is everything, if you remember something I forgot, let me know and I’ll add it. Once the presentations were over I went for a wander round the city. After some fun and games on the transit I managed to get all the way down to the bay. I took loads of pictures which I’ll play with properly when I get home. In the meantime here are just a couple.

harbour1

Lovely

boat Crop

A boat on a building? And why not.

More tomorrow, I’m off to bed now…

The Curse of Kinect

DSCF6824

A very patient audience, thanks for putting up with me.

Just completed my Kinect session. Having done lots of tests I then got lots of problems during the demos. But everything worked in the end. For those who were there and wondering what the problem was, I think I’ve found the solution. Sometimes the sensor doesn’t wake up before my update thread tries to use it. Which doesn’t end well. I’ll be putting up a nice long blog post (and some useful code) to address this later.

After I’ve had a lie down..

Every. Demo. Failed.

All the geeks

A big audience to fail in front of….

What do you do when you present a session and every demonstration fails? I didn’t know this until today. The answer is that you reach the end and then you go and find out why.

I was doing a Kinect session for Geek Night today. This was kind of ambitious, what with carrying the sensor around all over the place. So I’d tested everything before I set off, and I was confident that it would all work on the night.

It didn’t.

I was very happy when the first demo worked, but I can’t take too much credit for that because it was the demonstration application that ships with the SDK. As soon as I moved onto my code that problems began. Programs that just worked suddenly locked up before my eyes. All of them.

It took me a while to figure out what had happened. As in the case of most big failures, it was a collection of little things that added up to make a catastrophe. First thing was that I was using my lovely little Alienware netbook rather than the “Big Ole Dell” that I usually use. The main reason I took the Alien was that it made room in the case for the Kinect sensor. That and the way the keyboard lights up. It is just powerful enough to run the demos, but just powerful enough is fine. Except today it wasn’t.

Something has mysteriously turned all my overclocking settings back down to normal. I turned them on ages ago when I got the device and forgot all about them. Today, after a lot of head scratching, I checked in the BIOS and there they all were. Back where they shouldn’t be.

A bit of tweakage and all is well. I’ve even tried flipping to the built in high performance graphics, which also helps (but also breaks the Windows Phone emulator – so I don’t usually use it).

I’m kicking myself for not testing the demos on site this afternoon when I had a bit of free time, but I assumed that since they worked before they’d work again.

Oh well. Everybody at the session seemed to have a good time. Except me.

Kinect Fun Labs at Imagine Cup

IMG_7043.jpg

There is a rather interesting new addition to the ranks of the Imagine Cup competitions this year. The Kinect Fun Labs Challenge is out to get you exploring new ways to use the Kinect sensor. The nice thing about it is that at the moment all you need is the idea. The implementation can come later. They are actually giving out 100 Kinect for Windows sensors (these are the special ones that have higher resolution close up and other interesting tweaks) to the ideas they like the best, so that you can realise them and enter the next phase of the competition. Next week there is a Live Meeting all about how it works. If I was still a student, I’d be there.

Kinect Skeleton Viewer

image

The new Kinect for Windows SDK is now available. It works really well, but they have changed the API slightly (generally it is a lot tidier now). If you want a simple program to get you started using the skeleton data I’ve done a quick conversion of one of the demos in the Kinect book that I’m working on. You can download the project from here. Now all I have to do is update all the other fifty or so demos and the 12 chapters. Lovely.

Chapter 12 is finished

image

If you’ve wondered where I’ve been for a week. Or why I’ve suddenly just had time to suddenly produce seven blog updates (ahem) it’s because I’ve been writing. Book stuff. Twelve chapters on having fun with your Kinect using the Kinect SDK and your PC. I’ve been squashing pretend bugs with virtual mallets, taking pictures of ghosts and creating all kinds of funky pictures. I even made the computer talk to itself.

The book will be out in late spring. And now I’ve written all the words.

A Computer that talks to itself…

Union Building

I’m still working on the Kinect voice controlled human painting program. First thing I need is a shorter name…

Today I added a feature I thought would be really cool. Voice response is one thing, but I also wanted the computer to talk back when I issued a command. Adding voice output to a C# program is a doddle.

First you add the System.Speech library to the references in your solution.

Then you add the speech synthesis namespace:

using System.Speech.Synthesis;

Now you can make your program speak:

SpeechSynthesizer speaker;

void setupSpeechOutput()
{
    speaker = new SpeechSynthesizer();
    speaker.Speak("Ready to Go");
}

This is the setup method for my speech output. Whenever you want your program to say something, just call the Speak method on the variable speaker. If you are worried about slowing things down you can use an asynchronous call to speak in the background while your program runs on. Works very well. In fact too well.

I had the program repeating the commands aloud and it worked wonderfully. I would say “Red” to select the red colour and the program would say “Red” back. Then commands started repeating, with the computer saying “Red” time after time. Took me a minute to figure out what was happening. Turns out that the computer is really good at recognizing computer speech. It would hear itself say the confirmation message and echo it, and so on. I added a timeout so that it ignores things for a second after a command and all is well now.

Kinect Skeleton Drawing Fun

demo0

I drew these pictures myself. With myself. This is the first ever picture from my Kinect Drawing program. This lets you use your arm to draw on the screen by waving it around.. You can use voice commands to select the colour you want to draw with or you can have the random rainbow effect that you see above.

All this Kinect fun and games is in aid of a book that I’m writing, “Start Here! – Learn the Kinect API”. It should be in the shops later this year.

Using the Proper Kinect USB Drivers

End of Year Ball
This picture has nothing to do with Kinect, but I took it after the End Of Year Ball and I quite like it…

I’ve been playing with the Microsoft Kinect SDK and I really like it. The speed with which it snaps on to people and tracks them is really impressive. However, I did have one bit of fun and games when I installed it. Like loads of other people I’ve been using other drivers with the hardware and although some of these have uninstall behaviours they don’t always get rid of the device drivers themselves. This can lead to problems when you try to install the “proper” drivers and the old ones load up and get in the way. So, to get rid of the Kinect drivers you can do this before you install the Microsoft Kinect SDK. First perform the uninstall on all the previous drivers. Now you need to get rid of anything left lying around:

Open up a new command prompt running in Admin mode. The best way to do this is to click the Start button, type CMD into the search box and then hold down CTRL+SHIFT and press Enter. If you get this right you will be rewarded with a User Account Control dialogue box warning you that you are about to do something vaguely dangerous. Click OK.

Now, in the command box give the command:

SET DEVMGR_SHOW_NONPRESENT_DEVICES=1

This sets an environment variable to tell Windows you want to see all the hardware devices, not just the ones that are active . If you type this command wrong you won’t see an error of any kind, but the process won’t work either. You can select and copy the above text into the paste buffer, then right click in the command window and paste it into the command prompt if you like. Now give the command:

devmgmt.msc

This starts the Device Manager. Now open the View menu and select “Show hidden devices”. This is actually quite fun, as now you will see every device that has ever been connected to your computer. If your machine is like mine there will be around 50 or so different Disk drives, one for every memory key that has been plugged in over the years. Look through the device tree for things with the word Kinect in the name, or the name of the package you are removed.  Look in the “Human Interface Devices”, “Sound, Video and Game Controllers” and “Universal Serial Bus controllers” parts. Anything you find that you want to get rid of you must right click and select Uninstall. If the dialog that appears has a checkbox marked “remove driver software files” then you should select this so that the driver files are no longer around to cause trouble.

Note that this could be vaguely dangerous, in that if you delete an important driver for your system you might find that it will stop working until you replace the driver file, but if you only remove things that are to do with Kinect you should be fine. One tip is to plug the Kinect sensor in before you remove the software and just note what appears in the Device Manager when you do this. These are the things that need to be removed.

Once you have removed all the drivers simply exit Device Manager and close the command prompt. The setting is forgotten, so if you want to remove other drivers later you have to do the whole thing again. This technique can also be useful for removing old USB drivers that are causing trouble.

Robot Fun at the University Transition Event

Cowardly Programming
Making Robot Cowards with C#

Sometimes it helps to read the specification. I’d been asked to prepare a talk for a schools visit today. Six sessions in front of students from schools who were visiting the university to learn about the kind of things we do. I thought Oscar the robot and the Kinect SDK might hit the spot, so I made my slides, built some demos and turned up to give a talk to a bunch of interested Sixth Formers. Who were between 8 and 9 years old. Ooops.Turned out that this was a visit from youngsters looking at moving to the new Northern Academy which opens in 2012. If I’d taken the trouble to read up on the event I would have known all this. Oh well.

During the introductory talk I made some frantic changes to the slide deck and then off we went. Children at this age are about the toughest audience you can get. You either have them, or you haven’t. The good thing was that I had some nice props. I had a robot that you could control by touching your hand on you head. And this proved very popular. At the end of every talk we had a queue waiting for their turn to step in front of the Kinect Sensor and make Oscar the robot do a wheelie.

Who's Next
Who wants to have a go next?

It was really hard work, but enormous fun. All the kids were fantastic and a real credit to their schools. I got some great questions from the audience and everyone left happy, including me.

Customer 2Customer 1
Two satisfied customers

Watching Oscar
Watching Oscar

Thanks to Moy Lanade for sorting everything out and Mike Park, University Photographer, for the pictures.