Skip to content

Commit ac70bfe

Browse files
Added @SuppressWarnings("removal") annotation to Robot.java, Drive.java, PIDHeadingCorrection.java, and PIDHeadingError.java in order to suppress warnings related to some of the WPILib PIDController classes being deprecated. Need to remember to fix these in Summer 2020, so also added a "TODO" to the code to fix these later.
1 parent cd9d9aa commit ac70bfe

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

src/main/java/frc/robot/Robot.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class Robot extends TimedRobot {
3333
* for any initialization code.
3434
*/
3535
@Override
36+
@SuppressWarnings("deprecation")
3637
public void robotInit() {
3738
// Instantiate our RobotContainer. This will perform all our button bindings,
3839
// and put our

src/main/java/org/mayheminc/robot2020/subsystems/Drive.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import org.mayheminc.util.MayhemTalonSRX;
1919
import org.mayheminc.util.Utils;
2020

21+
// TODO: Address all deprecated code masked by @SuppressWarnings("removal") annotations (not just in Drive.java)
22+
@SuppressWarnings("removal")
2123
public class Drive extends SubsystemBase {
2224

2325
History headingHistory = new History();
@@ -27,7 +29,6 @@ public class Drive extends SubsystemBase {
2729
public static final boolean COAST_MODE = false;
2830

2931
// PID loop variables
30-
// TODO: Suppress 'deprecated' warnings from the compiler
3132
private PIDController m_HeadingPid;
3233
private PIDHeadingError m_HeadingError;
3334
private PIDHeadingCorrection m_HeadingCorrection;
@@ -49,8 +50,7 @@ public class Drive extends SubsystemBase {
4950
// NavX parameters
5051
private double m_desiredHeading = 0.0;
5152
private boolean m_useHeadingCorrection = true;
52-
private static final double HEADING_PID_P_FOR_HIGH_GEAR = 0.007; // was 0.030 in 2019
53-
private static final double HEADING_PID_P_FOR_LOW_GEAR = HEADING_PID_P_FOR_HIGH_GEAR;
53+
private static final double HEADING_PID_P = 0.007; // was 0.030 in 2019 for HIGH_GEAR
5454
private static final double kToleranceDegreesPIDControl = 0.2;
5555

5656
// Drive parameters
@@ -94,7 +94,7 @@ public Drive() {
9494
m_HeadingError = new PIDHeadingError();
9595
m_HeadingError.m_Error = 0.0;
9696
m_HeadingCorrection = new PIDHeadingCorrection();
97-
m_HeadingPid = new PIDController(HEADING_PID_P_FOR_HIGH_GEAR, 0.000, 0.04, m_HeadingError, m_HeadingCorrection,
97+
m_HeadingPid = new PIDController(HEADING_PID_P, 0.000, 0.04, m_HeadingError, m_HeadingCorrection,
9898
0.020 /* period in seconds */);
9999
m_HeadingPid.setInputRange(-180.0f, 180.0f);
100100
m_HeadingPid.setContinuous(true); // treats the input range as "continous" with wrap-around
@@ -263,7 +263,7 @@ public void setHeadingCorrectionMode(boolean useHeadingCorrection) {
263263

264264
private void resetAndEnableHeadingPID() {
265265
// if (Robot.shifter.getGear() == Shifter.HIGH_GEAR) {
266-
m_HeadingPid.setP(HEADING_PID_P_FOR_HIGH_GEAR);
266+
m_HeadingPid.setP(HEADING_PID_P);
267267
// } else
268268
// {
269269
// low gear

src/main/java/org/mayheminc/robot2020/subsystems/PIDHeadingCorrection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package org.mayheminc.robot2020.subsystems;
2-
32
import edu.wpi.first.wpilibj.PIDOutput;
43

54
/**
65
*
76
* @author user This class holds the correction that is calculated by the PID
87
* Controller.
98
*/
9+
@SuppressWarnings("removal")
1010
public class PIDHeadingCorrection implements PIDOutput {
1111

1212
public double HeadingCorrection = 0.0;

src/main/java/org/mayheminc/robot2020/subsystems/PIDHeadingError.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*
88
* @author user This is a class to hold the Heading error of the drive.
99
*/
10+
@SuppressWarnings("removal")
1011
public class PIDHeadingError implements PIDSource {
1112

1213
@Override

0 commit comments

Comments
 (0)