Go to Post You can't just leave us hanging! That was SOOO 2010! - nighterfighter [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Spotlight this post!  
Unread 11-01-2010, 22:44
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: PID Control

PID stands for Proportional-Integral-Derivative
Each is a "term" and the result of each is added to get the motor motion or change.
Proportional is, well, proportional to the difference between where you are and where you want to be. Basically, you say error = want - at, and then multiply that by a constant that testing reveals to be correct (the highest number without too much overshoot). Integral is the integration (sum) of the already corrected error, and gives the offset that should have been previously corrected.Derivative adjusts the rate of change by determining the slope of the error, the rate of change. This helps to even out noise.
Each term is multiplied by a gain that is statically set and manually tuned - this determines how much affect each term will have on the final output. It is also possible to switch from several gains based on set conditions, for example if you have a multi-jointed arm you might change the gain of the shoulder based on how far out the end-effector is from the shoulder, to prevent tippage when far out but allow it to move fast when tucked in.
PID is used in closed-loop control, basically you set a setpoint and it actively works to achieve it. This can implement itself in various ways, such as checking the angle of a potentiometer and adjusting it with a motor (used for angle control), checking the speed of a motor using an encoder and making it correct (useful for shooter wheels or such that must run at a certain speed), or even during autonomous to get the accumulated angle of a gyro and turn the chassis to acheve the desired angle, or setting the distance to travel and actively trying to get there without overshoot.
The standard FRC LabVIEW installation includes a PID toolkit - that can help. All you need to do is set the gain of each term.
If you want to learn how to do I would recommend implementing the simple Proportional control, tuning it, and seeing how it works. If you have problems, add either I or D depending on the problem. If you still have problems, add the other one.
One very very important thing to remember when working with potentiometers - if you turn them past their limit, they will break. Make sure that a positive motor direction = positive change in voltage. If this is not so, multiply the output by -1 or swap the wires on the OUTPUT side of the speed controller or the motor input. You could also swap the RED and BLACK wires on the pot.

As for where to start....
If you have large articulating structures on your robot, the most useful would be to use a potentiometer and a motor to control the angle. This would allow you to baically have a giant servo.
If you want to do autonomous stuff, then try to control the rotation (X on an arcade drive) using a gyro and a desired angle. When you get close to the desired angle, it will automatically slow down as the gain decreases and you will have a perfect turn.
And one last tip:
Always limit the output to -1 to 1. This is the range of the output and it is always good practice to do so. Do not rely on the WPIlib to do it for you.

And wikipedia has an article on the subject.
__________________
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
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PID traction Control dpeterson3 C/C++ 5 26-01-2009 21:11
PID Control John Gutmann Programming 12 15-04-2007 18:52
Generic PID control code Uberbots Programming 3 26-02-2007 16:59
PID Control Chris Bright Programming 9 26-03-2005 19:44
PID Control Loops ttedrow Programming 7 05-12-2002 12:03


All times are GMT -5. The time now is 04:22.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi