File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 12
12
import edu .wpi .first .apriltag .AprilTagFields ;
13
13
import edu .wpi .first .math .Matrix ;
14
14
import edu .wpi .first .math .VecBuilder ;
15
+ import edu .wpi .first .math .controller .PIDController ;
15
16
import edu .wpi .first .math .geometry .Pose2d ;
16
17
import edu .wpi .first .math .geometry .Rotation2d ;
17
18
import edu .wpi .first .math .geometry .Rotation3d ;
27
28
import edu .wpi .first .math .numbers .N3 ;
28
29
29
30
public final class Constants {
30
-
31
+
31
32
public static final double stickDeadband = 0.1 ;
32
33
33
34
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
57
58
58
59
}
59
60
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 );
61
63
62
64
public static final int pigeonID = 10 ;
63
65
public static final boolean invertGyro = false ; // Always ensure Gyro is CCW+ CW-
Original file line number Diff line number Diff line change 5
5
package frc .robot .commands .SwerveCommands ;
6
6
7
7
import static frc .robot .Constants .IntakeArm .minimumError ;
8
- import static frc .robot .Constants .Swerve .minimumErrorTurn ;
8
+ import static frc .robot .Constants .Swerve .* ;
9
9
10
10
import edu .wpi .first .math .controller .PIDController ;
11
11
import edu .wpi .first .math .geometry .Rotation2d ;
19
19
public class AlignToSpeaker extends Command {
20
20
/** Creates a new TurnToDegree. */
21
21
SwerveSubsystem swerve = SwerveSubsystem .getInstance ();
22
- private PIDController pid = new PIDController ( 0 , 0 , 0 ) ;
22
+ private PIDController pid = swervePID ;
23
23
private Vision vision = Vision .getInstance ();
24
24
double angleFromTarget = vision .GetAngleFromTarget ().getDegrees ();
25
25
@@ -47,7 +47,7 @@ public void end(boolean interrupted) {}
47
47
// Returns true when the command should end.
48
48
@ Override
49
49
public boolean isFinished () {
50
- return Math .abs (vision .GetAngleFromTarget ().getDegrees () - 180 ) < minimumErrorTurn ;
50
+ return Math .abs (vision .GetAngleFromTarget ().getDegrees () - 180 ) < minimumErrorAligning ;
51
51
}
52
52
53
53
public void optimize () {
You can’t perform that action at this time.
0 commit comments