summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-02-20 23:22:24 -0500
committerLuke Shumaker <lukeshu@lukeshu.com>2017-02-20 23:22:24 -0500
commit56dc9cfc081a0ba552d3a3a4a966551e20b995c5 (patch)
treeaec759a3879c3024b501f115071407a1c05b1db6
parentfe92783bed8be3b02b6d62b7c232434ae48f96c6 (diff)
Correctly use DoubleSoleniod.
-rw-r--r--src/org/usfirst/frc/team4272/robot2016/Control.java3
-rw-r--r--src/org/usfirst/frc/team4272/robot2016/HwRobot.java22
-rw-r--r--src/org/usfirst/frc/team4272/robot2016/Teleop.java11
3 files changed, 14 insertions, 22 deletions
diff --git a/src/org/usfirst/frc/team4272/robot2016/Control.java b/src/org/usfirst/frc/team4272/robot2016/Control.java
index 4baedd4..eae613e 100644
--- a/src/org/usfirst/frc/team4272/robot2016/Control.java
+++ b/src/org/usfirst/frc/team4272/robot2016/Control.java
@@ -7,7 +7,6 @@ public class Control {
camTilt = 0,
climber = 0;
boolean highGear = false,
- PCM3 =true,
- PCM4 = false;
+ gedOut = false;
public Control() {}
}
diff --git a/src/org/usfirst/frc/team4272/robot2016/HwRobot.java b/src/org/usfirst/frc/team4272/robot2016/HwRobot.java
index 0f5375f..1fb47be 100644
--- a/src/org/usfirst/frc/team4272/robot2016/HwRobot.java
+++ b/src/org/usfirst/frc/team4272/robot2016/HwRobot.java
@@ -1,16 +1,14 @@
package org.usfirst.frc.team4272.robot2016;
-import edu.wpi.first.wpilibj.networktables.NetworkTable;
-import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
-
import edu.wpi.first.wpilibj.DigitalInput;
+import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.PIDOutput;
import edu.wpi.first.wpilibj.PIDSourceType;
import edu.wpi.first.wpilibj.PowerDistributionPanel;
import edu.wpi.first.wpilibj.Talon;
-import edu.wpi.first.wpilibj.Jaguar;
-import edu.wpi.first.wpilibj.Solenoid;
+import edu.wpi.first.wpilibj.networktables.NetworkTable;
+import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import org.usfirst.frc.team4272.robotlib.PIDOutputSplitter;
import org.usfirst.frc.team4272.robotlib.PIDServo;
@@ -45,10 +43,9 @@ public class HwRobot {
public final Encoder rDriveE = new Encoder(/*DIO*/2,/*DIO*/3, /*reverse*/true);
public final PowerDistributionPanel PDP = new PowerDistributionPanel(); /* via CAN */
- public Solenoid PCM1 = new Solenoid(/*PCM*/ 4);
- public Solenoid PCM2 = new Solenoid(5);
- public Solenoid PCM3 = new Solenoid(6);
- public Solenoid PCM4 = new Solenoid(7);
+ public DoubleSolenoid
+ shifter = new DoubleSolenoid(/*PCM*/4, /*PCM*/5),
+ ged = new DoubleSolenoid(/*PCM*/6, /*PCM*/7);
public HwRobot() {
lDriveE.setDistancePerPulse(10.0/*feet*/ / 1865.75/*pulses*/);
@@ -66,11 +63,8 @@ public class HwRobot {
camRotate.pidWrite(c.camRotate);
camTilt.pidWrite(c.camTilt);
- PCM1.set(c.highGear);
- PCM2.set(!c.highGear);
-
- PCM3.set(c.PCM3);
- PCM4.set(c.PCM4);
+ shifter.set(c.highGear ? DoubleSolenoid.Value.kReverse : DoubleSolenoid.Value.kForward);
+ ged.set(c.gedOut ? DoubleSolenoid.Value.kReverse : DoubleSolenoid.Value.kForward);
SmartDashboard.putNumber("lDriveE distance", lDriveE.getDistance());
SmartDashboard.putNumber("lDriveE rate", lDriveE.getRate());
diff --git a/src/org/usfirst/frc/team4272/robot2016/Teleop.java b/src/org/usfirst/frc/team4272/robot2016/Teleop.java
index 09151a8..05783e8 100644
--- a/src/org/usfirst/frc/team4272/robot2016/Teleop.java
+++ b/src/org/usfirst/frc/team4272/robot2016/Teleop.java
@@ -68,13 +68,12 @@ public class Teleop {
control.climber = 0;
}
- if (oi.xbox.getAButton() == true) {
- control.PCM3 = true;
- control.PCM4 = false;
+ /* gear place */
+ if (oi.xbox.getAButton()) {
+ control.gedOut = true;
}
- if(oi.xbox.getBButton()==true) {
- control.PCM3 = false;
- control.PCM4 =true;
+ if (oi.xbox.getBButton()) {
+ control.gedOut = false;
}