![]() |
Pneumatics Code
Hey, thanks to some great help from Jon236, Alan Anderson and Mark McLeod, I think I got some code that *might* work with the pneumatics system...
If someone could take a look over it and maybe give me some pointers, that'd be great! (School is closed until Tuesday...Furlough days.:mad: ) Code:
#include "WPILib.h"One of my questions that I already have however, is with the Compressor.Start() I noticed in the Compressor.h file, there is a function called void SetRelayValue(Relay::Value relayValue). Does the Compressor class automatically call this is needed? From what I understand, calling compressorControl.Start() will turn on the compressor, and automatically keep the pressure to a certain level. |
Re: Pneumatics Code
Hey. Admittedly I don't have too much experience programming for the new control system (I was delegated to electronics this past year), but a couple things look kind of fishy. First of all, I don't think you're supposed to be disabling the Watchdog like that. From what I remember of the documentation and example code, you should be Feed()ing it. Also, I don't think doing
Code:
turret.Set(1)Code:
turret.Set(0)Code:
turret.Set(manipulator.GetRawButton(1))Code:
int shootercounter |
Re: Pneumatics Code
Another issue is the pressure switch doesn't behave the way you want.
The pressure switch value will only be 1 or 0. It will trip to 1 if the pressure is or falls below 95 psi. Once tripped it will remain at 1 until pressure rises to 115 psi. At 115 psi it resets to 0 and stays that way until pressure falls below 95 psi again. So part of the automatic compressor operation is built in to the pressure switch they send us in the KOP. You'd have to buy (fairly expensive) a pressure transducer to get a constant readout of current pressure the way you want. |
Re: Pneumatics Code
As for the watchdog, it doesn't matter for us now. We have been programming it that way, and whenever we did try feeding it, it would gives us Watchdog errors.
For the turret.Set(1) and turret.Set(0), I added a Wait in between them for 2 seconds. That should make the solenoid open up for 2 seconds, right? For the pressure switch readings, I guess that means you can't get it to be over 115 PSI? When we hooked it up manually (using 2 batteries and manually sparking them to fire) we fired it at 120 PSI, but we used a manual gauge thing. If I use compressorControl.Start(), does that mean it will never put the pressure above 115? |
Re: Pneumatics Code
Quote:
Start() will always cut off at 115psi using the current KOP pneumatic system and won't run again until the pressure falls to 95psi. There were some older KOP pressure switches that were set at 120psi and you might be able to buy a switch pre-set for 120psi. If you can't launch anywhere in the range of 95-115psi, then you probably want to use your own code rather than Start(). If your goal is to launch only at a particular pressure each time, then you'll either have to watch the gauge and operate the compressor manually, or dump enough pressure each use to trip the pressure switch (by dropping to 95psi) and let it build up to 115psi, or buy a pressure transducer. If it must be at 120psi every time, then you could force the compressor to run a minute more after the pressure switch cuts off to build up to 120psi. |
Re: Pneumatics Code
Okay, thanks a lot!
The only reason I had it test the pressure in my code, was because I wouldn't want it to fire if it only had like 60 PSI. :P As far as my solenoid firing, would that work? My thought was that it would switch the valves on the FESTO Solenoid for a second, allowing air to shoot out. |
Re: Pneumatics Code
With the Wait() added, as Jeremy suggested, the solenoid should operate the way you expect.
The solenoids we get in the Kit won't supply the fast, sudden pressure you need to launch a t-shirt though. There are different solutions for how to do the valve that other teams have used. T-shirt launchers have been talked about a lot on Chief Delphi, so check out some of those threads for how other teams have done it: |
Re: Pneumatics Code
Okay, thanks for answering all my questions. (I ask a lot. :P)
Maybe I could use the Axis camera to look at the pressure gauge...:eek: Edit: For the solenoid, although it is attatched to the spike motor, do I need to declare it as Solenoid firingCannon or Relay firingCannon? |
Re: Pneumatics Code
Declare it as a solenoid if you've attached it to the Pneumatic Bumper.
Declare it as a Relay if you've attached it to a Spike, controlled in turn by a Digital Sidecar Relay output. You can still do your check for sufficient pressure. Just never fire if it's "1" and wait for it to turn to "0" again. |
Re: Pneumatics Code
Okay, thanks.
If it becomes declared as a Relay, what is the equivalent of the Solenoid's boolean of 0/1? I assume kForward? |
Re: Pneumatics Code
A single solenoid like a Festo would be kForward and kOff.
A double solenoid would be kForward and kReverse. |
Re: Pneumatics Code
Quote:
|
Re: Pneumatics Code
Awesome guys, thanks.
I think I have some code that *should* work, I'll have to wait until Tuesday to find out... Thanks for answering my questions, I ask too many. :p I get bored if im not in school, and if I can't actually test my code. x_x |
Re: Pneumatics Code
3 Attachment(s)
Quote:
We only see one solenoid type in FRC. They are all simple coils that get energized or not, essentially, two single solenoids in one package. Typically, the major variations you'll see in wiring a double solenoid on FRC robots are:
|
Re: Pneumatics Code
Hey, I got an idea! :eek:
Since I can't really know the pressure (without buying an expensive item...we are flat broke for this project. :P) I decided to make my own gauge...thing. I made a new integer, called compressorValue, and I will use that to store the value of the pressure left. I can do some tests, and see how much pressure is used by firing one shot, and how much is added in X amount of seconds of the compressor running... But, this is where my question is. :/ Will the times change based on the pressure? Eg: Will it increase quicker at first, then increase slower as the pressure builds? Or is the compressor (the ones that came in the KoP) powerful enough that this resistance is negligible? |
Re: Pneumatics Code
You'll lose the same amount of pressure each time, down to 60 psi, so that part's consistent.
Restoring the pressure is a function of how much pressure is already in the system. The compressor takes longer the more it has to work against higher pressure. So, for example, pumping 5psi back into a system already at 110 psi will take longer than pumping 5 psi into a system at 60 psi. What you're suggesting will probably work for your purposes though. You don't have to be too exact. You can probably go with the time you measure when the overall system is down to 90 psi and you'd be fine. Then you could still check the pressure sensor for "1" and keep the compressor running as long as it doesn't turn back to "0". |
Re: Pneumatics Code
Cool, I wasn't too far off! :D
Looks like I have some system-of-equations to write tomorrow! |
| All times are GMT -5. The time now is 13:54. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi