Autonomous work

This commit is contained in:
SpencerPiha
2023-02-09 20:45:44 -06:00
parent 6e1e3981c6
commit 2d8ea6d431
5 changed files with 53 additions and 10 deletions

View File

@@ -16,7 +16,7 @@ import org.timecrafters.Autonomous.States.ServoCameraRotate;
import org.timecrafters.Autonomous.States.TopArm;
import org.timecrafters.Autonomous.TeleOp.states.PhoenixBot1;
@Autonomous (name = "Left Side")
//@Autonomous (name = "Left Side")
@Disabled
public class LeftSideAutonomousEngine extends CyberarmEngine {

View File

@@ -0,0 +1,32 @@
package org.timecrafters.Autonomous.Engines;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import org.cyberarm.engine.V2.CyberarmEngine;
import org.timecrafters.Autonomous.TeleOp.states.PhoenixBot1;
@Autonomous(name = "Left Side", group = "A Phoenix", preselectTeleOp = "APhoenixTeleOP")
public class LeftStateAutoEngine extends CyberarmEngine {
PhoenixBot1 robot;
@Override
public void loop() {
super.loop();
telemetry.addData("BlackBoard Input", blackboardGetString("parkPlace"));
}
@Override
public void setup() {
robot = new PhoenixBot1(this);
robot.imu.resetYaw();
setupFromConfig(
robot.configuration,
"org.timecrafters.Autonomous.States",
robot,
PhoenixBot1.class,
"Left State Auto");
}
}

View File

@@ -10,7 +10,7 @@ import org.timecrafters.Autonomous.States.RotationState;
import org.timecrafters.Autonomous.States.TopArmv2;
import org.timecrafters.Autonomous.TeleOp.states.PhoenixBot1;
@Autonomous(name = "Right Side")
@Autonomous(name = "Right Side", group = "A Phoenix", preselectTeleOp = "APhoenixTeleOP")
public class RightStateAutoEngine extends CyberarmEngine {
PhoenixBot1 robot;

View File

@@ -231,18 +231,18 @@ public class DriverStateWithOdometer extends CyberarmState {
if (currentAngle - direction > robot.ROTATION_TOLERANCE) {
robot.frontRightDrive.setPower(-robot.ROTATION_MINIMUM_POWER );
robot.frontLeftDrive.setPower(robot.ROTATION_MINIMUM_POWER );
robot.backRightDrive.setPower(-robot.ROTATION_MINIMUM_POWER );
robot.backLeftDrive.setPower(robot.ROTATION_MINIMUM_POWER );
robot.frontRightDrive.setPower(-robot.ROTATION_MINIMUM_POWER - 0.05 );
robot.frontLeftDrive.setPower(robot.ROTATION_MINIMUM_POWER + 0.05);
robot.backRightDrive.setPower(-robot.ROTATION_MINIMUM_POWER - 0.05 );
robot.backLeftDrive.setPower(robot.ROTATION_MINIMUM_POWER + 0.05 );
}
else if (currentAngle - direction < -robot.ROTATION_TOLERANCE) {
robot.frontRightDrive.setPower(robot.ROTATION_MINIMUM_POWER);
robot.frontLeftDrive.setPower(-robot.ROTATION_MINIMUM_POWER);
robot.backRightDrive.setPower(robot.ROTATION_MINIMUM_POWER);
robot.backLeftDrive.setPower(-robot.ROTATION_MINIMUM_POWER);
robot.frontRightDrive.setPower(robot.ROTATION_MINIMUM_POWER + 0.05 );
robot.frontLeftDrive.setPower(-robot.ROTATION_MINIMUM_POWER - 0.05 );
robot.backRightDrive.setPower(robot.ROTATION_MINIMUM_POWER + 0.05 );
robot.backLeftDrive.setPower(-robot.ROTATION_MINIMUM_POWER - 0.05);
} else {
robot.frontRightDrive.setPower(0);

View File

@@ -17,6 +17,17 @@ public class PathDecision extends CyberarmState {
@Override
public void exec() {
String placement = engine.blackboardGetString("parkPlace");
if (placement.equals("1")) {
addState(new DriverStateWithOdometer(robot, "" + groupName + " Parking", "Park 1"));
}
else if (placement.equals("3")){
addState(new DriverStateWithOdometer(robot, "" + groupName + " Parking", "Park 3"));
}
setHasFinished(true);
}