View Single Post
  #22   Spotlight this post!  
Unread 07-02-2014, 17:48
Jared's Avatar
Jared Jared is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Connecticut
Posts: 602
Jared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond repute
Re: Arm Position Control

Quote:
Originally Posted by apalrd View Post
In PID:

-P is the error of the position
-I is the accumulated error of position (steady state error)
-D is the velocity and often opposes the other two terms

A proper D gain will compensate for the velocity. With all of the gains set correctly, there will be a point where the error is so great that the sum of P, I, and D is larger than the motor's max output, so the negative D term will have no effect. As the arm slows down, the D term will compensate for the velocity (inertia) as the arm approaches the target.

When I calibrate PID loops by hand, I usually only end up with a PI controller. I have tried to add D manually with little success. When I calibrated automatically (using the ultimate stability method), I found that the D gains were many times what I was getting by hand, but the system worked beautifully.

On a side note, I autotuned a full PID loop on two VRC robots (relatively high intertia, fast gear ratio, more counterforce than gravity long arms) and found that a single PID gain set was adequate. On a cam driven linkage on our 2012 FRC robot, I needed to schedule the gains because the motion ratios changed significantly over the stroke.
It's really tough to get a D term to compensate for the inertia of an arm. In order for the D to really affect the system the way you want it to kD must be fairly large, which requires that kP and kI be pretty much perfect.

You could also adjust your gains based on where the arm is.

The way to tune this is to set up three or four different PID loops, each of which are tuned to make the arm respond nicely when going to a specific place. Then, you can take your kP/kI values that work for each of the locations and find a nice curve that fits them and use that curve to modify the gains based on where your arm is.

As for preventing integral wind-up, I just turn off the I term until we are withing 10 percent of the target.