View Single Post
  #4   Spotlight this post!  
Unread 06-02-2016, 22:43
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: PID Controller behaving erratically

Set the kP just low enough that you don't get oscillation. As you've seen, that doesn't always give enough power to get to the desired target, and you get a steady-state error. Now increase kI just high enough to overcome that error. Then tweak kD to account for rotational inertia so it doesn't overshoot badly and oscillate again.

It helps if you can modify the PID constants while the code is running. Perhaps you could use SmartDashboard for that.