mirror of
https://github.com/TimeCrafters/UltimateGoal.git
synced 2025-12-15 05:52:35 +00:00
a thing
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
package org.timecrafters.javaClass.cayden;
|
||||
|
||||
import com.qualcomm.hardware.rev.RevBlinkinLedDriver;
|
||||
|
||||
import org.cyberarm.engine.V2.CyberarmState;
|
||||
import org.timecrafters.UltimateGoal.Competition.Robot;
|
||||
|
||||
public class Cayden_Autonomous extends CyberarmState {
|
||||
private Robot robot;
|
||||
private double variable=.5;
|
||||
private double inches=12;
|
||||
|
||||
|
||||
|
||||
|
||||
public Cayden_Autonomous(Robot robot) {
|
||||
public Cayden_Autonomous(Robot robot, double variable, double inches) {
|
||||
this.robot = robot;
|
||||
this.variable = variable;
|
||||
this.inches = inches;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exec() {
|
||||
|
||||
@@ -21,10 +24,16 @@ public class Cayden_Autonomous extends CyberarmState {
|
||||
robot.driveFrontLeft.setPower(variable);
|
||||
robot.driveBackLeft.setPower(variable);
|
||||
|
||||
if (robot.encoderLeft.getCurrentPosition()>=300){
|
||||
|
||||
if (Math.abs(robot.encoderLeft.getCurrentPosition())>=robot.inchesToTicks(inches)){
|
||||
variable=0;
|
||||
}
|
||||
|
||||
robot.ledDriver.setPattern(RevBlinkinLedDriver.BlinkinPattern.BEATS_PER_MINUTE_FOREST_PALETTE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void telemetry() {
|
||||
engine.telemetry.addData("Encoder", robot.encoderLeft.getCurrentPosition());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ public class CaydenFirstEngine extends CyberarmEngine {
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
addState(new Cayden_Autonomous(robot));
|
||||
addState(new Cayden_Autonomous(robot,1,12));
|
||||
addState(new Cayden_Autonomous(robot,-1,12));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user