The version2 of the firmware is accessible on my Github
It's a "strong PID" tuning where the motor reaches its target. in one shot.
PID coefficients are quite agressive, but overshoot is very limited and motor does not oscillate.
//PID stuff
input = getMotorPos();
Kp = 6000; // start with an almost fully proportionnal PID
Ki = 20.;
Kd = 100. ;
myPID.SetTunings(Kp, Ki, Kd);
myPID.Compute();
A compensation factor of the "inertia" of the rotor is introduced (should be tuned if you change motor).
#define INERTIA 1155./4096. //inertia of motor when stopping (PID over shoot on sensor position)
This acts as a bias to setpoint value.
//turn the PID on
setpoint = targetRot - INERTIA; //setpoint is this target number corrected of the INERTIA bias
Results are impressively good !
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.