View Single Post
  #1   Spotlight this post!  
Unread 15-02-2014, 01:20
DSSRobotics DSSRobotics is offline
Registered User
FRC #5031
 
Join Date: Jan 2014
Location: Canada
Posts: 5
DSSRobotics is an unknown quantity at this point
Exclamation [Urgent] Compressor Problem either Programming or Wiring technical problems

We've been dealing with this problem for some time now. The compressor won't enabled when the robot is turned on even when the compressor code has been deployed.

Our current Java code is:

/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Compressor;

import edu.wpi.first.wpilibj.DoubleSolenoid;
/*
import edu.wpi.first.wpilibj.Encoder;
*/
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Victor;

/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the SimpleRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*/
public class RobotTemplate extends SimpleRobot {

RobotDrive drive = new RobotDrive(1, 2);
Joystick leftStick = new Joystick(1);//input from leftstick

Compressor compressor = new Compressor(5, 5);

DoubleSolenoid armSolenoid = new DoubleSolenoid(1, 2);
boolean shiftinggears = true;
boolean ispress9 = false;

boolean shiftingarms = true;
boolean ispress10 = false;

DoubleSolenoid ShiftingSolenoid = new DoubleSolenoid(3, 4);
/*



Encoder leftEncoder = new Encoder(1, 2);
Encoder rightEncoder = new Encoder(3, 4);
*/

Victor vex3 = new Victor(7); // (Motor for arms)
Victor motor = new Victor(8); // Shooter

/**
* This function is called once each time the robot enters autonomous mode.
*/
public void robotInit() {
compressor.start();
armSolenoid.set(DoubleSolenoid.Value.kReverse);
ShiftingSolenoid.set(DoubleSolenoid.Value.kReverse );

}

public void disabled() {
compressor.stop();

}

public void autonomous() {

/*
while(leftEncoder.getDistance() < 12)
{
driveForward();

}

leftEncoder.reset();


while(leftEncoder > - 3 && rightEncoder < 3);
*/
for (int i = 0; i < 300; i++) {
drive.drive(0.2, 0);

}
drive.drive(0, 0);

}

/**
* This function is called once each time the robot enters operator control.
*/
public void operatorControl() {
while (isOperatorControl() && isEnabled()) {
double left = leftStick.getRawAxis(5);
double right = leftStick.getRawAxis(2);
compressor.start();
drive.tankDrive(-left, -right); // driving with two joysticks. Wall is in the back and Pick up is in the front

if (leftStick.getRawButton(10) && !ispress10) {

if (shiftingarms) {
armSolenoid.set(DoubleSolenoid.Value.kForward);
shiftingarms = false;

} else {
armSolenoid.set(DoubleSolenoid.Value.kReverse);
shiftingarms = true;
}
}
ispress10 = leftStick.getRawButton(10);

if (leftStick.getRawButton(9) && !ispress9) {

if (shiftinggears) {
ShiftingSolenoid.set(DoubleSolenoid.Value.kForward );
shiftinggears = false;

} else {
ShiftingSolenoid.set(DoubleSolenoid.Value.kReverse );
shiftinggears = true;
}
}
ispress9 = leftStick.getRawButton(9);

if (leftStick.getRawButton(6)) {

vex3.set(-1.0);
} else {
vex3.set(0);
}

}
if (shiftingarms) {
vex3.set(1.0);
} else {
vex3.set(0);
}
}

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

In addition, we had an experienced programmer and mentor inspect our program and wiring but, they said there were no problems. I'm not sure if the program or wiring has a problem. If the program is wrong or there's a problem with the wiring please correct and guide us! Everything is working except the compressors being enable when the robot is turned on. Please help us and Thanks! P.S compressor will only charge when the battery is manually connected which, we obviously do not want.

Last edited by DSSRobotics : 15-02-2014 at 01:29.