Log in

View Full Version : solenoid and compressor code


johncap100
24-02-2010, 16:03
I have checked out the example in labview of solenoid and compressor vi. It is doing what I want and i have been able to deploy it by itself. I was wondering if anyone could give me some hints on how to incorporate that within the default arcade program i am running.

thanks Much

Mark McLeod
24-02-2010, 16:57
Does this help: http://www.chiefdelphi.com/forums/showpost.php?p=907769&postcount=15 ?

johncap100
24-02-2010, 21:00
so do i just need to set up the begin vi file like you show in the screen shot
and it should work?
I also have the solenoid set up with control on the joystick trigger in teleop and autonomus.

the solenoid and compressor is quite a bit different than your screen shot,
does that matter?
thanks much John

Mark McLeod
25-02-2010, 10:18
In Autonomous you don't want to use a joystick trigger. There are no joysticks in Autonomous. The Drivers stand back from the controls about 4 feet. You'll want to trigger the solenoid (Create -> Constant) at a certain time or if you have a sensor that detects when a ball is in range of your kicker.

The compressor should be just as it's shown in the Begin.vi I posted.
If yours is significantly different you should post a photo or tell us what differs.

The solenoid action can be quite a bit different. There are lots and lots of ways to handle that.

I also have the solenoid set up with control on the joystick trigger in teleop and autonomus.

the solenoid and compressor is quite a bit different than your screen shot,
does that matter?

johncap100
25-02-2010, 13:09
thanks for the info, yes i don't have the solenoid actuated with the trigger in autonomous, only in teleop.

so i only need to place the compressor in the begin vi, not in the teleop portion of the robot main vi?

thanks john

Mark McLeod
25-02-2010, 13:14
so i only need to place the compressor in the begin vi, not in the teleop portion of the robot main vi?

Yes, the compressor Start in Begin.vi actually spins off a background task that keeps monitoring the pressure switch and turning the compressor on & off as necessary, either in Autonomous or Teleop. Whenever the robot is disabled it won't be allowed to run the compressor, but it'll be trying it's best.

johncap100
25-02-2010, 16:35
ok so I set up the compressor like you had it in your begin vi. I deployed it but two things occurred, the compressor started when i enabled the teleop on the drivers station, but it did not shut off in response to the nason switch.
also i noticed that the arcade driver did not work, is that what will happen until the nason switch shuts off the compressor?, I am guessing that the arcade did not work because the compressor did not shut off?

In your begin vi where is the compressor supposed to react to the pressure switch. I put the pwm from the pressure switch into the slot 1 on the side car as instructed in the example of solenoid and compressor.

so what should i do next ?
thanks john
thanks John

Mark McLeod
25-02-2010, 22:29
Arcade has nothing to do with the compressor. That's going to be something else.

What's the highest pressure the gauge reads?
It should turn off when the pressure reaches 120psi.

The pressure switch tells the code when to turn the compressor on and when to turn it off. You can verify correct compressor operation by:
Disconnecting one of the wires from the pressure switch - the compressor should turn off.
Touch the loose wire directly to the other wire that's still connected and the compressor should come on.In Begin.vi you specified where the pressure switch is plugged in as well as where the compressor Relay is plugged in. Verify that both are in the right spots. If you used the default values those will be:
Pressure Switch = Digital IO #1
Compressor Spike = Relay #1The Start does the actual constant checking of the pressure switch. You can double click on that icon to drill down and see how it works.

johncap100
26-02-2010, 13:31
ok i got everything working, i simply used your begin vi and got rid of any references to the compressor in the teleop, thne in the finish, i put the close reference, works good now
thanks john

jman1783
28-02-2010, 17:48
Do we have to put the code in the begin and finish VIs? We have our compressor code working with the code in the teleop VI (not using autonomous mode), but we can't get our solenoid code working.

I'm not quite sure where to open the compressor, solenoid, and joystick VIs.

Mark McLeod
28-02-2010, 18:48
All Opens belong in Begin.vi

They definitely do NOT belong in teleop.vi -- or else you get 50 Opens per second resulting in 6,750+ Opens for each device, and heaven help you if you didn't Close them too...

Alan Anderson
28-02-2010, 21:34
All Opens belong in Begin.vi

They definitely do NOT belong in teleop.vi -- or else you get 50 Opens per second resulting in 6,750+ Opens for each device, and heaven help you if you didn't Close them too...

They could go in the Init case of Teleop, but it really does make sense to put them all in Begin. That way they'll be available to the entire program, including Periodic Tasks and Autonomous.