PX4 Altitude mode crash

#1

I am using Pixhawk 3 Pro to fly a T-REX 250 Helicopter. Manual flight is OKAY (Drift exists, but flies fine).
I had been trying out the Altitude mode with the help of PX4Flow sensor, which worked last couple of times. However, the last flight once I applied altitude mode the helicopter lost control and crashed. I would be grateful if someone experienced can help me interpret the graphs to find out what actually went wrong here.

The log can be accessed by: https://logs.px4.io/plot_app?log=3aacbd3e-3e7d-44f3-bf5c-62b7c84eb514

Thanks,
Junaid.

#2
  1. If you see this figure below then you know that the estimator reset the position and is generally not very happy.

  2. I do not recommend you to use the distance sensor as a primary source of height (set EKF2_HGT_MODE to baro or gps).

  3. You have to fix the effect of throttle on your magnetometer.
    The red like below should be as constant as possible.

#3

First of all thank you @tumbili for your quick feedback!

To clarify your points I have a few questions:

2: Even if I am flying indoors, would barometer act fine?

3: Any tips on how I can achieve that? I am using the Autopilot magnetometer only right now. What are usually the causes of these inconsistent magnetic field?

Thank you once again.

#4

Once I select barometer as my primary sensor the NED z graph in the Analyze section has a lot of drift in the reading. So I am not sure what to do about that

#5

Ok, if you are flying indoors and the drone is not flying over big obstacles then using range finder as the primary height sensor is fine.
Mostly the problem with the magnetometer is that they are too close to the power cables of the vehicle. That is why you mostly see that people mount the gps (which has the external magnetometer) on a mast which increases distance to the power cables.
Also make sure you don’t have any magnets or larger pieces of iron close to it.
An easy way to figure out if it’s power related is to strap the drone down to the ground, arm, apply full power in stabilized mode and monitor the heading reported in the ground station. If the heading starts to change once the throttle is increased (say more than 5 degrees) then it’s for a power issue.