Added back intake command and intake deploy

This commit is contained in:
Tyler Wilcox 2026-03-30 20:26:49 -04:00
parent 8f5988ea12
commit 9ab035db47
3 changed files with 25 additions and 20 deletions

View File

@ -62,14 +62,8 @@ public class RobotContainer {
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.x().onTrue(intakeSubsystem.killSpeedCommand());
// m_driverController.a().onTrue(intakeSubsystem.startSpeedCommand());
m_driverController.b().whileTrue(turretSubsystem.setShooter(1500));
m_driverController.x().whileTrue(turretSubsystem.setShooter(2000));
m_driverController.y().whileTrue(turretSubsystem.setShooter(3000));
m_driverController.rightBumper().whileTrue(intakeSubsystem.intake());
m_driverController.y().onTrue(intakeSubsystem.deploy());
m_driverController.a().whileTrue(new AutoShootCommandChassisTurret(driveSubsystem, hopperSubsystem, turretSubsystem));
}

View File

@ -36,7 +36,7 @@ public class ManualIntake extends Command {
public void execute() {
if(m_XboxController.getYButton()==true)
{
m_subsystem.extend();
m_subsystem.deploy();
}
}

View File

@ -17,6 +17,7 @@ import static org.fairportrobotics.frc.posty.assertions.Assertions.*;
import static org.fairportrobotics.frc.robolib.motors.Utils.*;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
public class IntakeSubsystem extends TestableSubsystem {
/** Creates a new ExampleSubsystem. */
@ -35,9 +36,24 @@ public class IntakeSubsystem extends TestableSubsystem {
deployMotor.setInverted(Constants.IntakeConstants.DEPLOY_MOTOR_INVERTED);
}
public void extend()
public Command deploy()
{
deployMotor.set(1);
return Commands.sequence(
Commands.deadline(
Commands.waitSeconds(2),
this.runEnd(
() -> {deployMotor.set(-0.5);},
() -> {deployMotor.stopMotor();}
)
),
Commands.deadline(
Commands.waitSeconds(2),
this.runEnd(
() -> { deployMotor.set(0.5); },
() -> { deployMotor.stopMotor(); }
)
)
);
}
public void setSpeed(double speed)
@ -45,19 +61,14 @@ public class IntakeSubsystem extends TestableSubsystem {
intakeMotor.set(speed);
}
public Command startSpeedCommand()
public Command intake()
{
return this.runOnce(() -> setSpeed(-.5));
return this.runEnd(() -> setSpeed(-.5), () -> { intakeMotor.stopMotor();});
}
public Command killSpeedCommand()
public Command reverseIntake()
{
return this.runOnce(() -> setSpeed(0));
}
public Command revSpeedCommand()
{
return this.runOnce(() -> setSpeed(.5));
return this.runEnd(() -> setSpeed(.5), () -> { intakeMotor.stopMotor();});
}
@PostTest(enabled = true)