IntelRealSense / librealsense

Intel® RealSense™ SDK
https://www.intelrealsense.com/
Apache License 2.0
7.53k stars 4.81k forks source link

D435 - Crash when setting EnableAutoExposure (C#/UnityWrapper) #3088

Closed easchimidt closed 5 years ago

easchimidt commented 5 years ago
Required Info
Camera Model D435
Firmware Version 05.11.01.00
Operating System & Version Win 10
Platform PC
SDK Version librealsense version: 2.17.0
Language C#/Unity }
Segment others

Issue Description

Hello guys,

Code and error below. Do you guys knows how can I handle this kind of error (when setting options), avoiding the crash?

Thanks.

Code (C#):

        Pipe = new Pipeline();  
        Config = new Config();

        Config.EnableStream(Stream.Color, 1280, 720, Format.Rgba8, 30);
        Config.EnableStream(Stream.Infrared, 1280, 720, Format.Y8, 30);

        PipelineProfile profile = Pipe.Start(Config);

        Sensor sensorIR = profile.Device.Sensors[0];
        Sensor sensorColor = profile.Device.Sensors[1];

        foreach (var opt in sensorIR.Options)
        {
                if (opt.Supported)
                {
                        if (opt.Key == Option.EmitterEnabled)
                        {
                                opt.Value = 0f;
                        }
                        if (opt.Key == Option.EnableAutoExposure)
                        {
                                opt.Value = 1f; // -------> Error happens at this line
                        }
                }
        }

Error: Exception: get_xu(id=11) failed! Last Error: No error rs2_get_option(options:0000000040D7D650, option:Enable Auto Exposure) Intel.RealSense.Helpers+ErrorMarshaler.MarshalNativeToManaged (System.IntPtr pNativeData) (at <4fd4dfd1857e4955a500c05c5081d4c2>:0) Intel.RealSense.Sensor+CameraOption.get_Value () (at <4fd4dfd1857e4955a500c05c5081d4c2>:0)

easchimidt commented 5 years ago

Just one fact that might not be related. When I try to use RealSense Viewer after this problem happens, the Viewer gets "stuck": I can't access anything (Add Source, On/Off cameras, 2D/3D, nothing). Don't know if it was a consequence of the code, or the camera was in a weird state before (note: it was the first usage after booting computer, so the camera wasn't being used before).

RealSenseCustomerSupport commented 5 years ago

Hi @easchimidt,

What's your D435 firmware version? Can you upgrade it to the latest version. I don't observe this issue based on a quick modified test based on the C# example "cs-tutorial-2-capture".

RealSenseCustomerSupport commented 5 years ago

Hi @easchimidt,

Any update? Do you still observe this issue in the latest librealsense?

easchimidt commented 5 years ago

Hi. Sorry for the late reply. I've tried with the latest firmware, and the bug isn't happening anymore when disabling the emmiter.

Thanks for the help!