Skip to content

Commit

Permalink
a few more preference additions
Browse files Browse the repository at this point in the history
  • Loading branch information
rflood07 committed Feb 27, 2024
1 parent 9823b2e commit aca9d95
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/main/java/frc/robot/settings/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,9 @@ public static final class ShooterConstants{
public static final double DEGREES_PER_ROTATION = 360;
public static final double DISTANCE_MULTIPLIER = 0.15;
public static final double OFFSET_MULTIPLIER = 1;
public static final double MINIMUM_SHOOTER_ANGLE = 10;//still has to be found
public static final double MAXIMUM_SHOOTER_ANGLE = 108;//still has to be found
public static final double MINIMUM_SHOOTER_ANGLE = 11.64;//still has to be found
public static final double COMP_MAXIMUM_SHOOTER_ANGLE = 101;//still has to be found
public static final double PRAC_MAXIMUM_SHOOTER_ANGLE = 108;//still has to be found
public static final double HUMAN_PLAYER_ANGLE = 97;//still has to be found
public static final double HUMAN_PLAYER_RPS = -10;//still has to be found

Expand Down
11 changes: 8 additions & 3 deletions src/main/java/frc/robot/subsystems/AngleShooterSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import frc.robot.settings.Constants.Field;
import frc.robot.settings.Constants.ShooterConstants;
import pabeles.concurrency.IntOperatorTask.Max;

import java.util.Optional;

Expand Down Expand Up @@ -62,7 +63,11 @@ public AngleShooterSubsystem() {
}

public void setDesiredShooterAngle(double degrees) {
if(degrees>MAXIMUM_SHOOTER_ANGLE) {degrees = MAXIMUM_SHOOTER_ANGLE;}
double MaxAngle = COMP_MAXIMUM_SHOOTER_ANGLE;
if(!Preferences.getBoolean("CompBot", true)) {
MaxAngle = PRAC_MAXIMUM_SHOOTER_ANGLE;
}
if(degrees>MaxAngle) {degrees = COMP_MAXIMUM_SHOOTER_ANGLE;}
if(degrees<MINIMUM_SHOOTER_ANGLE) {degrees = MINIMUM_SHOOTER_ANGLE;}
pitchPID.setFF(Math.cos(Math.toRadians(degrees))*ShooterConstants.pitchFeedForward);
pitchPID.setReference(
Expand Down Expand Up @@ -136,8 +141,8 @@ public double calculateSpeakerAngle() {
if(desiredShooterAngle<ShooterConstants.MINIMUM_SHOOTER_ANGLE) {
desiredShooterAngle = ShooterConstants.MINIMUM_SHOOTER_ANGLE;
}
if(desiredShooterAngle>ShooterConstants.MAXIMUM_SHOOTER_ANGLE) {
desiredShooterAngle = ShooterConstants.MAXIMUM_SHOOTER_ANGLE;
if(desiredShooterAngle>ShooterConstants.PRAC_MAXIMUM_SHOOTER_ANGLE) {
desiredShooterAngle = ShooterConstants.PRAC_MAXIMUM_SHOOTER_ANGLE;
}
SmartDashboard.putNumber("desired shooter angle", desiredShooterAngle);

Expand Down

0 comments on commit aca9d95

Please sign in to comment.