summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-02-20 23:38:54 -0500
committerLuke Shumaker <lukeshu@lukeshu.com>2017-02-20 23:38:54 -0500
commit4bb2507b723ee83c448efa07a1d448b94a42eea2 (patch)
tree26204febc84604dff9d187761ac80a5ba20eb42a /src
parent686148db709000eb78e6528bd7049807756fef8e (diff)
Teleop: Tidy, simplify.
Diffstat (limited to 'src')
-rw-r--r--src/org/usfirst/frc/team4272/robot2016/Teleop.java22
1 files 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;