Perhaps it would do good to do some research on PID systems outside the scope of controlling a drone:
Oscillations typically occur when a system is critically damped or under damped, and unless your copter is has some fatal design flaw, you should be able to get rid of the oscillations.
In general, keep in mind that in a simple system:
Increasing a P value will make your copter respond faster, but will tend to cause oscillations.
Increasing an I value will help eliminate drift.
Increasing a D value helps smooth out oscillations.
There is no guarantee that will be the case when tuning your PID gains. When you put them all together they often behave in un-intuitive ways.
Just remember to only change one gain at a time, and do so slowly until you no longer see any improvements in stability. Then try another.
You could also try using the Zieger-Nichols method:
Worst case scenario, if you can’t get the copter to be stable through trial and error, you may need to go to an engineering school and see if you can commission someone (a masters or PhD student if you want it cheap) to design a custom control system.
It`s so big step to change P. To prevent the oscillation on my heavy drone (45kg), we changed P,I,D with step 0,0001 . For example, on P-stab roll = 0,0955 we receive oscillation on full throttle and max load, but so small decreasis, as to P=0,0945 - we have no oscillation. Such steps are needed for all PID-regulation parameters. The moment with battery voltage is very important - all settings must be made exclusively on fully charged batteries! Otherwise, the settings will be incorrected !
Dear Matt, Indeed we have to do trial and error. Thanks for the suggestions. The good thing is that at 1/2 payload and empty the Loiter position is quite OK, Only at the full load is starts oscillations at loiter Pdis=1 PID 1,0.5 and 0. But at Pdis =.5 it does not stick to position nicely, and yaw is also not tight. Indeed you have a tendency to turn on more buttons at the same time, hoping on a golden combination… Thanks for the advice! Will have to look at such student I guess if we cannot solve it…
Good news, Yesterday we changed the 18650 batteries with C15 with LIPO battteries with 20C and it made the whole craft full load and in alt mode much more responsive. So I felt we are moving to the right direction. So today we did use the lipos in Loiter with loiter Pdis settings of 0.7 and PIS 1, 0.5 , 0.5 and it worked nicely. So now we are up to the mission waypoints start…
Conclusion: lipo’s with low internal resistance make the craft respond better. High resistance batteries lead to slower response capacity as voltage might drop swifter with a sudden required power increase…
thanks for all the reactions and you can ask me your questions as well for bigger crafts!
Hi Chris, Thanks for your comments. The CoG lower would not improve the oscillations. Intuitively you might say that a low CoG would make it easier to correct, however it does not as the Cog on top makes active correction continuous, while a low CoG would make a pendulum effect, so the active correction would need to go against that. Also interesting in the pitch axis the drone corrects very well with lower PID settings as over roll. Cheers Winfried
This looks like a nice project! You probably thought of what I say below, but these are just a few things that came across my head…
Is the payload perfectly distributed? If it is asymmetric, different axis will respond differently. Also, is it as close as possible to the centre of the drone (in all 3 axis)? This will make it require less energy to do the corrections (inertia). Also, if the payload is liquid, check how the liquid is moving in the tank (I’d say you’ll need baffles inside the tank to avoid load displacement… or many small tanks). To see if it is something like this, you could do some test with a static and smaller load located as close as possible to the geometric centre of the drone and check the response from there (go to the gym and grab 100kg of iron )
Also, you mention it behaves better with more powerful batteries… it could be it has not enough power and the control loop gets saturated until it overreacts (aka integral windup). I don’t know if ArduPilot is implementing any mitigation techniques against this, but such large drone surely has much slower dynamics that might need a review.
Dear Nico, yes let me explain. Payload is perfectly distributed, and as you can see the payload is quite central ( batteries in cog) tanks as close as possible. But indeed there inertia in the roll axis. Quite some! Yes the payload should be liquid, however important to say that at the start I did not want to fill it with liquid yet…So I used sand bags to start. Now we plan to fill it with liquid. I think that the shaking can be handled. And we can also place pressure bags or baffles, but lets first test…
The last part of your comments is I think is most useful! I think that is the case. But as not very familiar with this I looked it up at WIKI
This problem can be addressed by:
Initialising the controller integral to a desired value, for instance to the value before the problem
Increasing the setpoint in a suitable ramp
Disabling the integral function until the to-be-controlled process variable (PV) has entered the controllable region
Preventing the integral term from accumulating above or below pre-determined bounds
Back-calculating the integral term to constrain the process output within feasible bounds.
Zeroing the integral value every time the error is equal to, or crosses zero. This avoids having the controller attempt to drive the system to have the same error integral in the opposite direction as was caused by a perturbation.
Yes I can definitively look into this further. I will ask one of the developers to look at this.
The research angle is interesting. I have made so many tests, varying so many variables! At high Pdist to speed) eg >1 like 1.5 and 2 the drone auto oscillated heavily. No way to stop! But now with the lipos we tested the .7 value in loiter and it stopped nicely the induced oscilation, whereas with the 18650 batt it was sluggish and could not be handled in Loiter, no good control. I thought of monitoring voltage during corrections and see motor (power) response to change of angle induced by stick movement. Question to you:are you in ardupilot development, or a user?
Thanks for the suggestion and will go further to evaluate the PID saturation effect…
So are you saying that you have not yet tried with payload of liquid? Only sand bags, !
My theory was all about sloshing water moving your c of g around as is oscillates, but if you’re only using sand do far them this is not the problem
Correct, First wanted to work with sandbags to tackle the problems bit by bit. Eg the sloshing can relatively easy be resolved. (in shape of tank, baffles, constant pressure bag above level etc. Will soon know, currently too much wind for testing!
It is a spray drone so we only should fly at low wind in order to reduce drift. Best is in early morning at sun rise. We have with this one flown so far with 5m/s but, the drone should not spray with winds >3m/s according to tractor spray regulations, which we think is necessary to reduce drift. We think that it should have an estimated max speed of ca 36 km/hr. However is not relevant for this craft. We have made octoquads of 100 kg payload that were quite fast.
In general we think that the use case determines the configuration: in this case we wanted to have a forced airflow (by the props) over the whole width of the craft, equally distributed. This brings the spray well into the crops. We think that biological spraying with bacteria or nematodes or organic substances would be preferable. Will soon be able to show you on this one. We had smaller models (3m span, 5 lit) doing this nicely, Best Winfried
Hi, I am also new to ardupilot. But have some experince with control theory. I don’t know if it exists but a gain scheduling is needed with your configuration. So (an idea), you should tune pid’s for like 3 cases (full load, half load and empty) and imply (if ardupilot lets you) a gain scheduling.
Looks like the total flying weight is pushing the pwm of the esc commands too high, as a result you are not getting a fluid response from your pid loops…
As soon as the controlled variable of a pid gets to a min or max value during loop control then you loose any ability to further correct for an error in pitch or roll.
As you have already worked out im sure, 100kg is too much for your power system.
Either need more available power, or less weight untill the output of the flight control pwm never reaches 100% during level flight.
Dear Scott, that is likely correct and coinciding with the findings. We have 16 units that produce ca 12.5 kg of thrust max so ca 200 kg. So we took only half of that for MTOW. so 100 kg, and with 60 kg empty craft we came to 40 kg max payload. the PID loops are functioning in Altmode ok with the full payload and low C batteries. In loiter we had the problem. The issue was resolved with high C batteries. Cheers Winfried
I like this conclusion. For further investigation (your case seems similar to mine), could you please provide some motor/battery configurations you had in your system? (Which motor, props, lion, lipo battery…)
Thanks in advance,