I wrote some code to add sonar altitude to LP, but had hardware problems. It turns out that you need to buy the expensive maxbotix sensor since the cheap HC-SR04/5 has bad problems if the motors are running.
So there are 3 possibilities:
- sonar (not currently implemented)
- baro (works well, but only maintains fixed altitude, so no good in hilly area)
- GPS (currently fused with baro when using GPS modes, not repeatable, may vary several meters from day to day so waypoint flight must leave a large margin)
For a beginner just needing altitude help, use AltitudeVario (baro) thrust mode.
In the future, we may add sonar support which would help where the terrain is not level, but requires buying a $30 sensor.