View Single Post
  #5   Spotlight this post!  
Unread 04-02-2016, 23:11
Dan Waxman Dan Waxman is offline
Registered User
FRC #0263 (Aftershock)
Team Role: Programmer
 
Join Date: Feb 2016
Rookie Year: 2016
Location: Long Island
Posts: 34
Dan Waxman is an unknown quantity at this point
Re: Problems with Encoders

Quote:
Originally Posted by Ether View Post
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.

Last edited by Dan Waxman : 04-02-2016 at 23:16.
Reply With Quote