Quote:
Originally Posted by ozrien
Attached is an excel sheet demonstrating a few examples of how to do this.
|
If I may:
Let P be your present angle sensor reading (converted to degrees)
Let T be your desired angle position (in degrees)
the angle between them (let's call it ERR) is found by the equation:
ERR = (T-P) - 360*floor(0.5+(T-P)/360);
the above returns a value for ERR between -180 and +180 degrees,
the shortest angle path to the target.
So it tells you which direction to rotate as well as how much to rotate.
So compute your setpoint:
SetPoint = P + ERR