import edu.wpi.first.math.geometry.Pose3d;
import edu.wpi.first.wpilibj.DriverStation;
+import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.PS5Controller;
import edu.wpi.first.wpilibj.RobotController;
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
// Auto Command selection
private final SendableChooser<Command> autoChooser = new SendableChooser<>();
+ // custom match timer
+ private final Timer matchTimer = new Timer();
+ private boolean hasBeenEnabled = false;
+
/**
* The container for the robot. Contains subsystems, OI devices, and commands.
* <p>
/** Updates SmartDashboard values that need to be refreshed every loop */
public void periodic() {
+ // update custom timer (counts before phase change)
+ if (!hasBeenEnabled) {
+ if (DriverStation.isAutonomousEnabled() || DriverStation.isTeleopEnabled()) {
+ matchTimer.reset();
+ matchTimer.start();
+ hasBeenEnabled = true;
+ }
+ }
+
// update match timer
double matchTime = DriverStation.getMatchTime();
if (matchTime > 0) {
SmartDashboard.putNumber("Match Time", matchTime);
}
+ SmartDashboard.putNumber("Phase Change Time", matchTimer.get());
SmartDashboard.putString("Alliance", DriverStation.getAlliance().toString());
}
}