Autoformatted

This commit is contained in:
Austen Adler 2016-09-21 12:00:49 -04:00
parent 2fe8a25226
commit da3c1b24d6
No known key found for this signature in database
GPG Key ID: 7ECEE590CCDFE3F1
2 changed files with 43 additions and 45 deletions

View File

@ -2,38 +2,38 @@ package org.usfirst.frc.team2059.robot.commands.autonomous;
import org.usfirst.frc.team2059.robot.commands.CommandBase; import org.usfirst.frc.team2059.robot.commands.CommandBase;
import org.usfirst.frc.team2059.robot.Robot; import org.usfirst.frc.team2059.robot.Robot;
public class AutoDrive extends CommandBase { public class AutoDrive extends CommandBase {
private double distance; private double distance;
// Determines if we should start driving // Determines if we should start driving
// Will be false if we already started driving // Will be false if we already started driving
private boolean startDriving = true; private boolean startDriving = true;
public AutoDrive(double distance, double timeout) { public AutoDrive(double distance, double timeout) {
requires(driveBase); requires(driveBase);
this.distance = distance; this.distance = distance;
setTimeout(timeout); setTimeout(timeout);
} }
public AutoDrive(double distance) { public AutoDrive(double distance) {
requires(driveBase); requires(driveBase);
this.distance = distance; this.distance = distance;
// Make the default timeout 2s // Make the default timeout 2s
setTimeout(2.0d); setTimeout(2.0d);
} }
protected void initialize() { protected void initialize() {
} }
protected void execute() { protected void execute() {
if (startDriving) { if (startDriving) {
driveBase.pidDrive(distance); driveBase.pidDrive(distance);
} }
startDriving = false; startDriving = false;
} }
protected void end() { protected void end() {
startDriving = true; startDriving = true;
driveBase.stopDriving(); driveBase.stopDriving();
} }
protected void interrupted() { protected void interrupted() {
end(); end();
} }
protected boolean isFinished() { protected boolean isFinished() {
return isTimedOut(); return isTimedOut();
} }
} }
// vim: sw=2:ts=2:sts=2 // vim: sw=2:ts=2:sts=2

View File

@ -37,39 +37,37 @@ public class MainArm extends PIDSubsystem {
public double getDegrees() { public double getDegrees() {
return potToDegrees(getRaw()); return potToDegrees(getRaw());
} }
public void resetLower(double speed) {
public void resetLower(double speed){ if (!limitSwitchBottom.get()) {
if(!limitSwitchBottom.get()){
System.out.println("PRESSDE"); System.out.println("PRESSDE");
moveArm(0); moveArm(0);
return; return;
}else{ } else {
System.out.println("not pressed"); System.out.println("not pressed");
moveArm(speed); moveArm(speed);
} }
} }
public boolean getBottomPressed(){ public boolean getBottomPressed() {
return !limitSwitchBottom.get(); return !limitSwitchBottom.get();
} }
public void resetUpper(double speed) {
public void resetUpper(double speed){ if (!limitSwitchTop.get()) {
if(!limitSwitchTop.get()){
System.out.println("PRESSDE"); System.out.println("PRESSDE");
moveArm(0); moveArm(0);
return; return;
}else{ } else {
System.out.println("not pressed"); System.out.println("not pressed");
moveArm(speed); moveArm(speed);
} }
} }
public boolean getTopPressed(){ public boolean getTopPressed() {
return !limitSwitchTop.get(); return !limitSwitchTop.get();
} }
private double potToDegrees(double pot) { private double potToDegrees(double pot) {
if(!limitSwitchBottom.get()){ if (!limitSwitchBottom.get()) {
System.out.println("got"); System.out.println("got");
min = getRaw(); min = getRaw();
}else if(!limitSwitchTop.get()){ } else if (!limitSwitchTop.get()) {
max = getRaw(); max = getRaw();
} }
System.out.println((pot - min) / (Math.abs(min - max) / 90)); System.out.println((pot - min) / (Math.abs(min - max) / 90));