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:
- getting more readings from the barometer in the init_barometer() function.
- calling the init_barometer() after the init_ardupilot() function so the time between the barometer calibration and the first lecture in the main loop is equal to the time between barometer readings in the main loop.
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:
- home.alt ([cm])
- gps->alt ([cm])
- current_loc.alt ([cm])
- ground_press (ground pressure estimated in the function init_barometer [Pa])
- current_press (pressure sensed by the barometer in each execution of main loop [Pa])
- ground_temp (barometer calibration temperature [10·C])
- delta_t_baro (time between calls to method barometer.read() [ms])