[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

@@ -105,8 +105,15 @@ MecanumDrive = "wpi/drive/MecanumDrive.hpp"
RobotDriveBase = "wpi/drive/RobotDriveBase.hpp"
# wpi/driverstation
DriverStationBackend = "wpi/driverstation/internal/DriverStationBackend.hpp"
Alliance = "wpi/driverstation/Alliance.hpp"
Alert = "wpi/driverstation/Alert.hpp"
DriverStation = "wpi/driverstation/DriverStation.hpp"
MatchState = "wpi/driverstation/MatchState.hpp"
MatchType = "wpi/driverstation/MatchType.hpp"
POVDirection = "wpi/driverstation/POVDirection.hpp"
RobotState = "wpi/driverstation/RobotState.hpp"
TouchpadFinger = "wpi/driverstation/TouchpadFinger.hpp"
Gamepad = "wpi/driverstation/Gamepad.hpp"
GenericHID = "wpi/driverstation/GenericHID.hpp"
Joystick = "wpi/driverstation/Joystick.hpp"

View File

@@ -0,0 +1,2 @@
enums:
Alliance:

View File

@@ -1,82 +1,12 @@
extra_includes:
- wpi/datalog/DataLog.hpp
- wpi/util/Color.hpp
classes:
wpi::DriverStation:
attributes:
JOYSTICK_PORTS:
enums:
Alliance:
MatchType:
POVDirection:
methods:
GetStickButton:
GetStickButtonPressed:
GetStickButtonReleased:
GetStickAxis:
GetStickPOV:
GetStickButtons:
GetJoystickGamepadType:
GetJoystickSupportedOutputs:
GetJoystickName:
IsJoystickConnected:
IsEnabled:
IsDisabled:
IsEStopped:
IsAutonomous:
IsAutonomousEnabled:
IsTeleop:
IsTeleopEnabled:
IsTest:
IsTestEnabled:
IsDSAttached:
IsFMSAttached:
GetGameData:
GetEventName:
GetMatchType:
GetMatchNumber:
GetReplayNumber:
GetAlliance:
GetLocation:
GetMatchTime:
GetBatteryVoltage:
RefreshData:
ProvideRefreshedDataEventHandle:
RemoveRefreshedDataEventHandle:
SilenceJoystickConnectionWarning:
IsJoystickConnectionWarningSilenced:
StartDataLog:
GetAngle:
GetJoystickIsGamepad:
GetStickButtonIfAvailable:
GetStickAxisIfAvailable:
GetStickAxesMaximumIndex:
GetStickAxesAvailable:
GetStickPOVsMaximumIndex:
GetStickPOVsAvailable:
GetStickButtonsMaximumIndex:
GetStickButtonsAvailable:
GetRobotMode:
AddOpMode:
overloads:
RobotMode, std::string_view, std::string_view, std::string_view:
RobotMode, std::string_view, std::string_view, std::string_view, const wpi::util::Color&, const wpi::util::Color&:
RemoveOpMode:
PublishOpModes:
ClearOpModes:
GetOpModeId:
GetOpMode:
IsOpMode:
overloads:
int64_t:
std::string_view:
GetControlWord:
GetStickTouchpadFinger:
GetStickTouchpadFingerAvailable:
ObserveUserProgramStarting:
wpi::DriverStation::TouchpadFinger:
attributes:
down:
x:
y:
wpi::log::DataLog&:
wpi::log::DataLog&, bool:

View File

@@ -0,0 +1,72 @@
extra_includes:
- wpi/datalog/DataLog.hpp
- wpi/util/Color.hpp
classes:
wpi::internal::DriverStationBackend:
attributes:
JOYSTICK_PORTS:
methods:
GetStickButton:
GetStickButtonIfAvailable:
GetStickButtonPressed:
GetStickButtonReleased:
GetStickAxis:
GetStickTouchpadFinger:
GetStickTouchpadFingerAvailable:
GetStickAxisIfAvailable:
GetStickPOV:
GetStickButtons:
GetStickAxesMaximumIndex:
GetStickAxesAvailable:
GetStickPOVsMaximumIndex:
GetStickPOVsAvailable:
GetStickButtonsMaximumIndex:
GetStickButtonsAvailable:
GetJoystickIsGamepad:
GetJoystickGamepadType:
GetJoystickSupportedOutputs:
GetJoystickName:
IsJoystickConnected:
IsEnabled:
IsDisabled:
IsEStopped:
GetRobotMode:
IsAutonomous:
IsAutonomousEnabled:
IsTeleop:
IsTeleopEnabled:
IsTest:
IsTestEnabled:
AddOpMode:
overloads:
RobotMode, std::string_view, std::string_view, std::string_view, const wpi::util::Color&, const wpi::util::Color&:
RobotMode, std::string_view, std::string_view, std::string_view:
RemoveOpMode:
PublishOpModes:
ClearOpModes:
GetOpModeId:
GetOpMode:
IsOpMode:
overloads:
int64_t:
std::string_view:
IsDSAttached:
IsFMSAttached:
GetGameData:
GetEventName:
GetMatchType:
GetMatchNumber:
GetReplayNumber:
GetAlliance:
GetLocation:
GetMatchTime:
GetBatteryVoltage:
GetControlWord:
RefreshData:
ProvideRefreshedDataEventHandle:
RemoveRefreshedDataEventHandle:
SilenceJoystickConnectionWarning:
IsJoystickConnectionWarningSilenced:
StartDataLog:
ObserveUserProgramStarting:

View File

@@ -1,5 +1,5 @@
extra_includes:
- wpi/driverstation/DriverStation.hpp
- wpi/driverstation/internal/DriverStationBackend.hpp
- wpi/event/BooleanEvent.hpp
classes:
@@ -19,8 +19,8 @@ classes:
GetPOV:
POV:
overloads:
DriverStation::POVDirection, EventLoop* [const]:
int, DriverStation::POVDirection, EventLoop* [const]:
POVDirection, EventLoop* [const]:
int, POVDirection, EventLoop* [const]:
POVUp:
POVUpRight:
POVRight:

View File

@@ -1,5 +1,5 @@
extra_includes:
- wpi/driverstation/DriverStation.hpp
- wpi/driverstation/internal/DriverStationBackend.hpp
classes:
wpi::Joystick:

View File

@@ -0,0 +1,11 @@
classes:
wpi::MatchState:
methods:
GetMatchTime:
GetAlliance:
GetLocation:
GetReplayNumber:
GetMatchNumber:
GetMatchType:
GetEventName:
GetGameData:

View File

@@ -0,0 +1,2 @@
enums:
MatchType:

View File

@@ -1,6 +1,6 @@
extra_includes:
- wpi/util/sendable/SendableBuilder.hpp
- wpi/driverstation/DriverStation.hpp
- wpi/driverstation/internal/DriverStationBackend.hpp
- wpi/event/BooleanEvent.hpp
classes:

View File

@@ -0,0 +1,4 @@
enums:
POVDirection:
functions:
GetPOVAngle:

View File

@@ -1,5 +1,5 @@
extra_includes:
- wpi/driverstation/DriverStation.hpp
- wpi/driverstation/internal/DriverStationBackend.hpp
functions:
# TODO

View File

@@ -0,0 +1,31 @@
extra_includes:
- wpi/util/Color.hpp
classes:
wpi::RobotState:
methods:
IsEnabled:
IsDisabled:
IsEStopped:
GetRobotMode:
IsAutonomous:
IsAutonomousEnabled:
IsTeleop:
IsTeleopEnabled:
IsTest:
IsTestEnabled:
AddOpMode:
overloads:
RobotMode, std::string_view, std::string_view, std::string_view, const wpi::util::Color&, const wpi::util::Color&:
RobotMode, std::string_view, std::string_view, std::string_view:
RemoveOpMode:
PublishOpModes:
ClearOpModes:
GetOpModeId:
GetOpMode:
IsOpMode:
overloads:
int64_t:
std::string_view:
IsDSAttached:
IsFMSAttached:

View File

@@ -0,0 +1,6 @@
classes:
wpi::TouchpadFinger:
attributes:
down:
x:
y:

View File

@@ -10,8 +10,8 @@ classes:
SetRawAxis:
SetPOV:
overloads:
int, DriverStation::POVDirection:
DriverStation::POVDirection:
int, POVDirection:
POVDirection:
SetGamepadType:
SetSupportedOutputs:
SetName:

View File

@@ -21,6 +21,7 @@ from ._wpilib import (
DigitalOutput,
DoubleSolenoid,
DriverStation,
DriverStationBackend,
DutyCycle,
DutyCycleEncoder,
EdgeConfiguration,
@@ -39,6 +40,7 @@ from ._wpilib import (
Joystick,
Koors40,
LEDPattern,
MatchState,
MecanumDrive,
Mechanism2d,
MechanismLigament2d,
@@ -72,6 +74,7 @@ from ._wpilib import (
RobotBase,
RobotController,
RobotDriveBase,
RobotState,
RuntimeType,
SendableBuilderImpl,
SendableChooser,
@@ -124,6 +127,7 @@ __all__ = [
"DigitalOutput",
"DoubleSolenoid",
"DriverStation",
"DriverStationBackend",
"DutyCycle",
"DutyCycleEncoder",
"EdgeConfiguration",
@@ -142,6 +146,7 @@ __all__ = [
"Joystick",
"Koors40",
"LEDPattern",
"MatchState",
"MecanumDrive",
"Mechanism2d",
"MechanismLigament2d",
@@ -173,6 +178,7 @@ __all__ = [
"PowerDistribution",
"Preferences",
"RobotBase",
"RobotState",
"RobotController",
"RobotDriveBase",
"RuntimeType",

View File

@@ -189,8 +189,8 @@ class RobotStarter:
wpilib.SmartDashboard.init()
# Call DriverStation.refreshData() to kick things off
wpilib.DriverStation.refreshData()
# Call DriverStationBackend.refreshData() to kick things off
wpilib.DriverStationBackend.refreshData()
try:
self.robot = robot_cls()

View File

@@ -73,7 +73,7 @@ class RobotTestingPlugin:
pauseTiming()
restartTiming()
wpilib.DriverStation.silenceJoystickConnectionWarning(True)
wpilib.DriverStationBackend.silenceJoystickConnectionWarning(True)
DriverStationSim.setRobotMode(RobotMode.AUTONOMOUS)
DriverStationSim.setEnabled(False)
DriverStationSim.notifyNewData()