Estimated_current and velocity mode: high current at standstill

Hmm, you may have found a true bug in the PID.

Since error and prev_error should both be zero, integral just gets set to integral_prev, i.e. it’s probably sitting there non-zero commanding torque, but since the motor is unable to move due to stiction/cogging, nothing ever causes it to change. But it looks like it’s been that way since the beginning, so I don’t know how it could have gone unnoticed for so long, nor do I have enough experience with PID controllers to propose a solution.

Try printing out motor.PID_Velocity.integral_prev to verify this is the problem. Comment out protected: on line 41 of pid.h so all the variables are accessible by outside code.

To quick-test your thesis, I will set I = 0. It will change the behaviour during acceleration, but standstill should be clean.