diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-01-31 15:12:47 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-01-31 15:12:47 -0500 |
commit | 582f062811d298efc6a0d4c09ca746a240a96220 (patch) | |
tree | b3887fa6181200bfd40955325beab9c7843eb660 /src | |
parent | 894d9ddd315c058b8ede29dc8fadba742ca148af (diff) |
Only run one set of drive motors unless triggers are pulled (to save power)
Diffstat (limited to 'src')
-rw-r--r-- | src/org/usfirst/frc/team4272/robot2016/Control.java | 12 | ||||
-rw-r--r-- | src/org/usfirst/frc/team4272/robot2016/HwRobot.java | 10 | ||||
-rw-r--r-- | src/org/usfirst/frc/team4272/robot2016/Teleop.java | 6 |
3 files changed, 18 insertions, 10 deletions
diff --git a/src/org/usfirst/frc/team4272/robot2016/Control.java b/src/org/usfirst/frc/team4272/robot2016/Control.java index d7eadf5..40fcb5a 100644 --- a/src/org/usfirst/frc/team4272/robot2016/Control.java +++ b/src/org/usfirst/frc/team4272/robot2016/Control.java @@ -1,9 +1,13 @@ package org.usfirst.frc.team4272.robot2016; public class Control { - double lDrive, rDrive, fBall, bBall, arm; + double lDrive1 = 0, + lDrive2 = 0, + rDrive1 = 0, + rDrive2 = 0, + fBall = 0, + bBall = 0, + arm = 0; - public Control() { - lDrive = rDrive = fBall = bBall = arm = 0; - } + public Control() {} } diff --git a/src/org/usfirst/frc/team4272/robot2016/HwRobot.java b/src/org/usfirst/frc/team4272/robot2016/HwRobot.java index 90eafe1..62b71c5 100644 --- a/src/org/usfirst/frc/team4272/robot2016/HwRobot.java +++ b/src/org/usfirst/frc/team4272/robot2016/HwRobot.java @@ -29,8 +29,8 @@ public class HwRobot { //public Encoder lDriveE = new Encoder(/*DIO*/2,/*DIO*/3); //public Encoder rDriveE = new Encoder(/*DIO*/0,/*DIO*/1, true); - private PIDOutput lDriveM = new PIDOutputSplitter(new Talon(/*PWM*/0), new Talon(/*PWM*/1)); - private PIDOutput rDriveM = new PIDOutputSplitter(new Talon(/*PWM*/2), new Talon(/*PWM*/3)); + private PIDOutput lDriveM1 = new Talon(/*PWM*/0), lDriveM2 = new Talon(/*PWM*/1); + private PIDOutput rDriveM1 = new Talon(/*PWM*/2), rDriveM2 = new Talon(/*PWM*/3); private PIDOutput armM = new PIDOutputSplitter(new Talon(/*PWM*/4), new Talon(/*PWM*/5)); private PIDOutput fBallM = new PIDOutputSplitter(new Talon(/*PWM*/6), new Talon(/*PWM*/7)); private PIDOutput bBallM = new PIDOutputSplitter(new Talon(/*PWM*/8), new Talon(/*PWM*/9)); @@ -41,8 +41,10 @@ public class HwRobot { } public void run(Control c) { - lDriveM.pidWrite( c.lDrive); - rDriveM.pidWrite(-c.rDrive); + lDriveM1.pidWrite( c.lDrive1); + lDriveM2.pidWrite( c.lDrive2); + rDriveM1.pidWrite(-c.rDrive1); + rDriveM2.pidWrite(-c.rDrive2); armM.pidWrite(-c.arm); fBallM.pidWrite(-c.fBall); bBallM.pidWrite(-c.bBall); diff --git a/src/org/usfirst/frc/team4272/robot2016/Teleop.java b/src/org/usfirst/frc/team4272/robot2016/Teleop.java index 0de200d..b082adb 100644 --- a/src/org/usfirst/frc/team4272/robot2016/Teleop.java +++ b/src/org/usfirst/frc/team4272/robot2016/Teleop.java @@ -28,8 +28,10 @@ public class Teleop { public Control run(Control control, HwOI oi) { /* Drive */ - control.lDrive = jsScale(oi.lStick); - control.rDrive = jsScale(oi.rStick); + control.lDrive1 = jsScale(oi.lStick); + control.rDrive1 = jsScale(oi.rStick); + control.lDrive2 = oi.lStick.getTrigger() ? control.lDrive1 : 0; + control.rDrive2 = oi.rStick.getTrigger() ? control.rDrive1 : 0; control.arm = -oi.xbox.getAxis(Axis.LY); control.fBall = bound(-1, oi.xbox.getAxis(Axis.RTrigger) - oi.xbox.getAxis(Axis.LTrigger), 1); control.bBall = bound(-1, |