Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Compressor Programming in LabView (http://www.chiefdelphi.com/forums/showthread.php?t=145531)

snotsdelta 10-03-2016 16:03

Compressor Programming in LabView
 
We need help programming our compressor to be able to launch things. We want it to be able press a button, make the piston shoot forward, and then release the button and the piston retracts.

If any one can help us we would be quite happy! Please and Thank You!

josephno1 10-03-2016 17:16

Re: Compressor Programming in LabView
 
Sorry I have never used LabView.

We did something really similar in java. Here is our code

Code:

package org.usfirst.frc.team3647.subsystems;

import edu.wpi.first.wpilibj.Talon;
import edu.wpi.first.wpilibj.Timer;
//import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Solenoid;

import org.usfirst.frc.team3647.robot.*;

public class Piston {
        public static Talon rShooter = new Talon(1);

        public static void BallShooterPiston(){
               

                Solenoid pistonOut = new Solenoid(7); // creates a Solenoid object in
                                                                                                // slot 7, channel 4.

                Solenoid pistonIn = new Solenoid(0);

                if (LogitechJoystick.leftBumper) // this shoots the ball out

                {
                        Robot.shootTest1 = true;
                        if (Robot.shootTest1 = !Robot.shootTest) {
                                rShooter.set(-1);
                                // lShooter.set(1);

                                Timer.delay(2);

                                pistonOut.set(true); // Pushes the piston out
                                pistonIn.set(false);

                                Timer.delay(2);

                                pistonIn.set(true); // Pulls the piston in
                                pistonOut.set(false);
                                Robot.shootTest = true;
                                rShooter.set(0);

                        }

                }
               
                if (LogitechJoystick.rightBumper2) // this shoots the ball out

                {
                        Robot.shootTest1 = true;
                        if (Robot.shootTest1 = !Robot.shootTest) {
                                rShooter.set(-0.5);
                                // lShooter.set(1);

                                Timer.delay(2);

                                pistonOut.set(true); // Pushes the piston out
                                pistonIn.set(false);

                                Timer.delay(2);

                                pistonIn.set(true); // Pulls the piston in
                                pistonOut.set(false);
                                Robot.shootTest = true;
                                rShooter.set(0);

                        }

                }
               
                if(LogitechJoystick.rightBumper){
                       
                        rShooter.set(.25);
                }

                else {
                        rShooter.set(0);
                        Robot.shootTest1 = false;
                        Robot.shootTest = false;
                        // lShooter.set(0);
                }

        }
}


Matt-T-FRC 10-03-2016 18:08

Re: Compressor Programming in LabView
 
3 Attachment(s)
Just Drag and drop these code sniplets into your Begin and telop vis and remember to close the reference in the Finish vi. Also make sure that the correct solenoid channel is used and that the shooting solenoid is on the right button.

Are these Single Solenoids or Double Solenoids?

snotsdelta 11-03-2016 13:52

Re: Compressor Programming in LabView
 
And I quote from my teacher "It is for sure a double solenoid."

snotsdelta 11-03-2016 14:24

Re: Compressor Programming in LabView
 
we got the PCM to enable and the compressor light was green. we also got these errors
ERROR 91 Variant To Data in WPI_SolenoidRefNum Registry Get.vi->Teleop.vi->Robot Main.viLabVIEW: The data type of the variant is not compatible with the data type wired to the type input.

ERROR -44007 FRC: The RefNum you are trying to Get does not exist in this RefNum Registry. WPI_SolenoidRefNum Registry Get.vi

ERROR -44007 FRC: The RefNum you are trying to Get does not exist in this RefNum Registry. Teleop.vi

snotsdelta 11-03-2016 14:31

Re: Compressor Programming in LabView
 
3 Attachment(s)
images of the program

Matt-T-FRC 11-03-2016 21:58

Re: Compressor Programming in LabView
 
1 Attachment(s)
Quote:

Originally Posted by snotsdelta (Post 1555543)
we got the PCM to enable and the compressor light was green. we also got these errors
ERROR 91 Variant To Data in WPI_SolenoidRefNum Registry Get.vi->Teleop.vi->Robot Main.viLabVIEW: The data type of the variant is not compatible with the data type wired to the type input.

ERROR -44007 FRC: The RefNum you are trying to Get does not exist in this RefNum Registry. WPI_SolenoidRefNum Registry Get.vi

ERROR -44007 FRC: The RefNum you are trying to Get does not exist in this RefNum Registry. Teleop.vi

Alright, to solve the -44007 errors, make sure that your using the same refnum registry name in begin, Teleop and finish. In begin and finish you have Shooter Solenoid, but in Teleop you have Shooteer Solenoid.

To solve the 91 error, in the begin vi, set the solenoid to a double instead of a single solenoid from the drop down menu. Next, set the forward and reverse channels that the solenoid is wired to. After that, in the teleop.vi, change the On to a Forward and the Off to Reverse. I also attached a revised select function to drag and drop into the teleop.vi if you would like to do it that way.

That will fix both of those errors. Also, do you have a picture of how this solenoid is wired?

snotsdelta 14-03-2016 15:52

Re: Compressor Programming in LabView
 
1 Attachment(s)
We got the piston working, thank you by the way for that! Next question is will the air compressor shut down automatically?
Now here is the picture you asked for earlier.

Matt-T-FRC 14-03-2016 22:51

Re: Compressor Programming in LabView
 
Quote:

Originally Posted by snotsdelta (Post 1557036)
We got the piston working, thank you by the way for that! Next question is will the air compressor shut down automatically?
Now here is the picture you asked for earlier.

Your Welcome and thank you for the picture. Everything appears to be wired correctly, so the compressor will shut off automatically once the pressure switch reaches ~120 PSI.

snotsdelta 15-03-2016 16:06

Re: Compressor Programming in LabView
 
It is all working, but we are still getting a refnum error. My teacher is just curious as why that would be.

Mark McLeod 15-03-2016 16:16

Re: Compressor Programming in LabView
 
A Refnum error is usually going to be a typo in a name or a reference to an old device that's no longer being used.
Since everything works, hopefully it'll be a name in an unimportant or redundant section of code.


All times are GMT -5. The time now is 03:50.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi