Single axis motion control from Kuka KRC


Thread Starter


So this application seems extremely simple and I am sure there are a few ways to do it. I am trying to control an external hydraulic axis from a Kuka KRC2 robot controller. The requirements seem very low, so I would like to think it can be done with a minimum of additional components. I just want to position a rotating shaft(using chain coupled hydraulic cylinder). I plan to put an encoder on the shaft. I don't really care how smooth or for that matter accurate the "path" is, I only care about the final angular position of the encoder(don't want to overshoot much of course).

I am sure I can do this with an external controller/drive on a servo proportional valve, or a simple analogue proportional valve, closing the loop there.

I feel like a "simpler" (less hardware) solution would be to close the loop inside my robot controller. I have to admit I got a D in my controls class, and that was 10 years ago! I know what a PID loops looks like, but I have never written a controller program.

I found the "pseudocode" for a PID loop...amazingly simple:
previous_error = 0
integral = 0
error = setpoint - actual_position
integral = integral + (error*dt)
derivative = (error - previous_error)/dt
output = (Kp*error) + (Ki*integral) + (Kd*derivative)
previous_error = error
goto start
Nothing there that couldn't exist in KRL, probably write a while loop and exit when the error is low enough. The accuracy in this case will be limited more by real world mechanicals of the system, than by the ability to hit the position target.

I have posted this on another well know robot forum, I just thought I would ask here if there were any people familiar with programming KRC controllers, who knew if this was possible or if I am missing something big.