-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31fbfc3
commit 51ad841
Showing
3 changed files
with
50 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package frc.robot.commands; | ||
|
||
import java.util.function.BooleanSupplier; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.settings.Constants.Field; | ||
import frc.robot.settings.Constants.ShooterConstants; | ||
import frc.robot.subsystems.AngleShooterSubsystem; | ||
|
||
public class AimShooter extends Command { | ||
AngleShooterSubsystem angleShooterSubsystem; | ||
BooleanSupplier aimAtAmp; | ||
|
||
public AimShooter(AngleShooterSubsystem angleShooterSubsystem, BooleanSupplier aimAtAmp) { | ||
this.angleShooterSubsystem = angleShooterSubsystem; | ||
this.aimAtAmp = aimAtAmp; | ||
} | ||
|
||
@Override | ||
public void initialize() { | ||
|
||
} | ||
|
||
@Override | ||
public void execute() { | ||
if (!aimAtAmp.getAsBoolean()) { | ||
double desiredShooterAngleSpeed = angleShooterSubsystem.calculateSpeakerAngle() * ShooterConstants.AUTO_AIM_SHOOTER_kP; | ||
angleShooterSubsystem.pitchShooter(desiredShooterAngleSpeed); | ||
} else { | ||
double differenceAmp = Field.AMPLIFIER_ANGLE - angleShooterSubsystem.getShooterAngle(); | ||
double ampSpeed = differenceAmp * ShooterConstants.AUTO_AIM_SHOOTER_kP; | ||
angleShooterSubsystem.pitchShooter(ampSpeed); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void end(boolean interrupted) { | ||
angleShooterSubsystem.pitchShooter(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters