From 6b2fc22f2340904faee55cf5c84c57f59188f1d9 Mon Sep 17 00:00:00 2001 From: Rohan Rodrigues Date: Wed, 8 Mar 2017 17:10:05 -0800 Subject: [PATCH] Fix merge conflicts --- src/org/usfirst/frc/team3501/robot/OI.java | 1 - .../commands/driving/ToggleDrivePiston.java | 58 ------------------- .../robot/commands/driving/ToggleGear.java | 10 +++- .../team3501/robot/subsystems/DriveTrain.java | 21 ++++--- 4 files changed, 22 insertions(+), 68 deletions(-) delete mode 100644 src/org/usfirst/frc/team3501/robot/commands/driving/ToggleDrivePiston.java diff --git a/src/org/usfirst/frc/team3501/robot/OI.java b/src/org/usfirst/frc/team3501/robot/OI.java index c2571ec..16ed17c 100644 --- a/src/org/usfirst/frc/team3501/robot/OI.java +++ b/src/org/usfirst/frc/team3501/robot/OI.java @@ -98,7 +98,6 @@ public class OI /* implements KeyListener */ { coastCANTalons = new JoystickButton(rightJoystick, Constants.OI.COAST_CANTALONS_PORT); coastCANTalons.whenPressed(new CoastCANTalons()); - } public static OI getOI() { diff --git a/src/org/usfirst/frc/team3501/robot/commands/driving/ToggleDrivePiston.java b/src/org/usfirst/frc/team3501/robot/commands/driving/ToggleDrivePiston.java deleted file mode 100644 index ad13cc0..0000000 --- a/src/org/usfirst/frc/team3501/robot/commands/driving/ToggleDrivePiston.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands.driving; - -import org.usfirst.frc.team3501.robot.Constants; -import org.usfirst.frc.team3501.robot.Robot; -import org.usfirst.frc.team3501.robot.subsystems.DriveTrain; -import edu.wpi.first.wpilibj.command.Command; - -public class ToggleDrivePiston extends Command { - private DriveTrain driveTrain = Robot.getDriveTrain(); - - /** - * See JavaDoc comment in class for details - * - * @param motorVal - * value range from -1 to 1 - */ - public ToggleDrivePiston() { - requires(driveTrain); - } - - // Called just before this Command runs the first time - @Override - protected void initialize() { - } - - // Called repeatedly when this Command is scheduled to run - @Override - protected void execute() { - if (DriveTrain.getDriveTrain() - .getLeftGearPistonValue() == Constants.DriveTrain.HIGH_GEAR) { - DriveTrain.getDriveTrain().setLowGear(); - } else { - DriveTrain.getDriveTrain().setHighGear(); - } - - // check to make sure that both pistons are set to the same gear. Otherwise, - // the code must be changed - } - - // Called once after isFinished returns true - @Override - protected void end() { - } - - // Called when another command which requires one or more of the same - // subsystems is scheduled to run - @Override - protected void interrupted() { - end(); - } - - @Override - protected boolean isFinished() { - return false; - - } - -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/driving/ToggleGear.java b/src/org/usfirst/frc/team3501/robot/commands/driving/ToggleGear.java index ca802e7..8fa8bc7 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/driving/ToggleGear.java +++ b/src/org/usfirst/frc/team3501/robot/commands/driving/ToggleGear.java @@ -31,9 +31,15 @@ public class ToggleGear extends Command { Value rightGearPistonValue = driveTrain.getRightGearPistonValue(); if (leftGearPistonValue == Constants.DriveTrain.LOW_GEAR) { - driveTrain.setHighGear(); + driveTrain.setHighGear(driveTrain.getLeftPiston()); } else { - driveTrain.setLowGear(); + driveTrain.setLowGear(driveTrain.getLeftPiston()); + } + + if (rightGearPistonValue == Constants.DriveTrain.LOW_GEAR) { + driveTrain.setHighGear(driveTrain.getRightPiston()); + } else { + driveTrain.setLowGear(driveTrain.getRightPiston()); } } diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java b/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java index bad303a..10bc445 100644 --- a/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java @@ -170,26 +170,33 @@ public class DriveTrain extends Subsystem { return rightGearPiston.get(); } + public DoubleSolenoid getLeftPiston() { + return this.leftGearPiston; + } + + public DoubleSolenoid getRightPiston() { + return this.rightGearPiston; + } + /* * Changes the ball shift gear assembly to high */ - public void setHighGear() { - changeGear(Constants.DriveTrain.HIGH_GEAR); + public void setHighGear(DoubleSolenoid p) { + changeGear(Constants.DriveTrain.HIGH_GEAR, p); } /* * Changes the ball shift gear assembly to low */ - public void setLowGear() { - changeGear(Constants.DriveTrain.LOW_GEAR); + public void setLowGear(DoubleSolenoid p) { + changeGear(Constants.DriveTrain.LOW_GEAR, p); } /* * Changes the gear to a DoubleSolenoid.Value */ - private void changeGear(DoubleSolenoid.Value gear) { - leftGearPiston.set(gear); - rightGearPiston.set(gear); + private void changeGear(DoubleSolenoid.Value gear, DoubleSolenoid piston) { + piston.set(gear); } @Override -- 2.30.2