librealsense icon indicating copy to clipboard operation
librealsense copied to clipboard

Projector status in code

Open rupak-d opened this issue 5 years ago • 9 comments

Camera Model: D400 Firmware Version: 05.12.10.00 Operating System & Version: Linux Kernel Version (Linux Only): 5.4.3 SDK Version: 2.43.0 Language: C++

Issue Description

We have had some cameras on which the projectors had stopped working resulting in bad depth data. It might or might not be a hardware issue on our side. Is there a way to know in code if the projectors are working or not?

rupak-d avatar Apr 13 '21 17:04 rupak-d

Hi @rupak-d You could monitor the status of RS2_OPTION_LASER_POWER - when it has a value of '0' then the projector is off.

Example code for the control of laser power is provided in the link below, under the 'librealsense2' heading.

https://github.com/IntelRealSense/librealsense/wiki/API-How-To#controlling-the-laser

MartyG-RealSense avatar Apr 13 '21 18:04 MartyG-RealSense

Does that show what the laser power is set to? Or does it show it's current value?

rupak-d avatar Apr 13 '21 19:04 rupak-d

You should be able to query the value in real-time. The link below provides example C++ code that prints the current value of RS2_OPTION_LASER_POWER. That particular script is designed to check for the SR300 camera model but it will be simple to remove that check.

https://github.com/IntelRealSense/librealsense/issues/4923#issuecomment-544816825

MartyG-RealSense avatar Apr 13 '21 20:04 MartyG-RealSense

How will this differentiate between the laser being at 0 power due to lighting conditions and it not working?

rupak-d avatar Apr 14 '21 17:04 rupak-d

If the laser is using the Laser setting (Setting '1') then it should ignore the lighting conditions and remain on. The laser would be turned off by the firmware's laser safety mechanism though if the camera's detected projector temperature exceeded 60 degrees C for a period of time.

When the temperature is 60 degrees C or more for several seconds then the Laser Power is first halved by the laser safety mechhanism. If the temperature continues to exceed 60 degrees after that then the laser is shut off. The laser will also shut off if the projector temperature falls below 0 degrees C.

I believe that the Laser Auto setting (Setting 2) was originally designed to change the emitter status based on lighting conditions, but that setting was deprecated a long time ago. Currently, in the RealSense Viewer at least, setting Laser Auto mode does not change the Laser Power value and just renders the IR dot pattern projection inactive.

It is a fair point though that checking the Laser Power value may indicate when the value is '0' but would not on its own indicate the reason why it had become '0'. I would speculate that you could combine the Laser Power result with other checks, such as a check for whether a temperature-related laser shut-off event had occurred (e.g if Laser Power = 0 AND the temperature exceeded '60' THEN a temperature-related laser shut-off may have occurrred).

MartyG-RealSense avatar Apr 15 '21 11:04 MartyG-RealSense

How does rendering the IR dot projection pattern inactive work?

rupak-d avatar Apr 15 '21 23:04 rupak-d

In camera models such as the D415, the dot pattern can be removed from the image with color correction. The D415 supports a Visual Preset camera configuration setting called Left Imager Color w/o IR Pattern.

https://dev.intelrealsense.com/docs/d400-series-visual-presets#section-preset-table

Point 3 of the section of Intel's camera tunig guide that I have linked to below has further information about color correction on D415.

https://dev.intelrealsense.com/docs/tuning-depth-cameras-for-best-performance#section-use-the-left-color-camera

This feature was also being worked on for the D455 camera model but I have not seen updated information about that since late 2020.

https://github.com/IntelRealSense/librealsense/issues/7149

MartyG-RealSense avatar Apr 16 '21 08:04 MartyG-RealSense

Hi @rupak-d Do you require further assistance with this case, please? Thanks!

MartyG-RealSense avatar Apr 23 '21 05:04 MartyG-RealSense

Case closed due to no further comments received.

MartyG-RealSense avatar Apr 28 '21 17:04 MartyG-RealSense