View Single Post
  #3   Spotlight this post!  
Unread 31-01-2011, 15:22
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Any PID experts ?

There are two pieces of code necessary to do everything you want: PID (probably more like PD) and a gain scheduler.

What P/PD/PID will do for you:
*If you jack up the gain, it will run at max output power until it gets close to its target (P)
*If you tune it correctly, it will slow down faster if it is moving faster (D)
*If your motor will not burn out at very slow speeds, it will keep going after P gets to the motor deadband (I) to get to an exact position

P and PD are usually used to do this. We will be using P and if we have issues we will add D. You can write them all, and set the gains of non-used terms to 0.

What a gain scheduler will do:
*Adjust the gains of the terms depending on machine dynamics, such as gravity (adjust gains based on sign of error) or other factors.

You could also add a "friction bias", where you add a constant to the motor all the time. Then, what the PID algorithm defines as "0" actually is turned into a very low motor power to hold the mechanism in position.

If properly written and tune, it will work well.

(p.s. potentiometers are absolute and don't need to know their home position)

My suggestion:
Write a P controller with a gain scheduler and see how well it works. If you have issues with overshoot at high speeds, you can add D and tune that.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack