Question

I want to ask is there any way to check whether a Kinect is being used at the moment (sensor.start) so that we can use another Kinect for another application or in the same application? I tried using Kinect.IsRunning but it's not working.

Here is the case: I have an application that runs on one Kinect, but I want to run this application two times. I have two Kinects connected to my PC. The problem is whenever I ran the second application, it will detect the same Kinect to be used causing the second application to crash. I want this application can know if the first Kinect sensor already start, it will go for the next one. I have read this article but it doesn't help me to solve this problem. http://social.msdn.microsoft.com/Forums/en-US/e8e96d97-ec02-430e-b80c-a40ae6b92604/running-two-instances-of-the-same-app-for-two-kinects?forum=kinectsdknuiapi

So far I hard-coded the Kinect ID into my application, but that means I need to have two applications which is not efficient. If I need to change the Kinect I need to change the ID again inside the codes. Anyone can help me. please? I thought it should be not difficult, but I still haven't found any function to do that. I'm writing my codes in VB.Net

Was it helpful?

Solution

I would do something like this:

For Each _sensor As KinectSensor In KinectSensor.KinectSensors
    sensor = _sensor

    ...//setup event handlers and such

    Try
        sensor.Start() //If it gets past this, then we can exit as it has
                       // successfully started a kinect
        Exit For

    Catch ex As ApplicationException
        MsgBox("That Kinect is being used in another application, moving to the next")
    Catch ex2 As IOException
        MsgBox("Error")
    End Try
Next

This will search all the kinects, try to start them, and if an ApplicationException is thrown, then it moves onto the next kinect.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top