mirror of
https://github.com/TimeCrafters/FTC_2022
synced 2025-12-15 15:32:35 +00:00
Adding the autonomous, day 1
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package org.timecrafters.Autonomous.States;
|
||||
|
||||
import org.cyberarm.engine.V2.CyberarmState;
|
||||
import org.timecrafters.testing.states.PrototypeBot1;
|
||||
|
||||
public class DriverState extends CyberarmState {
|
||||
PrototypeBot1 robot;
|
||||
public DriverState(PrototypeBot1 robot, String groupName, String actionName) {
|
||||
this.robot = robot;
|
||||
this.drivePower = robot.configuration.variable(groupName, actionName, "drivePower").value();
|
||||
}
|
||||
|
||||
private float RobotRotation;
|
||||
private double drivePower;
|
||||
private int RobotPosition,RobotStartingPosition;
|
||||
|
||||
@Override
|
||||
public void exec() {
|
||||
|
||||
if (RobotPosition - RobotStartingPosition < 2500){
|
||||
drivePower = 1;
|
||||
robot.backLeftDrive.setPower(drivePower);
|
||||
robot.backRightDrive.setPower(drivePower);
|
||||
robot.frontLeftDrive.setPower(drivePower);
|
||||
robot.frontRightDrive.setPower(drivePower);
|
||||
} else {
|
||||
robot.backLeftDrive.setPower(0);
|
||||
robot.backRightDrive.setPower(0);
|
||||
robot.frontLeftDrive.setPower(0);
|
||||
robot.frontRightDrive.setPower(0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user