I understand how a general single input PID controller works, but I'm having trouble understanding how to calculate the ERROR in a multi-input PID controller? For the sake of clarify, let's take the example of a PID controller in a line-following robot. For a single light sensor line-following robot, the pseudo code is something like this:
Kp = 10 Offset = 45 MaxMotorSpeed = 50 Ki = 0 Kd = 0 LastError = 0; Loop forever LightValue = read light sensor ERROR = LightValue - Offset integral = integral + ERROR derivative = ERROR - LastError Turn = Kp*error + Ki*integral + Kd*derivative End loop forever
However, how would you set up the ERROR variable for the PID controller of a line-following robot that has, say, 3 light sensors intended to go across the line in a straight configuration?
Any guidance here would be much appreciated. Thanks in advance!