Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create PrepareToScoreInAmpCommand #77

Merged
merged 8 commits into from
Feb 7, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,19 @@ public void setupMobilityComands(

}

@Inject
public void scoringCommands(
SetArmAngleCommand armAngle,
WarmUpShooterCommand shooter
)
{
// Prepare to score in Amp
armAngle.setArmPosition(ArmSubsystem.UsefulArmPosition.FIRING_IN_AMP);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⭐ I wonder if there's a way we could unify the position -> angle + rpm logic so you can have a single command that's about preparing for an arbitary position that does both? What do you think?

Since very soon we'll have a bunch of these

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a generic helper function that sets arm position and shooter wheel rpm.

shooter.setTargetRpm(ShooterWheelSubsystem.TargetRPM.AMP_SHOT);
var prepareToScoreInAmp = armAngle.alongWith(shooter);
// TODO: Bind command to a button in operatorGamepad
}

@Inject
public void setupOracleCommands(OperatorInterface oi,
SwerveAccordingToOracleCommand oracleSwerve,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public class ShooterWheelSubsystem extends BaseSetpointSubsystem<Double> impleme
public enum TargetRPM {
SAFE,
NEARSHOT,
DISTANCESHOT
DISTANCESHOT,
AMP_SHOT
}

//need pose for real time calculations
Expand All @@ -35,6 +36,7 @@ public enum TargetRPM {
private final DoubleProperty safeRpm;
private final DoubleProperty nearShotRpm;
private final DoubleProperty distanceShotRpm;
private final DoubleProperty ampShotRpm;
private final DoubleProperty shortRangeErrorToleranceRpm;
private final DoubleProperty longRangeErrorToleranceRpm;
private final DoubleProperty iMaxAccumValueForShooter;
Expand Down Expand Up @@ -62,6 +64,8 @@ public ShooterWheelSubsystem(XCANSparkMax.XCANSparkMaxFactory sparkMaxFactory, P
safeRpm = pf.createPersistentProperty("SafeRpm", 500);
nearShotRpm = pf.createPersistentProperty("NearShotRpm", 1000);
distanceShotRpm = pf.createPersistentProperty("DistanceShotRpm", 3000);
// placeholder value for rpm when preparing to score in amp
ampShotRpm = pf.createPersistentProperty("AmpShotRpm", 2000);

this.pose = pose;
this.converter = new ShooterDistanceToRpmConverter();
Expand Down Expand Up @@ -103,6 +107,7 @@ public void setTargetRPM(TargetRPM target) {
case SAFE -> setTargetValue(safeRpm.get());
case NEARSHOT -> setTargetValue(nearShotRpm.get());
case DISTANCESHOT -> setTargetValue(distanceShotRpm.get());
case AMP_SHOT -> setTargetValue(ampShotRpm.get());
default -> setTargetValue(0.0);
}
}
Expand Down