diff --git a/hal/src/main/python/pyproject.toml b/hal/src/main/python/pyproject.toml index f1df6f18b6..2c14ae0a58 100644 --- a/hal/src/main/python/pyproject.toml +++ b/hal/src/main/python/pyproject.toml @@ -41,8 +41,6 @@ packages = ["hal"] [tool.semiwrap] update_init = [] scan_headers_ignore = [ - "hal/ChipObject.h", - "hal/DMA.h", "wpi/hal/Errors.h", "wpi/hal/HAL.h", "wpi/hal/IMU.h", @@ -51,8 +49,6 @@ scan_headers_ignore = [ "wpi/hal/Types.h", "wpi/hal/Value.h", - "hal/cpp/SerialHelper.h", - "hal/cpp/UnsafeDIO.h", "wpi/hal/cpp/fpga_clock.h", "wpi/hal/handles/DigitalHandleResource.h", @@ -62,15 +58,11 @@ scan_headers_ignore = [ "wpi/hal/handles/LimitedHandleResource.h", "wpi/hal/handles/UnlimitedHandleResource.h", - "hal/proto/*", - - "hal/roborio/HMB.h", - "hal/roborio/InterruptManager.h", + "wpi/hal/proto/*", "wpi/hal/simulation/CanData.h", "wpi/hal/simulation/I2CData.h", "wpi/hal/simulation/NotifyListener.h", - "hal/simulation/SPIData.h", "wpi/hal/simulation/SimCallbackRegistry.h", "wpi/hal/simulation/SimDataValue.h", diff --git a/hal/src/main/python/semiwrap/DriverStation.yml b/hal/src/main/python/semiwrap/DriverStation.yml index 98f3787800..7914c87b50 100644 --- a/hal/src/main/python/semiwrap/DriverStation.yml +++ b/hal/src/main/python/semiwrap/DriverStation.yml @@ -26,7 +26,6 @@ functions: WPI_FreeString(&name); return sname; } - HAL_GetJoystickAxisType: HAL_SetJoystickOutputs: HAL_GetMatchTime: HAL_GetOutputsEnabled: diff --git a/hal/src/main/python/semiwrap/DriverStationTypes.yml b/hal/src/main/python/semiwrap/DriverStationTypes.yml index 63662e6eb6..cdba6496fc 100644 --- a/hal/src/main/python/semiwrap/DriverStationTypes.yml +++ b/hal/src/main/python/semiwrap/DriverStationTypes.yml @@ -21,27 +21,24 @@ classes: fmsAttached: dsAttached: control_reserved: + watchdogEnabled: HAL_JoystickAxes: attributes: - count: axes: raw: + available: HAL_JoystickPOVs: attributes: - count: povs: + available: HAL_JoystickButtons: attributes: buttons: - count: + available: HAL_JoystickDescriptor: attributes: type: name: - axisCount: - axisTypes: - buttonCount: - povCount: isGamepad: HAL_MatchInfo: attributes: diff --git a/hal/src/main/python/semiwrap/simulation/DriverStationData.yml b/hal/src/main/python/semiwrap/simulation/DriverStationData.yml index 29b5a91acd..7be9485c45 100644 --- a/hal/src/main/python/semiwrap/simulation/DriverStationData.yml +++ b/hal/src/main/python/semiwrap/simulation/DriverStationData.yml @@ -77,10 +77,6 @@ functions: HALSIM_SetJoystickAxis: HALSIM_SetJoystickPOV: HALSIM_SetJoystickButtonsValue: - HALSIM_SetJoystickAxisCount: - HALSIM_SetJoystickPOVCount: - HALSIM_SetJoystickButtonCount: - HALSIM_GetJoystickCounts: HALSIM_SetJoystickType: HALSIM_SetJoystickName: cpp_code: | @@ -88,7 +84,6 @@ functions: auto s = wpi::make_string(sv); HALSIM_SetJoystickName(stick, &s); } - HALSIM_SetJoystickAxisType: HALSIM_SetGameSpecificMessage: cpp_code: | [](std::string_view sv) { @@ -111,3 +106,7 @@ functions: HALSIM_CancelDriverStationNewDataCallback: HALSIM_NotifyDriverStationNewData: HALSIM_SetJoystickIsGamepad: + HALSIM_SetJoystickAxesAvailable: + HALSIM_SetJoystickPOVsAvailable: + HALSIM_SetJoystickButtonsAvailable: + HALSIM_GetJoystickAvailables: diff --git a/wpilibc/src/main/python/pyproject.toml b/wpilibc/src/main/python/pyproject.toml index 252172fee4..5afae50c79 100644 --- a/wpilibc/src/main/python/pyproject.toml +++ b/wpilibc/src/main/python/pyproject.toml @@ -112,7 +112,12 @@ DutyCycle = "wpi/hardware/rotation/DutyCycle.hpp" DutyCycleEncoder = "wpi/hardware/rotation/DutyCycleEncoder.hpp" Encoder = "wpi/hardware/rotation/Encoder.hpp" Errors = "wpi/system/Errors.hpp" +ExpansionHub = "wpi/ExpansionHub.hpp" +ExpansionHubMotor = "wpi/ExpansionHubMotor.hpp" +ExpansionHubPidConstants = "wpi/ExpansionHubPidConstants.hpp" +ExpansionHubServo = "wpi/ExpansionHubServo.hpp" Filesystem = "rpy/Filesystem.h" +Gamepad = "wpi/driverstation/Gamepad.hpp" I2C = "wpi/hardware/bus/I2C.hpp" IterativeRobotBase = "wpi/opmode/IterativeRobotBase.hpp" Joystick = "wpi/driverstation/Joystick.hpp" @@ -256,6 +261,7 @@ DutyCycleSim = "wpi/simulation/DutyCycleSim.hpp" ElevatorSim = "wpi/simulation/ElevatorSim.hpp" EncoderSim = "wpi/simulation/EncoderSim.hpp" FlywheelSim = "wpi/simulation/FlywheelSim.hpp" +GamepadSim = "wpi/simulation/GamepadSim.hpp" GenericHIDSim = "wpi/simulation/GenericHIDSim.hpp" JoystickSim = "wpi/simulation/JoystickSim.hpp" LinearSystemSim = "wpi/simulation/LinearSystemSim.hpp" diff --git a/wpilibc/src/main/python/semiwrap/DriverStation.yml b/wpilibc/src/main/python/semiwrap/DriverStation.yml index 446b1b0c91..fdd5b28136 100644 --- a/wpilibc/src/main/python/semiwrap/DriverStation.yml +++ b/wpilibc/src/main/python/semiwrap/DriverStation.yml @@ -17,12 +17,8 @@ classes: GetStickAxis: GetStickPOV: GetStickButtons: - GetStickAxisCount: - GetStickPOVCount: - GetStickButtonCount: GetJoystickType: GetJoystickName: - GetJoystickAxisType: IsJoystickConnected: IsEnabled: IsDisabled: @@ -52,6 +48,14 @@ classes: StartDataLog: GetAngle: GetJoystickIsGamepad: + GetStickButtonIfAvailable: + GetStickAxisIfAvailable: + GetStickAxesMaximumIndex: + GetStickAxesAvailable: + GetStickPOVsMaximumIndex: + GetStickPOVsAvailable: + GetStickButtonsMaximumIndex: + GetStickButtonsAvailable: inline_code: | .def("getControlState", [](DriverStation *self) -> std::tuple { diff --git a/wpilibc/src/main/python/semiwrap/ExpansionHub.yml b/wpilibc/src/main/python/semiwrap/ExpansionHub.yml new file mode 100644 index 0000000000..cc95384620 --- /dev/null +++ b/wpilibc/src/main/python/semiwrap/ExpansionHub.yml @@ -0,0 +1,16 @@ +extra_includes: +- wpi/ExpansionHubMotor.hpp +- wpi/ExpansionHubServo.hpp + +classes: + frc::ExpansionHub: + attributes: + NumUsbPorts: + NumServoPorts: + NumMotorPorts: + methods: + ExpansionHub: + MakeServo: + MakeMotor: + IsHubConnected: + GetUsbId: diff --git a/wpilibc/src/main/python/semiwrap/ExpansionHubMotor.yml b/wpilibc/src/main/python/semiwrap/ExpansionHubMotor.yml new file mode 100644 index 0000000000..67a176012d --- /dev/null +++ b/wpilibc/src/main/python/semiwrap/ExpansionHubMotor.yml @@ -0,0 +1,20 @@ +classes: + frc::ExpansionHubMotor: + methods: + ExpansionHubMotor: + SetPercentagePower: + SetVoltage: + SetPositionSetpoint: + SetVelocitySetpoint: + SetEnabled: + SetFloatOn0: + GetCurrent: + SetDistancePerCount: + GetEncoderVelocity: + GetEncoderPosition: + SetReversed: + ResetEncoder: + GetVelocityPidConstants: + GetPositionPidConstants: + IsHubConnected: + Follow: diff --git a/wpilibc/src/main/python/semiwrap/ExpansionHubPidConstants.yml b/wpilibc/src/main/python/semiwrap/ExpansionHubPidConstants.yml new file mode 100644 index 0000000000..d9efd8cc6b --- /dev/null +++ b/wpilibc/src/main/python/semiwrap/ExpansionHubPidConstants.yml @@ -0,0 +1,7 @@ +classes: + frc::ExpansionHubPidConstants: + methods: + SetPID: + SetFF: + EnableContinousInput: + DisableContinousInput: diff --git a/wpilibc/src/main/python/semiwrap/ExpansionHubServo.yml b/wpilibc/src/main/python/semiwrap/ExpansionHubServo.yml new file mode 100644 index 0000000000..1764536f9e --- /dev/null +++ b/wpilibc/src/main/python/semiwrap/ExpansionHubServo.yml @@ -0,0 +1,14 @@ +classes: + frc::ExpansionHubServo: + methods: + ExpansionHubServo: + Set: + SetAngle: + SetPulseWidth: + SetEnabled: + SetFramePeriod: + IsHubConnected: + SetAngleRange: + SetPWMRange: + SetReversed: + SetContinousRotationMode: diff --git a/wpilibc/src/main/python/semiwrap/Gamepad.yml b/wpilibc/src/main/python/semiwrap/Gamepad.yml new file mode 100644 index 0000000000..7ef9a80133 --- /dev/null +++ b/wpilibc/src/main/python/semiwrap/Gamepad.yml @@ -0,0 +1,161 @@ +classes: + frc::Gamepad: + ignored_bases: + - wpi::SendableHelper + methods: + Gamepad: + GetLeftX: + GetLeftY: + GetRightX: + GetRightY: + GetLeftTriggerAxis: + LeftTrigger: + overloads: + double, EventLoop* [const]: + EventLoop* [const]: + GetRightTriggerAxis: + RightTrigger: + overloads: + double, EventLoop* [const]: + EventLoop* [const]: + GetSouthFaceButton: + GetSouthFaceButtonPressed: + GetSouthFaceButtonReleased: + SouthFace: + GetEastFaceButton: + GetEastFaceButtonPressed: + GetEastFaceButtonReleased: + EastFace: + GetWestFaceButton: + GetWestFaceButtonPressed: + GetWestFaceButtonReleased: + WestFace: + GetNorthFaceButton: + GetNorthFaceButtonPressed: + GetNorthFaceButtonReleased: + NorthFace: + GetBackButton: + GetBackButtonPressed: + GetBackButtonReleased: + Back: + GetGuideButton: + GetGuideButtonPressed: + GetGuideButtonReleased: + Guide: + GetStartButton: + GetStartButtonPressed: + GetStartButtonReleased: + Start: + GetLeftStickButton: + GetLeftStickButtonPressed: + GetLeftStickButtonReleased: + LeftStick: + GetRightStickButton: + GetRightStickButtonPressed: + GetRightStickButtonReleased: + RightStick: + GetLeftShoulderButton: + GetLeftShoulderButtonPressed: + GetLeftShoulderButtonReleased: + LeftShoulder: + GetRightShoulderButton: + GetRightShoulderButtonPressed: + GetRightShoulderButtonReleased: + RightShoulder: + GetDpadUpButton: + GetDpadUpButtonPressed: + GetDpadUpButtonReleased: + DpadUp: + GetDpadDownButton: + GetDpadDownButtonPressed: + GetDpadDownButtonReleased: + DpadDown: + GetDpadLeftButton: + GetDpadLeftButtonPressed: + GetDpadLeftButtonReleased: + DpadLeft: + GetDpadRightButton: + GetDpadRightButtonPressed: + GetDpadRightButtonReleased: + DpadRight: + GetMisc1Button: + GetMisc1ButtonPressed: + GetMisc1ButtonReleased: + Misc1: + GetRightPaddle1Button: + GetRightPaddle1ButtonPressed: + GetRightPaddle1ButtonReleased: + RightPaddle1: + GetLeftPaddle1Button: + GetLeftPaddle1ButtonPressed: + GetLeftPaddle1ButtonReleased: + LeftPaddle1: + GetRightPaddle2Button: + GetRightPaddle2ButtonPressed: + GetRightPaddle2ButtonReleased: + RightPaddle2: + GetLeftPaddle2Button: + GetLeftPaddle2ButtonPressed: + GetLeftPaddle2ButtonReleased: + LeftPaddle2: + GetTouchpadButton: + GetTouchpadButtonPressed: + GetTouchpadButtonReleased: + Touchpad: + GetMisc2Button: + GetMisc2ButtonPressed: + GetMisc2ButtonReleased: + Misc2: + GetMisc3Button: + GetMisc3ButtonPressed: + GetMisc3ButtonReleased: + Misc3: + GetMisc4Button: + GetMisc4ButtonPressed: + GetMisc4ButtonReleased: + Misc4: + GetMisc5Button: + GetMisc5ButtonPressed: + GetMisc5ButtonReleased: + Misc5: + GetMisc6Button: + GetMisc6ButtonPressed: + GetMisc6ButtonReleased: + Misc6: + InitSendable: + frc::Gamepad::Button: + attributes: + kSouthFace: + kEastFace: + kWestFace: + kNorthFace: + kBack: + kGuide: + kStart: + kLeftStick: + kRightStick: + kLeftShoulder: + kRightShoulder: + kDpadUp: + kDpadDown: + kDpadLeft: + kDpadRight: + kMisc1: + kRightPaddle1: + kLeftPaddle1: + kRightPaddle2: + kLeftPaddle2: + kTouchpad: + kMisc2: + kMisc3: + kMisc4: + kMisc5: + kMisc6: + frc::Gamepad::Axis: + attributes: + kLeftX: + kLeftY: + kRightX: + kRightY: + kLeftTrigger: + kRightTrigger: diff --git a/wpilibc/src/main/python/semiwrap/GenericHID.yml b/wpilibc/src/main/python/semiwrap/GenericHID.yml index 04ea37fd39..4d26c4967c 100644 --- a/wpilibc/src/main/python/semiwrap/GenericHID.yml +++ b/wpilibc/src/main/python/semiwrap/GenericHID.yml @@ -33,17 +33,19 @@ classes: POVCenter: AxisLessThan: AxisGreaterThan: - GetAxisCount: - GetPOVCount: - GetButtonCount: IsConnected: GetType: GetName: - GetAxisType: GetPort: SetOutput: SetOutputs: SetRumble: + GetAxesMaximumIndex: + GetAxesAvailable: + GetPOVsMaximumIndex: + GetPOVsAvailable: + GetButtonsMaximumIndex: + GetButtonsAvailable: inline_code: | cls_GenericHID diff --git a/wpilibc/src/main/python/semiwrap/TimedRobot.yml b/wpilibc/src/main/python/semiwrap/TimedRobot.yml index c787bb715b..bbbd87e2a5 100644 --- a/wpilibc/src/main/python/semiwrap/TimedRobot.yml +++ b/wpilibc/src/main/python/semiwrap/TimedRobot.yml @@ -12,6 +12,5 @@ classes: default: 0_s TimedRobot: overloads: - double: - ignore: true units::second_t: + units::hertz_t: diff --git a/wpilibc/src/main/python/semiwrap/simulation/DriverStationSim.yml b/wpilibc/src/main/python/semiwrap/simulation/DriverStationSim.yml index c58c6663b0..b04367a661 100644 --- a/wpilibc/src/main/python/semiwrap/simulation/DriverStationSim.yml +++ b/wpilibc/src/main/python/semiwrap/simulation/DriverStationSim.yml @@ -35,13 +35,8 @@ classes: SetJoystickButton: SetJoystickAxis: SetJoystickPOV: - SetJoystickButtons: - SetJoystickAxisCount: - SetJoystickPOVCount: - SetJoystickButtonCount: SetJoystickType: SetJoystickName: - SetJoystickAxisType: SetGameSpecificMessage: SetEventName: SetMatchType: @@ -49,3 +44,9 @@ classes: SetReplayNumber: ResetData: SetJoystickIsGamepad: + SetJoystickAxesMaximumIndex: + SetJoystickAxesAvailable: + SetJoystickPOVsMaximumIndex: + SetJoystickPOVsAvailable: + SetJoystickButtonsMaximumIndex: + SetJoystickButtonsAvailable: diff --git a/wpilibc/src/main/python/semiwrap/simulation/GamepadSim.yml b/wpilibc/src/main/python/semiwrap/simulation/GamepadSim.yml new file mode 100644 index 0000000000..4ce6851641 --- /dev/null +++ b/wpilibc/src/main/python/semiwrap/simulation/GamepadSim.yml @@ -0,0 +1,43 @@ +extra_includes: +- wpi/driverstation/Gamepad.hpp + +classes: + frc::sim::GamepadSim: + force_no_trampoline: true + methods: + GamepadSim: + overloads: + const Gamepad&: + int: + SetLeftX: + SetLeftY: + SetRightX: + SetRightY: + SetLeftTriggerAxis: + SetRightTriggerAxis: + SetSouthFaceButton: + SetEastFaceButton: + SetWestFaceButton: + SetNorthFaceButton: + SetBackButton: + SetGuideButton: + SetStartButton: + SetLeftStickButton: + SetRightStickButton: + SetLeftShoulderButton: + SetRightShoulderButton: + SetDpadUpButton: + SetDpadDownButton: + SetDpadLeftButton: + SetDpadRightButton: + SetMisc1Button: + SetRightPaddle1Button: + SetLeftPaddle1Button: + SetRightPaddle2Button: + SetLeftPaddle2Button: + SetTouchpadButton: + SetMisc2Button: + SetMisc3Button: + SetMisc4Button: + SetMisc5Button: + SetMisc6Button: diff --git a/wpilibc/src/main/python/semiwrap/simulation/GenericHIDSim.yml b/wpilibc/src/main/python/semiwrap/simulation/GenericHIDSim.yml index 176317c98a..41fc24e297 100644 --- a/wpilibc/src/main/python/semiwrap/simulation/GenericHIDSim.yml +++ b/wpilibc/src/main/python/semiwrap/simulation/GenericHIDSim.yml @@ -12,12 +12,14 @@ classes: overloads: int, DriverStation::POVDirection: DriverStation::POVDirection: - SetAxisCount: - SetPOVCount: - SetButtonCount: SetType: SetName: - SetAxisType: GetOutput: GetOutputs: GetRumble: + SetAxesMaximumIndex: + SetAxesAvailable: + SetPOVsMaximumIndex: + SetPOVsAvailable: + SetButtonsMaximumIndex: + SetButtonsAvailable: diff --git a/wpilibc/src/main/python/wpilib/__init__.py b/wpilibc/src/main/python/wpilib/__init__.py index a4c9ba9040..527a166a1e 100644 --- a/wpilibc/src/main/python/wpilib/__init__.py +++ b/wpilibc/src/main/python/wpilib/__init__.py @@ -27,8 +27,13 @@ from ._wpilib import ( DutyCycle, DutyCycleEncoder, Encoder, + ExpansionHub, + ExpansionHubMotor, + ExpansionHubPidConstants, + ExpansionHubServo, Field2d, FieldObject2d, + Gamepad, I2C, IterativeRobotBase, Joystick, @@ -114,8 +119,13 @@ __all__ = [ "DutyCycle", "DutyCycleEncoder", "Encoder", + "ExpansionHub", + "ExpansionHubMotor", + "ExpansionHubPidConstants", + "ExpansionHubServo", "Field2d", "FieldObject2d", + "Gamepad", "I2C", "IterativeRobotBase", "Joystick", diff --git a/wpilibc/src/main/python/wpilib/simulation/__init__.py b/wpilibc/src/main/python/wpilib/simulation/__init__.py index 3e3260b404..041923862f 100644 --- a/wpilibc/src/main/python/wpilib/simulation/__init__.py +++ b/wpilibc/src/main/python/wpilib/simulation/__init__.py @@ -23,6 +23,7 @@ from ._simulation import ( ElevatorSim, EncoderSim, FlywheelSim, + GamepadSim, GenericHIDSim, JoystickSim, LinearSystemSim_1_1_1, @@ -77,6 +78,7 @@ __all__ = [ "ElevatorSim", "EncoderSim", "FlywheelSim", + "GamepadSim", "GenericHIDSim", "JoystickSim", "LinearSystemSim_1_1_1", diff --git a/wpimath/src/main/python/pyproject.toml b/wpimath/src/main/python/pyproject.toml index a12fd5dfd6..1b2de2631f 100644 --- a/wpimath/src/main/python/pyproject.toml +++ b/wpimath/src/main/python/pyproject.toml @@ -81,11 +81,11 @@ scan_headers_ignore = [ "wpi/math/system/NumericalIntegration.hpp", "wpi/math/system/NumericalJacobian.hpp", - "frc/proto/*", - "frc/*/proto/*", + "wpi/math/proto/*", + "wpi/math/*/proto/*", - "frc/struct/*", - "frc/*/struct/*", + "wpi/math/struct/*", + "wpi/math/*/struct/*", "[eE]igen/*", @@ -96,7 +96,7 @@ scan_headers_ignore = [ "sleipnir/*", "type_casters/*", "unsupported/*", - "units/*", + "wpi/units/*", "wpimath/protobuf/*", "wpi/math/util/MathShared.hpp", diff --git a/wpimath/src/main/python/semiwrap/controls/DCMotor.yml b/wpimath/src/main/python/semiwrap/controls/DCMotor.yml index ee62a40d11..68c659a083 100644 --- a/wpimath/src/main/python/semiwrap/controls/DCMotor.yml +++ b/wpimath/src/main/python/semiwrap/controls/DCMotor.yml @@ -41,6 +41,9 @@ classes: KrakenX60: KrakenX60FOC: NeoVortex: + KrakenX44: + KrakenX44FOC: + Minion: inline_code: | SetupWPyStruct(cls_DCMotor); diff --git a/wpimath/src/test/python/cpp/semiwrap/module.yml b/wpimath/src/test/python/cpp/semiwrap/module.yml index bcec6a22f6..e06366e061 100644 --- a/wpimath/src/test/python/cpp/semiwrap/module.yml +++ b/wpimath/src/test/python/cpp/semiwrap/module.yml @@ -1,4 +1,3 @@ - classes: SomeClass: attributes: