Go to Post Your team will be more of a team and not a group of students who are just building a robot. Instead of being in FIRST, you will be FIRST. - JackN [more]
Home
Go Back   Chief Delphi > Technical > Pneumatics
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rating: Thread Rating: 5 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 12-06-2014, 23:57
Team 4939 Team 4939 is offline
Registered User
AKA: Anshul Shah
FRC #4939 (All spark 9)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2014
Location: Brampton
Posts: 52
Team 4939 is an unknown quantity at this point
Pneumatics system code

From all of us here at Team 4939, hopefully everybody had a good time. As a rookie team I know we did.

During the off-season we decided to incorporate a very basic pneumatics system into our robot, so that we would be more experienced for next. We were able to figure out where to connect everything (or so we think) according to the instructions, but when it comes to the code, we are just feeling very lost.

As a rookie team most of out programmers including myself, have no clue where to go from here. We found a couple resources online, but are just feeling very confused. We believe we have all the parts we just have to get them to work. The system works manually, but when doing it automatically with the joystick we have no clue where to go. Here is our current code

Code:
package edu.wpi.first.wpilibj.templates;
 
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
 
public class RobotTemplate extends SimpleRobot {
    
    RobotDrive chassis = new RobotDrive(1,2);
    Joystick mainStick = new Joystick(1);
    Jaguar jaguar = new Jaguar(3);
    Jaguar jag = new Jaguar(4);

    
    public void autonomous(){ 
        chassis.setSafetyEnabled(false);
        chassis.drive (-0.5, 0.08);
        Timer.delay(2.0);
        chassis.drive (0, 0.0);
    }
    
    public void operatorControl() {
        chassis.setSafetyEnabled(true);
        while (isOperatorControl() && isEnabled()) {
            double speed;
            double rot;
            speed = mainStick.getY();
            rot = -mainStick.getX();
            chassis.arcadeDrive (speed, rot);
            if (mainStick.getRawButton(3)){
                jag.set(1);
                jaguar.set(-1);
            }
            else if (mainStick.getRawButton(4)){
                jaguar.set(-1);
                jag.set(1);
            }
            else{
                jaguar.set(0);
                jag.set(0);
            }
    }
    }
    
    public void test() {
       
    }
}
All help is greatly appreciated since it is the end of the FRC season.

I will try and upload a picture of how we have the system set up tomorrow.

Thanks in Advance
  #2   Spotlight this post!  
Unread 13-06-2014, 00:29
Domenic Rodriguez's Avatar
Domenic Rodriguez Domenic Rodriguez is offline
Registered User
FRC #0316 (LuNaTeCs)
Team Role: College Student
 
Join Date: Sep 2010
Rookie Year: 2011
Location: Grove City, PA
Posts: 213
Domenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura about
Re: Pneumatics system code

The compressor is controlled automatically through the Compressor class. Simply pass the Pressure Switch and Relay channels to the constructor and call Compressor#start() in robotInit() and you should be good to go. If desired, it can be disabled with Compressor#stop().

Solenoids come in two varieties: Solenoids and DoubleSolenoids. Single solenoids can be set true or false, while double solenoids are typically set to DoubleSolenoid.Value.kForward, DoubleSolenoid.Value.kReverse, or DoubleSolenoid.Value.kOff.

A simple example incorporating your code:
Code:
package edu.wpi.first.wpilibj.templates;
 
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
 
public class RobotTemplate extends SimpleRobot {
    
    RobotDrive chassis = new RobotDrive(1,2);
    Joystick mainStick = new Joystick(1);
    Jaguar jaguar = new Jaguar(3);
    Jaguar jag = new Jaguar(4);

    // Pneumatics
    Compressor compressor = new Compressor(1, 1);
    Solenoid solenoid = new Solenoid(1);
    DoubleSolenoid doubleSolenoid = new DoubleSolenoid(2, 3);
    
    public void robotInit() {
        compressor.start();
    }

    public void autonomous(){ 
        chassis.setSafetyEnabled(false);
        chassis.drive (-0.5, 0.08);
        Timer.delay(2.0);
        chassis.drive (0, 0.0);
    }
    
    public void operatorControl() {
        chassis.setSafetyEnabled(true);
        while (isOperatorControl() && isEnabled()) {
            double speed;
            double rot;
            speed = mainStick.getY();
            rot = -mainStick.getX();
            chassis.arcadeDrive (speed, rot);
            if (mainStick.getRawButton(3)){
                jag.set(1);
                jaguar.set(-1);
            }
            else if (mainStick.getRawButton(4)){
                jaguar.set(-1);
                jag.set(1);
            }
            else{
                jaguar.set(0);
                jag.set(0);
            }

            // Solenoid
            solenoid.set(mainStick.getRawButton(1);
            if (mainStick.getRawButton(2))
                doubleSolenoid.set(DoubleSolnoid.Value.kForward);
            else
                doubleSolenoid.set(DoubleSolenoid.Value.kOff);
        }
    }
    
    public void test() {
       
    }
}

Also, you might want to check out these articles from the WPILib docs at ScreenSteps Live:
http://wpilib.screenstepslive.com/s/...for-pneumatics
http://wpilib.screenstepslive.com/s/...ders-solenoids
__________________

LuNaTeCs - Learning Under Nurturing Adults Teaching Engineering Concepts and Skills - Small and Mighty!

FRC 316 LuNaTeCs - Student (2011-2014), Lead Programmer (2011-2014), Team Captain (2013-2014), Operator (2013), Drive Coach (2014), Mentor (2015-????)
'11 Philly Regional Finalists, '13 Chestnut Hill Finalists, '13 Lenape Champions, '13 Archimedes Division, '14 Chestnut Hill Champions, '14 Lenape Champions
FTC 7071 EngiNerds - Founding Advisor (2013-2014) | FRC 5420 Velocity - Founding Advisor (2015)
Grove City College Class of '18, Electrical/Computer Engineering (B.S.E.E)


Last edited by Domenic Rodriguez : 13-06-2014 at 21:41. Reason: Fixed a bug that is obvious during the day but not at midnight.
  #3   Spotlight this post!  
Unread 13-06-2014, 00:32
SoftwareBug2.0's Avatar
SoftwareBug2.0 SoftwareBug2.0 is offline
Registered User
AKA: Eric
FRC #1425 (Error Code Xero)
Team Role: Mentor
 
Join Date: Aug 2004
Rookie Year: 2004
Location: Tigard, Oregon
Posts: 486
SoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant futureSoftwareBug2.0 has a brilliant future
Re: Pneumatics system code

I would start by making a list of what all the connected pneumatic components are and what joystick inputs they're supposed to be controlled by. This will make it easier to help you.

By the way, the following two code snipets are identical:
Code:
int x;
x=4;
Code:
int x=4;
  #4   Spotlight this post!  
Unread 13-06-2014, 20:44
mmaunu's Avatar
mmaunu mmaunu is offline
Registered User
FRC #2485 (W.A.R. Lords)
Team Role: Mentor
 
Join Date: Mar 2013
Rookie Year: 2010
Location: San Diego, CA
Posts: 89
mmaunu is a jewel in the roughmmaunu is a jewel in the roughmmaunu is a jewel in the roughmmaunu is a jewel in the rough
Re: Pneumatics system code

Since you are just starting out, I want to point out a tiny error in Domenic Rodriguez ' s code. He named a variable "double" since it represents a double solenoid. However, you can't name a variable "double" in Java as it is a reserved word. Change the name to doubleSol or something else and you will be fine. Be sure to only change the name of the variable and not other occurrences of "double".

Sorry...on mobile or I would repost the code with the fixes in place.
__________________
2014 Las Vegas (Winners with 987, 2478; Excellence in Engineering)
2014 San Diego (Finalists with 987, 3250; Quality Award)
2013 Inland Empire (Winners with 1538, 968; Excellence in Engineering Award)
2013 San Diego (Finalists with 2984, 4322; Creativity Award)
2012 Las Vegas (Finalists with 2034, 3187; Quality Award)
  #5   Spotlight this post!  
Unread 13-06-2014, 21:40
Domenic Rodriguez's Avatar
Domenic Rodriguez Domenic Rodriguez is offline
Registered User
FRC #0316 (LuNaTeCs)
Team Role: College Student
 
Join Date: Sep 2010
Rookie Year: 2011
Location: Grove City, PA
Posts: 213
Domenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura about
Re: Pneumatics system code

Quote:
Originally Posted by mmaunu View Post
Since you are just starting out, I want to point out a tiny error in Domenic Rodriguez ' s code. He named a variable "double" since it represents a double solenoid. However, you can't name a variable "double" in Java as it is a reserved word. Change the name to doubleSol or something else and you will be fine. Be sure to only change the name of the variable and not other occurrences of "double".

Sorry...on mobile or I would repost the code with the fixes in place.
Fixed, my bad. Now I feel silly; I guess that's what I get for writing code at 12:30 AM
__________________

LuNaTeCs - Learning Under Nurturing Adults Teaching Engineering Concepts and Skills - Small and Mighty!

FRC 316 LuNaTeCs - Student (2011-2014), Lead Programmer (2011-2014), Team Captain (2013-2014), Operator (2013), Drive Coach (2014), Mentor (2015-????)
'11 Philly Regional Finalists, '13 Chestnut Hill Finalists, '13 Lenape Champions, '13 Archimedes Division, '14 Chestnut Hill Champions, '14 Lenape Champions
FTC 7071 EngiNerds - Founding Advisor (2013-2014) | FRC 5420 Velocity - Founding Advisor (2015)
Grove City College Class of '18, Electrical/Computer Engineering (B.S.E.E)

  #6   Spotlight this post!  
Unread 16-06-2014, 17:32
Team 4939 Team 4939 is offline
Registered User
AKA: Anshul Shah
FRC #4939 (All spark 9)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2014
Location: Brampton
Posts: 52
Team 4939 is an unknown quantity at this point
Re: Pneumatics system code

Sorry for not replying earlier, but I just haven't been able to test the code that you all helped out with yet, due to exams and such. I should be able to test the system out tomorrow and I will post a reply letting you know how it worked out. I was able to get a picture: http://postimg.org/image/wvu8lykol/ . If that makes a difference to the code.

Also I was wondering something about where to plug the spike in, I pluged one end to the solenoid, and the other end into port 5 on my Digital side car.

I noticed in the code that Domenic Rodriguez posted :

Code:
 // Pneumatics
    Compressor compressor = new Compressor(1, 1);
    Solenoid solenoid = new Solenoid(1);
    DoubleSolenoid doubleSolenoid = new DoubleSolenoid(2, 3);

Ports 1, 2, and 3 are labeled.

Where should I plug my Spike into?

Thank You to all that helped me get this far, just a little more help is needed.
  #7   Spotlight this post!  
Unread 16-06-2014, 18:35
Domenic Rodriguez's Avatar
Domenic Rodriguez Domenic Rodriguez is offline
Registered User
FRC #0316 (LuNaTeCs)
Team Role: College Student
 
Join Date: Sep 2010
Rookie Year: 2011
Location: Grove City, PA
Posts: 213
Domenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura about
Re: Pneumatics system code

Quote:
Originally Posted by Team 4939 View Post
Sorry for not replying earlier, but I just haven't been able to test the code that you all helped out with yet, due to exams and such. I should be able to test the system out tomorrow and I will post a reply letting you know how it worked out. I was able to get a picture: http://postimg.org/image/wvu8lykol/ . If that makes a difference to the code.

Also I was wondering something about where to plug the spike in, I pluged one end to the solenoid, and the other end into port 5 on my Digital side car.

I noticed in the code that Domenic Rodriguez posted :

Code:
 // Pneumatics
    Compressor compressor = new Compressor(1, 1);
    Solenoid solenoid = new Solenoid(1);
    DoubleSolenoid doubleSolenoid = new DoubleSolenoid(2, 3);

Ports 1, 2, and 3 are labeled.

Where should I plug my Spike into?

Thank You to all that helped me get this far, just a little more help is needed.
To clarify, are you planning on controlling your solenoid with a Spike Relay, or with the solenoid module on the cRIO?

The Solenoid and DoubleSolenoid classes only work for controlling solenoids through the solenoid module. If you are controlling your solenoid through a relay, you will need to use the Relay class instead.

Judging by your picture, it looks like you are using a double solenoid. I've never controlled a solenoid through Spikes before, but I believe you will need two Spikes, one for each side. Edit: Nope, see Mark McLeod's post below.

Updated code:
Code:
package edu.wpi.first.wpilibj.templates;
 
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Relay;
 
public class RobotTemplate extends SimpleRobot {
    
    RobotDrive chassis = new RobotDrive(1,2);
    Joystick mainStick = new Joystick(1);
    Jaguar jaguar = new Jaguar(3);
    Jaguar jag = new Jaguar(4);

    // Pneumatics
    Compressor compressor = new Compressor(1, 1);
    Relay spike = new Relay(2);
    
    public void robotInit() {
        compressor.start();
    }

    public void autonomous(){ 
        chassis.setSafetyEnabled(false);
        chassis.drive (-0.5, 0.08);
        Timer.delay(2.0);
        chassis.drive (0, 0.0);
    }
    
    public void operatorControl() {
        chassis.setSafetyEnabled(true);
        while (isOperatorControl() && isEnabled()) {
            double speed = mainStick.getY();
            double rot = -mainStick.getX();
            chassis.arcadeDrive (speed, rot);
            if (mainStick.getRawButton(3)){
                jag.set(1);
                jaguar.set(-1);
            }
            else if (mainStick.getRawButton(4)){
                jaguar.set(-1);
                jag.set(1);
            }
            else{
                jaguar.set(0);
                jag.set(0);
            }

            // Solenoid
            if (mainStick.getRawButton(1))
                spike.set(Relay.Value.kForward);
            else if (mainStick.getRawButton(2))
                spike.set(Relay.Value.kReverse);
        }
    }
}
__________________

LuNaTeCs - Learning Under Nurturing Adults Teaching Engineering Concepts and Skills - Small and Mighty!

FRC 316 LuNaTeCs - Student (2011-2014), Lead Programmer (2011-2014), Team Captain (2013-2014), Operator (2013), Drive Coach (2014), Mentor (2015-????)
'11 Philly Regional Finalists, '13 Chestnut Hill Finalists, '13 Lenape Champions, '13 Archimedes Division, '14 Chestnut Hill Champions, '14 Lenape Champions
FTC 7071 EngiNerds - Founding Advisor (2013-2014) | FRC 5420 Velocity - Founding Advisor (2015)
Grove City College Class of '18, Electrical/Computer Engineering (B.S.E.E)


Last edited by Domenic Rodriguez : 17-06-2014 at 14:34. Reason: Tried to answer a question I didn't know the answer to.
  #8   Spotlight this post!  
Unread 16-06-2014, 19:23
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,800
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Pneumatics system code

Quote:
Originally Posted by Domenic Rodriguez View Post
Judging by your picture, it looks like you are using a double solenoid. I've never controlled a solenoid through Spikes before, but I believe you will need two Spikes, one for each side.
Only one spike per double solenoid.
The code for a double would use kForward for one direction and kReverse for the other direction. Don't use kOff for this purpose.
Wiring a spike to control a 12v-only solenoid via a Relay output on the Digital Sidecar looks like this:


24v solenoids are usable only through the cRIO Solenoid Module/Breakout, not a 12v Spike relay.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #9   Spotlight this post!  
Unread 16-06-2014, 19:42
Team 4939 Team 4939 is offline
Registered User
AKA: Anshul Shah
FRC #4939 (All spark 9)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2014
Location: Brampton
Posts: 52
Team 4939 is an unknown quantity at this point
Re: Pneumatics system code

Quote:
Originally Posted by Mark McLeod View Post
Only one spike per double solenoid.
The code for a double would use kForward for one direction and kReverse for the other direction. Don't use kOff for this purpose.
Wiring a spike to control a 12v-only solenoid via a Relay output on the Digital Sidecar looks like this:


24v solenoids are usable only through the cRIO Solenoid Module/Breakout, not a 12v Spike relay.
By the picture that I posted earlier this evening could you tell me if it is a 24v solenoid or a 12v solenoid. If not I will just ask my electrical team members.
  #10   Spotlight this post!  
Unread 16-06-2014, 19:57
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,800
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Pneumatics system code

I suspect from your photo that it is a 24v solenoid just because that's what has been offered in the KOP, but that style can be either voltage rating. The black end caps will have a voltage printed on them.

If it is a 24v solenoid, then it gets wired to two sets of pins on the Solenoid Breakout and the Solenoid Breakout must get 24v power from the empty connectors of the Power Distribution's special 24v output.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #11   Spotlight this post!  
Unread 17-06-2014, 14:06
Team 4939 Team 4939 is offline
Registered User
AKA: Anshul Shah
FRC #4939 (All spark 9)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2014
Location: Brampton
Posts: 52
Team 4939 is an unknown quantity at this point
Re: Pneumatics system code

Quote:
Originally Posted by Mark McLeod View Post
I suspect from your photo that it is a 24v solenoid just because that's what has been offered in the KOP, but that style can be either voltage rating. The black end caps will have a voltage printed on them.

If it is a 24v solenoid, then it gets wired to two sets of pins on the Solenoid Breakout and the Solenoid Breakout must get 24v power from the empty connectors of the Power Distribution's special 24v output.
Yes you were right it was a 24v solenoid, but I was able to find a different 12v double solenoid in a couple of spare parts sitting around, but unfortunately due to exams and such our team will not be able to switch the solenoids out until next week this time. So I would just like to thank you for all the help you have offered.

I should be able to use the code above posted by Domenic Rodriguez correct?
  #12   Spotlight this post!  
Unread 17-06-2014, 14:59
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,800
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Pneumatics system code

Quote:
Originally Posted by Team 4939 View Post
I should be able to use the code above posted by Domenic Rodriguez correct?
Correct, that code looks good.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #13   Spotlight this post!  
Unread 24-06-2014, 10:25
Team 4939 Team 4939 is offline
Registered User
AKA: Anshul Shah
FRC #4939 (All spark 9)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2014
Location: Brampton
Posts: 52
Team 4939 is an unknown quantity at this point
Re: Pneumatics system code

I tried out the code but it did not work out.

If I am right the spike has a light that is supposed to flash when I pressed the assigned button on my joystick. Also on my driver station when a activate any of the other functions such as (movement, or intake motors) the voltage spikes, is that not supposed to happen when a press the button assigned to the pneumatics spike.

None of the things is happening, so I don't know what to exactly do.

I am sitting here with my team so any immediate help would be greatly appreciated.
  #14   Spotlight this post!  
Unread 24-06-2014, 10:33
adciv adciv is offline
One Eyed Man
FRC #0836 (RoboBees)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2010
Location: Southern Maryland
Posts: 478
adciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to alladciv is a name known to all
Re: Pneumatics system code

Please provide a copy of your code for this.

Also, what is the LED on the spike doing? (Blink Status & Color)
__________________
Quote:
Originally Posted by texarkana View Post
I would not want the task of devising a system that 50,000 very smart people try to outwit.
  #15   Spotlight this post!  
Unread 24-06-2014, 10:36
Team 4939 Team 4939 is offline
Registered User
AKA: Anshul Shah
FRC #4939 (All spark 9)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2014
Location: Brampton
Posts: 52
Team 4939 is an unknown quantity at this point
Re: Pneumatics system code

I am using the code that Domenic Rodriguez posted:

Quote:
Originally Posted by Domenic Rodriguez View Post
Updated code:
Code:
package edu.wpi.first.wpilibj.templates;
 
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Relay;
 
public class RobotTemplate extends SimpleRobot {
    
    RobotDrive chassis = new RobotDrive(1,2);
    Joystick mainStick = new Joystick(1);
    Jaguar jaguar = new Jaguar(3);
    Jaguar jag = new Jaguar(4);

    // Pneumatics
    Compressor compressor = new Compressor(1, 1);
    Relay spike = new Relay(2);
    
    public void robotInit() {
        compressor.start();
    }

    public void autonomous(){ 
        chassis.setSafetyEnabled(false);
        chassis.drive (-0.5, 0.08);
        Timer.delay(2.0);
        chassis.drive (0, 0.0);
    }
    
    public void operatorControl() {
        chassis.setSafetyEnabled(true);
        while (isOperatorControl() && isEnabled()) {
            double speed = mainStick.getY();
            double rot = -mainStick.getX();
            chassis.arcadeDrive (speed, rot);
            if (mainStick.getRawButton(3)){
                jag.set(1);
                jaguar.set(-1);
            }
            else if (mainStick.getRawButton(4)){
                jaguar.set(-1);
                jag.set(1);
            }
            else{
                jaguar.set(0);
                jag.set(0);
            }

            // Solenoid
            if (mainStick.getRawButton(1))
                spike.set(Relay.Value.kForward);
            else if (mainStick.getRawButton(2))
                spike.set(Relay.Value.kReverse);
        }
    }
}
The light of the spike is red-ish/orange and it is steady.

Here are some pics of the wiring at the moment:

http://tinypic.com/view.php?pic=11qp...8#.U6m8OyWmfIU

http://i61.tinypic.com/2qkjmuh.jpg

Any solutions would be appreciated

Last edited by Team 4939 : 24-06-2014 at 10:57. Reason: More information
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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