mirror of
https://github.com/TimeCrafters/FTC_2022
synced 2025-12-15 22:22:35 +00:00
Adding semi-autonomous functions, variable names are *NOT* inspired by the story of Spirit and Opportunity, the names are a coincidence.
This commit is contained in:
@@ -15,6 +15,7 @@ public class TeleOPTankDriver extends CyberarmState {
|
||||
private double RotationTarget, DeltaRotation;
|
||||
private double MinimalPower = 0.2;
|
||||
private int DeltaOdometerR, Endeavour, Spirit;
|
||||
private boolean FreeSpirit;
|
||||
private GamepadChecker gamepad1Checker;
|
||||
public TeleOPTankDriver(PhoenixBot1 robot) {
|
||||
this.robot = robot;
|
||||
@@ -31,15 +32,39 @@ public class TeleOPTankDriver extends CyberarmState {
|
||||
@Override
|
||||
public void init() {
|
||||
gamepad1Checker = new GamepadChecker(engine, engine.gamepad1);
|
||||
FreeSpirit = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exec() {
|
||||
|
||||
if (drivePower > 0.1 && ) {
|
||||
|
||||
if (drivePower > 0.2) {
|
||||
if (System.currentTimeMillis() - lastStepTime >= 2000 && DeltaOdometerR < 4096) {
|
||||
lastStepTime = System.currentTimeMillis();
|
||||
FreeSpirit = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (FreeSpirit) {
|
||||
drivePower = -engine.gamepad1.left_stick_y;
|
||||
robot.backLeftDrive.setPower(drivePower);
|
||||
robot.backRightDrive.setPower(drivePower);
|
||||
robot.frontLeftDrive.setPower(drivePower);
|
||||
robot.frontRightDrive.setPower(drivePower);
|
||||
}
|
||||
|
||||
if (Math.abs(engine.gamepad1.left_stick_y) > 0.1 && !FreeSpirit) {
|
||||
drivePower = engine.gamepad1.left_stick_y;
|
||||
robot.backLeftDrive.setPower(drivePower);
|
||||
robot.backRightDrive.setPower(drivePower);
|
||||
robot.frontLeftDrive.setPower(drivePower);
|
||||
robot.frontRightDrive.setPower(drivePower);
|
||||
}
|
||||
|
||||
if ()
|
||||
|
||||
|
||||
|
||||
}
|
||||
public void CalculateDeltaRotation() {
|
||||
if (RotationTarget >= 0 && RobotRotation >= 0) {
|
||||
|
||||
Reference in New Issue
Block a user