View Single Post
  #4   Spotlight this post!  
Unread 17-01-2011, 11:56
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,101
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: PID Speed Control

Quote:
Originally Posted by JewishDan18 View Post
I was looking to use encoders to control the speed on the motors via a PID loop this year. I've done a lot of searching, and have not found the answers I'm looking for. I have no experience using PID loops, so bear with me for a moment.

Using the WPILib PIDController, I made a wrapper for the encoder to get speed, but I'm a little confused about the output. If I use the Jaguar for the output, it seems to me that as the robot approaches my desired speed, the motors will slow down (since error will approach zero).
Yes, the motors slow down, but... they slow down to the "desired speed" (not to zero).

Think of it this way: a PID tries to drive the error to zero. Since your error is a "speed error", when the error is zero, it means your actual speed (measured by the encoder) is equal to your "desired speed" (the command you are sending).

If you use only the "P" term of the PID, you will always have a small speed error. That's where the "I" term comes in. The "I" term causes the PID to keep slowly bumping up (or down) the speed as long as the speed error is non-zero.

The "P" term gives you dynamic response, the "I" term gives you steady-state accuracy.




Last edited by Ether : 17-01-2011 at 12:02.
Reply With Quote