Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class Hardware implements Loggable {
public static List<LynxModule> hubs;

public EncodedMotor<DcMotorEx> launcher;
public Motor<DcMotorEx> inTake;
public Motor<DcMotorEx> intake;
public MotorEncoder fbOdo;
public MotorEncoder strafeOdo;
public Limelight3A limelight;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -59,7 +39,7 @@ public DriverController(CommandGamepad g, Robot r) {
bindLaunchControls();
}
if (Setup.Connected.INTAKE) {
bindFeedControls();
bindIntakeControls();
}
if (Setup.Connected.LIMELIGHT) {
bindPipelineControls();
Expand All @@ -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() {
Expand Down Expand Up @@ -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();
// }
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading