Create RobotTime

To keep track of deltas, frames, and times. Need it for completing pigeon gyro rates.
This commit is contained in:
Keenan D. Buckley
2020-03-27 12:20:22 -06:00
parent f310c8d90a
commit ecff989745
4 changed files with 92 additions and 0 deletions
+5
View File
@@ -10,6 +10,7 @@ package frc4388.robot;
import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import frc4388.utility.RobotTime;
/**
* The VM is configured to automatically run this class, and to call the
@@ -44,6 +45,7 @@ public class Robot extends TimedRobot {
*/
@Override
public void robotPeriodic() {
RobotTime.updateTimes();
// Runs the Scheduler. This is responsible for polling buttons, adding newly-scheduled
// commands, running already-scheduled commands, removing finished or interrupted commands,
// and running subsystem periodic() methods. This must be called from the robot's periodic
@@ -58,6 +60,7 @@ public class Robot extends TimedRobot {
*/
@Override
public void disabledInit() {
RobotTime.endMatchTime();
}
@Override
@@ -82,6 +85,7 @@ public class Robot extends TimedRobot {
if (m_autonomousCommand != null) {
m_autonomousCommand.schedule();
}
RobotTime.startMatchTime();
}
/**
@@ -100,6 +104,7 @@ public class Robot extends TimedRobot {
if (m_autonomousCommand != null) {
m_autonomousCommand.cancel();
}
RobotTime.startMatchTime();
}
/**