Logic about Baro.Gnd_temp

I found a problem about parameter ‘GND_TEMP’(see figure 1),which used for barometer calibration. According to Ardupilot code (see figure 2), if the parameter ‘GND_TEMP’ setted with ‘0’,the ground temperature should be minimum of barometer temperature and 35 degrees C,but actually it was not.

I think I can explain this (and it indicates the docs should be better). We do clamp to 35C but only if an external temperature estimate isn’t available.

We take the airspeed sensor as an external temperature source, as it’s normally mounted far enough from the self heating of the autopilot to avoid the large temperature rise on the internal barometer.

What you should be seeing here is that your external temperature is being used instead of being clamped at your internal one. It does seem unlikely you truly had 48C ambient weather in which case inputting a corrected ground temp could improve the baro accuracy a bit.

How do you set GND_TEMP before flight? Does this parameter require ourselves to set it? Or that we do not need to do anything,it will automatically take the value from the airspeed sensor?

If you want to provide a value you simply set the parameter (it’s in degrees celsius). It will automatically be reset to 0 (the select the best value (airspeed first then the minimum of the baro temperature or 35C)) every time you reboot.

Thank you,I understand!The above figure 1 shows my plane getting ground temperature from the airspeed sensor,which can be certified by the following figure.

I still have questions whether the airspeed sensor’s temperature is bigger than ground actual ambient temperature?

Typical causes are self heating, heating from other components (IE the autopilot itself tends to get warm), exposure to direct sunlight (this one should be avoided for other reasons as it can interfere with the sensor badly). You could graph the various IMU temps as well to help get an idea of what the autopilot was at temperature wise.

According to the figure above, the airspeed temperature (red) is higher relative to the barometer temperature (brown) and IMU temperature (blue).I admit that my plane always exposure to direct sunlight before takeoff ,which may be why the airspeed temperature is so high.Do you have a good idea about this question for getting more accuracy baro altitude?Thanks again!

The highest accuracy use case of the baro at the moment requires that you set the actual external air temperature for wherever you power on the system. If we were to assume your ambient temp is around 35C you would have less then a 10% error. (The logic for the math/temperature clipping (as well as some graphs of the effect) is presented here: https://github.com/ArduPilot/ardupilot/pull/5930 )

I honestly fly GPS as my primary altitude source, particularly because my flight times are up to 3 hours and baro drift becomes a large problem over a flight that long.