diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-04-07 10:32:31 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-04-07 10:32:31 -0400 |
commit | 3949e64c7707b53081a60daaf8e1118ebee41ea7 (patch) | |
tree | ab7f24fb77b02d1f9157d8137489920eddee2f3d /src/org | |
parent | 97f0f4c548ae405d72b7b4f3bd50bdedb1426279 (diff) |
add compressor inhibitor
Diffstat (limited to 'src/org')
4 files changed, 13 insertions, 1 deletions
diff --git a/src/org/usfirst/frc/team4272/robot2017/Autonomous.java b/src/org/usfirst/frc/team4272/robot2017/Autonomous.java index 28ec580..affe49d 100644 --- a/src/org/usfirst/frc/team4272/robot2017/Autonomous.java +++ b/src/org/usfirst/frc/team4272/robot2017/Autonomous.java @@ -69,6 +69,7 @@ public class Autonomous { Command init = c->{ c.lDrive = c.rDrive = 0; c.highGear = c.gedOut = false; + c.compressorEnabled = true; return true; }; diff --git a/src/org/usfirst/frc/team4272/robot2017/Control.java b/src/org/usfirst/frc/team4272/robot2017/Control.java index c8561c0..b32eac7 100644 --- a/src/org/usfirst/frc/team4272/robot2017/Control.java +++ b/src/org/usfirst/frc/team4272/robot2017/Control.java @@ -6,6 +6,7 @@ public class Control { rDrive = 0, climber = 0; boolean highGear = false, - gedOut = false; + gedOut = false, + compressorEnabled = true; public Control() {} } diff --git a/src/org/usfirst/frc/team4272/robot2017/HwRobot.java b/src/org/usfirst/frc/team4272/robot2017/HwRobot.java index 533cf9d..23e5c34 100644 --- a/src/org/usfirst/frc/team4272/robot2017/HwRobot.java +++ b/src/org/usfirst/frc/team4272/robot2017/HwRobot.java @@ -29,6 +29,7 @@ */ package org.usfirst.frc.team4272.robot2017; +import edu.wpi.first.wpilibj.Compressor; import edu.wpi.first.wpilibj.DoubleSolenoid; import edu.wpi.first.wpilibj.DriverStation; import edu.wpi.first.wpilibj.Encoder; @@ -70,6 +71,8 @@ public class HwRobot { private final DoubleSolenoid shifter = new DoubleSolenoid(/*PCM*/4, /*PCM*/5), ged = new DoubleSolenoid(/*PCM*/6, /*PCM*/7); + private final Compressor + compressor = new Compressor(); // Sensors/info should be public /////////////////////////////////////// public final Encoder lDriveE = new Encoder(/*DIO*/0,/*DIO*/1, /*reverse*/false); public final Encoder rDriveE = new Encoder(/*DIO*/2,/*DIO*/3, /*reverse*/true); @@ -116,6 +119,10 @@ public class HwRobot { minBatt = batt; SmartDashboard.putNumber("minBatt", minBatt); + if (c.compressorEnabled != compressor.getClosedLoopControl()) + compressor.setClosedLoopControl(c.compressorEnabled); + + SmartDashboard.putBoolean("compressorOn", compressor.enabled()); SmartDashboard.putBoolean("highGear", c.highGear); SmartDashboard.putBoolean("gedOut", c.gedOut); } diff --git a/src/org/usfirst/frc/team4272/robot2017/Teleop.java b/src/org/usfirst/frc/team4272/robot2017/Teleop.java index 4dc3627..b55a42b 100644 --- a/src/org/usfirst/frc/team4272/robot2017/Teleop.java +++ b/src/org/usfirst/frc/team4272/robot2017/Teleop.java @@ -96,6 +96,9 @@ public class Teleop { /* GED */ control.gedOut = oi.xbox.getTriggerAxis(Hand.kRight) > 0.5; + /* compressor */ + control.compressorEnabled = !oi.xbox.getAButton(); + return control; } } |