Development discussion of TauLabs software such as flight controllers, sensors, radios and speed controllers.

Auto tune: Article?

User avatar
User

Korken

Posts

83

Joined

Tue Mar 18, 2014 8:11 pm

Re: Auto tune: Article?

by Korken » Tue Apr 15, 2014 7:48 pm

It's looking really nice! :)
User avatar
User

Korken

Posts

83

Joined

Tue Mar 18, 2014 8:11 pm

Re: Auto tune: Article?

by Korken » Wed Apr 16, 2014 7:11 pm

I've been working on how to keep the estimation from diverging when there is not enough excitement, and I am starting to get something working.
I will upload the code tomorrow or so with the changes so you can try. :)
User avatar
User

VArcht

Posts

287

Joined

Thu Mar 06, 2014 5:24 am

Re: Auto tune: Article?

by VArcht » Wed Apr 16, 2014 8:05 pm

Sounds like you guys might need to change the name of this feature to "Magic Tune" , exciting progress. Would it ever be feasible/useful to constantly run the tuning loop for real time adjustment to changes such as atmospheric changes, motor output variations or...?
User avatar
User

peabody124

Posts

1339

Joined

Tue Feb 18, 2014 12:33 pm

Re: Auto tune: Article?

by peabody124 » Wed Apr 16, 2014 9:23 pm

Ok great. Yeah, I definitely see the model drifting when there is less excitation, although once I decreased the drift variance for the biases it seems to work pretty well.

Watch this video:


Then this is the resulting fit:

Screen Shot 2014-04-16 at 4.15.59 PM.png
Screen Shot 2014-04-16 at 4.15.59 PM.png (48.91 KiB) Viewed 1474 times


What's nice is it is a much more subtle and smaller amount of disturbance than we require for relay tuning. It also learns in about 20 seconds. I ran another test that also systematically perturbed yaw and it did well too.

If we can have it more stable when it is unexcited it might be possible to keep it running all the time. I'm not convinced that would be beneficial though, and it would increase computation costs.

There are definitely reasons to keep the subset of the filter running without updating the beta and tau terms though - that allows you to estimate rotor speed. When you have that, you can actually provide something analogous to the derivative term but much better. If that were running we could also track significant model deviations and when they occur trigger a learning mode (and know that probably a motor failed ;-).
no avatar
User

Kapers

Posts

1

Joined

Thu Apr 17, 2014 3:08 pm

Re: Auto tune: Article?

by Kapers » Fri Apr 18, 2014 2:48 am

I have to say that's really impressive to go from a new concept to simulation to implementation and tested results
in like a week. Totally impressed. It's taken me over a year to put together a Thrust Response measurement system.
Almost there though. Just need to calibrate the load cell.

Do you think this will work better for mini quads then the original Auto-Tune?
User avatar
User

peabody124

Posts

1339

Joined

Tue Feb 18, 2014 12:33 pm

Re: Auto tune: Article?

by peabody124 » Fri Apr 18, 2014 4:05 am

Yeah, I'm hoping since this this a bit more directed at measuring quad properties it might work more robustly. Before we were fighting between having excessively large jumps for a bigger quad and getting good measurements for a micro. I have enough quads that I should be able to test a few variants.

I got at least a first pass of the math working to calculate the tuning settings from the results. What is quite nice is that it also calculates the derivative term now, which isn't something we've tuned systematically before.

It's producing values that make a lot of sense for this frame. I'll test them tomorrow.

Edit: couldn't wait. just tested it. the calculated values seemed to work well. it let me get a lot higher with the Kp than I've been able to before. there seems to be some vibration from the frame though that is getting amplified because of the higher Kd - at least by ear. responsive feeling though.
User avatar
User

peabody124

Posts

1339

Joined

Tue Feb 18, 2014 12:33 pm

Re: Auto tune: Article?

by peabody124 » Fri Apr 18, 2014 3:49 pm

Just to comment a bit on the approach I'm currently working on, using a PD controller for rate you can get the characteristic polynomial of the closed loop response. There are enough free parameters to completely specify the undamped frequency and the damping constant.

From that I can solve for the kp and kd that give a reasonable control bandwidth (right now I'm shooting for 5hz) and making it critically damped.

The main constraint is picking a kd term that has a low enough sensitivity to the gyro noise. Luckily we can measure that while learning the system and then measure the gain in the 50-150 hz range - reasonable prop speeds). I think the goal constraints will be something like solving for the control bandwidth that allows critical damping with a gyro noise sensitivity below a certain threshold.



Sent from my Nexus 5 using Tapatalk
User avatar
User

peabody124

Posts

1339

Joined

Tue Feb 18, 2014 12:33 pm

Re: Auto tune: Article?

by peabody124 » Sun Apr 20, 2014 4:56 pm

Here it is running an on board filter (optimized to only take a few percent of the CPU).



Currently I'm just taking the values it learns and dumping them into matlab. The current equations to calculate the PID constants are pretty simple and could be optimized on board. However, I'm trying to add other constraints. For example to account for the measured gyro noise and limit the Kd based on a maximum noise sent to the ESC. I'm guessing these will make the calculation a bit too complicated to implement on board.

Do you guys think plugging it into the GCS to get the settings would be too burdensome (or alternatively android can calculate)? Possibly we'll end up with a rough tuning on board and a more optimized one offline.
User avatar
User

h3nk

Posts

37

Joined

Sat Mar 01, 2014 5:11 pm

Location

Germany

Re: Auto tune: Article?

by h3nk » Sun Apr 20, 2014 6:59 pm

The offline approach isn't a bad thing since the current autotune also requires GCS to be running in order to apply the results. I would even vote in favor of a wizard in GCS to guide the user through the autotuning process. Currently there is a long text with advice on how to correctly use autotuning and much of it might seem a little easier to beginners if it was presented in a step-by-step manner.

@peabody: did the quad in your video feel more stable after tuning? I wasn't sure if it was you shaking your quad around or if it actually was rather unstable. ...I'm just curious, not that anyone could expect the new approach to work flawlessly already :)
User avatar
User

peabody124

Posts

1339

Joined

Tue Feb 18, 2014 12:33 pm

Re: Auto tune: Article?

by peabody124 » Sun Apr 20, 2014 7:24 pm

Good point. One reason I'd love to have it calculate from the coefficients, though, is then it opens up a whole elegant world of scaling the PID settings in an intelligent way across throttle ranges (since different throttle settings will have different parameters). I may have made a minor breakthrough in the math too so I might get rid of some of the approximations.

Yeah I was wobbling the sticks pretty aggressively to demonstrate that it could respond sharply. Good point, I should have shown some stable hovering afterwards.
PreviousNext

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB ® | phpBB3 Style by KomiDesign