Go to Post Figuring out how to do something is half of the fun. - Mike [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 25 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 25-12-2014, 11:05
GuyM142's Avatar
GuyM142 GuyM142 is offline
Registered User
AKA: Guy
FRC #3339 (BumbleBee)
Team Role: Mentor
 
Join Date: Jul 2013
Rookie Year: 2012
Location: Israel
Posts: 158
GuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really nice
Exclamation PID Help

Hey,
I'm the head programmer of my team 3339.

I want to teach my crew how to use PID properly and I'm having a hard time finding a good presentation that will explain each parameter and the general principals.

Moreover, I am looking for a simulation for PID in order to demonstrate how it works. The one I've found in LabVIEW is not responding fast enough as a real motor would.

Can you help me?
Reply With Quote
  #2   Spotlight this post!  
Unread 25-12-2014, 11:36
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,114
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: PID Help

There are many, many threads on CD and the general internet about PID control. Try searching around.

Here's some good resources from NI:
Quote:
Originally Posted by plnyyanks View Post
Additionally, if you search through NI's website, they have some great resources about PID theory (and their examples are in LV). You can also view the complete help page for the PID VI here.
And here are some more resources:
Quote:
Originally Posted by plnyyanks View Post
The PID VI is entirely mathematical - it doesn't care what the inputs are, all it does it brings the error of the system (Setpoint - Process Variable) down to zero. It will work exactly the same with encoder rates and distances, provided that the SP and PV are scaled the same way (and the constants are tuned properly). I'd be more than happy to explain how some of the math works, if you'd like.

As for your specific system issues, it just looks like the constants aren't tuned properly. Read a little bit about PID Theory (also: wikipedia) and take a look at some tips on designing a good controller (the rest of that page is helpful too). You may also want to start with the Ziegler-Nichols method for tuning (start with all zero, bring P up until it oscillates, add D to dampen and add I to correct for steady state error.

Just another note - if I remember, the LabVIEW implementation of the algorithm doesn't use Kp, Ki, and Kd as straight constants. It actually uses time constants for I and D (so it has Kp, Ti, and Td). You can see details of the NI implementation here. You can verify this in the help popup (ctrl-H) for the VI. Plan your constants accordingly.
And this page looks like it has some cool simulation resources, and some overviews about the theory behind the controller.
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android

Last edited by plnyyanks : 25-12-2014 at 11:40.
Reply With Quote
  #3   Spotlight this post!  
Unread 25-12-2014, 13:00
GuyM142's Avatar
GuyM142 GuyM142 is offline
Registered User
AKA: Guy
FRC #3339 (BumbleBee)
Team Role: Mentor
 
Join Date: Jul 2013
Rookie Year: 2012
Location: Israel
Posts: 158
GuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really nice
Re: PID Help

Quote:
Originally Posted by plnyyanks View Post
There are many, many threads on CD and the general internet about PID control. Try searching around.

Here's some good resources from NI:


And here are some more resources:


And this page looks like it has some cool simulation resources, and some overviews about the theory behind the controller.
Thanks alot!

I have question about the Labview implantation (your 2nd quote):
Should I use Ti and Td differently of what is written about Ki and Kd or is it the same?
Reply With Quote
  #4   Spotlight this post!  
Unread 25-12-2014, 14:53
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,114
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: PID Help

Take a look at this page specifically, it details the exact math behind each of the P, I, and D parts of the controller.
Integral:

Derivative:


So in the integral case, Ki = Kc/Ti. It's a similar thing for the derivative part.

Disclaimer: I have no idea if NI has changed their implementation since I last looked at it (a year or two ago), so verify exactly what constants are used with the 2015 docs when they come out.
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android
Reply With Quote
  #5   Spotlight this post!  
Unread 25-12-2014, 20:38
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 7,011
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: PID Help

One story I've found to help people understand is a car's Cruise Control. We all know that it's a system used to keep a car moving at a constant speed.

P is the difference between the set speed and the actual speed. When P is non-zero, the system takes action to move this 'error' towards zero.

D is how fast you want to accelerate (or decelerate) back to the set speed. You may want to adjust this depending on engine power: with a very weak engine would want to go to full throttle quickly, with a very powerful engine you'd want to add throttle slowly. If you add too much power, you'd go past the set speed and have to slow down...the system would go too fast then too slow, continuously.

I is a little tricky, but basically it's fine control right around the set speed, allowing small speed errors to accumulate over time and allow for corrective action (like P) that is gentle instead of a large response (like D)
__________________

I am N2IRZ - What's your callsign?
Reply With Quote
  #6   Spotlight this post!  
Unread 25-12-2014, 20:45
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: PID Help

I made a PID simulator to teach some of our programmers. It simulates an arm with or without gravity pulling it down.

Check out my post about it here: http://www.chiefdelphi.com/forums/sh...d.php?t=130801

For a sample of a well tuned loop, try setting a setpoint of 200, a mass of 0.03, kP of .35, and kD to 5, then click start.

The simulation is fairly realistic, and takes into account motor torque curves and the inertia of the arm.

Last edited by Jared : 25-12-2014 at 20:47.
Reply With Quote
Reply


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


All times are GMT -5. The time now is 20:11.

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