Skip to content

Commit

Permalink
Merge pull request #93 from iamawesomecat/main
Browse files Browse the repository at this point in the history
launcher 1.4.1 (really small pre-testing changes)
  • Loading branch information
TAKBS2412 authored Mar 19, 2024
2 parents a24da4b + 2bd2b1f commit 41014a3
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/main/java/frc/team2412/robot/subsystems/LauncherSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public class LauncherSubsystem extends SubsystemBase {

// HARDWARE
private static final double PIVOT_GEARING_RATIO = 1.0 / 180.0;
private static final float PIVOT_SOFTSTOP_FORWARD = 0.96f;
private static final float PIVOT_SOFTSTOP_BACKWARD = 0.80f;
// ANGLE VALUES
public static final int AMP_AIM_ANGLE = 335;
public static final int SUBWOOFER_AIM_ANGLE = 298;
Expand Down Expand Up @@ -147,8 +149,10 @@ public void configMotors() {
launcherAngleOneMotor.setSmartCurrentLimit(60);
launcherAngleTwoMotor.setSmartCurrentLimit(60);

launcherAngleOneMotor.setSoftLimit(CANSparkBase.SoftLimitDirection.kForward, 0.96f);
launcherAngleOneMotor.setSoftLimit(CANSparkBase.SoftLimitDirection.kReverse, 0.80f);
launcherAngleOneMotor.setSoftLimit(
CANSparkBase.SoftLimitDirection.kForward, PIVOT_SOFTSTOP_FORWARD);
launcherAngleOneMotor.setSoftLimit(
CANSparkBase.SoftLimitDirection.kReverse, PIVOT_SOFTSTOP_BACKWARD);
launcherAngleOneMotor.enableSoftLimit(CANSparkBase.SoftLimitDirection.kForward, true);
launcherAngleOneMotor.enableSoftLimit(CANSparkBase.SoftLimitDirection.kReverse, true);

Expand Down Expand Up @@ -246,10 +250,13 @@ public double getAngleSpeed() {

public void setAngleManual(double joystickInput) {
manualAngleSetpoint =
MathUtil.clamp(manualAngleSetpoint + joystickInput * MANUAL_MODIFIER, 0.80f, 0.96f);
MathUtil.clamp(
manualAngleSetpoint + joystickInput * MANUAL_MODIFIER,
PIVOT_SOFTSTOP_BACKWARD,
PIVOT_SOFTSTOP_FORWARD);

if (Units.degreesToRotations(getAngle()) > 0.80
&& Units.degreesToRotations(getAngle()) < 0.96) {
if (Units.degreesToRotations(getAngle()) > PIVOT_SOFTSTOP_BACKWARD
&& Units.degreesToRotations(getAngle()) < PIVOT_SOFTSTOP_FORWARD) {
launcherAngleOnePIDController.setReference(
manualAngleSetpoint,
ControlType.kPosition,
Expand Down

0 comments on commit 41014a3

Please sign in to comment.