solenoid with compressor vi

Ok, I removed that code. The only Air Compressor code I have opens it and starts it in the begin.vi and closes it in the finish.vi.
However, the pressure switch does not turn the spike on and off. The LED status was green for the duration of the air pumping.

On a sidenote, teleop keeps switching from teleop enabled to disabled. I have no clue what is causing this, and i wonder if it is affecting my deployment.

Edit: So we have confirmed that the Pressure Switch is working, but the spike is not turning off since the led next to relay 1 is green the entire time. Is this a programming error or what? Screenshots would help alot.

The problem can be with the Pressure Switch or the code.
One test is to unplug the pressure switch while the compressor is running. If the Relay light goes out, then you have a bad pressure switch. If the Relay keeps going green, then I’d suspect a code problem.

Since the Spike is doing what the Digital Sidecar Relay LEDs are doing, then the wiring for that is working fine.

We unplugged the pressure switch while the compressor was running and the LED remained green, so it was a code problem?
I attached my Begin.vi, Robot Main.vi and Teleop.vi. Is the code wrong? The Spike, Compressor, and the Pressure Switch is apparently connected correctly.

Edit: Will upload code asap… the Screenshots are too big for this forum.
Begin+Robot Main: http://i49.tinypic.com/24uycr8.jpg
Teleop: http://i48.tinypic.com/sqqe8n.jpg

If you .zip them the forum accepts larger size .zip files.
Make sure they’re jpegs.

Well, what is wrong with our code? Do you need to see anything else?
Problem: Joysticks dont work(will explain this later) and Air Compressor does not shut off(Spike doesnt turn off) after the pressure switch opens(its normally closed, and it does open after it reaches about 120 psi)

For Joysticks:
Joystick 1 sends a signal to the both jaguars and they go in opposite directions(1 Jaguar is green, the other is blinking red).
Joystick 2 randomly sends a signal to the jaguar on the right(usually orange, randomly goes blinking red or blinking green).

With the lightbulb on, We have confirmed that pushing joystick 1 forward and not pushing joystick 2 gives the value of -1 and 0 respectively. It works vice versa also. So there is a screw-up somewhere in tank drive where the signals get mixed together or something.

I’d need to see your code to help much, but I don’t see anything.
Are you using imageshack or something like that?
Those sites get block by our school and there’s not even an indication that there is a picture in any of your posts.

Someone else will have to help with this problem…

P.S. When I get home I’ll be able to see what you posted. That is if they ever let me out of this shop…

One thing I noticed is that you’re opening and closing your robot drive in teleop, plus you still have references to the default robot drive in telop. You probably have conflicts in PWM assignments doing that. You also shouldn’t be opening and closing hardware like that, as telop is called 50 times per second. You should open it and save the device reference in begin. In teleop you should get the device reference and do something with it. It should be closed in finish.

I used tinypic. next time, ill just upload a zip file so everyone can access it.

Thats what we had. We had all that, and the only errors we were getting from the driver station were the watchdog errors. This was good, except that tank drive was not functioning properly(meaning each joystick controls its own jaguar which moves the motor its connected to).

I guess we are just having errors somewhere when everything is being referenced. maybe some other code is screwing around the data for the references because when we use joystick references instead of just opening joysticks on a USB port, tank drive screws up(I am sure i wrote this before, but ill do it once again. When i say tank drive screws up, i mean that in light bulb mode, the joysticks are giving the correct values[joystick 1 turns left motor, joystick 2 turns right motor]. When we run the code on the robot, Joystick 1 controls both motors and joystick 2 looses control of motor 2(it regains control for half a second randomly)

It would be really helpful if you could post or PM me some sample code(we dont have any examples installed in labview for some reason) that we could work off of.

I can see it at home.

Your Begin.vi code looks good. The only danger is we can’t see if you are opening multiple things like “USB 1” and “Drive Motors”.
P.S. One mistake is you open two different devices on Relay 1.

Your basic Teleop.vi code looks okay too, except for what Joe commented on.

The Compressor code in Robot Main.vi doesn’t actually do anything. It can be removed and you wouldn’t notice any difference in operation.
I’d refrain from adding anything at all to Robot Main on general principle.

I’m with Joe on the duplicate drive code. Without seeing the full Begin.vi it looks like you probably have a conflict where sometimes your code wins control and sometimes the default drive code you left in the False case in the top part wins control.

If you’re not using the default targeting code I’d recommend you just delete it from Teleop.
In Begin clean up opening the drive motors twice and any multiple Opens on joysticks you might have.

I’ll see if I can post a cleaned up version of your code later after lunch and a trip to Lowe’s for bumper plywood and aluminum tubing.

we were having this same problem of the compressor turning on and then immediately off as soon as the robot was enabled. now the compressor does not turn on at all. after reading several other posts i noticed that our relay leds on our digital side car are not lighting up and the led on our spike stays orange, it has never changed colors, i’ve tried fliping the pwm cable around but that seems to not have made any difference. we are using the example vi from labview to try to run this compressor and cylinder. does any one have any suggestions on how to get the relay to start working?

I copied your code into a new copy of the default robot project.
Robot Main.vi is left in it’s original untouched state.
All Opens are done in Begin.vi
All Closes are in Finish.vi
All uses are in Teleop.vi

I got rid of the duplicate drive motors and fixed the duplicate relays.


Teleop-sample.jpg

Begin.vi (42.7 KB)
Teleop.vi (19 KB)



Teleop-sample.jpg

Begin.vi (42.7 KB)
Teleop.vi (19 KB)

I see PWM2 being used for both the right drive motor and the camera base servo. That’ll have to be fixed before Mark’s code will do what is intended.

Ok, we now have Tank Drive running in Teleop(The problem was that we didn’t realize that there was Arcade drive code in the Teleop.vi which was screwing around with our tank drive. I fixed it, so its working now.

Now back to the thread.
I have very minimal solenoid code in LabView atm. I have a Solenoid Get Ref outside the Robot Main loop, and a Front Panel Boolean switch wired to the Solenoid Set inside the Teleop loop in Robot Main.

When we run the code(when i click on the boolean switch to go from false to true), the solenoids doesn’t fire the piston-type-firing-thing(no clue what its called). We know the solenoid works mechanically because we can press the button to release the air into the piston thing, and it fires.

my begin vi looks very similar to mark’s code. We have the solenoid we are testing in slot 1 on module 8, so wiring is not the problem.

That won’t work the way you think it will. The RefNum Get is very likely going to be executed before Begin.vi has done its RefNum Set, so the reference you’re passing to the Solenoid Set will be invalid.

I strongly advise you to leave Robot Main the way it started. Don’t change it from its default. When you want to add code, do it in the Begin, Teleop, and Finish vi’s, and maybe in the Periodic Tasks. Your solenoid code should be right next to your drive code in Teleop.

Hello All,

We’ve been having some problems with the compressor vi’s. We’ve followed the solenoid with compressor example and

are trying to do pretty much the same thing.

We are putting the Compressor Open.vi in BEGIN and assigning a refnum to it. Then in Teleop.vi we do refnum get

and inside the execute loop we have the refnum get wired to compressor start and compressor enable. We’ve changed

around where we put the start and enable vi’s- whether to go inside the loop or if they only need to be called

once.

When we look into the block diagrams of the open vi, it seems that this is where all the inputs get read, logic is

processed, and outputs set. The other compressor vi’s seem only to do monitoring and fifo stuff which we don’t

mess with. In the example, the compressor Open.vi is not in the loop and the only vi’s in the loop seem to change

the monitoring feedbacks.

Where should I put the compressor Open.vi? Where are the other vi’s supposed to go? DO WE NEED the other vi’s?

The programming manual says ‘After you open a reference to a compressor, you can use the start and stop vi’s…’

but the block diagrams for the start and enable vi’s don’t have anything to do with reading DIO get or relay SET.

In the Dashboard I can see the IO channel change state when I short together wires (for a long time) simulating

the contact closure/opening of the pressure switch. Just outputs never get set - the relay LEDs on the sidecar

don’t light, spike relay doesn’t change colors, and in hilight execution it doesn’t show the action taking place

within the compressor open.vi

We ran the simple relay example successfully and our solenoids are working elsewhere in the program.

any help is greatly appreciated!!

Team 1268 WHS Purgolders

The examples have a lot of things we don’t need.
As you noticed, the Enabled vi just tells us if the compressor is running or not.

The necessary compressor vi’s are just the Open and Start in Begin.vi.
They only need to be called that one time, not repeatedly.
It’s also good technique to close the compressor in Finish.vi, but it’s not absolutely necessary in this case.

Hello, I have a similar problem. I have the same goal that involves turning the compressor on when below 120 psi and turning it off when it reaches it. The code seems to be exactly the same as the images posted. Problem is that the compressor stays on forever. What am I missing that turns the compressor off? I have attached screenshots of my code to a zip file.

Pics.zip (92 KB)


Pics.zip (92 KB)

Is your pressure switch working and connected to DIO 14? On the dashboard, do you see DIO 14 change when the pressure reaches 120?

It seems that I had the wrong version of my team’s pin-out. It was supposed to be connected to DIO 8. It is working fine now.

Thanks