Skip to content

Commit 82ffcf6

Browse files
committed
constant-inated
1 parent 91b60cb commit 82ffcf6

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

src/main/java/frc/robot/Constants.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,18 @@ public final class Constants {
2121
public static class IntakeConstants {
2222
public static final int SPINTAKEID = 10;
2323
public static final int DEPLOYID = 12;
24+
2425
public static final double INTAKE_SPEED = 1;
2526
public static final double SPITAKE_SPEED = -1;
2627
public static final double DEPLOY_SPEED = 1;
28+
29+
public static final double kP1 = 0.1;
30+
public static final double kI1 = 0;
31+
public static final double kD1 = 0;
32+
33+
public static final double kP2 = 0.0001;
34+
public static final double kI2 = 0;
35+
public static final double kD2 = 0;
2736
}
2837

2938
public static enum Mode {

src/main/java/frc/robot/subsystems/Intake/Deploy.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
import com.revrobotics.spark.config.SparkMaxConfig;
1313
import edu.wpi.first.wpilibj2.command.Command;
1414
import edu.wpi.first.wpilibj2.command.SubsystemBase;
15-
import frc.robot.Constants;
15+
import frc.robot.Constants.IntakeConstants;
1616

1717
public class Deploy extends SubsystemBase {
1818
/** Creates a new Deploy. */
19-
SparkMax deployMotor = new SparkMax(Constants.IntakeConstants.DEPLOYID, MotorType.kBrushless);
19+
SparkMax deployMotor = new SparkMax(IntakeConstants.DEPLOYID, MotorType.kBrushless);
2020

2121
SparkMaxConfig config = new SparkMaxConfig();
2222

@@ -30,7 +30,7 @@ public Command deployCMD() {
3030
// Deploys fuel
3131
return runOnce(
3232
() -> {
33-
deployMotor.set(Constants.IntakeConstants.DEPLOY_SPEED);
33+
deployMotor.set(IntakeConstants.DEPLOY_SPEED);
3434
});
3535
}
3636
// Stops motor

src/main/java/frc/robot/subsystems/Intake/Intake.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
import com.revrobotics.spark.config.SparkMaxConfig;
1717
import edu.wpi.first.wpilibj2.command.Command;
1818
import edu.wpi.first.wpilibj2.command.SubsystemBase;
19-
import frc.robot.Constants;
19+
import frc.robot.Constants.IntakeConstants;
2020

2121
public class Intake extends SubsystemBase {
2222
SparkMax intakeMotor =
23-
new SparkMax(Constants.IntakeConstants.SPINTAKEID, MotorType.kBrushless); // 10, for now
23+
new SparkMax(IntakeConstants.SPINTAKEID, MotorType.kBrushless); // 10, for now
2424
RelativeEncoder encoder;
2525
SparkMaxConfig config = new SparkMaxConfig();
2626
SparkClosedLoopController controller = intakeMotor.getClosedLoopController();
@@ -40,14 +40,14 @@ public Intake() {
4040
.feedbackSensor(FeedbackSensor.kPrimaryEncoder)
4141
// Set PID values for position control. We don't need to pass a closed loop
4242
// slot, as it will default to slot 0.
43-
.p(0.1)
44-
.i(0)
45-
.d(0)
43+
.p(IntakeConstants.kP1)
44+
.i(IntakeConstants.kI1)
45+
.d(IntakeConstants.kD1)
4646
.outputRange(-1, 1)
4747
// Set PID values for velocity control in slot 1
48-
.p(0.0001, ClosedLoopSlot.kSlot1)
49-
.i(0, ClosedLoopSlot.kSlot1)
50-
.d(0, ClosedLoopSlot.kSlot1)
48+
.p(IntakeConstants.kP2, ClosedLoopSlot.kSlot1)
49+
.i(IntakeConstants.kI2, ClosedLoopSlot.kSlot1)
50+
.d(IntakeConstants.kD2, ClosedLoopSlot.kSlot1)
5151
.outputRange(-1, 1, ClosedLoopSlot.kSlot1)
5252
.feedForward
5353
// kV is now in Volts, so we multiply by the nominal voltage (12V)
@@ -78,14 +78,14 @@ public Command intakeCMD() {
7878
// Takes in
7979
return runOnce(
8080
() -> {
81-
intakeMotor.set(Constants.IntakeConstants.INTAKE_SPEED);
81+
intakeMotor.set(IntakeConstants.INTAKE_SPEED);
8282
});
8383
}
8484
// Spits out
8585
public Command spitakeCMD() {
8686
return runOnce(
8787
() -> {
88-
intakeMotor.set(Constants.IntakeConstants.SPITAKE_SPEED);
88+
intakeMotor.set(IntakeConstants.SPITAKE_SPEED);
8989
});
9090
}
9191

0 commit comments

Comments
 (0)