Skip to content

Commit

Permalink
added pivot max angle const
Browse files Browse the repository at this point in the history
this is so we can convert angle in degrees into a position for the pivot motor
  • Loading branch information
Oliver-Cushman committed Jan 23, 2024
1 parent fb5b106 commit 4688280
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/java/frc/robot/subsystems/shooter/Pivot.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public void configMotor() {
}

public void setAngle(double angle) {
pivot.setTargetPosition(angle);
// Divide by 180 because angle will be a value between 180 and -180
// and we want to set the position between 1.0 and -1.0
pivot.setTargetPosition(angle / ShooterConstants.PIVOT_MAX_ANGLE);
}
}
2 changes: 2 additions & 0 deletions src/main/java/frc/robot/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ public static final class ShooterConstants {
public static final double PIVOT_MIN_OUTPUT = -1;
public static final double PIVOT_MAX_OUTPUT = 1;

public static final double PIVOT_MAX_ANGLE = 180.0;

public static final double MEASUREMENT_INTERVAL_FEET = 1.0;
/**
* The distances are in feet, the speeds are in RPM, and the angles are in
Expand Down

0 comments on commit 4688280

Please sign in to comment.