| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Sun Jun 04, 2006 12:06 am Post subject: Just realized that the system is nonlinear |
|
|
I was developing the differential equations for our openservo, in the context of developing the state space model (and hence the state space controller), and I just realized that the system is nonlinear, at least for most of our uses. D-uh, should have realized it from the start, it's sort of obvious for me now.
The model for the speed/position control of a DC motor is linear, as described by the motor mechanical and electrical equations. However, it seems that as soon as you try to use a motor to lift something (i.e.: a jointed robot arm), the model is no longer linear.
I've read somewhere that there are people having a hard time tuning the PID controller. This would certainly explain why. If I understand correctly, the ""torture rack"" is a servo put on its side, with an off-centered weight attached. This is exactly the situation I found. Basically, if you try to tune a PID controller in a situation like this, it will work for a neighbourhood of the position used. The behaviour will be more and more different as you move away from the position where the controller was tuned, and it can even become unstable at some point.
I'll include the equations I have in the next version of the theory document.
What this means for us is one of 3 things:
a) If we still use a PID controller, it will have to be either tuned very conservatively, or it should be implemented in ranges of position/speed (e.g.: 3), and tuned sperately for each one
b) We move to another type of controller, like Fuzzy logic
c) We use a non-linear control strategy
I still have to re-study, re-learn and re-practice my automatic control theory (particularly state space and parameter identification), so it'll take me a while to get into non-linear control.
ZZZ |
|
| Back to top |
|
 |
Zeddicus
Joined: 21 May 2006 Posts: 109
|
Posted: Sun Jun 04, 2006 12:08 am Post subject: |
|
|
Ooops, posted as a guest.... can I change that somehow...?
ZZZ |
|
| Back to top |
|
 |
mpthompson
Joined: 02 Jan 2006 Posts: 650 Location: San Carlos, CA
|
Posted: Sun Jun 04, 2006 6:05 am Post subject: |
|
|
Zedd,
You point out a number of things that I have come to learn by observing the behavior of the OpenServo. Something I'll need to do is to set up a test rig to see how well commercial servos will handle non-linear modes of operation. My first goal is to have the OpenServo function as well as commercial servos, but have more/better features geared to robotics rather than RC control. The long term goal is to be better than commercial servos, but I'll declare victory if we can accomplish the primary. I look forward to your input once you get some actual hardware running and start tweaking the algorithms.
-Mike |
|
| Back to top |
|
 |
Zeddicus
Joined: 21 May 2006 Posts: 109
|
Posted: Sun Jun 04, 2006 2:37 pm Post subject: |
|
|
Wish I had my hardware now, I'm very impatient.
Thing is, since it's a non-linear system, it will be very hard to control with the linear controllers that have been implemented so far, even after extensive tweaking. Like I said earlier, you can tune a PID controller for a specific angle, and it will behave very differently for another angle. If you have already observed this by experimenting, then you know what I mean. Even if you manage to get a smooth controller working, it will behave differently as soon as you change the attached weight parameters(i.e.: moving the elbow joint in an arm can mess up the controller for the shoulder movement)
A ranged PID controller works better, i.e.: a PID with 3 (or more) sets of parameters, which change according to the motor position.
In case of state space, a parameter identifier would be necessary. It would consider the system as linear, but with varying parameters over time, and since they're being calculated, the controller can cope with it. I don't know if this has been implemented in the code, I have to take a closer look at it. I'm still knocking my head against the wall trying to remember what a state space controller is all about.
In the end, it's likely that a direct non-linear controller design will be necessary, or that a linealization function will be necessary.
Anyway, I'll send you what I have, I added my findings to the theory document, maybe someone will figure something out before I do.
ZZZ |
|
| Back to top |
|
 |
Zeddicus
Joined: 21 May 2006 Posts: 109
|
Posted: Mon Jun 05, 2006 4:58 am Post subject: |
|
|
I see 2 options so far for controlling the openservo, that take the non-linearity into account:
1- A state space controller that is linearized about an arbitrary point, plus a parameter identification block to detect the ""linear parameter changes"", and maybe a partial state observer
Easy to implement, probably a few recursive equations, but it is still essentially a linear controller acting on a non-linear system
2.- A full fledged non-linear controller
Should be the most effective controller, because it takes the non-linearity completely into account, but it should be harder to implement, probably using sin/cos or acos/asin in the equations
My head is gonna explode, but still working on it...
Cheers,
ZZZ |
|
| Back to top |
|
 |
Zeddicus
Joined: 21 May 2006 Posts: 109
|
Posted: Fri Jun 09, 2006 11:06 pm Post subject: |
|
|
I've been working on a linearized model of the openservo, for parameter identification. It turns out that, while the equations are non-linear with respect to the state variables, they ARE linear with respect to the system parameters.
Basically, I've been using the Recursive Least Squares with Variable Forgetting Factor algorithm, but I just found a slightly better version than the original one I had, where the parameters are decoupled.
If I have the motor position, I also have cos(position). Therefore, I can identify the R, L, d, mg, J, and all K constants of the equations without resorting to any linear approximation.
This is good on the one hand, because it means the system can be considered as time invariant with constant parameters. The bad side is that there are rather complex calculations involved. Basically, it'll probably be impractical to implement everything with fixed point representations, and floating point would have be adopted. As discussed in another thread, calculation speed will have to be carefully taken into account if this is done...
One last thing: if PID controllers are really, really wanted, this parameter indentification scheme can also be used to autotune the controllers constants. This is not optimal (compared to a non-linear control scheme), but it can be done.
Still working on it...
ZZZ |
|
| Back to top |
|
 |
dispersion123
Joined: 14 Apr 2008 Posts: 17
|
Posted: Wed May 07, 2008 6:09 am Post subject: |
|
|
Maybe I can help (a little), I've had no real experience integrating a controller developed in the frequency domain into a microcontroller (I'd like to learn). But I did just turn in (yesterday) the final report for my Advanced Theory and Design of Linear Control Systems course (what a mouthful, huh?). Basically a graduate level controls course. The state space controllers we worked are:
State Feedback Controller
State Feedback Controller with Input Tracking
Linear Quadratic Regulator (different method of placing poles, can be used with State Feedback and State Feedback with tracking).
As always, all these controllers are just about moving the system poles to get the response characteristics you desire. Both the State Feedback and State Feedback with tracking gains can be determined using Ackerman's formula. The 'tracking' is simply adding an integrator on the error signal before going to the controller.
Anyway, you can use state feedback to move your system poles, then add another controller on top of that for added stability/robustness.
Last Comment: I don't really have much experience with non-linear control, but you *should* be able to use a standard linear controller if you increase the loop speed, because most everything looks linear on small time scales. Of course, if your already maxing your loop speed and can't change the hardware, it really isn't an option is it?
EDIT:
Comment on State Feedback: If you can measure your states directly and apply some good filtering state feedback should work pretty well. If you can't, you need to use a state estimator (observer), and the accuracy of the observer is dependent on the initial conditions you load into it and how accurately you know your model. If your system is noisy, you can use a Kalman Filter, but again, if you don't have your model fairly accurate it could go unstable pretty quick.
EDIT 2:
I'm sort of doing a brain dump here, but since this a SISO system, the 'All Stabilizing Controllers' theory could also work, and might be an interesting one to try and apply. |
|
| Back to top |
|
 |
Zeddicus
Joined: 21 May 2006 Posts: 109
|
Posted: Tue Jun 24, 2008 10:33 pm Post subject: |
|
|
2 comments:
if it's a nonlinear system (due to offcenter load), then a linear controller will only work if the parameters are being adjusted constantly, which is known as a supervisor system. If you don't do this, then the best u can do is a tuning of ur controller for a specified range of movement, and cross ur fingers that u don't get an unstable system when the load changes.
Second: it's actually a simo system. You input a voltage, and read a position angle and a current. Unless u leave the current uncontrolled, which is not a very good idea.
You indirectly read an angle speed as well, either by differentiating the position, or by observing the state, and applying a filter. In my simulations and real-data processing, both work about the same. I've also tried different filters, and a simple first order filter works about the same as a recursive moving window average. The first is simpler to implement and is easier on mem usage.
My old laptop blew up some time ago, and I only managed to salvage the data on my hardrives like a week ago. Setting up my new laptop and installing all the apps and stuff from pretty much scratch SUCKS!
But I'm finally getting back into this project!
Cheers,
ZZZ |
|
| Back to top |
|
 |
kubark42
Joined: 17 Nov 2008 Posts: 11
|
Posted: Tue Nov 18, 2008 1:04 pm Post subject: |
|
|
| Zeddicus wrote: | if it's a nonlinear system (due to offcenter load), then a linear controller will only work if the parameters are being adjusted constantly, which is known as a supervisor system. If you don't do this, then the best u can do is a tuning of ur controller for a specified range of movement, and cross ur fingers that u don't get an unstable system when the load changes.
|
There's a second possibility. You can linearize about multiple operation points. Depending on how badly/quickly the system diverges from the linear model, you can get away with just a couple points, or you can go whole-hog and discretize down to a very fine grain, much like they do with finite element methods. This works really well, even if from a theory standpoint it is a bit of a hack.
| Quote: |
Second: it's actually a simo system. You input a voltage, and read a position angle and a current. Unless u leave the current uncontrolled, which is not a very good idea.
|
I'm a little confused about current. It's a SIMO system, so the only thing being controlled is PWM voltage, right? Do you mean to say that there is a state limitation on current, i.e. a max/min current saturation value? |
|
| Back to top |
|
 |
Zeddicus
Joined: 21 May 2006 Posts: 109
|
Posted: Mon Dec 01, 2008 1:10 pm Post subject: |
|
|
Linearization about multiple points works well only if u have set and stable working points. In this case, the working range is the entire range of the servo movement. It can happen, for example, that for some specified movement, u end up trying to control exactly between your linearization ranges. Discretizing finely I guess is possible, but not viable here imho due to the limitations of the processing machine.
Also, in this application case the load is not constant, so the system is not only nonlinear, it's not time invariant either, meaning that if u linearize for, say, a robotic shoulder joint with an empty gripper at the end, then grabbing an object with the gripper means u have a different system.
What I meant about simo is that you manipulate a voltage as the input to the system, and you want to control the current and the position angle as the system's outputs. Controlling the current can be done with a cascade type controller, like an inner loop to the angle controller, or it can be done directly with a state controller. The typical aproach of leaving it uncontrolled is not a very good idea, and what is usually done is just add a min/max limiter, but a full current control loop is better.
Cheers,
Z |
|
| Back to top |
|
 |
kubark42
Joined: 17 Nov 2008 Posts: 11
|
Posted: Mon Dec 01, 2008 3:00 pm Post subject: |
|
|
| Zeddicus wrote: | | Linearization about multiple points works well only if u have set and stable working points. |
This is not correct. Linearization is the act of studying the Jacobian of a system in order to see how it will react at very precise points. In this case, we are effectively looking at the tangents to the system and *hoping* that the system stays linear "enough" as we drift away from that point.
Depending on you needs and the system boundaries and constraints, you can get away with just one linearization at the equilibrium point, and so that's what we usually do, especially in college courses. However, that is not to imply that we cannot do it differently.
| Quote: | | Discretizing finely I guess is possible, but not viable here imho due to the limitations of the processing machine. |
Think so? That's too bad. Of course, since the number of linearization points is only limited by available memory and time, it could be reasonable to think about upgrading to a better processor if paying $0.50 more improves the controller by X % and saves Y in time.
| Quote: | | Also, in this application case the load is not constant, so the system is not only nonlinear, it's not time invariant either, meaning that if u linearize for, say, a robotic shoulder joint with an empty gripper at the end, then grabbing an object with the gripper means u have a different system. |
I see what you mean. I hadn't thought about that. However, it would be completely reasonable to treat this sort of time invariance as an external perturbation. In fact, I think there would still be better ways to deal with that, since it's a very specific type of perturbation that would be relatively easy to identify online.
For a good summary of how to do this with a simple RLS, check this out: http://ghost.engin.umich.edu/JournalPaperMassGrade_Final.pdf. (Remember, RLS is just EKF light.)
| Quote: | What I meant about simo is that you manipulate a voltage as the input to the system, and you want to control the current and the position angle as the system's outputs. Controlling the current can be done with a cascade type controller, like an inner loop to the angle controller, or it can be done directly with a state controller. The typical aproach of leaving it uncontrolled is not a very good idea, and what is usually done is just add a min/max limiter, but a full current control loop is better.
|
Ah, okay, I see what you're doing. I guess it depends on how you define your system boundaries. From my perspective, it's better not to lump cascaded loops together, as for a SIMO system there is no general anticipation of controllability.
What you have, if I understand correctly, is multiple SISO loops that feed into each other. However, there is not one universal system, where the SS equations can be written and a complete feedback solution be found. Perfectly reasonable... especially since it works! <grin> No use in reinventing the wheel, and as the nested dynamics are so much faster than the external loop dynamics, it's in fact a very good choice. I suppose you could fund a PhD (heheh) to write the complete system and find the optimal control, but that's sooooooo far beyond what you want to do or what makes sense to be done.
Cheers,
Kenn |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|