I've been trying to get accurate altitude readings from my ardupilot mega using the pressure sensor. Since there doesn't seem to be any way to input the current qnh into the APM to get an accurate reading, I decided to dive into the code to see whats really going on.
It seems as though 29.271267 inches Hg is hard coded into the software, making the pressure altitude constant near ISA. It does however look like the altitude reading is being adjusted for temperature, giving us an accurate density altitude based our near ISA pressure altitude. I guess my question is, are there plans on making a QNH (sorry we used qnh in nz, I believe other countries use other figures) value configurable from something like the wireless com port? and if not, if I were to modify the code to add this feature, would you be interested in adding it to the code base?
If I've misinterpreted the code please let me know.
Any thoughts are appreciated, Cheers.
You need to be a member of diydrones to add comments!
The equation we are using is based on the pressure difference between the ground pressure and the pressure at altitude. We measure and record the ground pressure at startup. This is equivalent to dialing the current QNH pressure into an altimeter. We also record the ground MSL altitude as reported by the gps. Using the two values recorded at startup we can produce MSL from the pressure reading at altitude.
Of course we are mostly interested in AGL altitudes and in having the system as automated as possible, so the approach of just measuring the ground pressure at startup seems best. The most critical use of altitude is in landing and the vast majority of our users will be trying to land at their launch location versus elsewhere. By basing everything on the measured ground pressure at startup we get the most repeatable and accurate AGL data for the launch location. Also, since mission time is typically short, say a hour or less, we have not seen it as a requirement to be able to change the ambient pressure during a mission.