LeftSideAutonomous has drive backward and forward states after rotating towards both of the junctions for allignment. and it is organized

This commit is contained in:
SpencerPiha
2022-11-08 20:33:43 -06:00
parent d21441eec5
commit 250db12317
3 changed files with 20 additions and 3 deletions

View File

@@ -27,6 +27,8 @@ public class LeftSideAutonomousEngine extends CyberarmEngine {
addState(new DriverState(robot, "LeftSideAutonomous", "01-0"));
//turn towards high pole
addState(new RotationState(robot, "LeftSideAutonomous", "02-0"));
//drive back
addState(new DriverState(robot, "LeftSideAutonomous", "02-1"));
//lift the upper arm
addState(new TopArm(robot, "LeftSideAutonomous", "03-0"));
//lift the lower arm

View File

@@ -27,6 +27,8 @@ public class RightSideAutonomousEngine extends CyberarmEngine {
addState(new DriverState(robot, "RightSideAutonomous", "01-0"));
//turn towards high pole
addState(new RotationState(robot, "RightSideAutonomous", "02-0"));
// drive back
addState(new DriverState(robot, "RightSideAutonomous", "02-1"));
//lift the upper arm
addState(new TopArm(robot, "RightSideAutonomous", "03-0"));
//lift the lower arm

View File

@@ -20,6 +20,9 @@ public class CollectorDistanceState extends CyberarmState {
private double distanceDelta;
private double debugRunTime;
private String debugStatus = "?";
private boolean inRange = false;
private float collectTime;
private double inRangeTime;
public CollectorDistanceState(PrototypeBot1 robot, String groupName, String actionName) {
@@ -28,6 +31,7 @@ public class CollectorDistanceState extends CyberarmState {
this.traveledDistance = robot.configuration.variable(groupName, actionName, "traveledDistance").value();
this.RampUpDistance = robot.configuration.variable(groupName, actionName, "RampUpDistance").value();
this.RampDownDistance = robot.configuration.variable(groupName, actionName, "RampDownDistance").value();
this.collectTime = robot.configuration.variable(groupName, actionName, "collectTime").value();
}
@@ -147,9 +151,18 @@ public class CollectorDistanceState extends CyberarmState {
robot.frontLeftDrive.setPower(0);
robot.backRightDrive.setPower(0);
robot.backLeftDrive.setPower(0);
if (!inRange){
inRange = true;
inRangeTime = runTime();
} else {
if (runTime() - inRangeTime >= collectTime){
robot.collectorRight.setPower(0);
robot.collectorLeft.setPower(0);
setHasFinished(true);
}
}
}