Trying to find right syntax for a parallel background state

This commit is contained in:
NerdyBirdy460
2023-11-28 18:58:17 -06:00
parent fe0dbd1723
commit 60fbd98d48
3 changed files with 2 additions and 47 deletions

View File

@@ -70,51 +70,5 @@ public class SodiPizzaAutoFirstDriveState extends CyberarmState{
setHasFinished(true);
}
/* //Stop moving and update lastMoveTime
if (robot.leftFront.getCurrentPosition() >= targetPos && drivePower > 0) {
lastHalf = true;
drivePower = 0;
robot.leftFront.setPower(drivePower);
robot.leftBack.setPower(drivePower);
robot.rightFront.setPower(drivePower);
robot.rightBack.setPower(drivePower);
lastMoveTime = System.currentTimeMillis();
}
//Move backwards from targetPos to 0
if (robot.leftFront.getCurrentPosition() >= targetPos && drivePower == 0
&& System.currentTimeMillis() - lastMoveTime >= 500 && lastHalf) {
robot.leftFront.setTargetPosition(0);
robot.leftBack.setTargetPosition(0);
robot.rightFront.setTargetPosition(0);
robot.rightBack.setTargetPosition(0);
drivePower = -0.5;
robot.leftFront.setPower(drivePower);
robot.leftBack.setPower(drivePower);
robot.rightFront.setPower(drivePower);
robot.rightBack.setPower(drivePower);
} */
/* if (robot.leftFront.getCurrentPosition() < 1250 && robot.leftFront.getCurrentPosition() >= targetPos &&
robot.rightBack.getCurrentPosition() > 750) {
robot.leftFront.setPower(0.5);
robot.leftBack.setPower(0.5);
robot.rightFront.setPower(-0.5);
robot.rightBack.setPower(-0.5);
robot.leftFront.setTargetPosition(1250);
robot.leftBack.setTargetPosition(1250);
robot.rightFront.setTargetPosition(750);
robot.rightBack.setTargetPosition(750);
}
*/
}
}

View File

@@ -7,7 +7,7 @@ import org.timecrafters.CenterStage.Common.SodiPizzaMinibotObject;
import dev.cyberarm.engine.V2.CyberarmState;
public class SodiPizzaAutoTurnState extends CyberarmState {
final private SodiPizzaMinibotObject robot = SodiPizzaMinibotObject();
final private SodiPizzaMinibotObject robot = new SodiPizzaMinibotObject();
final private String groupName, actionName;
private long lastMoveTime;
private double turnSpeedRaw, turnSpeed;

View File

@@ -69,5 +69,6 @@ public class SodiPizzaMinibotObject extends Robot {
shoulder = engine.hardwareMap.servo.get("arm");
gripper = engine.hardwareMap.servo.get("gripper");
//readyToTurn
}
}