Crash when adding a range finder

Good morning
Here is my setup :

  • Simulation with gazebo (9.0.0) and PX4 on SITL with QGC (v4.0.6)
  • “make px4_sitl gazebo_plane” to start gazebo simulation with time factor 10

I’ve tuned the roll, pitch and yaw regulator and made a mission plan.
The first simulation is made without a range finder (no sensor include in the “plane.sdf”)
Here is the log file :
https://logs.px4.io/plot_app?log=6ea6a4e5-6b2b-4eeb-ad9c-a5f5ea3ce0b0
As I can see, the output of the EKF is following the setpoint and the regulation of the altitude is perfect. (but setpoint is 1.1m and the mission plan 1m)
The second simulation is made including a range finder in “plane.sdf” like this :
image
here is the “model.sdf” for the sensor :


I think the parameters is correctly configure :

  • EKF2_HGT_MODE : Range sensor
  • The gate, delay and noise are as default

Here is the logfile:
https://logs.px4.io/plot_app?log=3f074f95-e6e9-459e-a657-904be020a25d
I don’t understand why the plane crash if the EKF output is following the setpoint. When I compare the sensor output and the EKF Output, it’s like the EKF is not using the sensor.

My objectif is to have an altitude regulation with 10 cm accuracy above a flat surface. I want use the sensor as primary source for altitude measurement.(maybe the only one).

Please someone can give me advices or tell me some error I’ve made ? :slight_smile:
Thank you very much !