Oscillation in Loiter mode after auto tune

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.

I did this and when i tried 0.25 i was having oscillation so i kept that to 0.20 itself.

But i will try again and see your suggestions once i finish all the things.

You position controller values are normal and this should give very tight position holding.
There are still some slight attitude control issues. I would set up the harmonic notch filter as per below and run Autotune again.

Also GPS HDOP goes poor during that flight, which may affect how Loiter behaves. Set this to limit the number of constellations:
GPS_GNSS_MODE,65 or 5
For example I get lots of beidou satellites but they give a poorer HDOP.

Try these Loiter values to see if that feels better, they work well for me:

LOIT_ACC_MAX,600
LOIT_ANG_MAX,30
LOIT_BRK_ACCEL,300
LOIT_BRK_DELAY,0.3
LOIT_BRK_JERK,300

There is no notch filter set up in that log, use just the values I provided - I rechecked that log you provided to be sure.
image

Maybe disable Fast Attitude logging too - it seems like it would be an essential tuning tool, but in reality Leonard Hall is about the only person that knows how to make full and proper use of it. Autotune automatically enables fast attitude logging while it is working.

So combine all those things (except Autotune) into one flight and see what that is like.

EDIT:
Counter-intuitively, the bigger copters sometimes need the position controller relaxed a bit so the big copter doesnt try to follow tiny (GPS) position changes so strictly, and appearing as oscillations.
Keep this strategy as backup plan in case the other things already mentioned still dont work as expected.

PSC_POSXY_P,0.5
PSC_VELXY_D,0.25
PSC_VELXY_I,0.5
PSC_VELXY_P,1.0

These are just half of default values, so easy to put back if you need to.

1 Like

For tuning you could start by reducing your D terms, there’s quite a bit of oscillation going on there, probably causing motor heating and shortened battery/flight times.

ATC_RAT_RLL_D,0.0048
ATC_RAT_PIT_D,0.0030

and see what difference that makes.

Just for your info: the Loiter params I specified are more cosmetic or reactionary to pilot inputs - they not the cause of any of the issues. Loiter behaviour may improve after you’ve looked at the other things: GPS mode, HNOTCH, and Autotune

Hello guys, after long time, i have managed to find a good weather and good friend to help just for a few minutes. for now i have managed to solve the problem of the oscillation in the loiter mode. I did that with position hold mode and i can see the drone is almost fixing it self. I think the noise from the sensor was causing the issue, after filtering the noise i see there is not much trouble yet.

I could not find the right weather till now to do more test but i have seen there is high vibration(more than 30m/s/s but less than 60) in Z during the change in altitude that is for a short time and then it again becomes low(less or close to 30).I dont know if it is normal or not.

I will keep you guys posted after i do more test. Happy new year guys.

Vibrations over 30 are very bad
Vibrations over 20 are causing issues even if you dont know it yet
Vibrations over 15 are in a grey area - it could go either way
Vibrations below 10 are good

Set all the other parameters I already gave you.

Use Loiter instead of PosHold - it’s so much more modern and tunable. Using poshold may just be masking some issue that still exists.
When you do test flights use AltHold and Loiter in one flight - this tests a lot of aspects and provides useful data.

That is concerning than, cause i have something like this.


In the X i have something like this

and in Y i have something like this

The only issue i think as per your previous suggestion would be the Z. I read in ardupilot wiki:

“If you have a Z vibration then you may have a track issue with propeller (bent blade) or vertical play in a motor.”

and it seems to be the problem of the motor and prop play. I have no clue on how can i solve this.

Is there any way i can solve this issue. I am using folding prop.

I have is the numbering of [0], [1], [2]. I think these are the sensors number if i am correct. Is there any way to consideration to remove any sensors or we must see all the sensors data.

Looking at your previous log the X and Y axis vibrations are not too bad, only Z axis vibrations are getting into the danger zone. Z axis vibrations can be the hardest to fix, and in some cases even require design changes.

Send a couple of photos of you flight controller, and surrounding wiring, the copter in general.

In logs check the VibeX,Y,Z values as you have, but also the Clip values.
Clip is a count of the times an accelerometer exceeded it’s physical limits.
Also “on the map” you will see the GPS track (blue) and “POS” tracks (red) diverge - in your case there’s not a lot of divergence at all, indicating X and Y axis are reasonably good.

The X and Y axis vibrations cause error in the horizontal position and this will become apparent with “GPS Glitch” errors and similar as GPS position and IMU-calculated position start to disagree.
X and Y axis vibrations could be:

  • prop balance, a motor bent shaft or bad bearings
  • wiring pulling on the flight controller - either stretched tight, or bunch of wires putting weight on the FC
  • something touching the FC
  • loose wiring or items
  • antivibration system may be disproportionate in one direction
  • flexible arms and frame

Z axis vibrations make the copter think it’s falling and so it attempts to gain altitude (a fly-away). Eventually the disparity between baro, GPS and IMU becomes too much, the copter realises what is happening and declares a vibration failsafe. The copter will try to descend despite the accels probably saying it is still rising.
The Z axis vibrations can be caused by everything mentioned for X/Y axis, plus:

  • props passage over arms, especially if arms are bulky with ESCs attached externally
  • props passage over baseplate
  • prop wash over the flight controller
  • frame flexibility and resonance - worth a second mention!

Apart from excessive levels of vibrations causing direct and obvious issues to your airborne copter, “medium” levels of vibration will prevent proper tuning. For example Autotune will not produce a useful result. You will be forever chasing problems and trying to improve tuning.

Some flight controllers have accelerometers with a greater range. Generally you will know if you have those accelerometers because you would have paid a high price for your FC and likely sort out such a flight controller. It may be that vibrations of 30 m/s/s are well within an acceptable range. However the aircraft should not be operated in that elevated range of vibrations - more it should be viewed as a greater margin for error should something go wrong or come loose during flight.
Aircraft with an internal combustion engine and/or generator could be more reliable with such a flight controller.
A Cube Orange is a good choice, but even these can have a resonance problem with the internal damping and whatever is causing the vibrations.

Wiring is something that often gets overlooked - it should all be secured to the frame. Leave just enough flexibility where wiring needs to connect to the flight controller, so that vibrations are not transferred.

2 Likes

Thank you so much for your reply swan. It is really in depth. I have tried to answer your question below:

I have the clip some thing like this, i could see in the start there is not clip and it open happens during the change in the altitude. why is that, is it due to the vibration in the z axis.

I dont know how to manage to test this for now, but i am looking for something to make soon to test this.

I think this is what i also suspect as i see the esc signal wires in the carrier board is bunched up.

I have tried to tighten it and saw there is still the result…

i am using a double sided foam tape, thinking to change this to the holybro 3m double sided foam

I have a lidar and i think that is kicking in the low altitude… but i am not sure about high altitude what would happen, can you tell me what can go wrong if i am at high altitude, will just go away or will it start to land…

I dont think this is an issue apart from the arm mount. The blades are far away from the base plate so there wont be a interference.

for now the drone is flying well for what i want. But now i am afraid if it will just go off and crash…

I am using the cube orange flight controller.

I have bunched the esc pwm wires that comes to the flight controller, do you think i have to open it up.

Just a question from your experience, do you think i can use this drone like this cause the tune for now is good for me, i am just afraid as it is expensive and is going to carry expensive camera.

Can this also be a issue with the coaxial drone, what if there is no clip as clip is 0 and what if the clip is too low and still there is vibration with same condition i have.

Another question i have is using a folding prop and should it be very tight or very loose. Cause for me it is almost between tight and loose… more towards tight i would say. Can this also be the problem, cause i try to manually align them straight before every flight.

Correct - ANY wires that go to the flight controller should be just long enough and free enough to do the job, and not hanging loose (or be pulled tight). The wires should be flexible and then secured to the frame, so any weight like a bunch of servo wires is borne by the frame.

Much of what I said about vibrations in that previous post was general information, not necessarily what is happening with your copter.

The Cube antivibration pads are usually OK, and I would say in this case that changing the foam pads out would be masking a fixable problem.
Maybe you need some extra posts between the bottom plate and the top plate - something to improve stiffness and prevent a trampoline effect.
image

Yes i have those.

I recently discovered that my propellers can be the reason for this vibration in the Z. I was checking some old logs and i found out that there was no CLIP at all, for all the sensor it was zero. But the vibration was there but not too much like the last flight and i have changed nothing just folding and unfolding propellers.

OKay i am going to let it be there as open as possible. So i am not going to make it a bunch.
If you see my setup you should have notice that the flight controller is too close to the module, i was thinking, what would happen if the flight controller is a bit offset from the Center point.

Can you please tell me if the folding props need to be tight or loose like the DJI mavic mini ones.
Is there any tips for me to align the propeller each time i fly.

This is not a big problem and usually doesnt need any special consideration unless the flight controller is a long way from centre.

I think you will need those posts/supports near the centre.

I’m NOT totally certain about the folding props, I think quite free would be best, but not very loose so they can move up and down. You should only need to roughly spread them out before use, there should be no need to perfectly align them.

what would your suggestion be in case there is no clip but there is vibration between 30 to 60 with the mean being around 15 to 20.

I generally align it perfectly before starting. And also i think one or two of the prop can be tight then the other.

lower the control loop gains in an attempt to stop the oscillations. Currently, the defaults for these are “0”, disabling them. Setting them to a value can be done experimentally if oscillations are present.

I like to further understand this oscillation in the context referring to?
Does it apply to some category of ESC, for example, digital ESC?
Where are these PIDR.Dmod, PIQP.DMod located in the latest MP or UAV Log Viewer?

Are you referring to SMAX ?

apologies for not specifying clearly. Yes. SMAX

See the ‘07_esc.parm’ file and the parameters and comments inside.