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 » Wed Apr 09, 2014 4:48 pm

That video was exactly what I was thinking on!
I've been looking at this for a long time and was a bit confused as to why none are using LQG Controllers.
But the missing link for the LQG is the torque relationship. But I will come back with the results after I have analyzed/simulated the system. :)
User avatar
User

Korken

Posts

83

Joined

Tue Mar 18, 2014 8:11 pm

Re: Auto tune: Article?

by Korken » Sat Apr 12, 2014 6:32 pm

So I've been simulating the proposed system and I found a few discrepancies, so I changed to the full nonlinear model as:
eqn.png
eqn.png (15.7 KiB) Viewed 1450 times

Using this equation it stabilizes in between the two throttle up/down time constants. However when it has come to this model, it's just as good to estimate the entire physical model of the system.

I will post a bit later with the extended model. :)
User avatar
User

peabody124

Posts

1339

Joined

Tue Feb 18, 2014 12:33 pm

Re: Auto tune: Article?

by peabody124 » Sat Apr 12, 2014 8:27 pm

Shouldn't there be two tau terms then, one for the positive and negative control?
User avatar
User

Korken

Posts

83

Joined

Tue Mar 18, 2014 8:11 pm

Re: Auto tune: Article?

by Korken » Sat Apr 12, 2014 9:07 pm

If you want the decelerating tau, then yes. I skipped this and let the system represent the mean of acceleration and deceleration.
Plus, it is quite problematic to model the two time-constant model.

It can be done, but I don't have a good enough model and I'm not sure if it will do that much difference.
If you have a good model, then please share. :)

Edit: I had some more look into my old experimental data and found something interesting.
The decelerating time constant is dependent on the step size. This is probably because the ESC does not do breaking and has some throttle still during the deceleration.
User avatar
User

Korken

Posts

83

Joined

Tue Mar 18, 2014 8:11 pm

Re: Auto tune: Article?

by Korken » Sat Apr 12, 2014 10:58 pm

Here are some simulation results. The tau was set to 0.1s and Beta to 1.5. Starting guess for tau is 0.05 and 1 for beta.

Result: Very good! :)
As can be seen in the plots, beta has to converge for tau to converge. This is also observed in the Jacobian of the nonlinear equations.

est.png
est.png (101.42 KiB) Viewed 1429 times
User avatar
User

Korken

Posts

83

Joined

Tue Mar 18, 2014 8:11 pm

Re: Auto tune: Article?

by Korken » Sun Apr 13, 2014 1:23 pm

Okey, my old suggestion works fine. The problem was in my tuning of the filter.
So I will go with this model (works as good as the more nonlinear one):
eqn.png
eqn.png (21.92 KiB) Viewed 1409 times

Then for each of the three axises you make one calibration run using relay tuning.
Relay tuning excites the system very well, but anything can be used as long as it include rapid changes in the control signal. Else the time constant isn't observable. :)

Comments/ideas? I have functioning Matlab code for this filter if someone wants to try it.
User avatar
User

peabody124

Posts

1339

Joined

Tue Feb 18, 2014 12:33 pm

Re: Auto tune: Article?

by peabody124 » Sun Apr 13, 2014 1:34 pm

I think you'll find an additional scaling term will be necessary on yaw, unless you have worked out some proof they are equal. The yaw torques are a function of RPM and air drag, whereas the roll/pitch is more due to the air velocity through the blades. I doubt they are equal with proportionality of 1.

If you send me the matlab I can run it over lots of logged data from flight to see what it would do in the air.
User avatar
User

Korken

Posts

83

Joined

Tue Mar 18, 2014 8:11 pm

Re: Auto tune: Article?

by Korken » Sun Apr 13, 2014 1:41 pm

Ah, I forgot to mention, for each run there are different Beta and tau :) They are assumed to be different.
What you do is that you run 3 of these in parallel to get total estimation, or you run one axis at a time and save the results.

I have attached the Matlab files. :)
Attachments

[The extension zip has been deactivated and can no longer be displayed.]

User avatar
User

peabody124

Posts

1339

Joined

Tue Feb 18, 2014 12:33 pm

Re: Auto tune: Article?

by peabody124 » Sun Apr 13, 2014 7:22 pm

It might be a good idea to reparameterize beta and tau in a log space. I'm seeing some issues with them flipping sign which doesn't really make sense.

Edit: I suspect part of why this might be happening, is that in normal flight while hovering the majority of the variance in the command signal is actually explained (with low latency) by the gyro signal (because that is the structure of the feedback loop). It would probably be necessary to do a flight that adds some random perturbation to the output signal unrelated to the gyros to pull this signal out.

Edit2: I think a bias term is also going to be necessary. turns out at level flight the output isn't perfectly zero. I hadn't noticed that before.
User avatar
User

Korken

Posts

83

Joined

Tue Mar 18, 2014 8:11 pm

Re: Auto tune: Article?

by Korken » Sun Apr 13, 2014 8:30 pm

Okey!
When using log, do you have any good method/example of how to do this?
I did not have this problem you are describing, but I can see it happening. What also can be done is to change the beta and tau update equations to include absolute value.

When it comes to omega, a bias is of course needed! I wasn't thinking about that. :)

Edit: Got exponential mapping to work. :)
However, I am having problems with estimating the bias correctly. Looking into it.

Edit2: The bias does not seem to be observable... Looking into it.

Edit3: The bias is not observable without a fixed reference. To get the bias as well, attitude estimation must be coupled with this estimation, or if some other filter does bias estimation.
PreviousNext

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron