MicroArduCopter, 3" props, Omnibus Nano, Success!

Can we still log pre and post filter in the same flight?
That info never made it into the documentation, but I think that was something you (or someone) worked on at the beginning of the summer. Was it simply setting the INS_LOG_BAT_OPT param to 3?

Edit, that was actually ATC_LOG_BAT_OPT, which was for D term logging, and maybe that never was never a part of INS_LOG_BAT.

No you can’t do both at the same time. I had some back and forth with tridge about doing more logging but there is clearly a concern around CPU load etc.

The other thing this allows you to do is raise your gyro low pass filter value without the motors getting hot giving you more control.

Nice graphs!

So I wouldn’t do it that way round. Your main motor peak is down at 150Hz, but that will vary significantly as you throttle up and down so if you blast around you will see that the notch is not taking out this noise very well. Instead set the harmonic notch at 150Hz and the harmonics to 3 (the default) which will mean that both the 150Hz and its 2nd harmonic at 300Hz will be tracked. You could then set the static notch at 350Hz if needed, but I doubt you do as the low pass gyro filter will have take out most of that noise.

If you set INS_HNTCH_MODE=4 then its important to also set FFT_MINHZ and FFT_MAXHZ correctly. Can you post your parameters? I always have trouble reading them from a log!

I’m also interested in the noise at 500Hz I guess it could be aliasing, but its far bigger than I would expect.

Ok the learning code isn’t linked in :blush: I will fix

UPDATE: I’ve just had a flyaway crash in AltHold with my latest branch, I’m nervous about the cause of this so will check with Leonard before posting any further updates. Caveat Emptor - this is still unreleased code! :worried:

1 Like

Here my params file.
parameter-revomini-kk130-02-11-2019-EK2-hntch.param (20.4 KB)

Anyway I used
FFT_MINHZ,100
FFT_MAXHZ,380

I think that if I had to consider 150Hz the main motor peak I have to set something like
FFT_MINHZ,80
FFT_MAXHZ,240

otherwise 350Hz will be chosen as main motor peak.

P.S.:
I’ve got a curiosity:
why the same filter is not applied to the accel other then the gyro?

Ok, this is not doing what you expect.

You can basically ignore INS_HNTCH_FREQ if you have mode set to 4 - the harmonic notch will be set from the detected motor peak. Since you are searching between 100-350Hz (your MINHZ,MAXHZ) it will find the biggest peak at 150 and set the notch there. But you also have the bandwidth set very wide so you will be taking out a lot of useful control information. Your D-Term filtering is pretty low for a copter this size as well.

Here is what I recommend changing:

SCHED_LOOP_RATE = 800
INS_HNTCH_BW = 50
INS_GYRO_FILTER = 100
ATC_RAT_PIT_FLTD = 80
ATC_RAT_PIT_FLTT = 80
ATC_RAT_RLL_FLTD = 80
ATC_RAT_RLL_FLTT = 80

Accel can be filtered far more aggressively because it is not used for fine control - only for AltHold and the like.

Ok here’s a weird thing. When I look at you log above it’s detected the peak at 300Hz. I’m not sure why this is:

Maybe that’s because that is where the peak is? These are really high Kv motors so could easily be spinning at 300Hz. So maybe you having the static notch at 150 is correct.

1 Like

OK, I’d say it’s working… :slight_smile:

On a different subject…
Is anyone still having the issue where the copter leans more and more?
This new firmware is causing more of that for me… There was some discussion that it might be related to processor load, and I do believe I have a higher load on my processor w/ the FFT filtering.

Same as 6 or 8 months ago when I last talked about it. It starts off level, starts tilting more and more if I have no GPS lock. I’m at about 45 degrees after a couple minutes. If I get GPS lock it levels, and up until now, stayed level. Now, it’s going out of level w/ GPS lock, though not bad.

Last spring I also figured out different FC’s did it differently (all omnibus nanos, some tilted a lot more than others). I guess this will encourage me to try the new 20x20 kakute f7.

Can you get a log with this happening? I’m sure a log would tell us a lot. Also I would raise a bug on github - could get some attention that way.

I’ve put a log on google drive (This is also the pre-filter FFT flight above, if you want to review it for any reason(FFT Driven Harmonic Notch Enabled)):

I checked the roll parameters mentioned in “the leans” section of the vibration analysis section of the arducopter docs… Looks ok to me. Me and the other few people w/ this problem all did not think it was an issue w/ vibrations. I think we might have also all been using omnibus nanos. And if it is just an issue w/ this particular FC, I don’t expect it to get a lot of attention.

But if anyone wants to look, or recommend some areas for me to check in the logs, I’d appreciate it.

Also worth mentioning, yawing around in a circle seems to reset the lean, so maybe something magnetometer related… And maybe that makes sense w/ the GPS lock fixing it, because then maybe EKF doesn’t rely on the magnetometer as much… (all just guesses).

In choosing bandwidth I followed your instruction (PR on wiki Documentation on configuring the static notch and dynamic harmonic notch by andyp1per · Pull Request #2072 · ArduPilot/ardupilot_wiki · GitHub)
INS_HNTCH_BW = hover_freq / 2

Even on the log I see BwAvg is half the PeakAvg

Is there something wrong with this?

1 Like

Interesting! Ok then - your setting is good. My BwAvg never gets very large, but this is designed to find the 3db points so if it’s 150 then that’s a reasonable value.

My BW is also about 140 in the logs… I have it set to 50 in the parameters, and I don’t see any sign of noise on either end of the notch on the FFT.

The default attenuation is actually 15dB which is quite a lot, so 140Hz is probably the full width of the noise. If you set FFT_ATT_REF to 3, say, you will probably get a more reasonable version of the noise. I think I had it set high because I was only getting a 3 bin widths which is the minimum. Note that for gyro sampling at 1Hkz and an FFT length of 32 your bin size is 1000/32 = 31.25Hz and so the very smallest BW you will register is 3x31.25 = 93.75Hz. If you increase your FFT length you can get a more accurate reading, but your CPU load will also go up. I have run 128 on an F4 ok, but that’s pushing it.

Also note that seeing “noise” in MP FFT graph is quite difficult - this is an average of sample snapshots so you will be averaging out a lot of the variability. To get a more accurate picture you need to hover for an extended period, but even then you are only seeing information from one part of the throttle range.

I’m thinking of starting a new 4.0 thread for dynamic notch tuning to cover all this, do people think that’s a good idea?

For the curious the bandwidth is trying to find the width of the noise peak, since FFT only gives you a single value per-frequency bin the closest you can guess is by finding the bins at which the noise reduces by a given amount from the center bin, hence why the minimum number of bins is 3.

1 Like

Yes… I’d imagine a lot of people will be interested in it.

Do you think the FFT controlled notch will eventually make it in to 4.0, in a future release, like 4.0.2 or whatever…
Or will it not be until the next full version which might be a year from now?

Not sure. Tridge has shown some interest and Leonard is on the case - so I’m hopeful.

So I took a look at your log. I think like me its your gyro bias that is the problem:

GX is the roll axis so you are getting a large learnt gyro bias and I suspect this is why you are getting a lean and also why lowering the learning rate makes things better. I have no idea why these small copters have this problem although I suspect the issue is vibration.

Thanks a lot.
So I guess I should lower ek2_gbias_p_nse?
I was actually messing w/ ek2_abias_p_nse before… Maybe I lowered the gbias, too… It’s been months.

I’ll try it… I’m doing some indoor test flights at the moment, and it is leaning…

Dunno, the EKF is a mystery to me - looking through the history of this channel I see ABIAS cured things as well. Your ABIAS also seems bad! But I can’t see anything else that would explain it and given it’s on roll seems likely. Give it a go I guess. You used to be able to turn off bias learning but maybe that’s not possible now.

One thing w/ abias, some of it is temperature drift… If you power up the copter for 5 minutes or so, you’ll see it increase a lot… But if you reboot while it’s warm it likely won’t change much after that.