Altitude from terrain

I have a quadcopter with an ultrasonic range finder sensor.
The drone flies well in auto mode but suddenly dropped in altitude on one of the flights when the sensor was active.
In addition in loiter mode and auto mode Although all parameters are set, When an obstacle is placed under the drone, Sensor data show that the sensor has seen the obstacle but does not react to it
Can you tell me why the drone does not climb when it sees an obstacle below it?
Parameters file download link: