Hi all, it’s our rookie year in FRC and we have been struggling to figure out how to make the pneumatics run. There is no example code in WindRiver to help us figure this out; any sort of sample code or guidance would be appreciated. We have two solenoids, two outputs to the actuators, and one air input.
You can find code examples for various robot hardware components in the “WPI Robotics Library Users Guide”. Look for Pneumatics in the T-O-C. It gives an overview of the Compressor and Solenoid objects.
This document is available at the FIRST Forge site, WPI project documents section. The link is:
http://firstforge.wpi.edu/sf/docman/do/listDocuments/projects.wpilib/docman.root.c_and_java_documentation
Good luck!
Hi Teams!
Ask and ye shall receive. This is a very simple program that exercises solenoids 1-6 on slot 8 and 1-5 on slot 7 (I only had 11 buttons on my joystick). It also turns on the compressor and allows for control of the compressor. It’s pretty basic, but it should give you a leg up.
Enjoy,
Mike
sample-compressor.zip (1.18 MB)
sample-compressor.zip (1.18 MB)
Thanks for this code!
hi,
I’m still confused after reading these examples. we’re trying out pneumatics code also - it goes as follows:
arm_button1 = arm_stick.GetRawButton(1);
if (arm_button1)
{
s1.Set(0);
s2.Set(1);
}
else
{
s1.Set(1);
s2.Set(0);
}
I’ve declared s1 and s2 as Solenoids under the Class section, and initialized them as s1(1,1) and s1(1,2) in the Public section. But they are connected to pins 1 and 2 on the Digital Output Module. Which numbers in parentheses refer to the pins of the DOM? How can we trouble shoot this? we’re not getting any response when we press button 1 on our joystick.
some further comments - we are getting 12 V to the Solenoid break-out - the LED is lit up.
If you’re seeing the solenoid bumper LED come on, then you’re doing everything right as far as the software is concerned. Now, you’ve got to trace the wiring from the bumper to the actual solenoid switch. If that’s correct, you should hear a click as the the solenoid is engaged. From there, it’s all about the pneumatics plumbing, pressure switch, etc. I’m not the pneumatics guy. So, once it’s bits on the wire, it’s a hardware problem ;-).
Mike
we’re trying to use a 24V Festo solenoid for some reason, which we are switching out today.
The first number in parentheses is the module number. Solenoid modules are only supported in cRIO slots 8 and 7. You should probably be initializing them as s1(8,1) and s1(8,2) instead.
what are you talking about when you say the ‘solenoid bumper LED’? is this different from the LED on the board showing that it’s getting power? we switched out the solenoid, but it’s still not ‘clicking’ when we press the appropriate button (1, in this case) on the joystick.
Alan, we have the solenoid valves connected to pins 7 and 8 of the solenoid break-out board. I have the Solenoid declaration for s1 and s2 in the Class section, then s1(8,1) and s1(8,2) declared in the public section - something doesn’t seem right here - how does pin 7 enter into it?
When you supply two numbers to a solenoid initialization, the first one specifies the module number and the second one specifies the output pin number. There are eight slots in the FRC-cRIO chassis. Slots 1 and 2 support analog input modules. Slots 4 and 6 support digital I/O modules. Slots 7 and 8 support digital sourcing modules, which are used to control solenoids. Each solenoid breakout has eight outputs, numbered 1-8 (though the eight green LEDs on the module are actually labeled 0-7, giving a potential cause for confusion).
s1(8,1) defines the solenoid object as being associated with pin 1 of the pneumatics breakout connected to a digital sourcing module in slot 8 of the cRIO.
s1(8,2) defines the solenoid object as being associated with pin 2 of the pneumatics breakout connected to a digital sourcing module in slot 8 of the cRIO.
so we had the wrong module in the crio - we’ve now put the 9472 in - and we see the lights for pins 7 and 8 flashing as we pull the trigger on our joystick. But there’s no juice getting to the solenoid. I made a type in my previous email, we’re initializing s1(8,1), s1(8,2). i’m still puzzled about how this works when we’ve got the solenoid valves connected to pins 7 and 8.
sorry, the WPI LIB comments are not that helpful since they are using pointers. i’m not much of a C++ programmer.
Are you running 12V or 24V solenoids? If 12V, you need to power the solenoid breakout from a 20A circuit from the power distribution board. If 24V, you need to power the solenoid breakout from the 24V header on the power distribution board (the same header the cRIO is powered from).
If you are powered properly: each solenoid has a manual button. Press the button with a small screwdriver or other pointed object. If the solenoid works, it is getting air and electrical power – the problem is in your code. If the solenoid does not work, or no lights light up, you probably have a wiring problem. Have you done a continuity check of your wiring? Try reversing the two-wire connector on the solenoid breakout.
Good luck.
the constructor takes two arguments, (modulePort, breakoutPort)
modulePort is the number of the module in the crio’s 8 bays. It should be 8.
breakoutPort is the pin number on the breakout board on the module. It should be 7 and 8 according to what I think you are saying.
If you want to wire to 7 and 8, use s1(8,7), s1(8,8)
if you want to use s1(8,1), s1(8,2), wire to breakout pins 1 and 2