|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
||||
|
||||
|
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. ![]() |
|
#2
|
||||
|
||||
|
Re: Shooter PID loop
Quote:
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:
|
|
#3
|
||||
|
||||
|
Re: Shooter PID loop
So what do I do from here? I am kind of a noob in complex data management.
|
|
#4
|
||||
|
||||
|
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 |
|
#5
|
|||
|
|||
|
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.
|
|
#6
|
||||
|
||||
|
Re: Shooter PID loop
Quote:
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. Last edited by Ether : 07-02-2012 at 16:07. |
|
#7
|
||||
|
||||
|
Re: Shooter PID loop
Quote:
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. 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.) |
|
#8
|
||||
|
||||
|
Re: Shooter PID loop
Thanks guys! I'll try to work off of that.
![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|