From 1e6bee4dd483c4f15098807d9819280c443802df Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 27 Feb 2017 14:41:42 -0500 Subject: Tidy up. --- src/org/usfirst/frc/team4272/robot2017/Teleop.java | 24 +++++++++------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/org/usfirst/frc/team4272/robot2017/Teleop.java b/src/org/usfirst/frc/team4272/robot2017/Teleop.java index bc09f8a..254c530 100644 --- a/src/org/usfirst/frc/team4272/robot2017/Teleop.java +++ b/src/org/usfirst/frc/team4272/robot2017/Teleop.java @@ -41,20 +41,19 @@ import org.usfirst.frc.team4272.robotlib.RollingAvg; public class Teleop { private final HwRobot robot; - private final double armSoftStop = 95;//295; + private final PIDSource lRate, rRate; + private final Timer timer = new Timer(); + private final Preferences prefs = Preferences.getInstance(); - private final PushButton shootButton = new PushButton(); - private final Timer time = new Timer(); private double lastTime; private double currentTime; private boolean state = false; - private PIDSource lRate, rRate; - private Preferences prefs = Preferences.getInstance(); public Teleop(HwRobot robot) { this.robot = robot; this.lRate = new RollingAvg(5, robot.lDriveE); this.rRate = new RollingAvg(5, robot.rDriveE); + timer.start(); } private static double jsScale(Joystick j) { @@ -95,13 +94,11 @@ public class Teleop { } /* auto gear wiggle */ - if (oi.rStick.getRawButton(2) || oi.lStick.getRawButton(2)) { - currentTime = Timer.getMatchTime(); - if (currentTime-lastTime > 0.15) { - state = !state; - lastTime = currentTime; + if (oi.rStick.getRawButton(2) || oi.lStick.getRawButton(2)) { + if (timer.get() > 0.30) { + timer.reset(); } - if (state) { + if (timer.get() < 0.15) { control.lDrive = 0.5; control.rDrive = 0; } else { @@ -111,9 +108,8 @@ public class Teleop { } /* climber */ - if (Math.abs(oi.xbox.getY(Hand.kLeft)) > 0.2) { - control.climber = oi.xbox.getY(Hand.kLeft); - } else { + control.climber = oi.xbox.getY(Hand.kLeft); + if (control.climber <= 0.2) { control.climber = 0; } -- cgit v1.2.3