mirror of
https://github.com/TimeCrafters/FTC_2022
synced 2025-12-16 08:52:35 +00:00
Cleaning up TeleOP and straightening the drive
This commit is contained in:
@@ -43,13 +43,12 @@ public class PrototypeBot1 {
|
|||||||
|
|
||||||
public TimeCraftersConfiguration configuration;
|
public TimeCraftersConfiguration configuration;
|
||||||
|
|
||||||
// public Servo collectorWrist;
|
|
||||||
|
|
||||||
public PrototypeBot1(CyberarmEngine engine) {
|
public PrototypeBot1(CyberarmEngine engine) {
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
|
|
||||||
// initVuforia();
|
initVuforia();
|
||||||
// initTfod();
|
initTfod();
|
||||||
setupRobot();
|
setupRobot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package org.timecrafters.testing.states;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
|
||||||
import com.qualcomm.robotcore.hardware.Servo;
|
import com.qualcomm.robotcore.hardware.Servo;
|
||||||
|
import com.vuforia.Vuforia;
|
||||||
|
|
||||||
import org.cyberarm.engine.V2.CyberarmState;
|
import org.cyberarm.engine.V2.CyberarmState;
|
||||||
|
|
||||||
@@ -227,11 +228,11 @@ public class PrototypeTeleOPState extends CyberarmState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (engine.gamepad1.dpad_left) {
|
if (engine.gamepad1.dpad_left) {
|
||||||
robot.collectorLeft.setPower(1);
|
|
||||||
robot.collectorRight.setPower(1);
|
|
||||||
} else if (engine.gamepad1.dpad_right) {
|
|
||||||
robot.collectorLeft.setPower(-1);
|
robot.collectorLeft.setPower(-1);
|
||||||
robot.collectorRight.setPower(-1);
|
robot.collectorRight.setPower(-1);
|
||||||
|
} else if (engine.gamepad1.dpad_right) {
|
||||||
|
robot.collectorLeft.setPower(1);
|
||||||
|
robot.collectorRight.setPower(1);
|
||||||
} else {
|
} else {
|
||||||
robot.collectorLeft.setPower(0);
|
robot.collectorLeft.setPower(0);
|
||||||
robot.collectorRight.setPower(0);
|
robot.collectorRight.setPower(0);
|
||||||
@@ -273,6 +274,51 @@ public class PrototypeTeleOPState extends CyberarmState {
|
|||||||
}
|
}
|
||||||
}//end of a
|
}//end of a
|
||||||
|
|
||||||
|
if (engine.gamepad2.back) {
|
||||||
|
robot.backLeftDrive.setPower(1);
|
||||||
|
robot.backRightDrive.setPower(1);
|
||||||
|
robot.frontLeftDrive.setPower(1);
|
||||||
|
robot.frontRightDrive.setPower(1);
|
||||||
|
if (System.currentTimeMillis() - lastStepTime >= 1500) {
|
||||||
|
robot.backLeftDrive.setPower(0);
|
||||||
|
robot.backRightDrive.setPower(0);
|
||||||
|
robot.frontLeftDrive.setPower(0);
|
||||||
|
robot.frontRightDrive.setPower(0);
|
||||||
|
}
|
||||||
|
if (System.currentTimeMillis() - lastStepTime >= 150) {
|
||||||
|
if (robot.HighRiserLeft.getPosition() < 1) {
|
||||||
|
if (System.currentTimeMillis() - lastStepTime >= 150) {
|
||||||
|
lastStepTime = System.currentTimeMillis();
|
||||||
|
robot.HighRiserLeft.setPosition(robot.HighRiserLeft.getPosition() + 0.05);
|
||||||
|
robot.HighRiserRight.setPosition(robot.HighRiserRight.getPosition() + 0.05);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (System.currentTimeMillis() - lastStepTime >= 150) {
|
||||||
|
if (robot.LowRiserLeft.getPosition() < 1 && robot.HighRiserLeft.getPosition() == 1) {
|
||||||
|
if (System.currentTimeMillis() - lastStepTime >= 150) {
|
||||||
|
lastStepTime = System.currentTimeMillis();
|
||||||
|
robot.LowRiserLeft.setPosition(robot.LowRiserLeft.getPosition() + 0.05);
|
||||||
|
robot.LowRiserRight.setPosition(robot.LowRiserRight.getPosition() + 0.05);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (System.currentTimeMillis() >= 250) {
|
||||||
|
robot.backLeftDrive.setPower(1);
|
||||||
|
robot.backRightDrive.setPower(1);
|
||||||
|
robot.frontLeftDrive.setPower(1);
|
||||||
|
robot.frontRightDrive.setPower(1);
|
||||||
|
if (System.currentTimeMillis() - lastStepTime >= 250) {
|
||||||
|
robot.backLeftDrive.setPower(0);
|
||||||
|
robot.backRightDrive.setPower(0);
|
||||||
|
robot.frontLeftDrive.setPower(0);
|
||||||
|
robot.frontRightDrive.setPower(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|||||||
Reference in New Issue
Block a user