Reaction of Copter to spikes in range finder data

Hi,

I’m using a Pixhawk (Copter 3.5) with a PX4Flow sensor. Since I don’t have another range finder, I hooked up the sonar output to the 6.6 V analogue input of the Pixhawk, such as decribed here.

I was testing the px4flow performance by loitering over flagged floor. Looking over the log files, there were a lot of sonar spikes. Some spikes caused the drone to suddenly ascend without any manual control inputs, such as those at line numbers (shortly before) 50000, 60000 and 68000. The bad data between line numbers 20000 and 30000 can be ignored, since the copter was hovering over grass at that time.

The performance of the PX4Flow sonar is not top-notch, so some bad spikes can be expected. However, the drone should react the same way if those spikes would have been created by any other range finder.
I’m interested in knowing why the drone would ascend (and not descend) after certain spikes and why it would react to some but not other spikes of the same intensity.
I would appreciate any information on this topic, thanks!

Cheers,

Nafnaf

full log file is here:
2017-03-23 11-53-24.bin (3.0 MB)