From 07f59a4385099a4169cfb1a97bafc30956f5d234 Mon Sep 17 00:00:00 2001 From: Dave Oleksy Date: Thu, 2 Jul 2026 14:27:47 -0500 Subject: [PATCH 1/3] Update to REVLib 2027.0.0.-alpha-4 --- pyproject.toml | 13 +++++++--- semiwrap/A301.yml | 52 +++++++++++++++++++++++++++++++-------- semiwrap/Signal.yml | 4 +++ tests/test_cana301.py | 4 +-- tests/test_cansparkmax.py | 2 +- 5 files changed, 58 insertions(+), 17 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 80f59f7..e76eec1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ packages = ["rev"] artifact_id = "REVLib-cpp" group_id = "com.revrobotics.frc" repo_url = "https://maven.revrobotics.com" -version = "2027.0.0-alpha-3" +version = "2027.0.0-alpha-4" staticlibs = ["REVLib"] extract_to = "lib" @@ -52,7 +52,7 @@ extract_to = "lib" artifact_id = "REVLib-driver" group_id = "com.revrobotics.frc" repo_url = "https://maven.revrobotics.com" -version = "2027.0.0-alpha-3" +version = "2027.0.0-alpha-4" staticlibs = [ "REVLibDriver"] extract_to = "lib" @@ -60,7 +60,7 @@ extract_to = "lib" artifact_id = "RevLibBackendDriver" group_id = "com.revrobotics.frc" repo_url = "https://maven.revrobotics.com" -version = "2027.0.0-alpha-3" +version = "2027.0.0-alpha-4" staticlibs = [ "BackendDriver", ] @@ -71,7 +71,7 @@ use_headers = false artifact_id = "RevLibWpiBackendDriver" group_id = "com.revrobotics.frc" repo_url = "https://maven.revrobotics.com" -version = "2027.0.0-alpha-3" +version = "2027.0.0-alpha-4" staticlibs = [ "REVLibWpi", ] @@ -92,6 +92,11 @@ use_headers = false [tool.semiwrap] update_init = ["rev"] scan_headers_ignore = [ + #first + "first/CANA301Driver.h", + "first/CANA301Frames.h", + "first/SimA301.h", + # rev "rev/CANCommonParameters.h", "rev/CANDetachedEncoderDriver.h", diff --git a/semiwrap/A301.yml b/semiwrap/A301.yml index e4315fb..8b9b15c 100644 --- a/semiwrap/A301.yml +++ b/semiwrap/A301.yml @@ -3,14 +3,14 @@ extra_includes_first: classes: first::a301::A301: + enums: + GearboxRPM: methods: - GetFirmwareVersion: - overloads: - "": - bool&: - GetFirmwareString: + A301: GetBusId: GetDeviceId: + GetFirmwareVersion: + GetFirmwareString: HasActiveFault: HasStickyFault: HasActiveWarning: @@ -21,14 +21,23 @@ classes: GetStickyWarnings: GetBusVoltage: GetAppliedOutput: + GetMotorCurrent: GetMotorTemperature: + GetGearboxRPM: GetRelativeEncoderPosition: GetEncoderVelocity: GetAbsoluteEncoderPosition: + SetRelativeEncoderPosition: + SetAbsoluteEncoderPosition: ClearFaults: SetVelocity: - SetPosition: + SetRelativePosition: + SetRelativePositionWithSpeed: SetAbsolutePosition: + SetAbsolutePositionWithSpeed: + EnableAbsolutePositionContinuousInput: + DisableAbsolutePositionContinuousInput: + IsAbsolutePositionContinuousInputEnabled: SetCurrent: SetThrottle: GetThrottle: @@ -36,19 +45,40 @@ classes: SetInverted: GetInverted: Disable: - A301: - GetMotorCurrent: - SetRelativeEncoderPosition: + FaultsPeriodMs: + GetFaultsPeriodMs: + WarningsPeriodMs: + GetWarningsPeriodMs: + BusVoltagePeriodMs: + GetBusVoltagePeriodMs: + AppliedOutputPeriodMs: + GetAppliedOutputPeriodMs: + MotorCurrentPeriodMs: + GetMotorCurrentPeriodMs: + MotorTemperaturePeriodMs: + GetMotorTemperaturePeriodMs: + RelativeEncoderPositionPeriodMs: + GetRelativeEncoderPositionPeriodMs: + EncoderVelocityPeriodMs: + GetEncoderVelocityPeriodMs: + AbsoluteEncoderPositionPeriodMs: + GetAbsoluteEncoderPositionPeriodMs: + first::a301::A301::FirmwareVersion: + attributes: + major: + minor: + patch: + prerelease: first::a301::A301::Faults: attributes: other: - motorType: sensor: can: temperature: gateDriver: escEeprom: firmware: + motorStartup: rawBits: methods: Faults: @@ -57,6 +87,8 @@ classes: uint16_t: first::a301::A301::Warnings: attributes: + overvoltage: + motorLoopSpeed: brownout: overcurrent: escEeprom: diff --git a/semiwrap/Signal.yml b/semiwrap/Signal.yml index e2045b0..1231475 100644 --- a/semiwrap/Signal.yml +++ b/semiwrap/Signal.yml @@ -143,3 +143,7 @@ templates: qualname: rev::util::Signal params: - first::a301::A301::Warnings + Signal_A301GearboxRPM: + qualname: rev::util::Signal + params: + - first::a301::A301::GearboxRPM \ No newline at end of file diff --git a/tests/test_cana301.py b/tests/test_cana301.py index 667c69d..180379a 100644 --- a/tests/test_cana301.py +++ b/tests/test_cana301.py @@ -6,6 +6,6 @@ def test_set_velocity(): a301.setVelocity(12.34) -def test_set_position(): +def test_set_relative_position(): a301 = rev.A301(0, 0) - a301.setPosition(12.34) + a301.setRelativePositionWithSpeed(12.34, 350.0) diff --git a/tests/test_cansparkmax.py b/tests/test_cansparkmax.py index a3ec897..f6a81c6 100644 --- a/tests/test_cansparkmax.py +++ b/tests/test_cansparkmax.py @@ -53,4 +53,4 @@ def test_pid_set(): pid = sm.getClosedLoopController() # pid.setOutputRange(-1, 1) # pid.setP(0.005) - pid.setReference(5, rev.SparkBase.ControlType.kPosition) + pid.setSetpoint(5, rev.SparkBase.ControlType.kPosition) From 84ac64f44cc31e489ae79403f53985110b56ece8 Mon Sep 17 00:00:00 2001 From: Dave Oleksy Date: Mon, 6 Jul 2026 15:34:30 -0500 Subject: [PATCH 2/3] Fix limit switch examples --- examples/limit-switch/robot.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/examples/limit-switch/robot.py b/examples/limit-switch/robot.py index fe5a024..6a44918 100644 --- a/examples/limit-switch/robot.py +++ b/examples/limit-switch/robot.py @@ -35,10 +35,12 @@ def __init__(self): self.limitConfig = rev.SparkMaxConfig() self.limitConfig.limitSwitch.forwardLimitSwitchType( rev.LimitSwitchConfig.Type.kNormallyClosed - ).forwardLimitSwitchEnabled(False).reverseLimitSwitchType( + ).forwardLimitSwitchTriggerBehavior( + rev.LimitSwitchConfig.Behavior.kStopMovingMotor + ).reverseLimitSwitchType( rev.LimitSwitchConfig.Type.kNormallyClosed - ).reverseLimitSwitchEnabled( - False + ).reverseLimitSwitchTriggerBehavior( + rev.LimitSwitchConfig.Behavior.kStopMovingMotor ) self.motor.configure( self.limitConfig, @@ -47,10 +49,10 @@ def __init__(self): ) self.prevForwardLimitEnabled = ( - self.motor.configAccessor.limitSwitch.getForwardLimitSwitchEnabled() + self.motor.configAccessor.limitSwitch.getForwardLimitSwitchTriggerBehavior() != 0 ) self.prevReverseLimitEnabled = ( - self.motor.configAccessor.limitSwitch.getReverseLimitSwitchEnabled() + self.motor.configAccessor.limitSwitch.getReverseLimitSwitchTriggerBehavior() != 0 ) wpilib.SmartDashboard.putBoolean( @@ -71,8 +73,8 @@ def teleopPeriodic(self): self.prevForwardLimitEnabled = wpilib.SmartDashboard.getBoolean( "Forward Limit Enabled", False ) - self.limitConfig.limitSwitch.forwardLimitSwitchEnabled( - self.prevForwardLimitEnabled + self.limitConfig.limitSwitch.forwardLimitSwitchTriggerBehavior( + rev.LimitSwitchConfig.Behavior.kStopMovingMotor if self.prevForwardLimitEnabled else rev.LimitSwitchConfig.Behavior.kKeepMovingMotor ) self.motor.configure( self.limitConfig, @@ -85,8 +87,8 @@ def teleopPeriodic(self): self.prevReverseLimitEnabled = wpilib.SmartDashboard.getBoolean( "Reverse Limit Enabled", False ) - self.limitConfig.limitSwitch.reverseLimitSwitchEnabled( - self.prevReverseLimitEnabled + self.limitConfig.limitSwitch.reverseLimitSwitchTriggerBehavior( + rev.LimitSwitchConfig.Behavior.kStopMovingMotor if self.prevReverseLimitEnabled else rev.LimitSwitchConfig.Behavior.kKeepMovingMotor ) self.motor.configure( self.limitConfig, From e84928cfc9321e5c7d4842e609b4b575945d01a0 Mon Sep 17 00:00:00 2001 From: Dave Oleksy Date: Mon, 6 Jul 2026 15:37:30 -0500 Subject: [PATCH 3/3] Fix black formatting --- examples/limit-switch/robot.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/limit-switch/robot.py b/examples/limit-switch/robot.py index 6a44918..f0cd63c 100644 --- a/examples/limit-switch/robot.py +++ b/examples/limit-switch/robot.py @@ -49,10 +49,12 @@ def __init__(self): ) self.prevForwardLimitEnabled = ( - self.motor.configAccessor.limitSwitch.getForwardLimitSwitchTriggerBehavior() != 0 + self.motor.configAccessor.limitSwitch.getForwardLimitSwitchTriggerBehavior() + != 0 ) self.prevReverseLimitEnabled = ( - self.motor.configAccessor.limitSwitch.getReverseLimitSwitchTriggerBehavior() != 0 + self.motor.configAccessor.limitSwitch.getReverseLimitSwitchTriggerBehavior() + != 0 ) wpilib.SmartDashboard.putBoolean( @@ -74,7 +76,9 @@ def teleopPeriodic(self): "Forward Limit Enabled", False ) self.limitConfig.limitSwitch.forwardLimitSwitchTriggerBehavior( - rev.LimitSwitchConfig.Behavior.kStopMovingMotor if self.prevForwardLimitEnabled else rev.LimitSwitchConfig.Behavior.kKeepMovingMotor + rev.LimitSwitchConfig.Behavior.kStopMovingMotor + if self.prevForwardLimitEnabled + else rev.LimitSwitchConfig.Behavior.kKeepMovingMotor ) self.motor.configure( self.limitConfig, @@ -88,7 +92,9 @@ def teleopPeriodic(self): "Reverse Limit Enabled", False ) self.limitConfig.limitSwitch.reverseLimitSwitchTriggerBehavior( - rev.LimitSwitchConfig.Behavior.kStopMovingMotor if self.prevReverseLimitEnabled else rev.LimitSwitchConfig.Behavior.kKeepMovingMotor + rev.LimitSwitchConfig.Behavior.kStopMovingMotor + if self.prevReverseLimitEnabled + else rev.LimitSwitchConfig.Behavior.kKeepMovingMotor ) self.motor.configure( self.limitConfig,