Double pid loop

2.7k views Asked by At

I am working on a robotic project, that involves controlling the position of a large robotic arm. The suggestion was to use a double PID loop, and I am wondering what is involved in this.

As it was described to me, the first PID loop should deal with the speed of the arm (as it is expected to be heavy and long and thus "harder" to control) and then a second to control the position of the arm and feed its value into the first PID.

I have used PIDs before, by following the table provided on wikipedia to calibrate the loop. (AKA: Do not assume that I will be able to use a complex method to calibrate the loop)

So I am looking for some good sources to help in how to calibrate the loops, and also a little bit of information (pseudocode) on how to get this working, plus if this is even a good idea.

2

There are 2 answers

1
Jim C On BEST ANSWER

Most robot arms have a low level current loop for controlling motor torque, another low level voltage loop for controlling velocity, and a higher level position loop for controlling motor position. To the extent possible you want to set up a feed forward system to account for known effects like gravity and friction. You want the low level loops to run as quickly as possible. The higher level position loop can be somewhat slower. For example the low level loop may run at 5Khz (every 0.0002 seconds), the position loop at 250 Hz (0.004 seconds).

0
Throwback1986 On
  1. Simulate your loops. I can't stress this enough (particularly if you will be employing manual tuning methods). If you have access to it, Simulink is the way to go. If not, there are other approaches to model an arm.

  2. If you are certain that two loops is the best approach (and I'm not convinced), then first break the problem into two distinct control loops and solve them independently. As an example, first develop a velocity loop to achieve and maintain a speed target with acceptable control performance. Then, develop a displacement loop to achieve and maintain a position using some small number of fixed, discrete speeds.

  3. Once these two problems are solved to your satisfaction, you can use the displacement loop to set targets for the velocity loop. This is where simulation becomes vital: the control systems will be nonlinear (but you are effectively assuming a reasonable measure of linearity when applying constant-coefficient PID). You are compounding that non-linearity by using the displacement loop to set a variable target for your velocity loop. The timing will be critical: the displacement loop must give the velocity loop some time to achieve a target goal before setting a new speed target.

  4. Tuning is going to be a challenge. I solved a complex PID problem by avoiding tuning altogether. Instead, I used a simulated annealing algorithm to discover the best PID coefficients. Note that this approach assumed two things: a) the problem could be reliably simulated, and b) the existence of an objective performance criterion.