Cleanup of files no longer needed (or are in other branches) and start a standards way of naming files for comp vs development
This commit is contained in:
@ -1,35 +0,0 @@
|
||||
//package org.firstinspires.ftc.teamcode;
|
||||
//
|
||||
//import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
|
||||
//import com.qualcomm.robotcore.eventloop.opmode.OpMode;
|
||||
//
|
||||
//import org.firstinspires.ftc.teamcode.pedroPathing.follower.Follower;
|
||||
//import org.firstinspires.ftc.teamcode.runmodes.Auto;
|
||||
//
|
||||
//
|
||||
//@Autonomous(name = "CometBot Auto", group = "Competition")
|
||||
//public class CometBotAuto extends OpMode {
|
||||
// public Auto auto;
|
||||
//
|
||||
// @Override
|
||||
// public void init() {
|
||||
// auto = new Auto(hardwareMap, telemetry, new Follower(hardwareMap));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void start() {
|
||||
// auto.start();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loop() {
|
||||
// auto.update();
|
||||
// telemetry.addData("Arm State", auto.arm.getState());
|
||||
// telemetry.addData("Arm Position", auto.arm.getPosition());
|
||||
// telemetry.addData("Claw State", auto.claw.getState());
|
||||
// telemetry.addData("Wrist State", auto.wrist.getState());
|
||||
// telemetry.addData("Wrist Position", auto.wrist.getPosition());
|
||||
// telemetry.update();
|
||||
// }
|
||||
//
|
||||
//}
|
@ -1,11 +1,9 @@
|
||||
package org.firstinspires.ftc.teamcode;
|
||||
|
||||
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
|
||||
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
|
||||
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
|
||||
|
||||
import org.firstinspires.ftc.teamcode.runmodes.CometBotTeleopCompetition;
|
||||
import org.firstinspires.ftc.teamcode.runmodes.DevTeleopRunModeCompetition;
|
||||
|
||||
@TeleOp(name = "ComeBot Drive", group = "Competition")
|
||||
public class CometBotDrive extends OpMode {
|
||||
|
@ -1,97 +0,0 @@
|
||||
//package org.firstinspires.ftc.teamcode;
|
||||
//
|
||||
//import com.qualcomm.robotcore.eventloop.opmode.Disabled;
|
||||
//import com.qualcomm.robotcore.eventloop.opmode.OpMode;
|
||||
//import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
|
||||
//import com.qualcomm.robotcore.hardware.Gamepad;
|
||||
//
|
||||
//import org.firstinspires.ftc.teamcode.subsystem.ArmSubsystem;
|
||||
//import org.firstinspires.ftc.teamcode.subsystem.ClawSubsystem;
|
||||
//import org.firstinspires.ftc.teamcode.subsystem.LiftSubsystem;
|
||||
//import org.firstinspires.ftc.teamcode.subsystem.MotorsSubsystem;
|
||||
//import org.firstinspires.ftc.teamcode.subsystem.WristSubsystem;
|
||||
//
|
||||
//@TeleOp(name = "Dev Teleop Remix", group = "Debug")
|
||||
//@Disabled
|
||||
//public class DevTeleOpRemix extends OpMode {
|
||||
//
|
||||
// public ClawSubsystem claw;
|
||||
// public ArmSubsystem arm;
|
||||
// public WristSubsystem wrist;
|
||||
// public LiftSubsystem lift;
|
||||
// public MotorsSubsystem motors;
|
||||
//
|
||||
// public Gamepad currentGamepad1;
|
||||
// public Gamepad previousGamepad1;
|
||||
// public Gamepad currentGamepad2;
|
||||
// public Gamepad previousGamepad2;
|
||||
//
|
||||
// public double power = .6;
|
||||
//
|
||||
// @Override
|
||||
// public void init() {
|
||||
//
|
||||
// claw = new ClawSubsystem(hardwareMap, telemetry);
|
||||
// arm = new ArmSubsystem(hardwareMap, telemetry);
|
||||
// wrist = new WristSubsystem(hardwareMap, telemetry);
|
||||
// lift = new LiftSubsystem(hardwareMap, telemetry);
|
||||
// motors = new MotorsSubsystem(hardwareMap, telemetry, power);
|
||||
//
|
||||
// claw.init();
|
||||
// arm.init();
|
||||
// wrist.init();
|
||||
// lift.init();
|
||||
// motors.init();
|
||||
//
|
||||
// currentGamepad1 = new Gamepad();
|
||||
// previousGamepad1 = new Gamepad();
|
||||
// currentGamepad2 = new Gamepad();
|
||||
// previousGamepad2 = new Gamepad();
|
||||
// }
|
||||
//
|
||||
// public void theDrop(ArmSubsystem arm, WristSubsystem wrist) {
|
||||
// if (currentGamepad1.a && !previousGamepad1.a) {
|
||||
// wrist.toFloorPosition();
|
||||
// arm.toFloorPosition();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void thePickup(ClawSubsystem claw) {
|
||||
// if (currentGamepad1.x && !previousGamepad1.x) {
|
||||
// claw.switchState();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void theLift(ArmSubsystem arm, WristSubsystem wrist) {
|
||||
// if (currentGamepad1.b && !previousGamepad1.b) {
|
||||
// arm.toParkPosition();
|
||||
// wrist.toBucketPosition();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void theLowBucketScore(LiftSubsystem lift, WristSubsystem wrist, ArmSubsystem arm) {
|
||||
// if (currentGamepad1.y && !previousGamepad1.y) {
|
||||
// lift.toLowBucket();
|
||||
// wrist.toBucketPosition();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loop() {
|
||||
//
|
||||
// previousGamepad1.copy(currentGamepad1);
|
||||
// currentGamepad1.copy(gamepad1);
|
||||
//
|
||||
// previousGamepad2.copy(currentGamepad2);
|
||||
// currentGamepad2.copy(gamepad2);
|
||||
//
|
||||
// theDrop(arm, wrist);
|
||||
// thePickup(claw);
|
||||
// theLift(arm, wrist);
|
||||
// theLowBucketScore(lift, wrist, arm);
|
||||
//
|
||||
// motors.calculateTrajectory(gamepad1);
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
@ -1,107 +0,0 @@
|
||||
//package org.firstinspires.ftc.teamcode;
|
||||
//
|
||||
//import com.qualcomm.robotcore.eventloop.opmode.Disabled;
|
||||
//import com.qualcomm.robotcore.eventloop.opmode.OpMode;
|
||||
//import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
|
||||
//import com.qualcomm.robotcore.hardware.Gamepad;
|
||||
//
|
||||
//import org.firstinspires.ftc.teamcode.pedroPathing.follower.Follower;
|
||||
//import org.firstinspires.ftc.teamcode.subsystem.ArmSubsystem;
|
||||
//import org.firstinspires.ftc.teamcode.subsystem.ClawSubsystem;
|
||||
//import org.firstinspires.ftc.teamcode.subsystem.LiftSubsystem;
|
||||
//import org.firstinspires.ftc.teamcode.subsystem.MotorsSubsystem;
|
||||
//import org.firstinspires.ftc.teamcode.subsystem.WristSubsystem;
|
||||
//
|
||||
//@TeleOp(name = "Dev Teleop Remix Deux", group = "Debug")
|
||||
//@Disabled
|
||||
//public class DevTeleOpRemixDeux extends OpMode {
|
||||
//
|
||||
// private Follower follower;
|
||||
//
|
||||
// public ClawSubsystem claw;
|
||||
// public ArmSubsystem arm;
|
||||
// public WristSubsystem wrist;
|
||||
// public LiftSubsystem lift;
|
||||
// public MotorsSubsystem motors;
|
||||
//
|
||||
// public Gamepad currentGamepad1;
|
||||
// public Gamepad previousGamepad1;
|
||||
// public Gamepad currentGamepad2;
|
||||
// public Gamepad previousGamepad2;
|
||||
//
|
||||
// public double power = .6;
|
||||
//
|
||||
// @Override
|
||||
// public void init() {
|
||||
//
|
||||
// follower = new Follower(hardwareMap);
|
||||
//
|
||||
// claw = new ClawSubsystem(hardwareMap, telemetry);
|
||||
// arm = new ArmSubsystem(hardwareMap, telemetry);
|
||||
// wrist = new WristSubsystem(hardwareMap, telemetry);
|
||||
// motors = new MotorsSubsystem(hardwareMap, telemetry);
|
||||
// lift = new LiftSubsystem(hardwareMap, telemetry);
|
||||
//
|
||||
// claw.init();
|
||||
// arm.init();
|
||||
// wrist.init();
|
||||
// lift.init();
|
||||
// motors.init();
|
||||
//
|
||||
// currentGamepad1 = new Gamepad();
|
||||
// previousGamepad1 = new Gamepad();
|
||||
// currentGamepad2 = new Gamepad();
|
||||
// previousGamepad2 = new Gamepad();
|
||||
//
|
||||
// follower.setMaxPower(this.power);
|
||||
// follower.startTeleopDrive();
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public void theDrop(ArmSubsystem arm, WristSubsystem wrist) {
|
||||
// if (currentGamepad1.a && !previousGamepad1.a) {
|
||||
// wrist.toFloorPosition();
|
||||
// arm.toFloorPosition();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void thePickup(ClawSubsystem claw) {
|
||||
// if (currentGamepad1.x && !previousGamepad1.x) {
|
||||
// claw.switchState();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void theLift(ArmSubsystem arm, WristSubsystem wrist) {
|
||||
// if (currentGamepad1.b && !previousGamepad1.b) {
|
||||
// arm.toParkPosition();
|
||||
// wrist.toBucketPosition();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void theLowBucketScore(LiftSubsystem lift, WristSubsystem wrist, ArmSubsystem arm) {
|
||||
// if (currentGamepad1.y && !previousGamepad1.y) {
|
||||
// lift.toLowBucket();
|
||||
// wrist.toBucketPosition();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loop() {
|
||||
//
|
||||
// previousGamepad1.copy(currentGamepad1);
|
||||
// currentGamepad1.copy(gamepad1);
|
||||
//
|
||||
// previousGamepad2.copy(currentGamepad2);
|
||||
// currentGamepad2.copy(gamepad2);
|
||||
//
|
||||
// theDrop(arm, wrist);
|
||||
// thePickup(claw);
|
||||
// theLift(arm, wrist);
|
||||
// theLowBucketScore(lift, wrist, arm);
|
||||
//
|
||||
// follower.setTeleOpMovementVectors(-gamepad1.left_stick_y, -gamepad1.left_stick_x, -gamepad1.right_stick_x);
|
||||
// follower.update();
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
@ -3,16 +3,16 @@ package org.firstinspires.ftc.teamcode;
|
||||
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
|
||||
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
|
||||
|
||||
import org.firstinspires.ftc.teamcode.runmodes.DevTeleopRunModeCompetition;
|
||||
import org.firstinspires.ftc.teamcode.runmodes.CometBotAutoDevelopment;
|
||||
|
||||
@TeleOp(name = "Dev Teleop RR Actions", group = "Debug")
|
||||
public class DevTeleop extends OpMode {
|
||||
|
||||
public DevTeleopRunModeCompetition runMode;
|
||||
public CometBotAutoDevelopment runMode;
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
this.runMode = new DevTeleopRunModeCompetition(hardwareMap, telemetry, gamepad1, gamepad2);
|
||||
this.runMode = new CometBotAutoDevelopment(hardwareMap, telemetry, gamepad1, gamepad2);
|
||||
this.runMode.init();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,10 @@
|
||||
//package org.firstinspires.ftc.teamcode.runmodes;
|
||||
//
|
||||
package org.firstinspires.ftc.teamcode.runmodes;
|
||||
|
||||
public class CometBotAutoCompetition {
|
||||
|
||||
}
|
||||
|
||||
|
||||
//import com.qualcomm.robotcore.hardware.HardwareMap;
|
||||
//
|
||||
//import org.firstinspires.ftc.robotcore.external.Telemetry;
|
@ -15,7 +15,7 @@ import org.firstinspires.ftc.teamcode.subsystem.LiftActionsSubsystem;
|
||||
import org.firstinspires.ftc.teamcode.subsystem.MotorsSubsystem;
|
||||
import org.firstinspires.ftc.teamcode.subsystem.WristActionsSubsystem;
|
||||
|
||||
public class DevTeleopRunModeCompetition {
|
||||
public class CometBotAutoDevelopment {
|
||||
|
||||
/*
|
||||
Subsystems
|
||||
@ -40,7 +40,7 @@ public class DevTeleopRunModeCompetition {
|
||||
|
||||
private Follower follower;
|
||||
|
||||
public DevTeleopRunModeCompetition(HardwareMap hardwareMap, Telemetry telemetry, Gamepad gp1, Gamepad gp2) {
|
||||
public CometBotAutoDevelopment(HardwareMap hardwareMap, Telemetry telemetry, Gamepad gp1, Gamepad gp2) {
|
||||
this.motors = new MotorsSubsystem(hardwareMap, telemetry, .55);
|
||||
this.claw = new ClawActionsSubsystem(hardwareMap);
|
||||
this.arm = new ArmActionsSubsystem(hardwareMap);
|
@ -1,5 +1,9 @@
|
||||
//package org.firstinspires.ftc.teamcode.runmodes;
|
||||
//
|
||||
package org.firstinspires.ftc.teamcode.runmodes;
|
||||
|
||||
public class CometBotTeleopDevelopment {
|
||||
|
||||
}
|
||||
|
||||
//import com.qualcomm.robotcore.hardware.Gamepad;
|
||||
//import com.qualcomm.robotcore.hardware.HardwareMap;
|
||||
//
|
@ -1,89 +0,0 @@
|
||||
//package org.firstinspires.ftc.teamcode.runmodes;
|
||||
//
|
||||
//import static org.firstinspires.ftc.teamcode.PedroConstants.BACK_LEFT_MOTOR;
|
||||
//import static org.firstinspires.ftc.teamcode.PedroConstants.BACK_LEFT_MOTOR_DIRECTION;
|
||||
//import static org.firstinspires.ftc.teamcode.PedroConstants.BACK_RIGHT_MOTOR;
|
||||
//import static org.firstinspires.ftc.teamcode.PedroConstants.BACK_RIGHT_MOTOR_DIRECTION;
|
||||
//import static org.firstinspires.ftc.teamcode.PedroConstants.FRONT_LEFT_MOTOR;
|
||||
//import static org.firstinspires.ftc.teamcode.PedroConstants.FRONT_LEFT_MOTOR_DIRECTION;
|
||||
//import static org.firstinspires.ftc.teamcode.PedroConstants.FRONT_RIGHT_MOTOR;
|
||||
//import static org.firstinspires.ftc.teamcode.PedroConstants.FRONT_RIGHT_MOTOR_DIRECTION;
|
||||
//
|
||||
//import com.qualcomm.robotcore.hardware.DcMotor;
|
||||
//import com.qualcomm.robotcore.hardware.DcMotorEx;
|
||||
//import com.qualcomm.robotcore.hardware.Gamepad;
|
||||
//import com.qualcomm.robotcore.hardware.HardwareMap;
|
||||
//
|
||||
//import org.firstinspires.ftc.robotcore.external.Telemetry;
|
||||
//import org.firstinspires.ftc.teamcode.pedroPathing.follower.Follower;
|
||||
//import org.firstinspires.ftc.teamcode.pedroPathing.localization.Pose;
|
||||
//import org.firstinspires.ftc.teamcode.subsystem.ClawSubsystem;
|
||||
//import org.firstinspires.ftc.teamcode.util.action.RunAction;
|
||||
//
|
||||
//public class Teleop {
|
||||
//
|
||||
// private ClawSubsystem claw;
|
||||
// private Follower follower;
|
||||
// private DcMotorEx leftFront;
|
||||
// private DcMotorEx leftRear;
|
||||
// private DcMotorEx rightFront;
|
||||
// private DcMotorEx rightRear;
|
||||
// private Telemetry telemetry;
|
||||
//
|
||||
// private Gamepad gamepad1;
|
||||
// private Gamepad currentGamepad1;
|
||||
// private Gamepad previousGamepad1;
|
||||
//
|
||||
// public Teleop(HardwareMap hardwareMap, Telemetry telemetry, Follower follower, Gamepad gamepad1) {
|
||||
//
|
||||
// claw = new ClawSubsystem(hardwareMap, telemetry);
|
||||
// initMotors(hardwareMap);
|
||||
//
|
||||
// this.follower = follower;
|
||||
//
|
||||
// this.telemetry = telemetry;
|
||||
// this.gamepad1 = gamepad1;
|
||||
//
|
||||
// this.currentGamepad1 = new Gamepad();
|
||||
// this.previousGamepad1 = new Gamepad();
|
||||
// }
|
||||
//
|
||||
// public void start() {
|
||||
// claw.start();
|
||||
// follower.startTeleopDrive();
|
||||
// }
|
||||
//
|
||||
// public void update() {
|
||||
// previousGamepad1.copy(currentGamepad1);
|
||||
// currentGamepad1.copy(gamepad1);
|
||||
//
|
||||
// if (currentGamepad1.a && !previousGamepad1.a)
|
||||
// claw.switchState();
|
||||
//
|
||||
// follower.setTeleOpMovementVectors(-gamepad1.left_stick_y, -gamepad1.left_stick_x, -gamepad1.right_stick_x);
|
||||
// follower.update();
|
||||
//
|
||||
// telemetry.addData("X", follower.getPose().getX());
|
||||
// telemetry.addData("Y", follower.getPose().getY());
|
||||
// telemetry.addData("Heading", Math.toDegrees(follower.getPose().getHeading()));
|
||||
// telemetry.addData("Claw State", claw.getState());
|
||||
// telemetry.update();
|
||||
// }
|
||||
//
|
||||
// private void initMotors(HardwareMap hardwareMap) {
|
||||
// rightFront = hardwareMap.get(DcMotorEx.class, FRONT_RIGHT_MOTOR);
|
||||
// rightRear = hardwareMap.get(DcMotorEx.class, BACK_RIGHT_MOTOR);
|
||||
// leftFront = hardwareMap.get(DcMotorEx.class, FRONT_LEFT_MOTOR);
|
||||
// leftRear = hardwareMap.get(DcMotorEx.class, BACK_LEFT_MOTOR);
|
||||
//
|
||||
// rightFront.setDirection(FRONT_RIGHT_MOTOR_DIRECTION);
|
||||
// rightRear.setDirection(BACK_RIGHT_MOTOR_DIRECTION);
|
||||
// leftFront.setDirection(FRONT_LEFT_MOTOR_DIRECTION);
|
||||
// leftRear.setDirection(BACK_LEFT_MOTOR_DIRECTION);
|
||||
//
|
||||
// leftFront.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
|
||||
// leftRear.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
|
||||
// rightRear.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
|
||||
// rightFront.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
|
||||
// }
|
||||
//}
|
@ -1,11 +0,0 @@
|
||||
package org.firstinspires.ftc.teamcode.util.action;
|
||||
|
||||
import com.acmerobotics.dashboard.canvas.Canvas;
|
||||
import com.acmerobotics.dashboard.telemetry.TelemetryPacket;
|
||||
|
||||
public interface Action {
|
||||
boolean run(TelemetryPacket p);
|
||||
|
||||
default void preview(Canvas fieldOverlay) {
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package org.firstinspires.ftc.teamcode.util.action;
|
||||
|
||||
import com.acmerobotics.dashboard.FtcDashboard;
|
||||
import com.acmerobotics.dashboard.canvas.Canvas;
|
||||
import com.acmerobotics.dashboard.telemetry.TelemetryPacket;
|
||||
|
||||
public class Actions {
|
||||
|
||||
public static void runBlocking(Action a) {
|
||||
FtcDashboard dash = FtcDashboard.getInstance();
|
||||
Canvas c = new Canvas();
|
||||
a.preview(c);
|
||||
|
||||
boolean b = true;
|
||||
while (b && !Thread.currentThread().isInterrupted()) {
|
||||
TelemetryPacket p = new TelemetryPacket();
|
||||
p.fieldOverlay().getOperations().addAll(c.getOperations());
|
||||
b = a.run(p);
|
||||
dash.sendTelemetryPacket(p);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package org.firstinspires.ftc.teamcode.util.action;
|
||||
|
||||
import com.acmerobotics.dashboard.config.Config;
|
||||
|
||||
import org.firstinspires.ftc.teamcode.pedroPathing.localization.Pose;
|
||||
|
||||
@Config
|
||||
public class FieldConstants {
|
||||
|
||||
public enum RobotStart {
|
||||
BLUE_BUCKET,
|
||||
BLUE_OBSERVATION,
|
||||
RED_BUCKET,
|
||||
RED_OBSERVATION
|
||||
}
|
||||
|
||||
public static final Pose blueBucketStartPose = new Pose(8, 79.5, Math.toRadians(180));
|
||||
public static final Pose blueObservationStartPose = new Pose(8, 36, Math.toRadians(180));
|
||||
public static final Pose redBucketStartPose = new Pose(144-8, 79.5, 0);
|
||||
public static final Pose redObservationStartPose = new Pose(144-8, 36, 0);
|
||||
|
||||
// Blue Preload Poses
|
||||
public static final Pose blueBucketPreloadPose = new Pose(34.5, 79.5, Math.toRadians(180));
|
||||
|
||||
// Blue Bucket Sample Poses
|
||||
public static final Pose blueBucketLeftSamplePose = new Pose(34.75, 113.5, Math.toRadians(66));
|
||||
public static final Pose blueBucketLeftSampleControlPose = new Pose(32, 108);
|
||||
public static final Pose blueBucketMidSamplePose = new Pose(33, 125.5, Math.toRadians(73));
|
||||
public static final Pose blueBucketMidSampleControlPose = new Pose(47.5, 110);
|
||||
public static final Pose blueBucketRightSamplePose = new Pose(33, 133, Math.toRadians(74));
|
||||
public static final Pose blueBucketRightSampleControlPose = new Pose(46, 101);
|
||||
|
||||
public static final Pose blueBucketScorePose = new Pose(16, 128, Math.toRadians(-45));
|
||||
|
||||
public static final Pose blueBucketParkPose = new Pose(65, 97.75, Math.toRadians(90));
|
||||
public static final Pose blueBucketParkControlPose = new Pose(60.25, 123.5);
|
||||
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
package org.firstinspires.ftc.teamcode.util.action;
|
||||
|
||||
import com.acmerobotics.dashboard.telemetry.TelemetryPacket;
|
||||
|
||||
public class RunAction implements Action {
|
||||
|
||||
private final Runnable runnable;
|
||||
private Runnable callback;
|
||||
|
||||
public RunAction(Runnable runnable) {
|
||||
this.runnable = runnable;
|
||||
}
|
||||
|
||||
public void runAction() {
|
||||
runnable.run();
|
||||
if (callback != null) {
|
||||
callback.run();
|
||||
}
|
||||
}
|
||||
|
||||
public void setCallback(Runnable callback) {
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
// Adapter to make Action compatible with the Action interface
|
||||
public boolean run(TelemetryPacket p) {
|
||||
runAction();
|
||||
return false; // Regular actions complete after one execution
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
package org.firstinspires.ftc.teamcode.util.action;
|
||||
|
||||
import com.acmerobotics.dashboard.canvas.Canvas;
|
||||
import com.acmerobotics.dashboard.telemetry.TelemetryPacket;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class SequentialAction implements Action {
|
||||
private List<Action> actions;
|
||||
|
||||
public SequentialAction(List<Action> actions) {
|
||||
this.actions = new ArrayList<>(actions);
|
||||
}
|
||||
|
||||
public SequentialAction(Action... actions) {
|
||||
this(Arrays.asList(actions));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(TelemetryPacket p) {
|
||||
if (actions.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (actions.get(0).run(p)) {
|
||||
return true;
|
||||
} else {
|
||||
actions.remove(0);
|
||||
return run(p);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preview(Canvas fieldOverlay) {
|
||||
for (Action a : actions) {
|
||||
a.preview(fieldOverlay);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package org.firstinspires.ftc.teamcode.util.action;
|
||||
|
||||
import com.acmerobotics.dashboard.telemetry.TelemetryPacket;
|
||||
|
||||
public class SleepAction implements Action {
|
||||
private double dt;
|
||||
private double beginTs = -1.0;
|
||||
|
||||
public SleepAction(double dt) {
|
||||
this.dt = dt;
|
||||
}
|
||||
|
||||
public static double now() {
|
||||
return System.nanoTime() * 1e-9;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean run(TelemetryPacket p) {
|
||||
double t;
|
||||
if (beginTs < 0) {
|
||||
beginTs = now();
|
||||
t = 0.0;
|
||||
} else {
|
||||
t = now() - beginTs;
|
||||
}
|
||||
boolean output = t < dt;
|
||||
System.out.println(t + ":" + now() + ":" + beginTs + ":" + output);
|
||||
|
||||
return t < dt;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user