I'm getting lazy, so I'm going to switch to the laplace domain in this following explanation. If you or anyone has trouble following, I'll clarify by request. After a while working with differential equations, I get tired of typing d/dt... (Without going into the details, you can pretty much replace s with d/dt, and 1/s with an integral)
Quote:
Originally Posted by techhelpbb
This is correct in a strictly academic sense physics prevents perfectly achieving the set point with just the P. The P loop should not get exactly to the goal and should be offset usually below the goal short of disturbance.
However, why such a huge error?
|
For our robot last year, the actual constants we have successfully used are as follows.
Code:
num_motors = 4
m = 150 / 2.20462262
r = 0.0508
R = 12.0 / 133.0 / num_motors / 0.85 + 0.024 + .003
Kt = 0.0182326082
Km = (12.0 - R * 2.7) / (5310.0 / 60.0 * 2.0 * math.pi)
G = 40.0 / 12.0 * 48.0 / 15.0 * 22.0 / 15.0
The transfer function for the robot driving strait controlled by a voltage is
Code:
V = Km * G / r * s * x + R * r / (Kt * G) * s^2 * x
Let's let V = (ref - s * x) * Kp
The transfer function from ref to s * x (ie, if you ask for a velocity, what do you actually get) is then
Code:
s * x / ref = Kp/(Km * G / r + Kp + R * r / (Kt * G) * s)
At steady state, (ie s=0), this evaluates to
Code:
Kp / (Km * G / r + Kp)
This is different from what you get if you try to do position control with V = (ref - x) * Kp
Code:
x / ref = Kp/(s Km * G / r + Kp + R * r / (Kt * G) * s^2)
At steady state (ignoring friction, and s=0), this says that for any Kp, the transfer function will be 1. This means that ideally, a P loop with position control will seek to the goal perfectly. Now we know that not to be true if there is a bit of coulomb friction in the system, but that is distinctly different from using a P controller on the velocity loop. On the ideal velocity loop, you only get 0 steady state error if Kp -> infinity.
Quote:
Originally Posted by techhelpbb
I mean if you've got people with 50% error is the feedback that far off the actual measurements?
|
To me, that sounds like Mr Lin has set Kp = Km * G / r, which gives you a steady state error of 50%. That would evaluate to about 6.6 for our 2010 robot in low gear. Assuming velocity is measured in meters/sec, and the jaguar takes volts as it's input, which is probably not the case for the supplied control loop. This doesn't surprise me at all. A P controller driving the robot at a velocity will start to exhibit discrete time oscillation effects if the P constant is too high. (I can show this if you don't believe me)
Quote:
Originally Posted by techhelpbb
At least our system is sitting at 10-15% error at least on one version of the Jaguar as long as we keep the P gain low enough to avoid instability and that's with I and D set to 0.
I wonder if they are tuning under load on the ground. That would do it.
|
It sounds like your P constant is higher than Mr Lin's. Since the Jaguar is implementing a discrete time PID controller, if you crank up the P constant too high, it will go unstable. This is due to the discrete time poles leaving the unit circle, even though the laplace poles are in the left half plane.
I'm going to take the position that if someone is using just a P controller to try to get the robot to drive at a velocity, they are doing it wrong. They should first start with the I term, and leave the rest of them 0. Would you every try just using the D term in a PID loop when trying to go to position? You'd say that the person was doing it wrong if they did that.
Lets show this. Let V = (ref - s * x) * 1/s * Ki, ie a simple I controller.
This gives
Code:
sx / ref = Ki / (Ki + Km * G / r * s + R * r / Kt * G * s^2)
Evaluating the transfer function at steady state says that for all Ki, the transfer function is 1. This means that Ki will get you to the desired velocity. That is a good thing. Too much Ki will give you overshoot, but that's the same thing as a position P controller.
If you pattern match, this I controller for velocity control has the same form as the P controller when doing position control. This says that the I term in the Jaguar's velocity loop acts like the P term in the Jaguar's position loop. A similar analysis will show that the P term in the Jaguar's velocity loop acts like the D term in the Jaguar's position loop.