Skip to content

Commit 2b042ad

Browse files
committed
change a name and add the pid controller to constans
1 parent d3aa85e commit 2b042ad

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import edu.wpi.first.apriltag.AprilTagFields;
1313
import edu.wpi.first.math.Matrix;
1414
import edu.wpi.first.math.VecBuilder;
15+
import edu.wpi.first.math.controller.PIDController;
1516
import edu.wpi.first.math.geometry.Pose2d;
1617
import edu.wpi.first.math.geometry.Rotation2d;
1718
import edu.wpi.first.math.geometry.Rotation3d;
@@ -27,7 +28,7 @@
2728
import edu.wpi.first.math.numbers.N3;
2829

2930
public final class Constants {
30-
31+
3132
public static final double stickDeadband = 0.1;
3233

3334
public static final class IntakeArm{ //TODO: This must be tuned to specific robot
@@ -57,7 +58,8 @@ public static final class IntakeArm{ //TODO: This must be tuned to specific robo
5758

5859
}
5960
public static final class Swerve {
60-
public static final double minimumErrorTurn = 0; // TODO: This must be tuned to specific robot
61+
public static final double minimumErrorAligning = 0; // TODO: This must be tuned to specific robot
62+
public static final PIDController swervePID = new PIDController(0, 0, 0);
6163

6264
public static final int pigeonID = 10;
6365
public static final boolean invertGyro = false; // Always ensure Gyro is CCW+ CW-

src/main/java/frc/robot/commands/SwerveCommands/AlignToSpeaker.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
package frc.robot.commands.SwerveCommands;
66

77
import static frc.robot.Constants.IntakeArm.minimumError;
8-
import static frc.robot.Constants.Swerve.minimumErrorTurn;
8+
import static frc.robot.Constants.Swerve.*;
99

1010
import edu.wpi.first.math.controller.PIDController;
1111
import edu.wpi.first.math.geometry.Rotation2d;
@@ -19,7 +19,7 @@
1919
public class AlignToSpeaker extends Command {
2020
/** Creates a new TurnToDegree. */
2121
SwerveSubsystem swerve = SwerveSubsystem.getInstance();
22-
private PIDController pid = new PIDController(0, 0, 0);
22+
private PIDController pid = swervePID;
2323
private Vision vision = Vision.getInstance();
2424
double angleFromTarget = vision.GetAngleFromTarget().getDegrees();
2525

@@ -47,7 +47,7 @@ public void end(boolean interrupted) {}
4747
// Returns true when the command should end.
4848
@Override
4949
public boolean isFinished() {
50-
return Math.abs(vision.GetAngleFromTarget().getDegrees() - 180) < minimumErrorTurn ;
50+
return Math.abs(vision.GetAngleFromTarget().getDegrees() - 180) < minimumErrorAligning ;
5151
}
5252

5353
public void optimize() {

0 commit comments

Comments
 (0)