diff --git a/TeamCode/src/main/java/org/timecrafters/Autonomous/Engines/TestAutonomousEngine.java b/TeamCode/src/main/java/org/timecrafters/Autonomous/Engines/TestAutonomousEngine.java index 6188e11..ecc6c28 100644 --- a/TeamCode/src/main/java/org/timecrafters/Autonomous/Engines/TestAutonomousEngine.java +++ b/TeamCode/src/main/java/org/timecrafters/Autonomous/Engines/TestAutonomousEngine.java @@ -1,6 +1,7 @@ package org.timecrafters.Autonomous.Engines; import com.qualcomm.robotcore.eventloop.opmode.Autonomous; +import com.qualcomm.robotcore.hardware.DcMotor; import org.cyberarm.engine.V2.CyberarmEngine; import org.timecrafters.Autonomous.States.CollectorState; diff --git a/TeamCode/src/main/java/org/timecrafters/Autonomous/States/DriverState.java b/TeamCode/src/main/java/org/timecrafters/Autonomous/States/DriverState.java index d010627..059bd2c 100644 --- a/TeamCode/src/main/java/org/timecrafters/Autonomous/States/DriverState.java +++ b/TeamCode/src/main/java/org/timecrafters/Autonomous/States/DriverState.java @@ -11,19 +11,16 @@ public class DriverState extends CyberarmState { this.traveledDistance = robot.configuration.variable(groupName, actionName, "traveledDistance").value(); } - - private float RobotRotation; private double drivePower; - private int RobotPosition,RobotStartingPosition,traveledDistance; + private int traveledDistance; @Override public void exec() { - if (RobotPosition - RobotStartingPosition < traveledDistance){ - drivePower = 1; - robot.backLeftDrive.setPower(drivePower); + if (robot.frontRightDrive.getCurrentPosition() < traveledDistance){ + robot.backLeftDrive.setPower(drivePower * 0.5); robot.backRightDrive.setPower(drivePower); - robot.frontLeftDrive.setPower(drivePower); + robot.frontLeftDrive.setPower(drivePower * 0.5); robot.frontRightDrive.setPower(drivePower); } else { robot.backLeftDrive.setPower(0); diff --git a/TeamCode/src/main/java/org/timecrafters/Autonomous/States/RotationState.java b/TeamCode/src/main/java/org/timecrafters/Autonomous/States/RotationState.java index 2dc9d19..b09de56 100644 --- a/TeamCode/src/main/java/org/timecrafters/Autonomous/States/RotationState.java +++ b/TeamCode/src/main/java/org/timecrafters/Autonomous/States/RotationState.java @@ -21,7 +21,7 @@ public class RotationState extends CyberarmState { RobotRotation = robot.imu.getAngularOrientation().firstAngle; - if (RobotRotation - 3 <= targetRotation || RobotRotation + 3 <= targetRotation) { + if (RobotRotation <= targetRotation -3 || RobotRotation >= targetRotation + 3) { robot.backLeftDrive.setPower(-drivePower); robot.backRightDrive.setPower(drivePower); robot.frontLeftDrive.setPower(-drivePower); diff --git a/TeamCode/src/main/java/org/timecrafters/testing/states/PrototypeBot1.java b/TeamCode/src/main/java/org/timecrafters/testing/states/PrototypeBot1.java index d689026..a676126 100644 --- a/TeamCode/src/main/java/org/timecrafters/testing/states/PrototypeBot1.java +++ b/TeamCode/src/main/java/org/timecrafters/testing/states/PrototypeBot1.java @@ -89,17 +89,22 @@ public class PrototypeBot1 { //motors direction and encoders frontLeftDrive.setDirection(DcMotorSimple.Direction.REVERSE); + frontLeftDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); frontLeftDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER); frontRightDrive.setDirection(DcMotorSimple.Direction.FORWARD); + frontRightDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); frontRightDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER); backLeftDrive.setDirection(DcMotorSimple.Direction.REVERSE); + backLeftDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); backLeftDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER); backRightDrive.setDirection(DcMotorSimple.Direction.FORWARD); + backRightDrive.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); backRightDrive.setMode(DcMotor.RunMode.RUN_USING_ENCODER); + HighRiserLeft.setDirection(Servo.Direction.REVERSE); HighRiserRight.setDirection(Servo.Direction.FORWARD); LowRiserLeft.setDirection(Servo.Direction.FORWARD);