Convert RobotTime into a singleton

This commit is contained in:
Keenan D. Buckley
2020-03-28 21:42:08 -06:00
parent 850f503889
commit e373211f27
5 changed files with 43 additions and 26 deletions
+3 -1
View File
@@ -18,6 +18,8 @@ import edu.wpi.first.wpiutil.math.MathUtil;
* Gyro class that allows for interchangeable use between a pigeon and a navX
*/
public class RobotGyro extends GyroBase {
private RobotTime m_robotTime = RobotTime.getInstance();
private PigeonIMU m_pigeon;
private AHRS m_navX;
public boolean m_isGyroAPigeon; //true if pigeon, false if navX
@@ -149,7 +151,7 @@ public class RobotGyro extends GyroBase {
@Override
public double getRate() {
if (m_isGyroAPigeon) {
return m_deltaPigeonAngle / (RobotTime.m_deltaTime * 1000);
return m_deltaPigeonAngle / (m_robotTime.m_deltaTime * 1000);
} else {
return m_navX.getRate();
}