From e3e52b2dcd9d3feaeb25c0106ce3e0bf9a01cda9 Mon Sep 17 00:00:00 2001 From: Kevin Frei Date: Fri, 9 Oct 2026 22:16:47 -0700 Subject: [PATCH] austin - tampered with controls and now has intake, eject, and speedup / slowdown --- .../ftc/teamcode/twenty403/Hardware.java | 3 +- .../teamcode/twenty403/commands/EZCmd.java | 20 ++++ .../twenty403/controls/DriverController.java | 95 ++++--------------- .../twenty403/subsystems/IntakeSubsystem.java | 2 +- 4 files changed, 43 insertions(+), 77 deletions(-) diff --git a/Twenty403/src/main/java/org/firstinspires/ftc/teamcode/twenty403/Hardware.java b/Twenty403/src/main/java/org/firstinspires/ftc/teamcode/twenty403/Hardware.java index 3b9dc21..53be136 100644 --- a/Twenty403/src/main/java/org/firstinspires/ftc/teamcode/twenty403/Hardware.java +++ b/Twenty403/src/main/java/org/firstinspires/ftc/teamcode/twenty403/Hardware.java @@ -21,7 +21,7 @@ public class Hardware implements Loggable { public static List hubs; public EncodedMotor launcher; - public Motor inTake; + public Motor intake; public MotorEncoder fbOdo; public MotorEncoder strafeOdo; public Limelight3A limelight; @@ -47,6 +47,7 @@ public Hardware(HardwareMap hwmap) { if (Setup.Connected.INTAKE) { leftIntakeServo = new CRServo(Setup.HardwareNames.LEFTINTAKESERVO); rightIntakeServo = new CRServo(Setup.HardwareNames.RIGHTINTAKESERVO); + intake = new Motor<>(Setup.HardwareNames.LAUNCHER); } if (Setup.Connected.LIMELIGHT) { limelight = hwmap.get(Limelight3A.class, Setup.HardwareNames.LIMELIGHT); diff --git a/Twenty403/src/main/java/org/firstinspires/ftc/teamcode/twenty403/commands/EZCmd.java b/Twenty403/src/main/java/org/firstinspires/ftc/teamcode/twenty403/commands/EZCmd.java index 06c8232..1180d86 100644 --- a/Twenty403/src/main/java/org/firstinspires/ftc/teamcode/twenty403/commands/EZCmd.java +++ b/Twenty403/src/main/java/org/firstinspires/ftc/teamcode/twenty403/commands/EZCmd.java @@ -4,6 +4,8 @@ import com.pedropathing.math.Pose; import com.technototes.library.command.Command; import org.firstinspires.ftc.teamcode.twenty403.commands.driving.JoystickDriveCommand; +import org.firstinspires.ftc.teamcode.twenty403.subsystems.IntakeSubsystem; +import org.firstinspires.ftc.teamcode.twenty403.subsystems.LauncherSubsystem; public class EZCmd { @@ -21,4 +23,22 @@ public static Command ResetGyro(Follower follower) { ); } } + + public static class Launcher { + + public static Command Launch(LauncherSubsystem launcher) { + return Command.create(launcher::Launch); + } + } + + public static class PollenIntake { + + public static Command Intake(IntakeSubsystem intake) { + return Command.create(intake::Intake); + } + + public static Command Eject(IntakeSubsystem intake) { + return Command.create(intake::Reject); + } + } } diff --git a/Twenty403/src/main/java/org/firstinspires/ftc/teamcode/twenty403/controls/DriverController.java b/Twenty403/src/main/java/org/firstinspires/ftc/teamcode/twenty403/controls/DriverController.java index 378428b..73d9f77 100644 --- a/Twenty403/src/main/java/org/firstinspires/ftc/teamcode/twenty403/controls/DriverController.java +++ b/Twenty403/src/main/java/org/firstinspires/ftc/teamcode/twenty403/controls/DriverController.java @@ -20,32 +20,12 @@ public class DriverController { public Stick driveLeftStick, driveRightStick; public CommandButton resetGyroButton; - public CommandButton turboButton; - public CommandButton snailButton; - public CommandAxis straightTrigger; - public CommandAxis angleTrigger; public CommandButton launch; + public CommandButton intake; + public CommandButton spitOut; public CommandButton launchFaster; public CommandButton launchSlower; - public CommandButton moveballup; - public CommandButton moveballslow; - public CommandButton pipelineMode; - public CommandButton compactScore; - public CommandButton barcodePipeline; - public CommandButton GreencolorPipeline; - public CommandButton moveballanyways; - public CommandButton classifierPipeline; - public CommandButton objectPipeline; - public CommandButton apriltagPipeline; - public CommandButton PurplecolorPipeline; - public CommandButton AutoAim; - public static boolean pipelineToggle = false; - public static boolean launchOn = false; - private boolean faceTagMode = false; - - public void togglePipelineMode() { - pipelineToggle = !pipelineToggle; - } + public CommandButton autoAim; public DriverController(CommandGamepad g, Robot r) { this.robot = r; @@ -59,7 +39,7 @@ public DriverController(CommandGamepad g, Robot r) { bindLaunchControls(); } if (Setup.Connected.INTAKE) { - bindFeedControls(); + bindIntakeControls(); } if (Setup.Connected.LIMELIGHT) { bindPipelineControls(); @@ -70,49 +50,35 @@ private void AssignNamedControllerButton() { resetGyroButton = gamepad.ps_options; driveLeftStick = gamepad.leftStick; driveRightStick = gamepad.rightStick; - turboButton = gamepad.rightBumper; - snailButton = gamepad.leftBumper; - straightTrigger = gamepad.rightTrigger; - angleTrigger = gamepad.leftTrigger; - moveballup = gamepad.ps_square; - launch = gamepad.ps_triangle; - // pipelineMode = gamepad.dpadUp; - launchSlower = gamepad.ps_cross; - launchFaster = gamepad.ps_circle; - // apriltagPipeline = gamepad.dpadRight; - // AutoAim = gamepad.dpadDown; - moveballanyways = gamepad.dpadDown; - compactScore = gamepad.dpadLeft; + + launch = gamepad.rightTrigger.getAsButton(); + intake = gamepad.leftTrigger.getAsButton(); + spitOut = gamepad.leftBumper; + launchFaster = gamepad.dpadUp; + launchSlower = gamepad.dpadDown; } public void bindDriveControls() { CommandScheduler.scheduleJoystick( - new JoystickDriveCommand( - robot.follower, - driveLeftStick, - driveRightStick, - straightTrigger, - angleTrigger - ) + new JoystickDriveCommand(robot.follower, driveLeftStick, driveRightStick) ); if (Setup.Connected.LIMELIGHT) { - AutoAim.whenPressed(EZCmd.Drive.AutoAim()); + autoAim.whenPressed(EZCmd.Drive.AutoAim()); } } public void bindLaunchControls() { - launch.toggle(robot.launcherSubsystem::Launch, robot.launcherSubsystem::Stop); - launchSlower.whenPressed(this::launchSlower); - launchFaster.whenPressed(this::launchFaster); + if (Setup.Connected.LAUNCHER) { + launch.whenPressed(EZCmd.Launcher.Launch(robot.launcherSubsystem)); + } } - public void bindFeedControls() { - moveballup.whenPressed(robot.intakeSubsystem::Intake); - moveballup.whenReleased(robot.intakeSubsystem::Stop); - compactScore.whenPressed(FeedCMD.Feed(robot)); - moveballanyways.whenPressed(robot.intakeSubsystem::Intake); - moveballanyways.whenReleased(robot.intakeSubsystem::Stop); + public void bindIntakeControls() { + if (Setup.Connected.INTAKE) { + intake.whenPressed(EZCmd.PollenIntake.Intake(robot.intakeSubsystem)); + spitOut.whenPressed(EZCmd.PollenIntake.Eject(robot.intakeSubsystem)); + } } public void bindPipelineControls() { @@ -141,25 +107,4 @@ public void bindPipelineControls() { // ); // } } - - // public void setLaunch() { - // launchOn = !launchOn; - // Launch(); - // } - - public void launchFaster() { - robot.launcherSubsystem.IncreaseVelocity(); - } - - public void launchSlower() { - robot.launcherSubsystem.DecreaseVelocity(); - } - - // public void Launch() { - // if (launchOn) { - // robot.launcherSubsystem.Launch(); - // } else { - // robot.launcherSubsystem.Stop(); - // } - // } } diff --git a/Twenty403/src/main/java/org/firstinspires/ftc/teamcode/twenty403/subsystems/IntakeSubsystem.java b/Twenty403/src/main/java/org/firstinspires/ftc/teamcode/twenty403/subsystems/IntakeSubsystem.java index 07457ab..380ed29 100644 --- a/Twenty403/src/main/java/org/firstinspires/ftc/teamcode/twenty403/subsystems/IntakeSubsystem.java +++ b/Twenty403/src/main/java/org/firstinspires/ftc/teamcode/twenty403/subsystems/IntakeSubsystem.java @@ -25,7 +25,7 @@ public IntakeSubsystem(Hardware h) { if (hasHardware) { _leftintake = h.leftIntakeServo; _rightintake = h.rightIntakeServo; - _intakemotor = h.inTake; + _intakemotor = h.intake; } else { _leftintake = null; _rightintake = null;