Rangefinder voltage spike issue. How do I filter the signal to use for Autoland?

I’m using the SF11B laser rangefinder for a fixed-wing aircraft connected to a Pixhawk 4 board via ADC.

I want to use this rangefinder for altitude sensing for Autoland, however I’m getting voltage spikes which I believe is due to EMI issues that causes my Analog cable to sense 3.3V and therefore the altitude senses the maximum altitude on the linear analog range of the rangefinder (I set that to 15m).

Here’s a screenshot from a log where I just taxiied around my neighborhood:

If I zoom into the bottom portion of the plots, the rangefinder reads the altitude of the rangefinder above ground, which looks like good data.

If I leave the aircraft sitting there, the rangefinder will read fine. If I move wires inside the fuselage by hand, the rangefinder will read 3.3V. I have also looked at the sonnarrange value in the status tab of Mission Planner and can confirm that I’m getting multiple random spikes.

My question here is, I have currently set “RNGFND_LANDING” to true, however I would obviously not want the autopilot to think that the altitude is at 15m whenever the EMI issue occurs again. I have had several Autoland attempts where the aircraft does a sudden nose-dive because it thinks its altitude is too high.

  • Is there a way to filter this data? Or reject the signal if it hits its maximum?
  • Can I fuse this with GPS?
  • If RNGFND_LANDING is set to true, does that mean it is using the raw sensor values?
  • How does RNGFND_MAX_CM work? I currently have set that to 13m.

Thank you in advanced!