From 8d270bbc9b2104f80224a7b2932800ed8d9fd281 Mon Sep 17 00:00:00 2001 From: Harel Dor Date: Wed, 9 Mar 2016 23:12:11 -0800 Subject: [PATCH] Finally got this code reviewed, bugfixes --- .../robot/commands/driving/ToggleGear.java | 2 +- .../robot/commands/intakearm/StopIntake.java | 49 ------------------- .../team3501/robot/subsystems/DriveTrain.java | 6 +++ 3 files changed, 7 insertions(+), 50 deletions(-) delete mode 100644 src/org/usfirst/frc/team3501/robot/commands/intakearm/StopIntake.java 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 96f98dbc..cc7e1f76 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/driving/ToggleGear.java +++ b/src/org/usfirst/frc/team3501/robot/commands/driving/ToggleGear.java @@ -16,7 +16,7 @@ public class ToggleGear extends Command { // Called just before this Command runs the first time @Override protected void initialize() { - Robot.driveTrain.toggleFlipped(); + Robot.driveTrain.switchGear(); } // Called repeatedly when this Command is scheduled to run diff --git a/src/org/usfirst/frc/team3501/robot/commands/intakearm/StopIntake.java b/src/org/usfirst/frc/team3501/robot/commands/intakearm/StopIntake.java deleted file mode 100644 index aef6ab8b..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/intakearm/StopIntake.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands.intakearm; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command will take a boulder into the robot if there is not a boulder - * present inside already. - * - * pre-condition: Intake arm must be at correct height and a boulder is not - * present inside the robot. - * - * post-condition: A boulder is taken in from the field outside of the robot - * into the robot. - * - * @author Lauren and Niyati - * - */ - -public class StopIntake extends Command { - - public StopIntake() { - requires(Robot.intakeArm); - } - - @Override - protected void initialize() { - Robot.intakeArm.stopRollers(); - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return true; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } - -} diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java b/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java index 3d406d7c..73dcde70 100644 --- a/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/DriveTrain.java @@ -12,7 +12,9 @@ import edu.wpi.first.wpilibj.RobotDrive; import edu.wpi.first.wpilibj.command.PIDSubsystem; public class DriveTrain extends PIDSubsystem { + // Determines if the "front" of the robot has been reversed private boolean outputFlipped = false; + private static double pidOutput = 0; private Encoder leftEncoder, rightEncoder; @@ -193,8 +195,12 @@ public class DriveTrain extends PIDSubsystem { public void joystickDrive(double left, double right) { int type = Constants.DriveTrain.DRIVE_TYPE; + + // Handle flipping of the "front" of the robot double k = (isFlipped() ? -1 : 1); + if (type == Constants.DriveTrain.TANK) { + // TODO Test this for negation and for voltage vs. [-1,1] outputs double leftSpeed = (-frontLeft.get() + -rearLeft.get()) / 2; double rightSpeed = (-frontRight.get() + -rearRight.get()) / 2; left = ((Constants.DriveTrain.kADJUST - 1) * leftSpeed + left) -- 2.30.2