summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-02-27 14:41:42 -0500
committerLuke Shumaker <lukeshu@lukeshu.com>2017-02-27 14:41:42 -0500
commit1e6bee4dd483c4f15098807d9819280c443802df (patch)
treead34f7feaff32509ca1308fb69ea515f7ee5a8e5 /src
parenta26ce3f49e9d88302b7d16a0197b58119519650e (diff)
Tidy up.
Diffstat (limited to 'src')
-rw-r--r--src/org/usfirst/frc/team4272/robot2017/Teleop.java24
1 files 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;
}