Added speed control as per issue #3

This commit is contained in:
2024-11-13 15:29:15 -08:00
parent 3aec123ba0
commit 3849265627

View File

@ -38,10 +38,22 @@ public class CometBotTeleopCompetition {
public Gamepad previousGP1;
public Gamepad currentGP2;
public Gamepad previousGP2;
/*
Pedro/FTC Components
*/
private Follower follower;
private Telemetry telemetry;
/*
States
*/
public FieldStates fieldStates;
private Follower follower;
/*
Configurations
*/
public double currentPower = MAX_POWER;
public CometBotTeleopCompetition(HardwareMap hardwareMap, Telemetry telemetry, Gamepad gp1, Gamepad gp2) {
this.motors = new MotorsSubsystem(hardwareMap, telemetry, .55);
@ -82,6 +94,8 @@ public class CometBotTeleopCompetition {
this.toArmParkPosition();
this.toArmParkThenSwitchBetweenSubmarineAndFloorPosition();
this.clawControl();
this.decreaseMaxPower();
this.increaseMaxPower();
follower.setTeleOpMovementVectors(-this.GP1.left_stick_y, -this.GP1.left_stick_x, -this.GP1.right_stick_x, CENTRICITY);
follower.update();
@ -95,7 +109,33 @@ public class CometBotTeleopCompetition {
this.telemetry.addData("Lift Position", this.lift.getPosition());
}
/*
Type: PS4 / Logitech
Controller: 1
Button: Left Bumper
Assumption: Working motor mechanism
Action: Decreases maximum speed by -.05
*/
public void decreaseMaxPower() {
if (this.currentGP1.left_bumper && !this.previousGP1.left_bumper) {
this.currentPower = this.currentPower - .05;
this.follower.setMaxPower(this.currentPower);
}
}
/*
Type: PS4 / Logitech
Controller: 1
Button: Left Bumper
Assumption: Working motor mechanism
Action: Increases maximum speed by +.05
*/
public void increaseMaxPower() {
if (this.currentGP1.left_bumper && !this.previousGP1.left_bumper) {
this.currentPower = this.currentPower + .05;
this.follower.setMaxPower(this.currentPower);
}
}
/*
Type: PS4 / Logitech