Merge remote-tracking branch 'origin/master'

This commit is contained in:
SpencerPiha
2022-10-25 18:46:15 -05:00
2 changed files with 51 additions and 61 deletions

View File

@@ -1,4 +1,4 @@
package org.timecrafters.testing.states; package org.timecrafters.testing.engine;
import com.qualcomm.hardware.bosch.BNO055IMU; import com.qualcomm.hardware.bosch.BNO055IMU;
import com.qualcomm.robotcore.hardware.CRServo; import com.qualcomm.robotcore.hardware.CRServo;

View File

@@ -67,7 +67,6 @@ public class PrototypeTeleOPState extends CyberarmState {
Y = engine.gamepad1.y; Y = engine.gamepad1.y;
UpDPad = engine.gamepad1.dpad_up; UpDPad = engine.gamepad1.dpad_up;
//drive speed toggle //drive speed toggle
// //
// boolean b = engine.gamepad1.b; // boolean b = engine.gamepad1.b;
@@ -104,18 +103,9 @@ public class PrototypeTeleOPState extends CyberarmState {
// robot.frontRightDrive.setPower(-frontRightPower * speed); // robot.frontRightDrive.setPower(-frontRightPower * speed);
// robot.backRightDrive.setPower(backRightPower * speed); // robot.backRightDrive.setPower(backRightPower * speed);
// if (engine.gamepad2.y) {
//
// robot.collectorLeft.setPower(0);
// robot.collectorRight.setPower(0);
if (engine.gamepad2.dpad_up) {
robot.collectorLeft.setPower(1);
}
if (engine.gamepad1.right_trigger > 0) { if (engine.gamepad1.right_trigger > 0) {
drivePower = engine.gamepad1.right_trigger; drivePower = engine.gamepad1.right_trigger;
robot.backLeftDrive.setPower(drivePower); robot.backLeftDrive.setPower(0.1);
robot.backRightDrive.setPower(drivePower); robot.backRightDrive.setPower(drivePower);
robot.frontLeftDrive.setPower(drivePower); robot.frontLeftDrive.setPower(drivePower);
robot.frontRightDrive.setPower(drivePower); robot.frontRightDrive.setPower(drivePower);
@@ -123,7 +113,7 @@ public class PrototypeTeleOPState extends CyberarmState {
if (engine.gamepad1.left_trigger > 0) { if (engine.gamepad1.left_trigger > 0) {
drivePower = engine.gamepad1.left_trigger; drivePower = engine.gamepad1.left_trigger;
robot.backLeftDrive.setPower(-drivePower); robot.backLeftDrive.setPower(-0.1);
robot.backRightDrive.setPower(-drivePower); robot.backRightDrive.setPower(-drivePower);
robot.frontLeftDrive.setPower(-drivePower); robot.frontLeftDrive.setPower(-drivePower);
robot.frontRightDrive.setPower(-drivePower); robot.frontRightDrive.setPower(-drivePower);
@@ -262,7 +252,8 @@ public class PrototypeTeleOPState extends CyberarmState {
robot.LowRiserLeft.setPosition(robot.LowRiserLeft.getPosition() + 0.05); robot.LowRiserLeft.setPosition(robot.LowRiserLeft.getPosition() + 0.05);
robot.LowRiserRight.setPosition(robot.LowRiserRight.getPosition() + 0.05); robot.LowRiserRight.setPosition(robot.LowRiserRight.getPosition() + 0.05);
} }
}//end of y }
}//end of y
if (engine.gamepad2.a) { if (engine.gamepad2.a) {
if (robot.HighRiserLeft.getPosition() > 0.45 && robot.LowRiserLeft.getPosition() < 0.5) { if (robot.HighRiserLeft.getPosition() > 0.45 && robot.LowRiserLeft.getPosition() < 0.5) {
@@ -404,59 +395,59 @@ public class PrototypeTeleOPState extends CyberarmState {
// //
// } // }
// //
//// if (engine.gamepad2.start){ if (engine.gamepad2.start) {
////
//// if (System.currentTimeMillis() - lastStepTime >= 150) {
// lastStepTime = System.currentTimeMillis();
switch (CyclingArmUpAndDown) { if (System.currentTimeMillis() - lastStepTime >= 150) {
lastStepTime = System.currentTimeMillis();
// upper arm up switch (CyclingArmUpAndDown) {
case 0:
if (robot.HighRiserLeft.getPosition() < 1) {
robot.HighRiserLeft.setPosition(robot.HighRiserLeft.getPosition() + 0.05);
robot.HighRiserRight.setPosition(robot.HighRiserRight.getPosition() + 0.05);
} else {
CyclingArmUpAndDown = CyclingArmUpAndDown + 1;
}
break;
// lower arm up // upper arm up
case 1: case 0:
if (robot.LowRiserLeft.getPosition() < 1) { if (robot.HighRiserLeft.getPosition() < 1) {
robot.LowRiserLeft.setPosition(robot.LowRiserLeft.getPosition() + 0.05); robot.HighRiserLeft.setPosition(robot.HighRiserLeft.getPosition() + 0.05);
robot.LowRiserRight.setPosition(robot.LowRiserRight.getPosition() + 0.05); robot.HighRiserRight.setPosition(robot.HighRiserRight.getPosition() + 0.05);
} else { } else {
CyclingArmUpAndDown = CyclingArmUpAndDown + 1; CyclingArmUpAndDown = CyclingArmUpAndDown + 1;
} }
break; break;
// lower arm down // lower arm up
case 2: case 1:
if (robot.LowRiserLeft.getPosition() >= 0.44) { if (robot.LowRiserLeft.getPosition() < 1) {
robot.LowRiserLeft.setPosition(robot.LowRiserLeft.getPosition() - 0.05); robot.LowRiserLeft.setPosition(robot.LowRiserLeft.getPosition() + 0.05);
robot.LowRiserRight.setPosition(robot.LowRiserRight.getPosition() - 0.05); robot.LowRiserRight.setPosition(robot.LowRiserRight.getPosition() + 0.05);
} else { } else {
CyclingArmUpAndDown = CyclingArmUpAndDown + 1; CyclingArmUpAndDown = CyclingArmUpAndDown + 1;
} }
break; break;
// upper arm down // lower arm down
case 3: case 2:
if (robot.HighRiserLeft.getPosition() >= 0.45) { if (robot.LowRiserLeft.getPosition() >= 0.44) {
robot.HighRiserLeft.setPosition(robot.HighRiserLeft.getPosition() - 0.05); robot.LowRiserLeft.setPosition(robot.LowRiserLeft.getPosition() - 0.05);
robot.HighRiserRight.setPosition(robot.HighRiserRight.getPosition() - 0.05); robot.LowRiserRight.setPosition(robot.LowRiserRight.getPosition() - 0.05);
} else { } else {
CyclingArmUpAndDown = 0; CyclingArmUpAndDown = CyclingArmUpAndDown + 1;
} }
break; break;
default: // upper arm down
break; case 3:
if (robot.HighRiserLeft.getPosition() >= 0.45) {
robot.HighRiserLeft.setPosition(robot.HighRiserLeft.getPosition() - 0.05);
robot.HighRiserRight.setPosition(robot.HighRiserRight.getPosition() - 0.05);
} else {
CyclingArmUpAndDown = 0;
}
break;
} // end of switch default:
// end of time if statement break;
// end of start button press
} // end of switch
}// end of time if statement
}// end of start button press
// if (engine.gamepad2.left_stick_y > 0.1) { // if (engine.gamepad2.left_stick_y > 0.1) {
// robot.HighRiserLeft.setPosition(0.5); // robot.HighRiserLeft.setPosition(0.5);
@@ -683,4 +674,3 @@ public class PrototypeTeleOPState extends CyberarmState {
} }
}