3 Commits

4 changed files with 95 additions and 46 deletions

View File

@ -97,60 +97,63 @@ public class CometBotAutoDevelopment {
follower.setTeleOpMovementVectors(-gamepad1.left_stick_y, -gamepad1.left_stick_x, -gamepad1.right_stick_x); follower.setTeleOpMovementVectors(-gamepad1.left_stick_y, -gamepad1.left_stick_x, -gamepad1.right_stick_x);
follower.update(); follower.update();
} }
private void grabBlueberrySkyhook() { private void grabBlueberrySkyhook() {
if (currentGamepad1.x) { if (currentGamepad1.x) {
claw.grabBlueberry(); // claw.grabBlueberry();
wrist.grabBlueberrySkyhook(); //wrist.grabBlueberrySkyhook();
arm.grabBlueberrySkyhook(); //arm.grabBlueberrySkyhook();
} }
/*if(arm.getState() == ArmSubsystem.ArmState.GRAB_BLUEBERRY_SKYHOOK) /*if(arm.getState() == ArmSubsystem.ArmState.GRAB_BLUEBERRY_SKYHOOK)
claw.closeClaw();*/ claw.closeClaw();*/
} }
private void hangSkyhook() { private void hangSkyhook() {
if (currentGamepad1.right_bumper && !previousGamepad1.right_bumper) { if (currentGamepad1.right_bumper && !previousGamepad1.right_bumper) {
dualSlides.toHangHeight(); dualSlides.toHangHeight();
//check wrist make go throught test files again //check wrist make go throught test files again
wrist.hangBlueberrySkyhook(); // wrist.hangBlueberrySkyhook();
arm.hangBlueberrySkyhook(); // arm.hangBlueberrySkyhook();
if (arm.getState() == ArmSubsystem.ArmState.HANG_BLUEBERRY_SKYHOOK) { // if (arm.getState() == ArmSubsystem.ArmState.HANG_BLUEBERRY_SKYHOOK) {
try { // try {
Thread.sleep(2000); // Thread.sleep(2000);
} catch (InterruptedException e) { // } catch (InterruptedException e) {
throw new RuntimeException(e); // throw new RuntimeException(e);
// }
// }
} }
} }
}
}private void openClaw(){ private void openClaw() {
if (currentGamepad2.right_bumper && !previousGamepad2.right_bumper) { if (currentGamepad2.right_bumper && !previousGamepad2.right_bumper) {
claw.switchState(); claw.switchState();
} }
} }
private void openThumb() { private void openThumb() {
if (currentGamepad2.left_bumper && !previousGamepad2.left_bumper) { if (currentGamepad2.left_bumper && !previousGamepad2.left_bumper) {
claw.switchTState(); claw.switchTState();
} }
} }
private void armAndWristToFloor() { private void armAndWristToFloor() {
if (currentGamepad2.a && !previousGamepad2.a) { if (currentGamepad2.a && !previousGamepad2.a) {
double increment = 0.7 - arm.getPosition(); arm.toFloorPositionTeleOp();
for(int i = 0; i < 3; i ++){ if (wrist.getState() != WristSubsystem.WristState.FLOOR) {
arm.setPosition(arm.getPosition() + increment); wrist.toFloorPositionTeleop();
try { } else {
Thread.sleep(50); wrist.toPickupPosition();
} catch (InterruptedException e) {
throw new RuntimeException(e);
} }
} }
arm.toFloorPosition();
}
if (currentGamepad2.a && !previousGamepad2.a) { if (currentGamepad2.a && !previousGamepad2.a) {
wrist.switchState(); wrist.switchState();
} }
} }
private void armToBucketPosition() { private void armToBucketPosition() {
if (currentGamepad2.dpad_up && !previousGamepad2.dpad_up) { if (currentGamepad2.dpad_up && !previousGamepad2.dpad_up) {
arm.toBucketPosition(); arm.toBucketPosition();
@ -158,10 +161,11 @@ public class CometBotAutoDevelopment {
} }
} }
private void armToParkPosition() { private void armToParkPosition() {
if (currentGamepad2.x && !previousGamepad2.x) { if (currentGamepad2.x && !previousGamepad2.x) {
arm.toParkPosition(); arm.toParkPosition();
wrist.toFloorPosition(); wrist.toFloorPositionTeleop();
} }
} }
@ -170,6 +174,7 @@ public class CometBotAutoDevelopment {
dualSlides.toHighBucketPosition(); dualSlides.toHighBucketPosition();
} }
} }
private void robotUp() { private void robotUp() {
if (currentGamepad1.dpad_up && !previousGamepad1.dpad_up) { if (currentGamepad1.dpad_up && !previousGamepad1.dpad_up) {
dualSlides.toHangBelowFloor(); dualSlides.toHangBelowFloor();
@ -178,21 +183,25 @@ public class CometBotAutoDevelopment {
} }
} }
private void robotDown() { private void robotDown() {
if (currentGamepad1.dpad_down && !previousGamepad1.dpad_down) { if (currentGamepad1.dpad_down && !previousGamepad1.dpad_down) {
hang.robotToFloor(); hang.robotToFloor();
} }
} }
private void stopHook() { private void stopHook() {
if (gamepad1.left_bumper) { if (gamepad1.left_bumper) {
hang.disableMotor(); hang.disableMotor();
} }
} }
private void dualSlidesToFloorPosition() { private void dualSlidesToFloorPosition() {
if (currentGamepad2.dpad_down && !previousGamepad2.dpad_down) { if (currentGamepad2.dpad_down && !previousGamepad2.dpad_down) {
dualSlides.toFloorPosition(); dualSlides.toFloorPosition();
} }
} }
private void dualSlidesToLowBucketPosition() { private void dualSlidesToLowBucketPosition() {
if (currentGamepad2.b && !previousGamepad2.b) { if (currentGamepad2.b && !previousGamepad2.b) {
dualSlides.toLowBucketPosition(); dualSlides.toLowBucketPosition();

View File

@ -54,6 +54,11 @@ public class CometBotTeleopCompetition {
*/ */
public double currentPower = MAX_POWER; public double currentPower = MAX_POWER;
/*
Misc
*/
private int hbCounter = 0;
public CometBotTeleopCompetition(HardwareMap hardwareMap, Telemetry telemetry, Gamepad gp1, Gamepad gp2) { public CometBotTeleopCompetition(HardwareMap hardwareMap, Telemetry telemetry, Gamepad gp1, Gamepad gp2) {
this.motors = new MotorsSubsystem(hardwareMap, telemetry, .55); this.motors = new MotorsSubsystem(hardwareMap, telemetry, .55);
@ -175,12 +180,38 @@ public class CometBotTeleopCompetition {
*/ */
public void toHighBucketScore() { public void toHighBucketScore() {
if (this.currentGP2.y && !this.previousGP2.y) { if (this.currentGP2.y && !this.previousGP2.y) {
switch(hbCounter) {
case 0:
lift.toHighBucketPosition(); lift.toHighBucketPosition();
hbCounter = 1;
break;
case 1:
wrist.toBucketPosition();
arm.toBucketPosition();
hbCounter = 2;
break;
case 2:
claw.openClaw();
hbCounter = 3;
break;
case 3:
claw.closeClaw();
wrist.toTravelPosition();
arm.toParkPosition();
hbCounter = 4;
break;
case 4:
lift.toFloorPosition();
break;
default:
break;
}
hbCounter = 1;
if (lift.getFixedPosition() >= 4450) { if (lift.getFixedPosition() >= 4450) {
arm.toBucketPosition(); arm.toBucketPosition();
if(arm.getPosition() == 0.45) if(arm.getPosition() == 0.45);
wrist.toBucketPosition(); wrist.toBucketPosition();
if(wrist.getPosition() == 0.56) if(wrist.getPosition() == 0.56);
claw.openClaw(); claw.openClaw();
} }
} }

View File

@ -45,6 +45,10 @@ public class ArmSubsystem {
arm.setPosition(armFloor); arm.setPosition(armFloor);
setState(ArmState.FLOOR); setState(ArmState.FLOOR);
} }
public void toFloorPositionTeleOp() {
arm.setPosition(.68);
setState(ArmState.FLOOR);
}
public void toBucketPosition() { public void toBucketPosition() {
arm.setPosition(armBucket); arm.setPosition(armBucket);

View File

@ -64,6 +64,11 @@ public class WristSubsystem {
wrist.setPosition(wristFloor); wrist.setPosition(wristFloor);
} }
public void toFloorPositionTeleop() {
setState(WristState.FLOOR);
wrist.setPosition(.425);
}
public void toBucketPosition() { public void toBucketPosition() {
setState(WristState.BUCKET); setState(WristState.BUCKET);
wrist.setPosition(wristBucket); wrist.setPosition(wristBucket);