Fence problem - quad turned to Falcon 9

Hi guys,

I am trying to revive my main drone after a crash, I thought only the props and the gimbal were damaged, but strange things are happening with it.
Let me be brief, I installed the latest 4.0.4 stable on it. It was previously on 4.0.x, can’t remember which.
Oh, by the way, the crash was stupid pilot error (me), trying to land too fast due to depleted battery.

So, I started from scratch, recalibrating everything, radio, accells, compass.
This was my third test flight, the main purpose was to get a hover thrust for the notch filter, so I turned on hover learning (learn and save). I started in stabilize, then activated alt hold and tried to hover, but it seems I wasn’t too successful, it kept slowly climbing, and then it hit the fence altitude and all hell broke loose.
It rocketed in the air, reaching 241 meters and then stopped.
Unfortunately my telemetry wasn’t working (a relict from the crash), so I wasn’t aware what was happening, but as soon as it started climbing I switched to stabilize to get control of it but without effect, so I even thought I lost the radio link. After switching several times from stabilize to althold (loiter) and vice versa, I noticed that the small dot in the sky was responding to roll, so I lowered the throttle almost to zero, until I finally managed to land it safely.
Looking to the log I cannot even find the first switch to althold as it didn’t even happen, damn telemetry not working when you need it the most…
Anyway, it seems to me that the problems started when I hit the fence altitude, it switched to smart rtl and tried to go to the moon. There are a ton of fence errors in the logs don’t know how to interpret them.

This quad was not tuned, so it is flying like a drunk sailor…
The dynamic notch filter was the first on my list before tuning, but now I will first solve the telemetry problem, to have some info about the state the FC is in real time.

My fence settings were not my standard, I don’t remember setting such low values, usually I set a 150m altitude and at least 300m - 500m circle.

If someone could look at the log and tell me why it rocketed to the sky at full speed when breaching the fence, I would really appreciate it.

Here is the link to the log:
Log file

Your Fence settings are good, I’d probably just change:
FENCE_ACTION,1
Always leave Hover Learning on unless you’ve got a specific reason to disable it.
Increase INS_HNTCH_ATT to about 40
Set and test RC failsafe: FS_THR_ENABLE
There’s X and Y axis vibration, most likely from prop balance - fix that too and we’ll see what vibrations are like in the next flights.
There’s Z axis vibrations but it doesnt look like “fly away” bad…

I’ll check more later if I can.

Set INS_GYRO_FILTER,20

Your MOT_THST_HOVER value looks strange , 37, and I think this might be the cause of the near fly-away. Once you get everything else sorted out and ready to fly, set it to 0.2 and let it adjust itself in ALTHOLD mode.

I’d set you harmonic notch up like this for now, but there’s about 4 peaks you’ve got there so you might need a static notch as well. There’s more work needed in this section, let’s see what it’s like after you’ve fixed some vibration issues and done a couple of test flights.
INS_HNTCH_FREQ,74
INS_HNTCH_BW,35
INS_HNTCH_ATT,40
INS_HNTCH_REF,0 <-check and set to MOT_THST_HOVER - see above

The flight mode changes worked, you did well to switch to Stabilize and bring it home.

You could probably leave FENCE_ACTION,3 - it was trying to do the right thing and just couldn’t with that bad hover value.

If your “sticks” seem overly sensitive try:
ATC_INPUT_TC,0.2 <- go higher if you like, 0.22
and if yaw is a bit sluggish try:
ATC_ACCEL_Y_MAX,40000

Shawn,

Thanks for checking my log.
MOT_TST_HOVER should have been 0.37 as I’ve tried to set it by ploting CTUN.ThO from my first two flights, but it turns out that I entered 37. I need to change my glasses.
I have made all the changes you suggested.
Will check the prop balance to see if I have a problem there.

One thing I noticed, I have a constant -1.2x ATT.Pitch when my ATT.DesPitch is at zero although I have balanced my quad front to back with my battery.
Any clue why is that, or should I not pay attention to that before tuning the copter.

Hi Shawn,
I have trouble to determine INS_GYRO_FILTER or INS_ACCEL_FILTER value, would you please tell me how to set it and base on what?

I have done my homework.
First, I found out why the telemetry (frsky passthrough) wasn’t working, a faulty Tx wire - although with no visible damage, but the meter showed it’s broken. Replaced it with a new one. Five minutes for troubleshooting and about half an hour to crimp the small pins.
Second, I’ve checked all the props and only one was properly balanced. Two of the rest had hub imbalance and one a slightly heavier side.
Those are the T-motor beechwood props, rather pricey, but it just shows, don’t trust the name, do the balance yourself!
After that I did two more flights without problems. The first one to learn the hover value, this time it worked ok, and after that a second one with batch sampling on.
Checking my vibes, they are significantly lower then before!

Done an FFT analysis and the second one looks pretty good to me.
@xfacta should I set a static notch also, what do you think?

I’ve never tried to setup one so I would appreciate some help of setting it right.
What do you think, am I ready for AutoTune?

Here is the new log: New log

All looks pretty good to me, I couldn’t see anything really wrong.
You should be able to set these:
ATC_THR_MIX_MAN,0.5
PSC_ACCZ_I,0.72
PSC_ACCZ_P,0.36

Whatever you did to fix vibrations, apart from the prop balancing really cleaned up those FFT graphs.
And a minor adjustment to the harmonic notch filter:
INS_HNTCH_REF,0.36
And get an Autotune done!
Test LOITER mode before doing Autotune - take off and LOITER around for a bit, see if everything is OK, switch to Autotune mode, wait for twitching to finish then bring it back and Land, Disarm without changing out of Autotune mode. After a couple of seconds, you can change modes, Arm and test fly.
Set AUTOTUNE_AXES to do one axis per flight to allow for a battery recharge between sessions. Once all axis are done individually set AUTOTUNE_AXES,7 and do all at once, it shouldn’t take too long.

When you are happy with everything then you can set these to stop logging the extra data for tuning the HNOTCH filter:
INS_LOG_BAT_MASK,0
INS_LOG_BAT_OPT,0

1 Like

Set INS_GYRO_FILTER and INS_ACCEL_FILTER at 20. Sometimes you go a bit lower for big multirotors where it can be hard to eliminate all vibrations (big props, high take-off weight), or you can set it higher that 20 for really small quads with, for example, props smaller than 9 or 10 inch.

There’s a MissionPlanner plug-in to help with these settings, press Alt A since you may already have it installed
https://discuss.ardupilot.org/t/initial-parameters-calculator-plugin

And there’s a helper spreadsheet that does the same job, download a copy:

And of course the Tuning Guide that is required reading, and the source of truth.
https://ardupilot.org/copter/docs/tuning-process-instructions.html

I only balanced the props as they were the main reason for the vibration.
My FC is mounted on the Kyosho Zeal Gel.

Shawn, could you please explain me a little bit the PSC_ACCZ changes?
If you have some spare time, that is :slight_smile:

I always try to learn new things so in the future I can adjust things by myself instead of just blindly changing things.

Looking into the documentation for the parameters it is not clear what lower/higher values do.

How did you come to those number, especially the second one PSC_ACCZ_P which is by the docs and MP out of range (0.5-1.5)? Something you saw in the logs?
Sorry if I am asking too much questions :slight_smile:
I really appreciate your help.

Oh yeah, I already tried to autotune the pitch axis (in loiter) and it was successful - I received a message on my Taranis, but I switched to stablize to land the bird, as I always do as I am flying over a steep hill side, almost in the woods and I do not trust any auto flight modes especially if the bird is not tuned yet.

So, it seems that, even with my autotune switch still high, the moment I switched the flight mode it forgot the tune. The documentation clearly says that only the position of the autotune switch should matter, and if I recall right the last autotune I did some time ago on my other quad the same procedure worked ok. Is it a bug in the 4.0.4?

Thanks!

The PSC_ACCZ are set according to the Tuning guide and other info already posted above.
Don’t worry about MissionPlanner indicating the value is out of range, that’s an old sugestion and you can ignore it.

If you perform an Autotune then switch to another mode, you can still land and switch back to Autotune mode before disarming - that should still save the new PIDs.
Staying in Autotune mode is not an issue, it’s a bit like Loiter or PosHold.

The complete section of testing autotune somehow slipped my reading :blush:
Thanks Shawn for your great help.