From 4bb2507b723ee83c448efa07a1d448b94a42eea2 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 20 Feb 2017 23:38:54 -0500 Subject: Teleop: Tidy, simplify. --- src/org/usfirst/frc/team4272/robot2016/Teleop.java | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/org/usfirst/frc/team4272/robot2016/Teleop.java b/src/org/usfirst/frc/team4272/robot2016/Teleop.java index 7398f10..625e29c 100644 --- a/src/org/usfirst/frc/team4272/robot2016/Teleop.java +++ b/src/org/usfirst/frc/team4272/robot2016/Teleop.java @@ -43,7 +43,7 @@ public class Teleop { } public Control run(Control control, HwOI oi) { - /* Drive */ + /* drive */ control.lDrive = -jsScale(oi.lStick); control.rDrive = -jsScale(oi.rStick); @@ -68,25 +68,22 @@ public class Teleop { /* auto gear wiggle */ if (oi.rStick.getRawButton(2) || oi.lStick.getRawButton(2)) { currentTime = Timer.getMatchTime(); - if(currentTime-lastTime > 0.15){ + if (currentTime-lastTime > 0.15) { state = !state; lastTime = currentTime; } - if (state){ + if (state) { control.lDrive = 0.5; control.rDrive = 0; - } - else if(!state){ + } else { control.lDrive = 0; control.rDrive = 0.5; } } /* climber */ - if(oi.xbox.getRawAxis(1) > 0.2){ - control.climber = oi.xbox.getRawAxis(1); - } else if (oi.xbox.getRawAxis(1) < -0.2) { - control.climber = oi.xbox.getRawAxis(1); + if (Math.abs(oi.xbox.getY(Hand.kLeft)) > 0.2) { + control.climber = oi.xbox.getY(Hand.kLeft); } else { control.climber = 0; } @@ -100,12 +97,13 @@ public class Teleop { } /* camera */ - if(oi.xbox.getTriggerAxis(Hand.kRight) > 0) + if (oi.xbox.getTriggerAxis(Hand.kRight) > 0) { control.camRotate = 1; - else if(oi.xbox.getTriggerAxis(Hand.kLeft) > 0) + } else if (oi.xbox.getTriggerAxis(Hand.kLeft) > 0) { control.camRotate = -1; - else + } else { control.camRotate = 0; + } control.camTilt = oi.xbox.getX(Hand.kRight); return control; -- cgit v1.2.3