Oscillation in Loiter mode after auto tune

I am new to Drone and I am following the wiki. I completed the auto tune without doing the notch filter and it was sucess. The drone flies very well in the Alt hold and stabilize mode. I am having trouble in Loiter mode. I would like to know how can i solve this issue. The motor is sunnysky motor with 22 inch propeller.
I am adding the Log files here.

i tried the Roll/Pitch sensitive and i have vibration there too. Since my drone is not symmetrical i am having trouble with this as Roll/Pitch sensitivity is putting the same value for the roll and pitch. In this log you can see i have been trying different values using the slider in the mission planner.

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

Do the notch filter tuning, and redo the autotune after that.

Have you done an althold flight to learn the hover throttle, and then used that to set the altitude controller gains?

Thank you so much @amilcarlucas for this quick reply.

I dont know how to do that. Can you please guide me. When i do a left and right maneuvers the vehicle also looses altitude in alt hold mode.

https://ardupilot.org/copter/docs/initial-tuning-flight.html#test-althold

MOT_HOVER_LEARN is set to 2.

I have this set.
I dont know why the MOT_THST_HOVER changed now. Earlier it was different and now it changed and now the value are different. Should i have keep changing that.

That is normal. Small changes (+/- 5%) in MOT_THST_HOVER are normal, and you do not need to change PSC_ACCZ_? params in that case.

1 Like

Have you tuned the harmonic notch now?

Do you want me to leave that as it is then.

I was wondering to find out more about the hover frequency. Can you point me towards that direction.

Not yet. The weather here is stormy right now and tomorrow we have good weather. I will do that tomorrow at the first hour.

I was trying to set the INS_HNTCH_REF. I am not able to understand what exactly and what value should i consider to have here. In the Notch filter. Can you please guide me.

The wiki can guide you better than I do.

Which kind of harmonic notch are you trying to use?

There are multiple tools to examine the flight data for setting the Harmonic Notch filter:
MissionPlanner FFT tool, or
https://firmware.ardupilot.org/Tools/WebTools/FilterReview/

The correct formula for working out the REF value is:
INS_HNTCH_REF = hover_thrust * SQRT(min_freq / hover_freq)
but this is usually near enough:
INS_HNTCH_REF = hover_thrust * 0.6 or 0.7

I did a quick check of your log already provided and this should work fine:

INS_HNTCH_ENABLE,1  // write this then refresh params to see the rest
INS_HNTCH_MODE,1
INS_HNTCH_BW,10
INS_HNTCH_FREQ,35
INS_HNTCH_FM_RAT,0.7
INS_HNTCH_HMNCS,3
INS_HNTCH_REF,0.15

Hello @xfacta I wanted to know what

Where can i get this value:

min_feq
hover_freq
hover_thrust

Can you please tell me for my case what would be the value.

You used this value which is the mot_thst_hover(Motor thrust hover)

I am reading the wiki but it just lacks this point as it is not clear to find the exact value.

I am going to use the double notch and triple notch filter and the throttle based notch filter.

In that graph above (and in the log) the min_freq is about 25Hz and hover _freq is about 35Hz
Hover thrust is your MOT_THST_HOVER (0.16)

I must admit I didnt even check it’s value or do any calcs to come up with the REF value, I guessed and it works - this is the beauty of the Filter Review Tool, you have the ability to make changes and see the expected results :slight_smile:

Out of curiosity, what prompted you to use MOT_THST_EXPO,0.2 ?
That is highly unusual, especially since you seem to have large props.

What i understand is for the hover_freq it is something that has the highest first peak. But i am not able to understand the min_freq. How did you choose the 25Hz.

Mot_thst_hover is 0.16, this is from the parameter as drone is learning itself.

I am also using the same tool to check. I will do the flight test tomorrow.

I think this is automatically as i have set the MOT_HOVER_LEARN = enable. I get this value in that log. Yesterday i did another flight and found it was 0.16 the value. I dont know why it keeps changing.

DO NOT pick all those options! I hope that is just for experimentation and not for flight.
You dont need a second notch filter, INS_GYRO_FILTER, does a lot of the heavy lifting and you can see I only specified the default harmonics (the first two) because those are the only peaks with noise that get past the main low pass filter.

The key with the notch filter is only do the minimum required or you are just introducing processing overheads and lag in the PIDs leading to oscillations.

Have a close look at the graph I supplied and you’ll see the “estimated” lines are all flat along the bottom except where the indicated filters had to do a bit of work. That was essentially the same effect you had originally with the post-filter lines. So the only required notches are for the 1st and 2nd harmonics.

Hover learning should be set to learn and save by default and in normal operation.

EDIT:
and by the way, I didnt guess at the bandwidth value I supplied - it could be wider but at those low frequencies it tends to introduce more lag and oscillations, so keep it as narrow as you can.
If this was a quad with <12inch props, you could go big with the BW value since the 1st harmonic frequency would be much higher and a long was from control frequencies.

Another Edit:

1 Like

It was from the blogs. They said Flame ecs with t-Motor has this value. Do you think i need to change.

I think 0.4 is more likely with the Flame ESCs, but do a flight with ascents and descents and look for:

  • set too high you can see instability at low throttle
  • set too low you can see instability at high throttle

Then adjust if necessary.

The “Initial Paramaters” in MissionPlanner also has a Flame ESC option to select that gives you:

MOT_THST_EXPO,0.4
MOT_PWM_MIN,1100
MOT_PWM_MAX,1940

I did another test yesterday with the Notch filter and i found it was stable in wind too.

I noticed in the PID of the pitch the value is shiffted below zero can this be due to the wind as i was having high winds in the direction of the drone.

I saw the drone is stable but oscillating with the wind which i think is normal in loiter mode. The only issue was the stick movement. I was not able to lock in the position. What i am doing is making a hard left roll and then sudden right roll to stop the drone. Then i see the drone drifting towards right not stopping at that position. Is it normal to have this behavior.

here is the log

I would like to study the position controller. I wanted to know is there any issue with the position controller that was causing this problem.