Rapid oscillations in Loiter post Autotune

Hexa Plus
Cube Orange
HW X9 Plus
36120 props

Hey all,

Having a few issues with Oscillations post-Autotune.
I’m hoping you can point me down the right path. I’m trying to progress to the Dynamic Notch Filtering part that I saw Andy P doing.

I’m still very much learning and getting my head around everything. Really trying to get to grips with reading logs to better understand things.

• Determined Mot_Thst_Hover (2023-05-26 12-23-07)

• Set PSC_ACCZ_P = 0.105 (showed out of range)
• INS_LOG_BAT_MASK for FFT Logging (captured) 30s hover ALTHOLD (2023-05-26 13-47-54.bin)


• Completed Manual Tuning section with Transmitter-based approach which appeared straightforward.
• Progressed to Autotune

Had a few fails initially saving. One instance was the low batt failsafe kicked in and aborted the Autotune and another I hadn’t understood the procedure clearly in terms of landing in Autotune and disarming to save.

• Roll Axis = 0 (2023-06-15 12-50-32)
• Pitch Axis = 1 (2023-06-16 11-49-08)
o Pitch Took 2 attempts but was completed successfully after 2nd.
• Yaw Axis = 2 (2023-06-16 12-30-15)

Logs https://ipgbuzz-my.sharepoint.com/:f:/g/personal/anthony_ipg_buzz/EkM1IKS3Hz5Go9x54Vh8h_kBq5e5HLypMttPzlF_TZi3kA?e=bpun4M (public URL)

Bit of an issue with Yaw which I ended up having to revert.
I actually checked both tick boxes for Yaw & YawD by mistake.

The Autotune still however completed after a few attempts.

I had a little fly back to the landing point in ALTHOLD, and it seemed ok so I thought I’d carefully try in Loiter about 3m AGL

What happened next was unexpected. It started to shimmy i.e. Oscillate quite significantly and I caught it on video.

I decided to complete 2 additional test flights.

I’ve had a look at IMU vibration data and it looked relatively ok?

I wasn’t sure if checking both Yaw/YawD caused the issue so I rolled back the changes and ran Yaw exclusively but the Oscillations still exist visibly in Loiter.

• Yaw Axis = 2 (2023-06-29 12-27-19) 2 weeks lost due to bad weather.

Vibrations definitely look a little more erratic to me, but it’s funny when you drop back to ALTHOLD the oscillations appear to reduce dramatically.

I ran Autotune at the recommended Autotune_Aggr 0.1 with barely any wind.

I would really value your feedback on what I could try to reduce the oscillation and maybe improve the general feedback of the drone so it’s smoother without compromising responsiveness.

Cheers Anthony

@rmackay9 @xfacta - took a while to get things together.

Is there a log in there somewhere that’s not being Auto Tuned and it’s simply flying/hovering and Log Replay is not enabled? If not make another flight and collect one. If you do set this 1st:
INS_LOG_BAT_OPT,4
But the 1st problem is the outputs are oscillating:

You would have wanted to sort this and then configure the Notch filter before any attempt at Auto Tune.

For vibration analysis use the Vibe fields in the log not IMU acceleration. And for FFT graphs use linear scaling not log by checking the magnitude box before loading the log.

I had a quick look over the log you didnt list and there wasnt much Autotune there.
So it might be a bit different to the other logs you listed, but I think all these parameters should still apply.

For basic setup start by setting these.
I admit there’s a problem in the Initial Parameters calculator for these very large props, so it gives a thrust expo that is too high, and I’m working on that. I’ve asked for a lower value here that should be reasonable and we can check and change it more later. The hover thrust value might change after altering the thrust expo, so we may need to re-adjust a few other parameters too.

INS_ACCEL_FILTER,10
INS_HNTCH_ENABLE,1  //   write then refresh to see the rest
INS_HNTCH_MODE,1
INS_HNTCH_REF,0.11
INS_HNTCH_FREQ,30
INS_HNTCH_BW,10
INS_HNTCH_FM_RAT,0.7
INS_LOG_BAT_OPT,4
LOG_BITMASK,180222
LOG_REPLAY,0
MOT_THST_EXPO,0.78   //  or at maximum 8.0
PILOT_THR_BHV,7  //  spring-centred throttle
PSC_ACCZ_I,0.25
PSC_ACCZ_P,0.125

For a bit of PID adjustment
I’m requesting a softening of the yaw rate values which will reduce the chance of oscillations at arming (big copters can tend to do that with long landing gear legs), and less likely to take away effectiveness from pitch and roll. The increased Yaw Accel will allow yaw to better meet the desired yaw without overshooting too much. Yaw Angel P could probably be a bit higher than it is but we can tackle that much later.

ATC_ACCEL_Y_MAX,10000
ATC_RAT_YAW_I,0.08
ATC_RAT_YAW_P,0.80

And for Pitch and roll, just reducing the rate values quite a bit until we see more in the next flights.
I think that pitch and roll Angle P could be noticeably different to each other (in this log they are basically equal) but we will find out more on subsequent flights.

ATC_RAT_PIT_D,0.006
ATC_RAT_PIT_I,0.12
ATC_RAT_PIT_P,0.12
ATC_RAT_RLL_D,0.006
ATC_RAT_RLL_I,0.12
ATC_RAT_RLL_P,0.12

These should still be safe, and I suspect the high values you had might start inducing oscillations or make hot motors with other tuning changes (the motor thrust expo for example)

As always be cautious at first take off with these new parameters, start in Stabilise mode so you have complete control and can land immediately if anything is wrong. If take off and control is OK then switch to AltHold and hover for a while, allow the hover thrust value to learn, and do some gentle pitch and roll movements.

Let’s see that new .bin log file

EDIT:
I looked through another log - stay with the recommendations above.
I believe the PIDs that Autotune has produced are getting skewed because of noise and other factors (like the thrust expo)

thanks, Dave, just a sanity check. I followed the wiki documentation together with AndyP’s Hexoon youtube video and the assumption that after a manual tune you move straight to AutoTune?

Is this not correct?
I’m looking at the graph you sent. Outputs = Servo Outputs right?

Thanks, Shawn, I’m just getting ready to head out so will look at these in the field.
should I concern myself with what Dave said and therefore revert back to pre-autotune before I try your suggestions?

Steps:
Backup conf
I’ll gather a new log w/o Autotune/Replay on for Dave before I do anything.
I will then make your suggested changes and gather data
worse case I can also go back to Manual Tune conf, apply suggestions and gather some further logs

That would put me back to before Autotune or Notch setup.

Assuming that when I make the above changes I also need to collect new FFT data through INS_LOG_BAT_MASK?

Also just looking at ACCZ settings

I was on a previous thread Low throttle hover, MAG issues, and DSHOT600 that said to ignore the out-of-range warning and enter mot_thrst_hover as it appears.

I have

Mot_thst_hover = 0.105
PSC_ACCZ_I, 0.21
PSC_ACCZ_P,0.105 (out of range)

I guess this is subject to change once I apply the new suggested changes.

No, all my suggestions tie in with what Dave is saying too, so make all my changes at once, then go fly.

I took into account all your exist parameters, so you should still have INS_LOG_BAT_MASK,1 and so you just need to set INS_LOG_BAT_OPT,4 which I have already specified (and Dave did too)

Work through my list carefully to avoid typing errors. You could copy/paste the whole lot into notepad and save that as a .param file, then use MissionPlanner to import it all in one easy action.
Go to Full Parameter List and look for “Load from file” at top/right.

thanks will do that. See you chaps on the other side. :laughing:

You always want to have the notch filter functioning before running Auto Tune. Otherwise you will have to run it again after configuring it.

Ok, I think this is what AndyP did. which now makes sense.
I had always been of the mind that I would have to run it again.
thanks for clearing that up.

To be fair you may have to. It’s a complicated interaction between PID’s and other parameters before running Auto Tune. That’s what the “Failure to level, tune manually” error is for :grinning:

1 Like

Well, chaps what a difference.

@xfacta the oscillations near on disappeared and it sounded and performed like a different machine.
I completed stab, progressed to AltHold and finally Loiter

@dkemxr here is the new output from the log to compare with what you first sent me so this obviously displays much better data.

After testing basic roll/pitch and yaw manoeuvres I had a few test flights to get some FFT data while trying to do figure 8’s in both Althold and Loiter. The data is predominantly from log 2023-07-07 14-06-37 which I have dropped into shared folder above.

@dkemxr I’ve applied your note with regard to selecting magnitude for FFT.

@xfacta just to help my understanding.

eg. I was seeing myself 0.105- 0.107

Anthony

I added an estimate of FREQuency (based on prop size) to my spreadsheet, and also calculated the REF if the hover throttle is entered correctly.
If a copter was oscillating a lot and a bit out of control, or even if motor outputs are very noisy, then a new log would be needed to recheck and refine these values. For example the hover throttle can settle on a realistic value, and the HNOTCH REF would need adjusting.

1 Like

Thanks this is fantastic. I saw a thread where it was mentioned by Andras in terms of the work you chaps were doing but I hadn’t got that far.

I noticed a reference to confirm the INS_HNTCH_FREQ 30 Use logs to verify this

And I thought that I had the FFT data captured correctly in the logs I sent previously. Dave’s recommendation to use Magnitude helped identify nothing was there.

So I went back to 20230601 where I was specifically trying to capture FFT data before running Autotune
(2023-06-06 14-09-40.bin)

Mot_Thst_Hover = 0.11

I’m assuming the first small peak is the first freq (30-33 Hz) which is the INS_HNTCH_FREQ?

I found it somewhat hard to see in Mavfft_ISB but looking at GYRO x = 32?

Yes, it looks like it from that graph. If you put your prop size into that spreadsheet and it says 30Hz too, then that’s almost certainly correct - at least for a good starting point.

Amazing.

The logs from Friday are.

2023-07-07 14-06-37
2023-07-07-13-44-19

I can see the filter flattened out the frequency and there is a small amount sitting at 60-64Hz.

image

Quick addition to that.
After you sent me the test config I had a quick read of Notch_modes and the specific sections.
Something that raised a question was INS_HNTCH_MODE 4 / Inflight FFT and its potential use for High/Low loads.
This is a spray drone so given the changing demands for TOW would it make sense to stay the course or look at Mode 4?

Can you link to one of those logs?
I’d like to run it through the filter review tool, see if there’s improvements to be made.

I have added to the same share to keep in one place for everyone (-:

Is Filter Review Tool the same as fftui in MP?

The filter review tool is more extensive than the FFT graphs in MP, and allows us to experiment with different settings and see the effect.

I grabbed the largest log and chose to check the middle flight section.
This is what you have now, and you can see where the filter notches fall and what effect they have.

I think the copter is a fraction over-powered, so you can manually lower your hover throttle (based on checking the flight in MP log review) or add some dummy payload.
MOT_THST_HOVER,0.110
MOT_HOVER_LEARN,1 // or 0 to disable learning
and so also adjust:
INS_HNTCH_REF,0.10
also slightly adjust
INS_HNTCH_BW,12
These are only small changes but it does have a slight effect on the notch filter:

Motors are also hitting minimum at times, so you might want to set this:
MOT_SPIN_MIN,0.12
You’ve got some safe PIDs there, but slightly less than ideal attitude and yaw control, so you might want to consider running Autotunes, probably each axis individually. Or investigate manual tuning (transmitter tuning) but you generally need some experience and practice. Best to get a small/cheap/indestructible quad for practising manual tuning.

Ok. I made those suggestions.

I didn’t realise you could have a slightly different INS_HNTCH_REF to the MOT_THST_HOVER as I thought they essentially mirrored each other.

I can see you expanded slightly on the bandwidth too. I read the bit on Wiki where FREQ/2 is a good starting point. I was expecting to see 15 for this value initially.

I captured some logs but this one seemed the best.

2023-07-11 14-26-23
ALTHOLD Had 3 attempts at getting data for 30-40s but a bit of wind today.

LOITER
Loaded with 4.3kg payload (2 bottles of full water stuffed in the hopper so shouldn’t have moved)

Flew pretty well. did some more figure 8’s and tried a manual emergency decent (Loiter)

Surprisingly well-balanced from what I observed visually.

Just out of interest which log file?

I was just exploring the Filter Review Tool to try and understand what you sent.