Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Shooter PID loop (http://www.chiefdelphi.com/forums/showthread.php?t=102133)

Teamcodeorange 06-02-2012 20:11

Shooter PID loop
 
I know this has been asked many times before, but none of the answers I found are clear enough for me. How exactly do I program a PID loop to make sure our shooter is at the right rpm, compensating for variables such as battery voltage?

I know labview pretty well but PIDs look really complicated. We have a flywheel shooter with a US digital encoder. I would like to be able to input any rpm value I want (eg 1-8000 rpm) and have the motor automatically speed up or slow down to ~+/- 100 rpms of the requested speed.

Any help is greatly appreciated. ::safety::

Ether 06-02-2012 20:33

Re: Shooter PID loop
 
Quote:

Originally Posted by Teamcodeorange (Post 1121276)
...I know labview pretty well but PIDs look really complicated.... How exactly do I program a PID loop

You don't have to program it; that's already been done for you. There's a PID vi in LabVIEW.

Your desired speed goes to the setpoint input. The encoder signal goes to the process variable input. The output goes to the motor.

You will have to "tune" (adjust) the P I and D gains to make it work right.

Quote:

none of the answers I found are clear enough for me
Ask some specific targeted questions.


Teamcodeorange 06-02-2012 20:52

Re: Shooter PID loop
 
1 Attachment(s)
Quote:

Originally Posted by Ether (Post 1121292)

Ask some specific targeted questions.


So what do I do from here? I am kind of a noob in complex data management.

kuh-nig-its-EL 07-02-2012 15:15

Re: Shooter PID loop
 
It may be easier for you to use a CAN jaguar instead. CAN will do most of the PID work for you and there is an example already in labview for it. It's actually quite simple. For PID calculations try using Ziegler–Nichols method. Just keep adjusting P until you get a set oscillation and then the rest is easy.

-Ethan Lopez

j.cole 07-02-2012 15:48

Re: Shooter PID loop
 
@Ether You can't simply put the encoder into the PID process variable you have to find the speed of the motor using the encoder and put that into there. Correct? Unless I'm missing something.

Ether 07-02-2012 15:59

Re: Shooter PID loop
 
Quote:

Originally Posted by j.cole (Post 1121763)
@Ether You can't simply put the encoder into the PID process variable you have to find the speed of the motor using the encoder and put that into there. Correct? Unless I'm missing something.

You have to scale the process variable (the encoder signal) and/or the setpoint so they have the same range and offset.

Examples:

If your process variable (encoder signal) has been scaled to represent RPM, then you have to scale your setpoint so it also is in RPM (and not, say, -/+1).

Or you can do it the other way. If your setpoint has been scaled so that it has the value +1 when you want MaxRPM, and it has the value -1 when you want -MaxRPM, then you should scale your encoder signal so that it outputs +1 when the device it is measuring is spinning at MaxRPM, and it outputs -1 when the device it is measuring is spinning at -MaxRPM.


Tommy F. 07-02-2012 16:29

Re: Shooter PID loop
 
1 Attachment(s)
Quote:

Originally Posted by Teamcodeorange (Post 1121300)
So what do I do from here? I am kind of a noob in complex data management.

From there, I would go to "Help" > "Find Examples..." and in the NI Example Finder search for "PID" and look for the General PID Simulator.vi (or any other one you would like to use)

In the block diagram of the example, I would copy the PID gain cluster and the bundle + chart with the PV Setpoint Output label, so your code might look something like below.

Attachment 11791

I like to include the graph so that the gains are easier to tune, as well as using the controls so you can adjust them while the code is running. (When you get the gains the way you want them, be sure to write them down and take out the controls and replace them with constants; they tend to reset themselves.)

Teamcodeorange 07-02-2012 20:02

Re: Shooter PID loop
 
Thanks guys! I'll try to work off of that.:D


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

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