Reading/Writing ElevationAngle in Kinect throws InvalidOperationException

487 views Asked by At

Any idea how to move the Kinect up and down? Theoretically,

sensor.ElevationAngle = 20;

should do the job, but I am getting the following error:

InvalidOperationException
This API has returned an exception from an HRESULT: 0x8007000D

It breaks down even if e.g. reading the current ElevationAngle is the first thing after starting the Kinect Sensor... (the answer to the question here suggests it's because of too much movement operations but it happens even if the Kinect has not adjusted position for some time; if it's duplicating, I am sorry, but I am unable to comment the above mentioned question).

** edit ** code:

using Microsoft.Kinect;

namespace pro02_01_streams.tilt
{
/// <summary>
/// Interaction logic for Tilt_test.xaml
/// </summary>
public partial class Tilt_test : Window
{
    private KinectSensor sensor;
    public Tilt_test()
    {
        InitializeComponent();
        Test();
    }

    public void Test(){

         if (KinectSensor.KinectSensors.Count == 0)
        {
            MessageBox.Show("No Kinects presents", "Error");
            Application.Current.Shutdown();

        }
        try
        {
            sensor = KinectSensor.KinectSensors[0];
            sensor.DepthStream.Enable();
            sensor.ColorStream.Enable();

            sensor.Start();
            sensor.ElevationAngle = 1;
        }
        catch
        {
            MessageBox.Show("Failed to initialize kinect", "error");
            Application.Current.Shutdown();
        }
    }
}

}

1

There are 1 answers

2
Frozen--Wings On

Your code works fine for me. To find out if your Kinect works properly, open the Kinect Developer Toolkit Browser and run the Kinect Explorer-WPF. In the application, go to Sensor Settings and move your Kinect with desired angle.