Hi again all, Two blog posts in two days... i'm on a roll. I just finished the next set of revisions to my autotuning code. I have shifted from tuning the stab gains to tuning the rate gains. This is more dangerous but also more rewarding.
Here are the major changes:
1. Stab gains no longer tuned, switched to rate gains.
2. Addressed the issue of inconsistent user induced disturbances. Previously if the user disturbance was not consistent, the calculated performance value would be inaccurate. Now it is a scaled based on the initial pitch/roll of the copter.
3. Lowered the initial amount of gain change to 25% to mitigate the risk of in flight gain changes.
4. Added a safeguard against a gain that is too low and never returns the copter to level.
5. Moved all autotuning related logic into its own .pde file so it is easy to find
Instructions:
1. Upload the modified code (see attached zip based on v2.3)
2. Set your stab p gain to 1, stab i and d to zero
3. Set your rate p gain to some ballpark number, rate i and d to zero
4. Start your simulator
5. Bring the copter to a hover
6. Flip the ch 7 switch to the high position
7. Introduce a pitch or roll disturbance. This should be a quick movement and then return the stick to center (see video) (repeat 10 times at least).
8. Flip the ch 7 switch to the low position
9. Go to the planner and refresh the param list.
10. Set stab p = 1 + the value from rate p (maybe a little lower), stab i = 0 and stab d = .002
11. Set rate d = rate i - .003
12. Write the new values and observe in the simulator.
That should get you very close to rock solid. I have found the need to play with the stab p gain a little bit, but other than that I have had good results. Steps 10 - 12 are a bit hazy at the moment and will require some additional manual tuning. Those last steps are based on observations that I have made, not specific processes that I can guarantee will work for everyone. I am hoping some others can chime in here with some insight. Perhaps some devs can get eyes on this as well. I did try to push this into my git branch, but I am having some authentication issues at the moment.
Please watch the video for more information.... It is still uploading as of now, so if you can't see it yet just give it another 20 min or so. My videos are in 1080p so you can read my screen.
Thanks,
Adam

Nice job Adam, i try now with AeroSim, although I've already found the optimal parameters manually.
Bests

@Marco: Thank you. That may actually prove to be more useful. If you know what the gains are that work within your simulator, you can set your gains to something else and see if the autotuning gets close to what you know works. Let me know you observe, namely if the rate p gain appears to be too aggressive or too relaxed. Also, if it is at all possible make a video :-)

@Marco: I just downloaded AeroSim RC to try to get a better testing environment setup. I am running into an issue that perhaps you have seen before and solved. When I attempt to load the APMHil plugin, AeroSim RC says, "Plugin not compatible." Any ideas?

Yes, download and use the planner V1.1.28 and the plugin inside this one.

@Marco: That worked for me... Now I have other issues with the simulator. The throttle does not work until it is above 50% and the roll and pitch do not work at all. I think I will just stick to flightgear and real life testing :-)
Make sure your radio trim is set up properly, is low for throttle

@Michael: Does the latest AeroSim plugin in the Mission Planner work with the latest version of AeroSim or is that still in the works. AeroSim displayed an error when I attempted to load the latest plugin version.
for the latest plaugin you need
http://www.aerosimrc.com/downloads/AeroSIMRC_3.83-3.81.exe
and this is the instructions i sent to the dev list
ok new APMQUAD plugin. this passes direct pwms to channels 34-38 in aerosimrc.
1. in the planner tick quad instead of heli
2. the gains now do nothing. as this passes through pwms, they will affect the display graph though, but that is all.
3. in aerosim rc, you need to modify a quad. i have yet found good paramaters, so please be my guest and find something that is stable.
Aerosim
1. press F12 - editor
2. to get something flyable modify aerodynamic drag angular damping both to 0.1 - increasing this slows down overall responce.
3. in speed controllers modify the channel to 34 to 38 for sc_1 to sc_4
4. remove AP and Gyro is you like. 5. ive been testing with the QUAD-IV
and here are some pids i found using your tunning code
Stabalize P = 3.7 i = 0 Stabalize D = 0.002
Rate p = 0.96 i = 0.014 d = 0.011
and in aerosim, angualr drag x2 = 0.16

@Michael: Perfect thanks... I'll give that a shot tonight. Also, thanks for testing... I notice that your stab P value is quite high. Did you have to keep upping that to get it to be responsive enough?
Season Two of the Trust Time Trial (T3) Contest has now begun. The third round was a reliablilty/aerial photography round for both planes and copters, which is now closed. Stay tuned for the next round, beginning soon.32 members
18 members
32 members
109 members
22 members
© 2012 Created by Chris Anderson.

You need to be a member of DIY Drones to add comments!
Join DIY Drones