I am using ArduCopter V4.2.2 and a hexacopter with the following configuration:
F550 frame with A2212 1000KV 13T Brushless Outrunner Motors, 30A Brushless ESCs, 2 x 3S 3300 mAh in parallel, and 1045 Plastic Propellers. Current total weight of the craft (all inclusive) is 1.82 kg.
I was able to carry AutoTuning Yaw Axis on an older firmware (V4.0.3) but not on the newest stable firmware (V4.2.2). I keep getting these messages:
- AutoTune: YAW Rate D Up 0%
- AutoTune: fail to level, please tune manually
I was hoping if you could help me understand what could’ve been the problem. Hover throttle, weather, and flight advanced parameters were relatively the same. The only difference was the weight of the aircraft between the two times. When V4.0.3 was running the copter, the weight of the aircraft was 2.1 kg while V4.2.2 was running on the copter after weight reduction to 1.82 kg. The log files for the AutoTuning attempts running on V4.0.3 and V4.2.2.
Log with AutoTune V4.0.3:
Log with AutoTune V4.2.2:
Thank you in advance!
Failing to Level is a new message that we didnt have before - it is basically warning that existing tuning is not good enough to even do Autotune properly.
Your existing tune has pitch and roll oscillations.
Vibrations are a little bit high, see if you can do anything to improve that.
Set these and do a hover test and some gentle movements
INS_HNTCH_ENABLE,1 ← set this then refresh params to see the rest
See if you can get it into the air without much oscillation.
If there’s a lot of noise on the RCout’s in logs then reduce this to 20 at least temporarily
If you improve vibrations and fine-tune the Harmonic Notch filter, INS_GYRO_FILTER should be OK at 40 and will give a better Autotune.
Also setting INS_ACCEL_FILTER down to 10 is basically trying to compensate for the physical vibrations. Try to get it back up to 20 if you can.
Thanks for your reply. I will test these parameters. I guess I should’ve sent the current parameters that I am using. Please find below the parameters:
- INS_HNTCH_ENABLE: 1
- INS_HNTCH_MODE: 1
- INS_HNTCH_REF: 0.31 (equals MOT_THST_HOVER or at least what I understood from this)
- INS_HNTCH_FREQ: 32 (64 Gyro Peak Frequency / 2)
- INS_HNTCH_BW: 16 (32/2)
- INS_HNTCH_ATT: 40 db
- INS_ACCEL_FILTER: 10 Hz
- INS_GYRO_FILTER: 40 Hz
- ATC_ACCEL_R_MAX: 110000
- ATC_ACCEL_P_MAX: 110000
- ATC_ACCEL_Y_MAX: 27000
- ATC_ANG_RLL_P: 4.5
- ATC_ANG_PIT_P: 4.5
- ATC_ANG_YAW_P: 4.5
- ATC_RAT_RLL_P: 0.148
- ATC_RAT_RLL_I: 0.148
- ATC_RAT_RLL_D: 0.0044
- ATC_RAT_PIT_P: 0.141
- ATC_RAT_PIT_I: 0.148
- ATC_RAT_PIT_D: 0.004
- ATC_RAT_YAW_I: 0.018
- ATC_RAT_YAW_P: 0.162
- ATC_RAT_YAW_D: 0.004 (Yaw used to have a cw bias and by adding Kd fixed it somehow)
The axis PID values were as a result of Manual Tuning. Let me know what you think about these parameters.
I would use the params I specified, unless you’ve got another log I can check.
Some of your HNOTCH settings are wrong, I think.
Your RAT PIDs can be lower and ANG P’s higher, like I’ve specified.
Give my params a try and let us know what you think.
Alright, I will use your params for a spin and let you know the results. One question, though, how did you get INS_HNTCH_FREQ,60 and INS_HNTCH_REF,0.25?
The latest log file that I have had:
For INS_HNTCH_REF I use MOT_THST_HOVER x 0.8 which is a rough approximation of a more technical formula in the HNOTCH guide.
INS_HNTCH_REF = hover_thrust * SQUAREROOT(min_freq / hover_freq)
This means the HNOTCH filter becomes active just below hover throttle, which would still be valid - and also good if your hover throttle changes slightly for some reason.
INS_HNTCH_REF = MOT_THST_HOVER is just the quickest/easiest way, but would really need some occasional testing (looking at logs) to confirm it remains valid.
The 60Hz value came from the FFT of one of your logs.
Trouble is there’s also an 80Hz peak too. It’s not very apparent in the Gyro FFT’s but you can see the 60 and 80 Hz peaks in the Accel FFT (even though technically we should not use the accel graphs for this) - and their harmonics are there too at about 120Hz and 160Hz
None of them are big peaks so you might be able to get away with just one HNOTCH to squash everything.
30Hz is getting a bit low for comfort unless you have very big props and low RPM.
Sorry for all the edits
The F450 and F550 style of frames generally run the motors around 60 to 80Hz for hover, around 10 inch props at about 4000RPM give or take.
They are famous for flexibility and inducing vibration in the flight controller.
Once you get your building and tuning process nailed down and had you fun with the F550, upgrade to an all-carbon fibre frame.
I used the parameters that you suggested and it worked! I tested on the Roll AutoTune and roll tuning succeeded. Thank you very much for your suggestion. However, the Dynamic Harmonic Tuning didn’t work even after I set INS_HNTCH_FREQ to 60 Hz. The peak seems to hit 82Hz. So, I guess I try set the INS_HNTCH_FREQ to 82 Hz and INS_HNTCH_BW to 41 and see.
And I agree, the F550 is not the greatest. I am thinking of upgrading to all-carbon fibre hexa frame with KV400 motor and 1552 props (big drone). Do you think the same params that you suggested above (except the HNTCH part) apply to this as well?
Have you got that log available, or one after the Autotune with some test flight ?
So I can better see that harmonic notch filter stuff…
It looks like you’ve got peaks at 40 and 80 Hz in the Gyro graph pic, ignore the accel graph.
That would mean:
INS_LOG_BAT_OPT,2 to see if it is working
Yes, the log is attached below:
Do we always lean towards the lower frequency value when we have more than 1 peaks?
Also, the INS_LOG_BAT_OPT was already set 2
Roll gains eventually saved on the second attempt, so that’s good.
You could copy the same (new) params to Pitch before running the next Autotune, to give it a head start.
AutoTune: Roll Rate: P:0.115, I:0.115, D:0.0058
AutoTune: Roll Angle P:7.659, Max Accel:37234
Later do yaw by itself or all 3 together, Yaw is not as critical as pitch and roll but they all do interact a bit.
You might find that you can double the ATC_ACCEL_Y_MAX value that Autotune produces if you like a snappy yaw response. Single digits and decimal places are not important so you can round 12345.67 to 12000 or 12300 , for example.
In the frequencies for HNOTCH, you’ll often see the primary motor vibration frequency as 40Hz (for example), then a harmonic at 80Hz (often higher amplitude than the primary) and then another at 120Hz.
You just set the HNOTCH frequency to the primary/lowest frequency discernible peak, and let HNOTCH sort out the x2 and x3 harmonics.
Check you fence settings too - there were plenty of breaches in that log.
After you’ve got Autotunes done, do a test flight with INS_LOG_BAT_OPT,0 and lets see how everything stacks up then.
The Harmonic Frequency doesn’t seems to clear even after I set it to 40Hz. Amplitude decreased though. If you look at the log file below, 2022-08-25 13-58-15.bin and 2022-08-25 14-16-05.bin seem to be affected by a 60Hz frequency.
When I set the HNOTCH frequency to 60Hz, craft got affected again by 40Hz. Check 2022-08-25 14-43-13.bin and 2022-08-25 14-56-32.bin. Should I set INS_LOG_BAT_OPT,0 and try again?
The frequencies are a bit confusing.
and lets see what’s going on before filters… Just do hovering and some gentle movements.
Hi @xfacta I caught a good day to do more testing.
When I set INS_HNTCH_HMNCS,3 meaning selecting both Harmonic 1 and 2, I get the following error on start-up :
“Config Error: Too many notches: 36 > 18”
I had to set INS_HNTCH_HMNCS back to 1 in order to do hover testing. Should I set this to 2 instead?
The new folder with the logs attached below:
Log1-4, the notch freq was set to 60Hz, and, for Log5, I set the notch freq to 30 for a test. If you take a closer look at Log1 to Log4, you should see that the notch base frequency was at 40Hz and peaks at both 60Hz and 80Hz. I assumed that there could’ve been a base frequency of 30Hz as well. So, I set the INS_HNTCH_FREQ to 30Hz for Log5 to see if the 40Hz would disappear. The 40Hz disappeared maybe because the amplitude was huge, 0.12, compared to 0.020 for Log1-4. The peaks were once again 60Hz and 80Hz. I have an assumption why I keep getting two different frequency peaks and that is “maybe” because I had some motor replacements from different suppliers (same brand and specs, though). However, when INS_HNTCH_FREQ was set to 60Hz, the amplitude seemed to be lowered considerably. Should the 60Hz get rid of this frequency entirely? Couldn’t the Static Notch Filter take care of this instead?
Another thing, I attempted yaw AutoTuning in Log3 and Log4. I noticed almost always when the craft twitches ccw, a rough left roll followed. Towards the end of the Yaw tune, this left roll was calmer. Is that normal? FYI, Pitch Tuning is still pending.
Let me know what you think. Thanks!
I only looked at the last log
I’m starting to believe the multiple frequency peaks are due to the wide difference between these groups of motor outputs. It seems to indicate you’ve got quite a weight/COG bias towards the front right. Motors 1, 3 and 5 are getting up near maximum output and that will affect ability to yaw or cope with disturbances. This might account for the roll you see when yawing.
You should attempt to better balance the craft, and I suspect the FFT will settle on one main frequency instead of two.
I think the only real way to improve the notch filtering in software/settings is get a flight controller with more processing power and run dynamic FFT, or use ESC telemtry and per-motor notches. So all the good old fashioned physical work you can do will be highly beneficial - neat and tidy build, good COG, reduce vibrations, check from frame or arm twist.
Perform pitch and roll Autotunes before worrying about yaw.
Thank you for writing back. The current motor setup is shown below. RCOU.C1, C3, and C5 actually refer to the CW motors M3, M1, and M6 as in the diagram below.
I saw that in your config, but didnt have time to work out if the graphing followed your config, or the default motor ordering.
If it’s not a weight imbalance, then it is twisted motor mounts or frame, causing a physical yaw bias.
The outcome is about the same as I mentioned before.
Ooh I see! That makes sense. Alright, thank you very much for your support.
@amro would you mind sharing your params with me? I struggle on a similar problem (with a similarly sized drone) and would appreciate to test what you already got.