Unexpected course

Hello friends! I recently assembled a 5 inch quadcopter to perform inspections in confined environments. I’m using a CUAV nano V5, without GPS, 3300 mah 4s battery and herelink.
I mounted an anti-vibration base to avoid the vibrations in the controller and I made several successful flights.
However, on the last flight, as soon as the drone took off, it took a course and left. When analyzing the log I identified an EKF error and shortly afterwards the vibration level increased a lot. When rescuing the drone, the controller was still mounted on the anti-vibration base, so I didn’t understand the spike in values.
Could you please help me with the analysis? I share the logs on google drive. Log number 10 is from a good flight, and 18 is from the accident.
You will notice that I didn’t configure any actions for the low battery, as I was still testing the drone.
It was not necessary to change the pids, as the originals the drone was flying very well.

https://drive.google.com/drive/folders/1qAxli5Uxs2i6AK487S_TIZ2p3eWuXIdH?usp=sharing

I think there is a lot of room for improvement on the tune and set up.

The tune:


It is obviously flyable, but it could fly much better. Start with the basics, the initial configuration, and get the notch filter set up, Then go on to the autotune.

Motors:

The quad is overweight or underpowered. This graph is from the “good” flight, but I suspect this is a contributing factor to the crash.

Just before the crash the FC is requesting max or near max from the motors. At the same time the battery is going below 3.3v/cell. To me that says the motors are not able to produce full power because the system voltage is too low.

You might want to look at a tool such as ecalc.ch to see what the best way to improve your motors/props for your needs, then go on to dial in the tuning.

It’s worth point out that low battery failsafes may have prevented this crash.

Been there, done that :frowning:

I find this is one of the biggest misconceptions. Testing is when you really want the battery settings (and arming checks too) all correct and giving as much warning as possible.

BATT_FS_CRT_ACT,1
BATT_FS_LOW_ACT,2 or 3
and the values generated by Initial Parameters

Thanks for the analysis.
I’m going to do the auto tune and configure the fail safe for battery.

I have another point, I configured the FS_EKF_ACTION, how did an error occur in the EKF, the predefined action should not be triggered? In my case the LAND.

If vibrations are high, the effect is the flight controller thinks it is falling so it commands more motor output. So even Land does not work.
After some time the vibration failsafe should kick in and altitude will (hopefully) be reduced regardless of vibrations.

The problem is this stuff cant just be “programmed out” because accelerations are extremely important, so vibrations have to be physically fixed before you can achieve stable reliable flight.

Note that in the Log the EKF error is displayed when the battery reaches the minimum 12.93 and only after the engines accelerate that the vibration level is high. That is, I believe that it was not the vibrations that caused the error, but perhaps this voltage drop.

Could it be related to MOT_BAT_VOLT_MIN? Since the defined voltage was 13.2v?

That log 18 is so confused it’s hard to tell what’s going on.
Motor outputs start oscillating badly and attitude oscillations start, voltage is dropping…
The altitude is confusing and it looks like the copter might be touching the ground and all sorts of things going on.
The error EKF you point out is not the problem, it’s merely the flight controller (firmware) switching to another EKF/IMU in an attempt to make sense of the issues.

Vibrations dont look bad until the oscillations start, so maybe that aspect is OK.
See if you can prevent the barometer from being affected by prop wash (or light)

I would concentrate on reliability and tuning
Connect to MissionPlanner / Mandatory… / Initial Parameters
Enter you prop size and battery cell count, also select the Suggested settings then accept everything it offers.
Also set:
ARMING_CHECK,1
INS_LOG_BAT_MASK,1
INS_LOG_BAT_OPT,4

Is this a small quad? like 5 inch props?
If so start with these until you do more tests
ATC_ANG_RLL_P,10
ATC_ANG_PIT_P,10
ATC_ANG_YAW_P,5
ATC_RAT_RLL_P,0.06
ATC_RAT_RLL_I,0.06
ATC_RAT_RLL_D,0.001
ATC_RAT_PIT_P,0.06
ATC_RAT_PIT_I,0.06
ATC_RAT_PIT_D,0.001
PSC_ACCZ_I,0.88
PSC_ACCZ_P,0.44
INS_HNTCH_ENABLE,1 ← set this then refresh params to see the rest
INS_HNTCH_MODE,1
INS_HNTCH_REF,0.25
INS_HNTCH_FREQ,180
INS_HNTCH_BW,90
INS_HNTCH_FM_RAT,0.7

Ok, I’ll adjust the parameters according to your guidance and post the results soon. Thanks.

I send the new log the flight realized today. I don’t did ajusted INS_HNTCH, due of ajuste the pids, i like finish to pids to ajusted the filter harmonic.

I really enjoyed today’s flight, see what you think. I’m thinking of increasing the PIT and ROLL values a little more.

https://drive.google.com/file/d/1xLvtxIdKZ1UsvEOg7uSA_RR1bMU0aMQV/view?usp=sharing

There’s NO reason to avoid setting the Harmonic Notch Filter settings. It will give much improved tuning, so dont waste your time doing hours of tuning without first setting HNOTCH
And these:
ARMING_CHECK,1
INS_LOG_BAT_MASK,1
INS_LOG_BAT_OPT,4

That attitude control is still quite poor
I would try these PIDs too
ATC_RAT_RLL_P,0.09
ATC_RAT_RLL_I,0.09
ATC_RAT_RLL_D,0.002
ATC_RAT_PIT_P,0.09
ATC_RAT_PIT_I,0.09
ATC_RAT_PIT_D,0.002

Shawn I changed the parameters and made a new flight, sending below the link to download the bin file.

The only adjustment I didn’t make was the arming check, because I’m flying without GPS, since it’s an indoor drone.

I really liked the new pids, it’s flying very well.

https://drive.google.com/file/d/1mTouC6iAgq2o0nc1OqAA9PUPFtBI2C16/view?usp=sharing

What are your recommendations for the filter?

INS_HNTCH_ENABLE,1 ← set this then refresh params to see the rest
INS_HNTCH_MODE,1
INS_HNTCH_REF,0.23
INS_HNTCH_FREQ,140
INS_HNTCH_BW,90
INS_HNTCH_FM_RAT,0.7
and
PSC_ACCZ_I,0.80
PSC_ACCZ_P,0.40

I also suspect you didnt connect to MissionPlanner Initial Parameters and accept everything you should have. These are more like what’s required for a 5inch
ATC_ACCEL_P_MAX,160000
ATC_ACCEL_R_MAX,160000
ATC_ACCEL_Y_MAX,30000
If they make the copter too unstable, change to half way between these and the values you have now.
There could be yet more tuning after this, maybe back to the PIDs I recommended earlier - but fly it and check

That’s why the order is

  1. Initial Parameters
  2. Harmonic Notch Filter
  3. Adjustments and basic tuning
  4. Autotune

…and always check in the Tuning Guide, because almost everything is covered there.
Otherwise you get stuck in a loop of having to go back and change things that should have been done first, then restarting tuning all over again.

Hi Shawn. I applied the harmonic filter parameters and noticed that the peak of the FFT curve reduced.

I’ll default the INS_LOG_BAT_MASK parameters back to the default and avoid the memory overhead.

I also applied the ATC values, but I didn’t notice any noticeable flight difference to the eye, but in the logs the ATT Roll and Pitch values are very close to the desRoll and desPitch.

About reducing the gains, I was thinking of increasing the values of Roll and Pitch P a little more to 0.100 and Yaw P 0.2 and I 0.020 what do you think? I feel like I still have a lot of variation from Yaw.

About the configuration sequence, I initially worked on the basic adjustments and even the advanced tuning according to the documentation, where the ATC are defined based on the frame size. Right after that, I worked together with you on the PIDS adjustments, since I can’t do the autotune, because the drone flies for about 4 minutes, which is usually not enough for the Autotune of an axis. Next, I would work on the Harmonic filter.

But thanks a lot for the sequence tips, I’ll bring the harmonic filter before the PIDS adjustments, of course whenever the drone is flying stable for that.

Here is the new link of today’s flight log:
https://drive.google.com/file/d/1rMipahVrEx7w12pbzn6CkCZyqZwzT7aL/view?usp=sharing

About the unexpected course, I still believe that it is a bug, due to the engine compensation parameter. I will test this soon in the simulator.

Yes, it would be good to try increasing those pitch and roll values a bit.
Keep P and I the same.
Increase Yaw P and I quite a bit, like 0.5 and 0.05 or even more.

You will have to do a bit more manual tuning of course, I understand what you are saying about your sequence of testing and tuning. Harmonic Notch filter is one of the first things to set up and it has very little overhead on a V5 Nano.

Also set ATC_THR_MIX_MAN,0.5

I think your original problem was just vibrations.
Which parameter do you mean by this?

I’m talking about MOT_BAT_VOLT_MIN. Note that in the graphic the EKF_YAW_RESET is activated after the battery reaches 13v, the motors accelerate and the vibration increases.

The yaw reset can happen if there’s been some drift between GPS course and/or compass heading , and calculated IMU heading. Since you dont have a GPS it may have been a change in current that affected the compass. Also the increasing vibrations probably affected the IMUs leading to a false or differing heading to what the compass was indicating.
The yaw reset nor the MOT_BAT_VOLT_MIN would cause vibrations or the motors to ramp up by themselves.
I suspect in that original case, the FC was asking the motors to ramp up as voltage sagged and eventually vibrations became enough to cause problems with the IMUs (Yaw reset?). This had the effect of demanding more motor output, causing more vibrations, causing more battery current draw… and got caught in a loop there.
I think tuning played a role too - as the battery and motor output situation worsened, there was no chance of maintaining stability and you see oscillations and motor outputs worsening.

This is another slight problem with not having a GPS unit, there’s no external compass. You might want to add a compass on a small mast and disable the internal compass. Just to get it a bit further away from the battery and high current wires.

You have the correct MOT_BAT_VOLT settings for 4S, and you log shows good battery condition, voltage is not sagging to anything like 13 volts. Nor do vibrations and voltage seem to be related.
You vibration levels are good.
I would set these standard values :
BATT_ARM_VOLT,14.70
BATT_CRT_VOLT,14.00
BATT_LOW_VOLT,14.40
Motor outputs are still higher than ideal, but at least now attitude control is a little better. You could probably run Autotune and sort that out completely.

The outcome will be improved tuning and battery settings, so the battery voltage doesnt sag so much and cause excessive current draw as motor outputs ramp up. The copter should land before it gets caught in that loop of sagging voltage causing increased motor outputs causing sagging voltage causing increased motor outputs (and on it goes)

I understood. I thought that due to the fact that the voltage had dropped to the point of being below the value configured in parameter MOT_BAT_VOLT_MIN, there had been a problem that resulted in the unexpected course. But it became clear that over accelerating the engines caused the frame to increase in vibration and hence all the other problems.

How preventive measure, in addition to the adjustments we make, I also disabled the compass, since I will not be using a gps for positioning. I will also set the security voltage levels, even to prevent the drone from arming with a low voltage.

I would love to perform the autotune, but as I mentioned earlier the drone flies very little, about 5 minutes, which is usually not enough to perform the autotune of a single axis. But I’m going to install a GPS unit to help with the location of the drone to try to autotune and not have any problem of losing orientation for my part.

As expected, it was not possible to perform the autotune due to the flight time. But, I made a few more increments to Pitch and Roll and I really liked the result.
I even tested the battery failsafe and it worked fine too.

Thanks a lot for the support.

New log the flight:
https://drive.google.com/file/d/13vQAC9XQaW0A2T7XLrPzWbOPPJUeMovv/view?usp=sharing

What motors are you using and what weight is the aircraft at when you fly, ie battery included??
A picture would be nice! if you want to send one offcourse!

Just interesting to know what type of drone it is!

That looks quite reasonable now :slight_smile:
Good work.

1 Like