autonomous for scrimmage and tele op

This commit is contained in:
SpencerPiha
2022-11-27 13:02:52 -06:00
parent b4567a3f17
commit 0cbb6f2792
7 changed files with 95 additions and 77 deletions

View File

@@ -24,7 +24,7 @@ public class RightSideAutonomousEngine extends CyberarmEngine {
public void setup() {
robot = new PhoenixBot1(this);
addState(new ServoCameraRotate(robot, "RightSideAutonomous", "00-0"));
addState(new ConeIdentification(robot, "RightSideAutonomous", "00-1"));
// addState(new ConeIdentification(robot, "RightSideAutonomous", "00-1"));
addState(new ServoCameraRotate(robot, "RightSideAutonomous", "00-2"));
//drive to high pole
addState(new DriverState(robot, "RightSideAutonomous", "01-0"));

View File

@@ -23,6 +23,7 @@ public class CollectorDistanceState extends CyberarmState {
private boolean inRange = false;
private float collectTime;
private double inRangeTime;
private boolean stateDisabled;
public CollectorDistanceState(PhoenixBot1 robot, String groupName, String actionName) {
@@ -32,6 +33,8 @@ public class CollectorDistanceState extends CyberarmState {
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();
this.stateDisabled = !robot.configuration.action(groupName, actionName).enabled;
}
@@ -92,6 +95,10 @@ public class CollectorDistanceState extends CyberarmState {
@Override
public void exec() {
if (stateDisabled){
setHasFinished(true);
return;
}
if (System.currentTimeMillis() - lastMeasuredTime > 150) {
// checking to see if time is greater than 150 milliseconds