View Single Post
  #8   Spotlight this post!  
Unread 12-05-2014, 14:47
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,077
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Turning Robot with PID Feedback from Gyro

Quote:
Originally Posted by ArzaanK View Post
I will take that into account. So if I want the robot to turn at half speed I set P to 0.5, correct?
PID gains have real world units attached to them. They aren't just made up numbers.

Consider a simple P controller. It has the form:

Code:
output = Kp * error
What are the units of Kp? Rearrange the equation.

Code:
Kp = output / error
So Kp is a ratio between your output (in this case, the "turn" power from -1 to 1) and your error (in this case, degrees).

Commanding an output of -1 or +1 is like commanding a full speed turn with your joysticks during teleop. For most robots, that's probably pretty fast. Probably way, way too fast to accurately turn only 1 degree.

I would start with a really tiny gain and then move up from there. Try (1/90) or so. This would give full power when you are 90 degrees (or more) off of your goal, half power at 45 degrees off, etc.

What you will likely see is that your robot moves in the general direction of your goal, but stops a little short or overshoots a bit. At this point, you can try upping your P gain, or adding Ki or Kd gains (and by the way, the same principle applies: These gains also have units, and their units involve time as well). You may also find that limiting the maximum output of your PID controller is necessary to prevent overshoots (for example, no matter what, never go more than 50% of top speed).
Reply With Quote