Skip to content

Commit

Permalink
fix: coralShooter
Browse files Browse the repository at this point in the history
inverted 的參數有誤
漏加 powerDistribution
  • Loading branch information
Hannahjjj97 committed Feb 12, 2025
1 parent cae27f8 commit fcc2d99
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public static final class CoralShooterConstant {
public static final int kShooterRightMotorChannel = 2;
public static final double kShooterMotorFastSpeed = 4;
public static final double kShooterMotorSlowSpeed = 4;
public static final Boolean kCoralShooterMotorInverted = false;
public static final Boolean kCoralShooterRightMotorInverted = false;
public static final Boolean kCoralShooterLeftMotorInverted = false;
}

public static final class PowerDistributionConstant {
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/frc/robot/subsystems/CoralShooterSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public CoralShooterSubsystem(PowerDistribution powerDistribution) {
coralShooterRightMotor = new VictorSPX(CoralShooterConstant.kShooterRightMotorChannel);

distanceSensor = new DistanceSensor(Port.kOnboard);
coralShooterRightMotor.setInverted(CoralShooterConstant.kCoralShooterMotorInverted);
coralShooterLeftMotor.setInverted(CoralShooterConstant.kCoralShooterMotorInverted);
coralShooterRightMotor.setInverted(CoralShooterConstant.kCoralShooterRightMotorInverted);
coralShooterLeftMotor.setInverted(CoralShooterConstant.kCoralShooterLeftMotorInverted);
}

private void setMotorSpeed(double speed) {
Expand All @@ -48,7 +48,12 @@ public void coralShooterFastOn() { // Motor on Fast
}

public void coralShooterSlowOn() { // Motor on Slow
if (powerDistribution.isCoralShooterOverCurrent()) {
setMotorSpeed(0);
return;
}
setMotorSpeed(CoralShooterConstant.kShooterMotorSlowSpeed);
}
}

public void coralShooterStop() { // Motor stop
Expand Down

0 comments on commit fcc2d99

Please sign in to comment.