Background: A robot uses two encoders attached to each rear wheel for feedback of speed. The program reading the encoders reads pulses per time unit. The encoders are sufficiently linear. The actuators are two DC motors attached to each rear wheel. They are controlled with PWM signals. So the controlled output signal is speed.
Problem: A PID controller is used to ensure that the robot wheels turn at the same speed so the robot can follow a straight course. The problem is that the program reads pulses/s while the output from the controller must be a PWM signal (a duty cycle value between 0-100). The system also faces different loads (varying surface friction and incline).
Questions
- How do I convert between the two units (i.e. pulses/s vs PWM) in the program?
- Even if I find a linear relation between input signal and output signal, doesn't this only hold true for a certain load (i.e. a certain surface friction and incline)?
- If the answer above is yes, then what purpose does a PID controller even have in this system?
PWM=Kp * (Pulses/time)
. So to be consistent yourKp
will have the units ofPWM*time/pulses
. But since you are simply tuning the controller by adjustingKp
as a dimensionless number, you really don't care about this. If you add other terms (I and D) to the controller, each will have other units, which are still transparent to you. \$\endgroup\$