Temporary manual commands for intake, these are TEMPORARY, delete as soon as limit switches are in place. These are NOT GOOD. These are THE BARE NECESITY.

This commit is contained in:
TheRealGrayden 2026-03-12 14:45:36 -04:00
parent 41d8d89845
commit 7bce2b2a00
3 changed files with 85 additions and 4 deletions

View File

@ -70,9 +70,13 @@ public class RobotContainer {
m_driverController.povRight().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_SET_ANGLE3)); m_driverController.povRight().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_SET_ANGLE3));
m_driverController.povUp().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_SET_ANGLE2)); m_driverController.povUp().onTrue(new SetDeflectorCommand(turretSubsystem, Constants.ShooterConstants.DEFLECTOR_SET_ANGLE2));
m_driverController.y().onTrue(intakeSubsystem.deployCommand()); /*m_driverController.y().onTrue(intakeSubsystem.deployCommand());
m_driverController.a().onTrue(intakeSubsystem.retractCommand()); m_driverController.a().onTrue(intakeSubsystem.retractCommand());
m_driverController.b().onTrue(intakeSubsystem.reverseCommand()); m_driverController.b().onTrue(intakeSubsystem.reverseCommand());*/
m_driverController.x().onTrue(intakeSubsystem.killSpeedCommand());
m_driverController.a().onTrue(intakeSubsystem.startSpeedCommand());
m_driverController.b().onTrue(intakeSubsystem.revSpeedCommand());
} }
/** /**

View File

@ -0,0 +1,62 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package frc.robot.commands;
import frc.robot.subsystems.IntakeSubsystem;
import javax.lang.model.util.ElementScanner14;
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj2.command.Command;
/** An example command that uses an example subsystem. */
public class ManualIntake extends Command {
@SuppressWarnings({"PMD.UnusedPrivateField", "PMD.SingularField"})
private final IntakeSubsystem m_subsystem;
private final XboxController m_XboxController;
/**
* Creates a new ExampleCommand.
*
* @param subsystem The subsystem used by this command.
*/
public ManualIntake(IntakeSubsystem subsystem, XboxController xboxController) {
m_subsystem = subsystem;
m_XboxController = xboxController;
// Use addRequirements() here to declare subsystem dependencies.
addRequirements(subsystem);
}
// Called when the command is initially scheduled.
@Override
public void initialize() {}
// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
if(m_XboxController.getRightBumper()==true)
{
m_subsystem.extend();
}
else if(m_XboxController.getLeftBumper()==true)
{
m_subsystem.retract();
}
else
{
m_subsystem.neutral();
}
}
// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {}
// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}

View File

@ -69,12 +69,12 @@ public class IntakeSubsystem extends TestableSubsystem {
public Command deployCommand() public Command deployCommand()
{ {
return new FunctionalCommand(this::extend, this::extend, interrupted -> neutral(), this::isDeployed, this).andThen(Commands.startEnd(() -> setSpeed(50), () -> setSpeed(0), this)); return new FunctionalCommand(this::extend, this::extend, interrupted -> neutral(), this::isDeployed, this).andThen(Commands.startEnd(() -> setSpeed(.5), () -> setSpeed(0), this));
} }
public Command reverseCommand() public Command reverseCommand()
{ {
return new FunctionalCommand(this::extend, this::extend, interrupted -> neutral(), this::isDeployed, this).andThen(Commands.startEnd(() -> setSpeed(-50), () -> setSpeed(0), this)); return new FunctionalCommand(this::extend, this::extend, interrupted -> neutral(), this::isDeployed, this).andThen(Commands.startEnd(() -> setSpeed(-.5), () -> setSpeed(0), this));
} }
public Command retractCommand() public Command retractCommand()
@ -82,6 +82,21 @@ public class IntakeSubsystem extends TestableSubsystem {
return this.runOnce(() -> setSpeed(0)).andThen(new FunctionalCommand(this::retract, this::retract, interrupted -> neutral(), this::isRetracted, this)); return this.runOnce(() -> setSpeed(0)).andThen(new FunctionalCommand(this::retract, this::retract, interrupted -> neutral(), this::isRetracted, this));
} }
public Command startSpeedCommand()
{
return this.runOnce(() -> setSpeed(.5));
}
public Command killSpeedCommand()
{
return this.runOnce(() -> setSpeed(0));
}
public Command revSpeedCommand()
{
return this.runOnce(() -> setSpeed(-.5));
}
@PostTest(name = "A friendly name", enabled = true) @PostTest(name = "A friendly name", enabled = true)
public void myFailingPostTest(){ public void myFailingPostTest(){
assertThat(true).isFalse(); assertThat(true).isFalse();