add compressor on/off
authorLogan Howard <logan@oflogan.com>
Fri, 17 Apr 2015 03:08:26 +0000 (20:08 -0700)
committerLogan Howard <logan@oflogan.com>
Fri, 17 Apr 2015 03:08:26 +0000 (20:08 -0700)
src/org/usfirst/frc/team3501/robot/OI.java
src/org/usfirst/frc/team3501/robot/commands/CommandBase.java
src/org/usfirst/frc/team3501/robot/commands/TurnOffCompressor.java [new file with mode: 0644]
src/org/usfirst/frc/team3501/robot/commands/TurnOnCompressor.java [new file with mode: 0644]

index 6a245583c57421768c4c10482d3803cac2d228f4..58781e3b038ea24db01c3967b1d9c7f26814a941 100644 (file)
@@ -11,6 +11,12 @@ public class OI {
 
         right.whenPressed(1, new CloseClaw());
         right.whenReleased(1, new OpenClaw());
+
+        right.whenPressed(11, new TurnOffCompressor());
+        right.whenPressed(12, new TurnOffCompressor());
+
+        right.whenPressed(7, new TurnOnCompressor());
+        right.whenPressed(8, new TurnOnCompressor());
     }
 
     public double getForwardL() {
index 2fc40282410d3e372aaab25850f537fcf8af7dea..45bb43b36699bb0b5a08af651abf4dc633b6d206 100644 (file)
@@ -14,6 +14,8 @@ public abstract class CommandBase extends Command {
     protected static Arm arm;
     protected static Claw claw;
 
+    protected static Pneumatics pneumatics;
+
     public CommandBase(String commandName) {
         super(commandName);
 
@@ -22,6 +24,8 @@ public abstract class CommandBase extends Command {
         drivetrain = Robot.drivetrain;
         arm        = Robot.arm;
         claw       = Robot.claw;
+
+        pneumatics = Robot.pneumatics;
     }
 
     protected void initialize() {}
diff --git a/src/org/usfirst/frc/team3501/robot/commands/TurnOffCompressor.java b/src/org/usfirst/frc/team3501/robot/commands/TurnOffCompressor.java
new file mode 100644 (file)
index 0000000..dbb78c9
--- /dev/null
@@ -0,0 +1,17 @@
+package org.usfirst.frc.team3501.robot.commands;
+
+public class TurnOffCompressor extends CommandBase {
+
+    public TurnOffCompressor() {
+        super("TurnOffCompressor");
+        requires(pneumatics);
+    }
+
+    protected void initialize() {
+        pneumatics.stop();
+    }
+
+    protected boolean isFinished() {
+        return true;
+    }
+}
diff --git a/src/org/usfirst/frc/team3501/robot/commands/TurnOnCompressor.java b/src/org/usfirst/frc/team3501/robot/commands/TurnOnCompressor.java
new file mode 100644 (file)
index 0000000..74d0fea
--- /dev/null
@@ -0,0 +1,17 @@
+package org.usfirst.frc.team3501.robot.commands;
+
+public class TurnOnCompressor extends CommandBase {
+
+    public TurnOnCompressor() {
+        super("TurnOnCompressor");
+        requires(pneumatics);
+    }
+
+    protected void initialize() {
+        pneumatics.start();
+    }
+
+    protected boolean isFinished() {
+        return true;
+    }
+}