ArduPilot / ArduPilot/ardupilot
EKF altitude measurement failure
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 15.9k
- Forks
- 21.4k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 119
Description
#### Issue details
when I enable the EK2_RNG_USE_HGT parameter to 10, with a rangefinder max altitude of 15m and I fly away in loiter for some 100 meters or so, then switch to RTL, the copter comes back, waits the set loiter time and then starts descending. At this moment, the EKF switches and the altitude is completely wrong (stays more or less stationary). This results in the copter descending at considerable speed as it tries to attain the desired descend speed.
For some reason the EKF does not want to use the barometer (barometer innovations are very high anyway) and the lidar is still above its maximum altitude, so I assume that its values are not used. This problem only occurs when EK2_RNG_USE_HGT is on. I assumed that in this case, the EKF would only use the rangefinder altitude below the set percentage of the rangefinder max altitude.
can someone tell me what the EK2_RNG_USE_HGT enables and why it makes the EKF crash?
I'll take a look at the code myself as well, but I am not (yet) familiar with all the EKF code.
The problem is that the altitude measurement of the EKF becomes completely erratic and thus any mode that uses altitude hold is unusable. It only occurs when EK2_RNG_USE_HGT is enabled and only if I fly away far enough from the launch point, but in these conditions it happens consistently.
I attached a log file from a flight where this happens (last flight of the log)

#### Version
Copter 3.5.3
#### Platform
[ ] All
[ ] AntennaTracker
[ x] Copter
[ ] Plane
[ ] Rover
[ ] Submarine
#### Airframe type
X quad
#### Hardware type
pixhawk 2, using leddar_one rangefinder
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the attached flight log and tracing EK2_RNG_USE_HGT through EKF altitude-source selection during RTL; no source file or test is named. Done means the altitude measurement remains stable and the copter descends correctly when the rangefinder is above its maximum altitude.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- embedded-iot, robotics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100