mirror of
https://github.com/TimeCrafters/FTC_2022
synced 2025-12-16 18:12:34 +00:00
Rename the code
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
package org.timecrafters.testing.engine;
|
||||||
|
|
||||||
|
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
|
||||||
|
import com.qualcomm.robotcore.hardware.Gamepad;
|
||||||
|
|
||||||
|
import org.cyberarm.engine.V2.CyberarmEngine;
|
||||||
|
import org.timecrafters.testing.states.PhoenixBot1;
|
||||||
|
import org.timecrafters.testing.states.PhoenixTeleOPState;
|
||||||
|
|
||||||
|
@TeleOp (name = "PhoenixTeleOP")
|
||||||
|
|
||||||
|
public class PhoenixTeleOP extends CyberarmEngine {
|
||||||
|
|
||||||
|
PhoenixBot1 robot;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup() {
|
||||||
|
|
||||||
|
robot = new PhoenixBot1(this);
|
||||||
|
|
||||||
|
addState(new PhoenixTeleOPState(robot));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package org.timecrafters.testing.engine;
|
|
||||||
|
|
||||||
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
|
|
||||||
import com.qualcomm.robotcore.hardware.Gamepad;
|
|
||||||
|
|
||||||
import org.cyberarm.engine.V2.CyberarmEngine;
|
|
||||||
import org.timecrafters.testing.states.PrototypeBot1;
|
|
||||||
import org.timecrafters.testing.states.PrototypeTeleOPState;
|
|
||||||
|
|
||||||
@TeleOp (name = "PrototypeTeleOP")
|
|
||||||
|
|
||||||
public class PrototypeTeleOP extends CyberarmEngine {
|
|
||||||
|
|
||||||
PrototypeBot1 robot;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setup() {
|
|
||||||
|
|
||||||
robot = new PrototypeBot1(this);
|
|
||||||
|
|
||||||
addState(new PrototypeTeleOPState(robot));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -16,7 +16,7 @@ import org.firstinspires.ftc.robotcore.external.navigation.VuforiaLocalizer;
|
|||||||
import org.firstinspires.ftc.robotcore.external.tfod.TFObjectDetector;
|
import org.firstinspires.ftc.robotcore.external.tfod.TFObjectDetector;
|
||||||
import org.timecrafters.TimeCraftersConfigurationTool.library.TimeCraftersConfiguration;
|
import org.timecrafters.TimeCraftersConfigurationTool.library.TimeCraftersConfiguration;
|
||||||
|
|
||||||
public class PrototypeBot1 {
|
public class PhoenixBot1 {
|
||||||
|
|
||||||
private static final String TFOD_MODEL_ASSET = "PowerPlay.tflite";
|
private static final String TFOD_MODEL_ASSET = "PowerPlay.tflite";
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ public class PrototypeBot1 {
|
|||||||
public TimeCraftersConfiguration configuration;
|
public TimeCraftersConfiguration configuration;
|
||||||
|
|
||||||
|
|
||||||
public PrototypeBot1(CyberarmEngine engine) {
|
public PhoenixBot1(CyberarmEngine engine) {
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
|
|
||||||
initVuforia();
|
initVuforia();
|
||||||
@@ -10,9 +10,9 @@ import com.vuforia.Vuforia;
|
|||||||
import org.cyberarm.engine.V2.CyberarmState;
|
import org.cyberarm.engine.V2.CyberarmState;
|
||||||
import org.cyberarm.engine.V2.GamepadChecker;
|
import org.cyberarm.engine.V2.GamepadChecker;
|
||||||
|
|
||||||
public class PrototypeTeleOPState extends CyberarmState {
|
public class PhoenixTeleOPState extends CyberarmState {
|
||||||
|
|
||||||
private final PrototypeBot1 robot;
|
private final PhoenixBot1 robot;
|
||||||
private double drivePower = 1;
|
private double drivePower = 1;
|
||||||
private long lastStepTime = 0;
|
private long lastStepTime = 0;
|
||||||
private int CyclingArmUpAndDown = 0;
|
private int CyclingArmUpAndDown = 0;
|
||||||
@@ -21,7 +21,7 @@ public class PrototypeTeleOPState extends CyberarmState {
|
|||||||
private double MinimalPower = 0.2;
|
private double MinimalPower = 0.2;
|
||||||
private GamepadChecker gamepad1Checker, gamepad2Checker;
|
private GamepadChecker gamepad1Checker, gamepad2Checker;
|
||||||
|
|
||||||
public PrototypeTeleOPState(PrototypeBot1 robot) {
|
public PhoenixTeleOPState(PhoenixBot1 robot) {
|
||||||
this.robot = robot;
|
this.robot = robot;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,21 +148,21 @@ public class PrototypeTeleOPState extends CyberarmState {
|
|||||||
RobotRotation = robot.imu.getAngularOrientation().firstAngle;
|
RobotRotation = robot.imu.getAngularOrientation().firstAngle;
|
||||||
RotationTarget = 0;
|
RotationTarget = 0;
|
||||||
CalculateDeltaRotation();
|
CalculateDeltaRotation();
|
||||||
if (RobotRotation < -3) {
|
if (RobotRotation < -1) {
|
||||||
drivePower = (-1 * DeltaRotation/180) - MinimalPower;
|
drivePower = (-1 * DeltaRotation/180) - MinimalPower;
|
||||||
robot.backLeftDrive.setPower(drivePower);
|
robot.backLeftDrive.setPower(drivePower);
|
||||||
robot.backRightDrive.setPower(-drivePower);
|
robot.backRightDrive.setPower(-drivePower);
|
||||||
robot.frontLeftDrive.setPower(drivePower);
|
robot.frontLeftDrive.setPower(drivePower);
|
||||||
robot.frontRightDrive.setPower(-drivePower);
|
robot.frontRightDrive.setPower(-drivePower);
|
||||||
}
|
}
|
||||||
if (RobotRotation > 3) {
|
if (RobotRotation > 1) {
|
||||||
drivePower = (1 * DeltaRotation/180) + MinimalPower;
|
drivePower = (1 * DeltaRotation/180) + MinimalPower;
|
||||||
robot.backLeftDrive.setPower(drivePower);
|
robot.backLeftDrive.setPower(drivePower);
|
||||||
robot.backRightDrive.setPower(-drivePower);
|
robot.backRightDrive.setPower(-drivePower);
|
||||||
robot.frontLeftDrive.setPower(drivePower);
|
robot.frontLeftDrive.setPower(drivePower);
|
||||||
robot.frontRightDrive.setPower(-drivePower);
|
robot.frontRightDrive.setPower(-drivePower);
|
||||||
}
|
}
|
||||||
if (RobotRotation > -3 && RobotRotation < 3) {
|
if (RobotRotation > -1 && RobotRotation < 1) {
|
||||||
drivePower = 0;
|
drivePower = 0;
|
||||||
robot.backLeftDrive.setPower(drivePower);
|
robot.backLeftDrive.setPower(drivePower);
|
||||||
robot.backRightDrive.setPower(-drivePower);
|
robot.backRightDrive.setPower(-drivePower);
|
||||||
Reference in New Issue
Block a user