Quote:
Originally Posted by Ether
What was the little issue you found?
|
Using motors, I found little consistency (and a ton of undershooting) due to the fact that motors don't overcome inertia until a certain point. So I solved this by writing a linear equation to map the entire range of -1.0 to 1.0 into the effective range. The equation looks like this, where z is the minimum percent that overcomes inertia and x is the desired speed:
(1.0 - z)x + z
Hope this helped someone out there, I was very happy about how well my controller worked after I made this adjustment.
I also want to mention I would totally recommend writing your own PID controller anyways. The math behind a basic one isn't complicated and I have a much better understanding of why a PID controller works now that I've written one.
Edit: Should also mention that while I could probably have adjusted Kp to a perfect point, my mentor had been messing around with WPILib's PIDController for over a week trying to perfectly tune and still couldn't get it even close to consistent, which made me want to make my own implementation.