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

Auto tune: Article?

by Korken » Tue Apr 08, 2014 4:55 pm

Hi all!

I was looking into the auto tune function and was looking for a reference for the method being used.
Is there a paper associated with this function or how it works?

It feels like some sort of parameter estimation the finds the rotational constant (length times torque over inertia).

//Emil
User avatar
User

guilhermito

Posts

155

Joined

Mon Jan 13, 2014 9:16 pm

Re: Auto tune: Article?

by guilhermito » Tue Apr 08, 2014 5:10 pm

Relay based pic tunning I think it's called
User avatar
User

peabody124

Posts

1339

Joined

Tue Feb 18, 2014 12:33 pm

Re: Auto tune: Article?

by peabody124 » Tue Apr 08, 2014 6:48 pm

Yeah the math was written by dale and I did the implementation. Ill check with him if there are any particular references he would give.

For sure one issue we are running into us the best step size. Too low and it picks up noise on mini quads. Too high and because of the nonlinear response of escs the average thrust goes up and the quad jumps and drops at the beginning and end.

Sent from my Nexus 5 using Tapatalk
User avatar
User

Korken

Posts

83

Joined

Tue Mar 18, 2014 8:11 pm

Re: Auto tune: Article?

by Korken » Tue Apr 08, 2014 7:17 pm

Okey, so that is how it works. :)

I have an idea for a, I believe, better tuning scheme.
In stead of doing a shortcut in system identification (which relay tuning is by sampling the Nyquist plot), find the the "true" model:
CodeCogsEqn.gif
CodeCogsEqn.gif (892 Bytes) Viewed 5309 times
where L is the length to the rotational center, A_F is the thrust coefficient for the motors and w_max is the maximum angular rate of the motors.

By baking all the constants together and replacing the two squared throttles as a differential throttle we get:
CodeCogsEqn (1).gif
CodeCogsEqn (1).gif (1.06 KiB) Viewed 5309 times
And the parameter beta is observable as long as u_d is not equal to zero.

Then it-s just to make an observer for it of personal choice. Anything from a least squares (batch processing) to gradient descent to Kalman Filter (recursive) would to the trick.
And when beta has been identified, any way of calculating controller gains can be used. Since we now "know" the system.

I was planning on testing this om my system quite soon, but perhaps you will have use of it before me. :)
What do you think about this approach? Then any control signal (more or less) in will identify the system.
User avatar
User

peabody124

Posts

1339

Joined

Tue Feb 18, 2014 12:33 pm

Re: Auto tune: Article?

by peabody124 » Tue Apr 08, 2014 8:39 pm

You can give it a shot, but i'm 95% sure it won't work well because the main limitation for stabilization comes from the latencies of the ESCs and you leave those out of your model.

In fact what I should do is grab some Overo logs with Freedom (did this ages ago) and I can show you the phase plots of the rate command versus gyro values. That phase lag is the main thing we are modeling.

I can't recall for certain if I talked about it, but you can see I included latency in the system model here:



and i remember simulating that without those delays you could basically achieve infinite control bandwidth ;-)
User avatar
User

Korken

Posts

83

Joined

Tue Mar 18, 2014 8:11 pm

Re: Auto tune: Article?

by Korken » Tue Apr 08, 2014 8:55 pm

Hmm, so the ESCs have significant time delay. I have not seen this in my experiments (and have not looked for it), however I always use SimonK based ESCs.
But this should not be a problem. Assuming the time delay is the same for both ESCs.

I will augment the equations for estimating the time delay as well. :)

Do you have any idea of what size the time delay usually is?

Edit:
Or do you mean the rise time of the ESC?

Edit 2:
You must mean the rise time (time constant). I looked into a lot of old experimental data I had and there is no noticeable time delay.
However the time constant is in the range of 0.1s on the ESC/motor combo I used then. This is quite significant.
I will modify the equations to find the time constant as well. :D
User avatar
User

peabody124

Posts

1339

Joined

Tue Feb 18, 2014 12:33 pm

Re: Auto tune: Article?

by peabody124 » Tue Apr 08, 2014 11:45 pm

Yeah. Also it gets a bit nasty because the rise and fall times are actually not symmetrical. Some ESCs have four quadrant control to improve this, but fairly few. SimonK ESCs definitely are an improvement over normal ones, but I still doubt this is something that can be ignored.

Essentially when we determine the period of oscillation in the autotuning process, we are measuring this property. Actually it would be nice if I made a way for people to submit their results. I've also written a module that sweeps a frequency oscillation on top to more explicitly measure the frequency response, but never rolled it out. At lower frequencies, it is really quite weird feeling.



Here are my notes from back then http://forums.openpilot.org/topic/13926 ... ification/
User avatar
User

Korken

Posts

83

Joined

Tue Mar 18, 2014 8:11 pm

Re: Auto tune: Article?

by Korken » Wed Apr 09, 2014 7:03 am

Cool!

However, we are not interested in the time constant of the ESC. :)
We are interested in the time constant from throttle input to torque, and when doing this a nice thing of the nonlinearity helps us do perform a kind of linearization.
I will post the new system later today for feedback.
User avatar
User

Korken

Posts

83

Joined

Tue Mar 18, 2014 8:11 pm

Re: Auto tune: Article?

by Korken » Wed Apr 09, 2014 12:14 pm

Okey, this is how I designed the system which takes the time constant of the ESC into consideration:
est.png
est.png (20.7 KiB) Viewed 5277 times
(Ts is the sampling time)
I assume that we are interested in the response of the torque and not the ESCs directly, this response is symmetric in both positive and negative torque.

Comments? :)
I will do a few simulations on it, but I see no real problem with it.
User avatar
User

peabody124

Posts

1339

Joined

Tue Feb 18, 2014 12:33 pm

Re: Auto tune: Article?

by peabody124 » Wed Apr 09, 2014 1:59 pm

Looks reasonable. Would you plan to learn this continuously online? Once you have it coded up send me a link and I can run it over my logs and show you the results. I've done some fitting in the past of the response kernel and got some sane responses but never loved it.

Also, if we do estimate this we can improve the stabilization control quite a lot. I did some work on this previously



But set it aside since the time constant was another term to learn.

Sent from my Nexus 5 using Tapatalk
Next

Who is online

Users browsing this forum: Bing [Bot] and 1 guest

Powered by phpBB ® | phpBB3 Style by KomiDesign