PowerBroker2/ArduPID

how to tune setOutputLimits for two different motor?

arn0b-68 opened this issue · 1 comments

I am using this code to control the speed of two dc motors. But the output is not what I am expecting. I have set the bias to 0 as I only wish to get the PID value for my error. As I am using two motors and want them to work like differential, I plan to manually add and subtract the PID value with my motor's base speed (base speed = 200).
But the problem is when I set output limits to (0, 255), after mycontroller.calculate() I am getting an output value of either 0 or 255 resulting in my ultimate motor speed1 = base speed + output = 455 and motor speed2 = base speed - output = -55. But I expect a value between 0 and 255 depending on the error. Any hints on how I can achieve that?

I'm not sure I understand your approach/issue, but regardless: the bias is the output bias. Usually, this is set to the midpoint between your min and max output