I’m writing because I have some problems with the barometer readings of the APM v.1 hardware (sensor BMP085). I'm using the ArduPlane code version 2.32.
When I tried to do automatic landings I saw that the autopilot had problems with getting the correct altitude to turn off the motor or was coming to hight or to low. After checking the logs I concluded that the problem was the initialization of the home altitude.In each log I saw the same pattern:
During the first 15-20 executions of the main loop program, the home altitude is 0 and then is set to the current_loc.alt value. The problem is that at that moment the current_loc.alt had accumulated an error of approximately 22 meters as is shown in the next graphic. I'm using altitude_mix = 1 (barometric altitude).
I founded that this error in the current_loc.alt value responds to a difference between the ground pressure (estimated in the init_barometer() function) and the pressure that the barometer sense during the main loop execution as is shown in the next graphic.
It can be seen that in the first execution of the main loop, the ground pressure and the pressure sensed by the barometer are equal, but after 20-25 execution of main loop the pressure sensed by the barometer differs from the ground_press in approximately 300 Pa. I have made different test to check this error and I always get a difference between the “ground pressure” and the “current pressure” at approximately the same number of executions. It seems to be a systematic error in my case.
I tried different solutions to solve this problem but without any successful:
Had anyone experienced this situation? Does anyone had an idea of what can be the problem? Could be a communication problem of the barometric sensor BMP085 when it is running with another sensors? (In the init_barometer() function the barometer is call “alone” while when is running the main loop, the barometer is call between calls to another sensor like airspeed sensor or magnetometer).
I'll appreciate any comments on this problem. If it is needed a more detailed explanation, just let me know.
I post some logs with the barometric measurements. There is a special section call “BAR” in which is logged the next data:
Very detailed analysis. We really need some ArduPlane people to look at this. I'm mostly arducopter and we haven't seen this issue.
ArduPlane 2.32 is very old and there have been many changes, including to the baro library, since then. Please upgrade to 2.50 and see if the issue goes away.
...and please Diego do the same analysis again. Agree with Randy. Nice detailed analysis. thank you.
ok. I'll try upgrading to version 2.50. I'm using version 2.32 because I'm having problems with the mission planner program and the mavlink version.
Make sure you're using the MAVLink 1.0 version of the MP. It's in the same directory.
I repetead the test with the ArduPlane version 2.50. It performed much better than the version 2.32. In the next graphics are shown the current_loc.alt and the barometer readings.
I have marked in the pressure graphic with a yellow ellipse a small pressure drop that happen during de firsts executions. This pressure variation is the same that I had noted in the code v2.32 but now in version 2.50 is smaller. In the next graphic is shown this pressure drop for another log. Regardless the current_loc altitude error is very small.
I've also seen this issue. I'm 100% sure that the temperature raise due to electronics heat affect the barometer. So, I wait 10 minutes to stabilize the board temperature and press the reset button, to reinitialize the barometer. Normally, I get a much more stable altitude.
Hope this helps.