[wpilib] Split DriverStation into smaller classes (#8628)

This commit is contained in:
Thad House
2026-04-18 19:56:45 -07:00
committed by GitHub
parent 58ad633ae2
commit ab2aef2c29
108 changed files with 4406 additions and 3211 deletions

View File

@@ -6,7 +6,7 @@ package org.wpilib.command3;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.driverstation.RobotState;
/**
* Helper class for fetching information about the current opmode. This is a package-private class
@@ -52,12 +52,12 @@ abstract class OpModeFetcher {
static final class DriverStationOpModeFetcher extends OpModeFetcher {
@Override
public long getOpModeId() {
return DriverStation.getOpModeId();
return RobotState.getOpModeId();
}
@Override
public String getOpModeName() {
return DriverStation.getOpMode();
return RobotState.getOpMode();
}
}
}

View File

@@ -8,8 +8,8 @@ import java.util.HashMap;
import java.util.Map;
import org.wpilib.command3.Scheduler;
import org.wpilib.command3.Trigger;
import org.wpilib.driverstation.DriverStation.POVDirection;
import org.wpilib.driverstation.GenericHID;
import org.wpilib.driverstation.POVDirection;
import org.wpilib.event.EventLoop;
import org.wpilib.math.util.Pair;

View File

@@ -7,8 +7,8 @@ package org.wpilib.command3.button;
import static org.wpilib.util.ErrorMessages.requireNonNullParam;
import org.wpilib.command3.Trigger;
import org.wpilib.driverstation.DriverStation.POVDirection;
import org.wpilib.driverstation.GenericHID;
import org.wpilib.driverstation.POVDirection;
/** A {@link Trigger} that gets its state from a POV on a {@link GenericHID}. */
public class POVButton extends Trigger {

View File

@@ -5,7 +5,7 @@
package org.wpilib.command3.button;
import org.wpilib.command3.Trigger;
import org.wpilib.driverstation.DriverStation;
import org.wpilib.driverstation.RobotState;
/**
* A class containing static {@link Trigger} factories for running callbacks when the robot mode
@@ -21,7 +21,7 @@ public final class RobotModeTriggers {
* @return A trigger that is true when the robot is enabled in autonomous mode.
*/
public static Trigger autonomous() {
return new Trigger(DriverStation::isAutonomousEnabled);
return new Trigger(RobotState::isAutonomousEnabled);
}
/**
@@ -30,7 +30,7 @@ public final class RobotModeTriggers {
* @return A trigger that is true when the robot is enabled in teleop mode.
*/
public static Trigger teleop() {
return new Trigger(DriverStation::isTeleopEnabled);
return new Trigger(RobotState::isTeleopEnabled);
}
/**
@@ -39,7 +39,7 @@ public final class RobotModeTriggers {
* @return A trigger that is true when the robot is disabled.
*/
public static Trigger disabled() {
return new Trigger(DriverStation::isDisabled);
return new Trigger(RobotState::isDisabled);
}
/**
@@ -48,6 +48,6 @@ public final class RobotModeTriggers {
* @return A trigger that is true when the robot is enabled in test mode.
*/
public static Trigger test() {
return new Trigger(DriverStation::isTestEnabled);
return new Trigger(RobotState::isTestEnabled);
}
}