Unable to setup VTOL, apparently due to compass issues, with two crashes

I am still fighting with my trimotor VTOL with front tilt motors.

Had two crashes already and still do not know how to pinpoint the problem.

Initially I thought that it was due to bad PID setup, but now I am not sure. I changed the battery from 4S to 5S, did again quick tune for all axes, and…

I get very frequent messages DCM Yaw inconsistent by 85, 36, 28 etc degrees.

The VTOL hovers in QHover and QLoiter mode very well, I can make full abrupt deflections in pitch and roll with the VTOL following.

However, at some point when I engaged today FBWA mode and after less than 3 seconds back to QLoiter, the VTOL almost crashed, veering to the left and descending sharply. I checked that the desired Yaw was changed by 180 degrees, and the real yaw followed quickly to that direction, which looked like very sharp turn to the left and strong roll to the left.

y1

y11364×772 53.2 KB

Two days before I was flying with 4S and different PIDs, but basically the VTOL semicrashed, descending rapidly with oscillations after the transition from FBWA to QLoiter. Again, the desired yaw changed abruptly, this time by 90 degrees. Also, when I was transitioning from Qhover to FBWA, during the transition the plane was very unstable in yaw, with a tendency to turn left. However, when hovering, it was very stable.

y2

y21364×772 60.2 KB

The strangest thing is that 2 years ago it was flying, hovering, and transitioning well on 4S.

Just in case, I did not do motor compensation for compass, but then, I did not do it two years ago, either.

I am pretty sure that the reason why I did not crash today was due to the 5S which gave more power to sort out the problem, but I defintively need help with this!!!

The latest flight is here: https://www.ecoterrenos.cl/vtol0104.bin

16:52:30 Transition from Qhover to FBWA and back

16:55 - 16:56 Qhover flight with sharp pitch and roll inputs.

I am really not getting anywhere.

I tried to do the motor-compass compensation, but Mission Planner did not allow that. If I armed the plane with rudder (in Qstabilize mode), the Mission Planner messaged that the plane has to be disarmed. After I disarm, and press START button, nothing happened, and throttling up did not start the motors.

I also did the COMPASS_LEARN routine with 3, which went apparently correctly during the flight, but I undertand that it does not affect the motor compensation. In any case, the COMPASS_MOT remains at zero.

Before, I changed compass orientation to 4, which is Yaw180. That was done per BZ 251 manual (which gives for INAV a rotation of 180 for the physical position of the compass on the plane). After setting COMPASS_LEARN in previous flights it seems that the system changed compass orientation back to 6 which is Yaw270.

I am still getting these wild swings in desired yaw during hovering flight, and also, after disarming, the message that “PreArm: AHRS: EKF3 Yaw incosistent 23 degrees.”

I guess that there maybe a workaround, but which maybe a stop gap solution. My feeling is that the problem lies in the occasional wild swings of the desired yaw which cause very abrupt inputs. To prevent that during the transition from hover to forward flight and back to relax the Yaw authority (reduce PID)