Go to Post and isn't this fun? :) CD is great :D - rick.oliver [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 19-02-2013, 10:53
Mubtasim Mubtasim is offline
Registered User
FRC #4797
 
Join Date: Feb 2013
Location: NY
Posts: 10
Mubtasim is an unknown quantity at this point
Compressor is not working

We are having a problem with the compressor
The spike relay is orange; selenoid is communicating but the compressor never starts??
heres the code:
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.Jaguar;



public class RobotTemplate extends SimpleRobot {
private RobotDrive robotDrive = new RobotDrive(10,9);
private Joystick Stick = new Joystick(1);
private Jaguar Shooter = new Jaguar(5);
private Jaguar Loader = new Jaguar(6);
private Compressor compressor = new Compressor(2,2);
private Solenoid pistonUp = new Solenoid(1);
private Solenoid pistonDown = new Solenoid(2);
//Relay spikeRelay;
//private Relay spikeRelay = new Relay(2);

// public void robotInit() {

//spikeRelay = new Relay(2);}

public RobotTemplate() {
getWatchdog().setExpiration(0.5);
//spikeRelay.set(Relay.Value.kOn);
compressor.start();
//compressor.setRelayValue(Relay.Value.kForward);
}

public void operatorControl() {
getWatchdog().setEnabled(true);
while (isEnabled() && isOperatorControl()) {

getWatchdog().feed();
// robotDrive.setSafetyEnabled(false);
robotDrive.arcadeDrive(-Stick.getX(), Stick.getY());
robotDrive.setInvertedMotor(RobotDrive.MotorType.k RearLeft, true);


//spikeRelay.set(Relay.Value.kForward);



if (Stick.getTrigger()) {
pistonUp.set(true);
} else if (Stick.getRawButton(3)) {
pistonDown.set(true);
} else {
pistonUp.set(false);
pistonDown.set(false);
}
}

if (Stick.getRawButton(2)){
Shooter.set(.75);
} else {
Shooter.set(0);
}
if (Stick.getRawButton(5)){
Loader.set(.75);
} else {
Loader.set(0);
}
}

}
Reply With Quote
  #2   Spotlight this post!  
Unread 19-02-2013, 10:57
Arhowk's Avatar
Arhowk Arhowk is offline
FiM CSA
AKA: Jake Niman
FRC #1684 (The Chimeras) (5460 Mentor)
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Lapeer
Posts: 542
Arhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to beholdArhowk is a splendid one to behold
Re: Compressor is not working

whenever you say

= new ##(parameters) (such as new Jaguar(1))

keep it all in your robot init function, because it has to run after the cRIO is done compiling.

also,

public RobotTemplate() will never run. it has to be public void robotInit()
Reply With Quote
  #3   Spotlight this post!  
Unread 19-02-2013, 12:52
Mubtasim Mubtasim is offline
Registered User
FRC #4797
 
Join Date: Feb 2013
Location: NY
Posts: 10
Mubtasim is an unknown quantity at this point
Re: Compressor is not working

Didn't solve the problem, here is the simpler version of the code that we are starting all over from the begining (without messing with relay in the program):


package edu.wpi.first.wpilibj.templates;


import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Joystick;

public class RobotTemplate extends SimpleRobot {
private Joystick Stick = new Joystick(1);
private Compressor compressor = new Compressor(2,2);
private Solenoid pistonUP = new Solenoid(1);
private Solenoid pistonDOWN = new Solenoid(2);

public RobotTemplate(){
getWatchdog().setExpiration(0.5);
compressor.start();
}


/**
* This function is called once each time the robot enters operator control.
*/
public void operatorControl() {
getWatchdog().setEnabled(true);
while(isEnabled() && isOperatorControl()){
getWatchdog().feed();
if(Stick.getTrigger()){
pistonUP.set(true);
}else if(Stick.getRawButton(3)){
pistonDOWN.set(true);
}else{
pistonUP.set(false);
pistonDOWN.set(false);
}


}



}

/**
* This function is called once each time the robot enters test mode.
*/
public void test() {

}
}



Reply With Quote
  #4   Spotlight this post!  
Unread 19-02-2013, 13:54
Mubtasim Mubtasim is offline
Registered User
FRC #4797
 
Join Date: Feb 2013
Location: NY
Posts: 10
Mubtasim is an unknown quantity at this point
Smile Re: Compressor is not working

Everything works nice and finenow. There was some complication withhardware.
Thanks
Reply With Quote
Reply


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 22:16.

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