shooter + amp handoff sequences advancing

This commit is contained in:
Tyler-J42 2024-02-24 03:48:55 -05:00
parent b262fde35f
commit 0e308e2986
5 changed files with 44 additions and 2 deletions

View File

@ -0,0 +1,13 @@
package frc.robot.Commands;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import frc.robot.subsystems.Indexer;
import frc.robot.subsystems.Shooter;
public class AmpHandoff extends ParallelCommandGroup{
AmpHandoff(Indexer indexer, Shooter shooter){
addCommands(indexer.shootNote(null), shooter.ampHandoff());
}
}

View File

@ -0,0 +1,13 @@
package frc.robot.Commands;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import frc.robot.constants.ShooterConstants;
import frc.robot.subsystems.Indexer;
import frc.robot.subsystems.Shooter;
public class SpeakerShot extends ParallelCommandGroup{
SpeakerShot(Indexer indexer, Shooter shooter){
addCommands(shooter.angleSpeedsSetpoints(ShooterConstants.kShooterLoadAngle, 0, 0), indexer.shootNote(() -> 1.0));
}
}

View File

@ -19,6 +19,7 @@ import edu.wpi.first.wpilibj.shuffleboard.BuiltInWidgets;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;

View File

@ -31,13 +31,23 @@ public class Indexer extends SubsystemBase{
public Command autoIndexing(){
return run(() -> {
if(!indexerBeamBreak.get()){
indexerMotor.set(0.5);
indexerMotor.set(0.75);
}else if(indexerBeamBreak.get()){
indexerMotor.set(0.0);
}
});
}
public Command advanceNote(){
return run(() -> {
if(indexerBeamBreak.get()){
indexerMotor.set(0.75);
}else{
indexerMotor.set(0.75);
}
});
}
public Command shootNote(DoubleSupplier indexerSpeed){
return run(() -> {

View File

@ -36,6 +36,8 @@ public class Shooter extends SubsystemBase{
private DigitalInput shooterBeamBreak;
private boolean indexerBeamBreak;
public Shooter(BooleanSupplier indexerBeamBreak){
topShooter = new CANSparkMax(ShooterConstants.kTopShooterID, MotorType.kBrushless);
bottomShooter = new CANSparkMax(ShooterConstants.kBottomShooterID, MotorType.kBrushless);
@ -58,6 +60,9 @@ public class Shooter extends SubsystemBase{
shooterBeamBreak = new DigitalInput(ShooterConstants.kShooterBeamBreakChannel);
topShooter.setIdleMode(IdleMode.kBrake);
bottomShooter.setIdleMode(IdleMode.kCoast);
bottomShooter.burnFlash();
shooterPivot.burnFlash();
topShooter.burnFlash();
@ -105,7 +110,7 @@ public class Shooter extends SubsystemBase{
shooterPivotPID.calculate(pivotEncoder.getDistance(), ShooterConstants.kShooterLoadAngle) +
shooterPivotFF.calculate(ShooterConstants.kShooterLoadAngle, 0.0));
if(shooterBeamBreak.get() || shooterBeamBreak.get()){
if(shooterBeamBreak.get() || indexerBeamBreak){
angleAndSpeedControl(ShooterConstants.kShooterLoadAngle, 1000.0, 1000.0);
}else{
angleAndSpeedControl(ShooterConstants.kShooterAmpAngle, 0, 0);