Internal errors 0x400 l:856 cnstring_nan (Uncontrollable behavior in RTL and Loiter)

Log file is attached for review.
log File

Copter Hardware:
T Drones M690 Pro
Cube Orange
Here 3
Flown for more than 50 Flights

Our quadcopter was flying well before this abnormal behaviour occured. In the latest flight, compass calibration was performed beforehand. It is worth mentioning that previously we also performed Mot Compass calibration from Mission Planner but this time only compass was calibrated from QGroundControl. After calibration, drone was flown to 200m Distance and 150m Altitude. Then it was shifted to Guided mode and yaw command was given which it performed properly. Just after yaw, critical Internal error popped up followed by RTL. Surprisingly, drone started moving in a direction different from the home position. Pilot switched mode to Loiter to get control but drone kept moving in the wrong direction. After switching to RTL again, it kept moving in the wrong direction and in addition started to dive down at high speed. The pilot timely switched to Stabilize mode to regain control of the copter and landed safely in Loiter mode.

Following are our questions.

  1. What caused the internal error in first place? Wrong compass calibration?

  2. Why copter behaved erratically in RTL and Loiter modes. Does it suggest any GPS related issue?

  3. What improvements you suggest before next flight?

@rmackay9 @Leonardthall @priseborough @hosein_gh @xfacta

@rmackay9 , @priseborough , @Leonardthall Need ur insight to solve the matter…

Hi @saddi1991 @Yasir_khizar,

Thanks very much for the report. I imagine this was quite a scary incident to witness and it is good to see and hear that the pilot was able to successfully control the vehicle and bring it down to a safe landing.

While this is Copter 4.4.4 I’ve added it to the Copter-4.5.0 issues list until we can get to the bottom of what happened.

As you say, we can see from the log that the vehicle loses its ability to control its velocity. The WPNAV_SPEED is 10m/s but it reaches 25m/s.

Also the Position Control logs show the desired and actual velocities diverge.

This is most likely caused by a yaw estimation error and we see that at the end of the flight the pilot is able to control the vehicle again in Loiter mode after a yaw reset. Normally an EKF failsafe would trigger to switch the vehicle to Land mode and prevent the loss of control but FS_EKF_THRESH = 1 meaning the EKF failsafe has essentially been disabled. I’d recommend setting this back to the default of 0.8.

Based on the Internal error reported on line 159093 of the logs and the Pre-arm warning that appears after the vehicle is landed and disarmed it is this line of the attitude controller somehow received a NaN (Not-a-number).

At the same point in the logs we see that “SA” (Simple Avoidance) messages start to appear with all NaN. Simple avoidance is enabled (AVOID_ENABLE = 3 / UseFence+UseProximitySensor) but the fence and proximity sensors are disabled (FENCE_ENABLE=0, PRX1_TYPE=0). There is a rangefinder (RNGFND1_TYPE=8/LightwareSerial) but it is not actually working (log’s RFND.Stat=1/NoData).

By the way, you mentioned that you did a compass calibration before the flight. In general there is no need to re-do compass calibrations if the vehicle is flown at a new location. AP includes a small “yaw declination” database that makes this unnecessary.

I’ll get input from other developers on this. Txs again.