shooter + amp handoff sequences advancing
This commit is contained in:
parent
b262fde35f
commit
0e308e2986
13
src/main/java/frc/robot/Commands/AmpHandoff.java
Normal file
13
src/main/java/frc/robot/Commands/AmpHandoff.java
Normal 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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
13
src/main/java/frc/robot/Commands/SpeakerShot.java
Normal file
13
src/main/java/frc/robot/Commands/SpeakerShot.java
Normal 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));
|
||||||
|
}
|
||||||
|
}
|
@ -19,6 +19,7 @@ import edu.wpi.first.wpilibj.shuffleboard.BuiltInWidgets;
|
|||||||
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
|
||||||
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
|
||||||
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
|
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.Command;
|
||||||
import edu.wpi.first.wpilibj2.command.InstantCommand;
|
import edu.wpi.first.wpilibj2.command.InstantCommand;
|
||||||
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
|
||||||
|
@ -31,13 +31,23 @@ public class Indexer extends SubsystemBase{
|
|||||||
public Command autoIndexing(){
|
public Command autoIndexing(){
|
||||||
return run(() -> {
|
return run(() -> {
|
||||||
if(!indexerBeamBreak.get()){
|
if(!indexerBeamBreak.get()){
|
||||||
indexerMotor.set(0.5);
|
indexerMotor.set(0.75);
|
||||||
}else if(indexerBeamBreak.get()){
|
}else if(indexerBeamBreak.get()){
|
||||||
indexerMotor.set(0.0);
|
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){
|
public Command shootNote(DoubleSupplier indexerSpeed){
|
||||||
return run(() -> {
|
return run(() -> {
|
||||||
|
@ -36,6 +36,8 @@ public class Shooter extends SubsystemBase{
|
|||||||
|
|
||||||
private DigitalInput shooterBeamBreak;
|
private DigitalInput shooterBeamBreak;
|
||||||
|
|
||||||
|
private boolean indexerBeamBreak;
|
||||||
|
|
||||||
public Shooter(BooleanSupplier indexerBeamBreak){
|
public Shooter(BooleanSupplier indexerBeamBreak){
|
||||||
topShooter = new CANSparkMax(ShooterConstants.kTopShooterID, MotorType.kBrushless);
|
topShooter = new CANSparkMax(ShooterConstants.kTopShooterID, MotorType.kBrushless);
|
||||||
bottomShooter = new CANSparkMax(ShooterConstants.kBottomShooterID, MotorType.kBrushless);
|
bottomShooter = new CANSparkMax(ShooterConstants.kBottomShooterID, MotorType.kBrushless);
|
||||||
@ -58,6 +60,9 @@ public class Shooter extends SubsystemBase{
|
|||||||
|
|
||||||
shooterBeamBreak = new DigitalInput(ShooterConstants.kShooterBeamBreakChannel);
|
shooterBeamBreak = new DigitalInput(ShooterConstants.kShooterBeamBreakChannel);
|
||||||
|
|
||||||
|
topShooter.setIdleMode(IdleMode.kBrake);
|
||||||
|
bottomShooter.setIdleMode(IdleMode.kCoast);
|
||||||
|
|
||||||
bottomShooter.burnFlash();
|
bottomShooter.burnFlash();
|
||||||
shooterPivot.burnFlash();
|
shooterPivot.burnFlash();
|
||||||
topShooter.burnFlash();
|
topShooter.burnFlash();
|
||||||
@ -105,7 +110,7 @@ public class Shooter extends SubsystemBase{
|
|||||||
shooterPivotPID.calculate(pivotEncoder.getDistance(), ShooterConstants.kShooterLoadAngle) +
|
shooterPivotPID.calculate(pivotEncoder.getDistance(), ShooterConstants.kShooterLoadAngle) +
|
||||||
shooterPivotFF.calculate(ShooterConstants.kShooterLoadAngle, 0.0));
|
shooterPivotFF.calculate(ShooterConstants.kShooterLoadAngle, 0.0));
|
||||||
|
|
||||||
if(shooterBeamBreak.get() || shooterBeamBreak.get()){
|
if(shooterBeamBreak.get() || indexerBeamBreak){
|
||||||
angleAndSpeedControl(ShooterConstants.kShooterLoadAngle, 1000.0, 1000.0);
|
angleAndSpeedControl(ShooterConstants.kShooterLoadAngle, 1000.0, 1000.0);
|
||||||
}else{
|
}else{
|
||||||
angleAndSpeedControl(ShooterConstants.kShooterAmpAngle, 0, 0);
|
angleAndSpeedControl(ShooterConstants.kShooterAmpAngle, 0, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user