just added a slowmode fix and also cut power in half since there were issues with how much speed we have being applied at the moment. so now full speed (AKA as "speed" in the code) is at 50% while "half speed" is at 25%

This commit is contained in:
SpencerPiha
2022-10-08 16:45:05 -05:00
parent 9efbc78013
commit cf89b53e90
2 changed files with 11 additions and 9 deletions

View File

@@ -20,5 +20,4 @@ public class PrototypeTeleOP extends CyberarmEngine {
addState(new PrototypeTeleOPState(robot));
}
}

View File

@@ -22,11 +22,14 @@ public class PrototypeTeleOPState extends CyberarmState {
private boolean raiseHighRiser = true;
private long lastStepTime = 0;
private boolean raiseLowRiser = true;
private double speed = 0.5;
private double slowSpeed = 0.25;
public PrototypeTeleOPState(PrototypeBot1 robot) {
this.robot = robot;
}
@Override
public void telemetry() {
// engine.telemetry.addData("Arm Power", robot.armMotor.getPower());
@@ -75,10 +78,10 @@ public class PrototypeTeleOPState extends CyberarmState {
if (b && !bprev) {
if (drivePower == 1) {
drivePower = 0.5;
if (drivePower == speed) {
drivePower = slowSpeed;
} else {
drivePower = 1;
drivePower = speed;
}
}
@@ -98,14 +101,14 @@ public class PrototypeTeleOPState extends CyberarmState {
double backRightPower = (y + x - rx) / denominator;
// As I programmed this and ran it, I realized everything was backwards
// in direction so to fix that i either went in the robot object state and reversed
// in direction so to fix that I either went in the robot object state and reversed
// directions on drive motors or put a negative in behind the joystick power to reverse it.
// I put negatives in to reverse it because it was the easiest at the moment.
robot.frontLeftDrive.setPower(-frontLeftPower);
robot.backLeftDrive.setPower(backLeftPower);
robot.frontRightDrive.setPower(-frontRightPower);
robot.backRightDrive.setPower(backRightPower);
robot.frontLeftDrive.setPower(-frontLeftPower * speed);
robot.backLeftDrive.setPower(backLeftPower * speed);
robot.frontRightDrive.setPower(-frontRightPower * speed);
robot.backRightDrive.setPower(backRightPower * speed);
// robot.armMotor.setPower(engine.gamepad2.left_stick_y * 0.5);