Re-integrate LSS and updated constants
This commit is contained in:
@ -76,7 +76,7 @@ public class LiftTest extends LinearOpMode {
|
|||||||
currentGamepad1.copy(gamepad1);
|
currentGamepad1.copy(gamepad1);
|
||||||
|
|
||||||
if (currentGamepad1.square && !previousGamepad1.square) {
|
if (currentGamepad1.square && !previousGamepad1.square) {
|
||||||
lift.toZero();
|
lift.toFloor();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentGamepad1.triangle && !previousGamepad1.triangle) {
|
if (currentGamepad1.triangle && !previousGamepad1.triangle) {
|
||||||
|
@ -13,7 +13,8 @@ public class RobotConstants {
|
|||||||
|
|
||||||
public static double wristFloor = 0.625;
|
public static double wristFloor = 0.625;
|
||||||
public static double wristBucket = 0.215;
|
public static double wristBucket = 0.215;
|
||||||
public static int liftZeroPos = 0;
|
public static int liftToFloorPos = 0;
|
||||||
|
public static int liftToPoolPos = 500;
|
||||||
public static int liftToLowBucketPos = 2250;
|
public static int liftToLowBucketPos = 2250;
|
||||||
public static int liftToHighBucketPos = 3700;
|
public static int liftToHighBucketPos = 3700;
|
||||||
public static double liftPower = .45;
|
public static double liftPower = .45;
|
||||||
|
@ -3,7 +3,7 @@ package org.firstinspires.ftc.teamcode.subsystem;
|
|||||||
import static org.firstinspires.ftc.teamcode.configs.RobotConstants.liftPower;
|
import static org.firstinspires.ftc.teamcode.configs.RobotConstants.liftPower;
|
||||||
import static org.firstinspires.ftc.teamcode.configs.RobotConstants.liftToHighBucketPos;
|
import static org.firstinspires.ftc.teamcode.configs.RobotConstants.liftToHighBucketPos;
|
||||||
import static org.firstinspires.ftc.teamcode.configs.RobotConstants.liftToLowBucketPos;
|
import static org.firstinspires.ftc.teamcode.configs.RobotConstants.liftToLowBucketPos;
|
||||||
import static org.firstinspires.ftc.teamcode.configs.RobotConstants.liftZeroPos;
|
import static org.firstinspires.ftc.teamcode.configs.RobotConstants.liftToPoolPos;
|
||||||
|
|
||||||
import com.qualcomm.robotcore.hardware.DcMotor;
|
import com.qualcomm.robotcore.hardware.DcMotor;
|
||||||
import com.qualcomm.robotcore.hardware.DcMotorSimple;
|
import com.qualcomm.robotcore.hardware.DcMotorSimple;
|
||||||
@ -14,16 +14,17 @@ import org.firstinspires.ftc.teamcode.util.action.RunAction;
|
|||||||
public class LiftSubsystem {
|
public class LiftSubsystem {
|
||||||
|
|
||||||
public DcMotor lift;
|
public DcMotor lift;
|
||||||
public RunAction toZero, toLowBucket, toHighBucket;
|
public RunAction toFloor, toLowBucket, toHighBucket;
|
||||||
|
|
||||||
public enum LiftState {
|
public enum LiftState {
|
||||||
FLOOR, LOW_BUCKET, HIGH_BUCKET
|
FLOOR, LOW_BUCKET, HIGH_BUCKET, POOL
|
||||||
}
|
}
|
||||||
|
|
||||||
private LiftState liftState;
|
private LiftState liftState;
|
||||||
|
|
||||||
public LiftSubsystem(HardwareMap hardwareMap) {
|
public LiftSubsystem(HardwareMap hardwareMap) {
|
||||||
lift = hardwareMap.get(DcMotor.class, "lift-motor");
|
lift = hardwareMap.get(DcMotor.class, "lift-motor");
|
||||||
|
toFloor = new RunAction(this::toFloor);
|
||||||
toZero = new RunAction(this::toZero);
|
|
||||||
toLowBucket = new RunAction(this::toLowBucket);
|
toLowBucket = new RunAction(this::toLowBucket);
|
||||||
toHighBucket = new RunAction(this::toHighBucket);
|
toHighBucket = new RunAction(this::toHighBucket);
|
||||||
}
|
}
|
||||||
@ -33,29 +34,36 @@ public class LiftSubsystem {
|
|||||||
lift.setMode(DcMotor.RunMode.RUN_TO_POSITION);
|
lift.setMode(DcMotor.RunMode.RUN_TO_POSITION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toZero() {
|
|
||||||
lift.setTargetPosition(liftZeroPos);
|
|
||||||
lift.setMode(DcMotor.RunMode.RUN_TO_POSITION);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void switchState() {
|
public void switchState() {
|
||||||
if (this.liftState == LiftState.FLOOR) {
|
if (this.liftState == LiftState.FLOOR) {
|
||||||
|
this.toPool();
|
||||||
|
} else if (this.liftState == LiftState.POOL) {
|
||||||
this.toLowBucket();
|
this.toLowBucket();
|
||||||
} else if (this.liftState == LiftState.LOW_BUCKET) {
|
} else if (this.liftState == LiftState.LOW_BUCKET) {
|
||||||
this.toHighBucket();
|
this.toHighBucket();
|
||||||
} else if (this.liftState == LiftState.HIGH_BUCKET) {
|
} else if (this.liftState == LiftState.HIGH_BUCKET) {
|
||||||
this.toZero();
|
this.toFloor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void toFloor() {
|
||||||
|
this.setTarget(liftToPoolPos);
|
||||||
|
this.setState(LiftState.FLOOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void toPool() {
|
||||||
|
this.setTarget(liftToPoolPos);
|
||||||
|
this.setState(LiftState.POOL);
|
||||||
|
}
|
||||||
|
|
||||||
public void toLowBucket() {
|
public void toLowBucket() {
|
||||||
lift.setTargetPosition(liftToLowBucketPos);
|
this.setTarget(liftToLowBucketPos);
|
||||||
lift.setMode(DcMotor.RunMode.RUN_TO_POSITION);
|
this.setState(LiftState.LOW_BUCKET);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toHighBucket() {
|
public void toHighBucket() {
|
||||||
lift.setTargetPosition(liftToHighBucketPos);
|
this.setTarget(liftToHighBucketPos);
|
||||||
lift.setMode(DcMotor.RunMode.RUN_TO_POSITION);
|
this.setState(LiftState.HIGH_BUCKET);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
|
Reference in New Issue
Block a user