mirror of
https://github.com/TimeCrafters/FTC_2022
synced 2025-12-15 22:22:35 +00:00
Adding semi-autonomous functions and transferring Teleop code, variable names are *NOT* inspired by the story of Spirit and Opportunity, the names are a coincidence.
This commit is contained in:
@@ -11,7 +11,7 @@ public class TeleOPArmDriver extends CyberarmState {
|
|||||||
private long lastStepTime = 0;
|
private long lastStepTime = 0;
|
||||||
private int CyclingArmUpAndDown = 0;
|
private int CyclingArmUpAndDown = 0;
|
||||||
private GamepadChecker gamepad2Checker;
|
private GamepadChecker gamepad2Checker;
|
||||||
private int Opportunity, Endeavour;
|
private int Opportunity, Endeavour, Peanut;
|
||||||
private double drivePower;
|
private double drivePower;
|
||||||
private double MinimalPower = 0.25, topServoOffset = -0.05, lowServoOffset = -0.05;
|
private double MinimalPower = 0.25, topServoOffset = -0.05, lowServoOffset = -0.05;
|
||||||
private double servoCollectLow = 0.40; //Low servos, A button
|
private double servoCollectLow = 0.40; //Low servos, A button
|
||||||
@@ -189,5 +189,28 @@ public void exec() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (engine.gamepad2.dpad_left && Peanut != 1) {
|
||||||
|
Peanut = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (engine.gamepad2.dpad_right && Peanut != 2) {
|
||||||
|
Peanut = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (engine.gamepad2.dpad_left && Peanut == 1 || engine.gamepad2.dpad_right && Peanut == 2) {
|
||||||
|
robot.collectorLeft.setPower(0);
|
||||||
|
robot.collectorRight.setPower(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Peanut == 1) {
|
||||||
|
robot.collectorRight.setPower(1);
|
||||||
|
robot.collectorLeft.setPower(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Peanut == 2) {
|
||||||
|
robot.collectorLeft.setPower(1);
|
||||||
|
robot.collectorRight.setPower(-1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,7 @@ public class TeleOPTankDriver extends CyberarmState {
|
|||||||
currentDriveCommand = engine.gamepad1.right_stick_x;
|
currentDriveCommand = engine.gamepad1.right_stick_x;
|
||||||
} else if (Math.abs(engine.gamepad1.right_stick_y) > 0.1) {
|
} else if (Math.abs(engine.gamepad1.right_stick_y) > 0.1) {
|
||||||
currentDriveCommand = engine.gamepad1.right_stick_y;
|
currentDriveCommand = engine.gamepad1.right_stick_y;
|
||||||
} else if (Math.abs(engine.gamepad1.left_stick_y) > 0.1 && Math.abs(engine.gamepad1.left_stick_x) > 0.1 && Math.abs(engine.gamepad1.right_stick_x) > 0.1 && Math.abs(engine.gamepad1.right_stick_y) > 0.1) {
|
} else if ((Math.abs(engine.gamepad1.left_stick_y)) > 0.1 && Math.abs(engine.gamepad1.left_stick_x) > 0.1 && Math.abs(engine.gamepad1.right_stick_x) > 0.1 && Math.abs(engine.gamepad1.right_stick_y) > 0.1 && !FreeSpirit) {
|
||||||
currentDriveCommand = 0;
|
currentDriveCommand = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user