|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
Re: [Urgent] Compressor Problem either Programming or Wiring technical problems
Why is your
Code:
//compressor.start(); The way you have it in operatorControl(), the compressor will start every time you iterate through your while loop. Try moving this statement outside of the loop. Ensure that your pressure switch is in DIO port 5 and your compressor relay is in Relay port 5. Last edited by NWChen : 15-02-2014 at 01:27. |
|
#3
|
|||
|
|||
|
Re: [Urgent] Compressor Problem either Programming or Wiring technical problems
My bad we tested the code without compressor.start() being commented. Thank you I'll edit that part so it does not confuse other people.
Last edited by DSSRobotics : 15-02-2014 at 01:27. |
|
#4
|
||||
|
||||
|
Re: [Urgent] Compressor Problem either Programming or Wiring technical problems
I know 0 code but we had the same issue and took 4.5 hours to fix it. Try downloading the example compressor code from first and running that- if it works, than you have a code issue. If not, it's electrical.
Our issue turned out to be a combination of electrical and coding. Simple problem is that the pwm from the small blue rectangle box (sorry brain art on the name) to the spike might be plugged in the wrong slot. Also the pwm can be slightly bent in the spike-ours was mangled-like someone got an arm stuck in a blender. Also, try shorting the circuit while the code is enabled by taking a wire and connecting it to each side of the little sensor that measures when the compressor should turn off. If that makes it work, than your issue is with that little nameless guy. After trying some of these tests, repost on here with your results. |
|
#5
|
|||
|
|||
|
Re: [Urgent] Compressor Problem either Programming or Wiring technical problems
I apologize we're a rookie team so could you tell me where the sample code is located? Thanks
|
|
#6
|
|||
|
|||
|
Re: [Urgent] Compressor Problem either Programming or Wiring technical problems
Thanks for all the responses and help. We finally got the compressors to work. Thanks again!
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|