I’m trying to use my sonar as a primary source of height at low altitudes. Basically, in some of my latest flights, I’ve seen the barometer going down up to -8 m while landing (Alt value in Mission Planner). At that moment, my sonar (Maxbotix MB1240) was taking more accurate measurements (around 1 m). How can I make sure that at altitudes below say 2.5 m the EKF is using my sonar instead of the barometer?
What also surprises me is that in the flight logs I have no indication of this negative altitude I do see in Mission Planner while flying. In the CTUN values I have Alt (which I assume is the one the EKF uses), SAlt (which I assume is my sonar alt) and BAlt (which I assume is the raw barometer altitude). Is all of this correct? If so, what altitude does Mission Planner sees while flying, and why don’t I see the negative altitudes in my flight logs?
I tried setting the parameter EK2_RNG_USE_HGT to 50%, while my RNGFND_MAX_CMD is 5 m (by default, it should be 7 m, but I know I have a lot of noise around that altitude, so I lowered it a bit). I understand that this should make the sonar the primary height source at 2.5 m. However, I didn’t see any difference and I can’t see it in the flight log either. I am attaching a flight log which shows two AUTO flights without the parameters set, and then two AUTO flights with the parameter set. Could you help me spot any difference (specially regarding the CTUN values)?