librealsense icon indicating copy to clipboard operation
librealsense copied to clipboard

Implement Camera Temperature API

Open vidstige opened this issue 10 years ago • 18 comments

If I remember correctly, you could in the Windows SDK query the camera temperature. I only found stuff relating to temperature in the f200-private code. But can I get temperature readouts from a SR300 camera? If so, how would I go about that. I'm not afraid to look at the f200 code and try to recreate the feature for SR300....

vidstige avatar Apr 05 '16 10:04 vidstige

I believe SR300 reports temperatures using same API as F200. Check GetIRTemp = 0x52 and GetMEMSTemp = 0x0A USB commands and the related read_ir_temp and read_mems_temp functions. There are couple of changes that might be relevant: First, when camera is not streaming depth, F200 would successfully return temperature 0, while SR300 will fail with 'Invalid HW State" code. Another difference is that the temperature control loop in F200 is done in software, while SR300 is handling that automatically in hardware.

dorodnic avatar Apr 05 '16 10:04 dorodnic

Alright, thanks I'll try that!

vidstige avatar Apr 05 '16 12:04 vidstige

What is the difference between mems_temp and ir_temp? Which one should I use? Should I expose both?

vidstige avatar Apr 19 '16 09:04 vidstige

Also it looks like the perform_and_send_monitor_command function can take a const device? Right? Otherwise a new get_temp function would need to be non-const, seemingly without good reason.

vidstige avatar Apr 19 '16 09:04 vidstige

I'm I'm getting ir temps ~29 and mems temps around ~20. What units are these? Why are they different?

vidstige avatar Apr 19 '16 09:04 vidstige

@vidstige are you building your own temperature/calibration model for the SR300?

ddiakopoulos avatar Apr 19 '16 16:04 ddiakopoulos

Nope, just want the read outs. We're using the pcb and think we got enough cooling, but are not really sure. Things seems to work okay, but we would like to log the temperature to be able to see if we got heating problems if a camera fails or such.

vidstige avatar Apr 19 '16 18:04 vidstige

I'll let @dorodnic fill in the knowledge gaps here. When I see 29 and 20 I don't see how it could be any other range than degrees centigrade.

ddiakopoulos avatar Apr 19 '16 22:04 ddiakopoulos

Yeah, I think you mean degrees Celsius. Could be some "raw" format you need to shift one bit left or multiply with 1.2 or whatever as well. Just wanted to double check. Thanks for pinging @dorodnic

vidstige avatar Apr 20 '16 07:04 vidstige

A related question for you @ddiakopoulos : If I were to make a pull request for this, what would be a good way to add it to the API? I'm thinking a function in the device class, e.g. get_temperature that takes an enum for either mems or ir temp. Any thoughts on that?

vidstige avatar Apr 20 '16 08:04 vidstige

ping. any news on this? If no answer I'll propose a pull request and assume degrees Celcius.

vidstige avatar Apr 22 '16 09:04 vidstige

It should come through the get_option and set_option system.

ddiakopoulos avatar Apr 22 '16 15:04 ddiakopoulos

But is it really an "option" like the others? You can't really set it for example, and it will very for each call, so it is a diffrent kind of creature compared to the options that are in there now... But, I'll do it like that. Thanks for taking your time to think about his and for the feedback!

vidstige avatar Apr 22 '16 15:04 vidstige

Hi vidstige, sorry for late response.

Yes, the temperature is in degree Celsius. Regarding the different functions - you can query the temperature on different points on the PCB: ir_temp is measured near the IR Sensor. mems_temp is measured near the projector. These test points are device specific, and in theory new test points can be added for future products.

I fear that exposing temperature as an option abuses option API. Current API provides no way to know which options are read-only and which are read-write. Also, there is no way to know which options are safe to cache and which (like temperature) are being modified by the device. Since monitoring temperature is common use case, I would recommend adding get_temperature method.

dorodnic avatar Apr 24 '16 08:04 dorodnic

Hi @vidstige We'll add this to an internal feature tracker because it's functionality that should be exposed. I'll back out of my comment that it should be built on the get/set option API and defer to @dorodnic for a possible implementation.

ddiakopoulos avatar May 14 '16 23:05 ddiakopoulos

Alright, great. Thanks for the clarification and for looking into this. I got side tracked myself, was intending to make a pr for this but never got around.

vidstige avatar May 16 '16 11:05 vidstige

Checking in on this request, have also come across this need. Any updates?

digitologist avatar Nov 01 '16 00:11 digitologist

No, it turned out we did not really need this as badly as we thought. We're not currently working on it and it is not planned. It did not seem too time consuming too implement last time I checked the code though.

vidstige avatar Nov 01 '16 07:11 vidstige