mirror of
https://github.com/TimeCrafters/FTC_2022
synced 2025-12-16 05:22:36 +00:00
Autonomous work
This commit is contained in:
@@ -16,7 +16,7 @@ import org.timecrafters.Autonomous.States.ServoCameraRotate;
|
|||||||
import org.timecrafters.Autonomous.States.TopArm;
|
import org.timecrafters.Autonomous.States.TopArm;
|
||||||
import org.timecrafters.Autonomous.TeleOp.states.PhoenixBot1;
|
import org.timecrafters.Autonomous.TeleOp.states.PhoenixBot1;
|
||||||
|
|
||||||
@Autonomous (name = "Left Side")
|
//@Autonomous (name = "Left Side")
|
||||||
@Disabled
|
@Disabled
|
||||||
|
|
||||||
public class LeftSideAutonomousEngine extends CyberarmEngine {
|
public class LeftSideAutonomousEngine extends CyberarmEngine {
|
||||||
|
|||||||
@@ -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");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@ import org.timecrafters.Autonomous.States.RotationState;
|
|||||||
import org.timecrafters.Autonomous.States.TopArmv2;
|
import org.timecrafters.Autonomous.States.TopArmv2;
|
||||||
import org.timecrafters.Autonomous.TeleOp.states.PhoenixBot1;
|
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 {
|
public class RightStateAutoEngine extends CyberarmEngine {
|
||||||
PhoenixBot1 robot;
|
PhoenixBot1 robot;
|
||||||
|
|
||||||
|
|||||||
@@ -231,18 +231,18 @@ public class DriverStateWithOdometer extends CyberarmState {
|
|||||||
|
|
||||||
if (currentAngle - direction > robot.ROTATION_TOLERANCE) {
|
if (currentAngle - direction > robot.ROTATION_TOLERANCE) {
|
||||||
|
|
||||||
robot.frontRightDrive.setPower(-robot.ROTATION_MINIMUM_POWER );
|
robot.frontRightDrive.setPower(-robot.ROTATION_MINIMUM_POWER - 0.05 );
|
||||||
robot.frontLeftDrive.setPower(robot.ROTATION_MINIMUM_POWER );
|
robot.frontLeftDrive.setPower(robot.ROTATION_MINIMUM_POWER + 0.05);
|
||||||
robot.backRightDrive.setPower(-robot.ROTATION_MINIMUM_POWER );
|
robot.backRightDrive.setPower(-robot.ROTATION_MINIMUM_POWER - 0.05 );
|
||||||
robot.backLeftDrive.setPower(robot.ROTATION_MINIMUM_POWER );
|
robot.backLeftDrive.setPower(robot.ROTATION_MINIMUM_POWER + 0.05 );
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (currentAngle - direction < -robot.ROTATION_TOLERANCE) {
|
else if (currentAngle - direction < -robot.ROTATION_TOLERANCE) {
|
||||||
|
|
||||||
robot.frontRightDrive.setPower(robot.ROTATION_MINIMUM_POWER);
|
robot.frontRightDrive.setPower(robot.ROTATION_MINIMUM_POWER + 0.05 );
|
||||||
robot.frontLeftDrive.setPower(-robot.ROTATION_MINIMUM_POWER);
|
robot.frontLeftDrive.setPower(-robot.ROTATION_MINIMUM_POWER - 0.05 );
|
||||||
robot.backRightDrive.setPower(robot.ROTATION_MINIMUM_POWER);
|
robot.backRightDrive.setPower(robot.ROTATION_MINIMUM_POWER + 0.05 );
|
||||||
robot.backLeftDrive.setPower(-robot.ROTATION_MINIMUM_POWER);
|
robot.backLeftDrive.setPower(-robot.ROTATION_MINIMUM_POWER - 0.05);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
robot.frontRightDrive.setPower(0);
|
robot.frontRightDrive.setPower(0);
|
||||||
|
|||||||
@@ -17,6 +17,17 @@ public class PathDecision extends CyberarmState {
|
|||||||
@Override
|
@Override
|
||||||
public void exec() {
|
public void exec() {
|
||||||
String placement = engine.blackboardGetString("parkPlace");
|
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);
|
setHasFinished(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user