diff --git a/src/main/java/frc/robot/subsystems/Shooter/Pivot.java b/src/main/java/frc/robot/subsystems/Shooter/Pivot.java new file mode 100644 index 00000000..f63213a3 --- /dev/null +++ b/src/main/java/frc/robot/subsystems/Shooter/Pivot.java @@ -0,0 +1,29 @@ +package frc.robot.subsystems.Shooter; + +public class Pivot { + pivot = new Neo(ShooterConstants.SHOOTER_PIVOT_CAN_ID); + configMotor(); +} + +public void configMotor() { + pivot.setSmartCurrentLimit(PivotConstants.PIVOT_CURRENT_LIMIT); + // See https://docs.revrobotics.com/sparkmax/operating-modes/control-interfaces + pivot.setPeriodicFramePeriod(PeriodicFrame.kStatus3, 65535); + pivot.setPeriodicFramePeriod(PeriodicFrame.kStatus5, 65535); + pivot.setInverted(false); + + Pivot.setPID( + ShooterConstants.SHOOTER_P, + ShooterConstants.SHOOTER_I, + ShooterConstants.SHOOTER_D, + ShooterConstants.SHOOTER_MIN_OUTPUT, + ShooterConstants.SHOOTER_MAX_OUTPUT); + + + //sets brake mode + pivot.setBrakeMode(); + } + +public void setAngle(double angle) { + pivot.setTargetPosition(angle); +} \ No newline at end of file diff --git a/src/main/java/frc/robot/subsystems/Shooter.java b/src/main/java/frc/robot/subsystems/Shooter/Shooter.java similarity index 100% rename from src/main/java/frc/robot/subsystems/Shooter.java rename to src/main/java/frc/robot/subsystems/Shooter/Shooter.java diff --git a/src/main/java/frc/robot/util/Constants.java b/src/main/java/frc/robot/util/Constants.java index 35a1648b..922977f9 100644 --- a/src/main/java/frc/robot/util/Constants.java +++ b/src/main/java/frc/robot/util/Constants.java @@ -100,6 +100,8 @@ public static final class ShooterConstants { public static final int RIGHT_SHOOTER_CAN_ID = 12; public static final int SHOOTER_PIVOT_CAN_ID = 13; + public static final int PIVOT_MOTOR_CURRENT_LIMIT = 20; // amps + public static final double SHOOTER_P = 0.01; public static final double SHOOTER_I = 0; public static final double SHOOTER_D = 0; @@ -299,8 +301,7 @@ public static final class IntakeConstants { // % speeds of the motor public static final double INTAKE_SPEED = 0.5; public static final double OUTTAKE_SPEED = -0.5; - public static final double STOP_SPEED = 0; - + public static final double STOP_SPEED = 0; public static final int INTAKE_FREE_CURRENT_LIMIT_AMPS = 15; public static final int INTAKE_STALL_CURRENT_LIMIT_AMPS = 7;