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.Robot;
public class AutoDrive extends CommandBase {
private double distance;
// Determines if we should start driving
// Will be false if we already started driving
private boolean startDriving = true;
public AutoDrive(double distance, double timeout) {
requires(driveBase);
this.distance = distance;
setTimeout(timeout);
}
public AutoDrive(double distance) {
requires(driveBase);
this.distance = distance;
// Make the default timeout 2s
setTimeout(2.0d);
}
protected void initialize() {
}
protected void execute() {
if (startDriving) {
driveBase.pidDrive(distance);
}
startDriving = false;
}
protected void end() {
startDriving = true;
driveBase.stopDriving();
}
protected void interrupted() {
end();
}
protected boolean isFinished() {
return isTimedOut();
}
private double distance;
// Determines if we should start driving
// Will be false if we already started driving
private boolean startDriving = true;
public AutoDrive(double distance, double timeout) {
requires(driveBase);
this.distance = distance;
setTimeout(timeout);
}
public AutoDrive(double distance) {
requires(driveBase);
this.distance = distance;
// Make the default timeout 2s
setTimeout(2.0d);
}
protected void initialize() {
}
protected void execute() {
if (startDriving) {
driveBase.pidDrive(distance);
}
startDriving = false;
}
protected void end() {
startDriving = true;
driveBase.stopDriving();
}
protected void interrupted() {
end();
}
protected boolean isFinished() {
return isTimedOut();
}
}
// vim: sw=2:ts=2:sts=2

View File

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