From f257bb248c62611a1b66d3477596ea8da536971b Mon Sep 17 00:00:00 2001 From: Tom Blank Date: Thu, 5 Nov 2026 08:06:41 -0800 Subject: [PATCH] Build against SeriouslyCommonLib 20261031.5 (#688): CANPort.CAN_S0 replaces CANBusId.RIO Contract2023 used CANBusId.RIO and the DeviceInfo(String,int,boolean,double) constructor, both removed in SeriouslyCommonLib #688. The simulation scaling value went with it; the CANcoders keep CAN_S0, the old default bus. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_018WRhH1b6vqCkLNMXaAbvnp --- build.gradle | 2 +- .../electrical_contract/Contract2023.java | 28 +++++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/build.gradle b/build.gradle index c33bb31..b4e65e0 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ sourceSets.main.java { // When in doubt, use the latest version from // https://dev.azure.com/Team488/Team%20488%20Builds/_artifacts/feed/XBot -def SeriouslyCommonLibVersion = '20261010.5' +def SeriouslyCommonLibVersion = '20261031.5' def ROBOT_MAIN_CLASS = "competition.Main" diff --git a/src/main/java/competition/electrical_contract/Contract2023.java b/src/main/java/competition/electrical_contract/Contract2023.java index 9743331..16b6cbe 100644 --- a/src/main/java/competition/electrical_contract/Contract2023.java +++ b/src/main/java/competition/electrical_contract/Contract2023.java @@ -8,7 +8,7 @@ import org.wpilib.units.Units; import org.wpilib.units.measure.Distance; import org.wpilib.hardware.imu.OnboardIMU.MountOrientation; -import xbot.common.injection.electrical_contract.CANBusId; +import org.wpilib.hardware.bus.CANPort; import xbot.common.injection.electrical_contract.CANMotorControllerInfo; import xbot.common.injection.electrical_contract.CameraInfo; import xbot.common.injection.electrical_contract.DeviceInfo; @@ -51,28 +51,28 @@ public CANMotorControllerInfo getDriveMotor(SwerveInstance swerveInstance) { case "FrontLeftDrive" -> new CANMotorControllerInfo( getDriveControllerName(swerveInstance), MotorControllerType.SparkMax, - CANBusId.RIO, + CANPort.CAN_S0, 31, driveMotorControllerOutputConfig ); case "FrontRightDrive" -> new CANMotorControllerInfo( getDriveControllerName(swerveInstance), MotorControllerType.SparkMax, - CANBusId.RIO, + CANPort.CAN_S0, 29, driveMotorControllerOutputConfig ); case "RearLeftDrive" -> new CANMotorControllerInfo( getDriveControllerName(swerveInstance), MotorControllerType.SparkMax, - CANBusId.RIO, + CANPort.CAN_S0, 38, driveMotorControllerOutputConfig ); case "RearRightDrive" -> new CANMotorControllerInfo( getDriveControllerName(swerveInstance), MotorControllerType.SparkMax, - CANBusId.RIO, + CANPort.CAN_S0, 21, driveMotorControllerOutputConfig ); @@ -90,7 +90,7 @@ public CANMotorControllerInfo getSteeringMotor(SwerveInstance swerveInstance) { new CANMotorControllerInfo( getDriveControllerName(swerveInstance), MotorControllerType.SparkMax, - CANBusId.RIO, + CANPort.CAN_S0, 30, steerMotorControllerOutputConfig ); @@ -98,7 +98,7 @@ public CANMotorControllerInfo getSteeringMotor(SwerveInstance swerveInstance) { new CANMotorControllerInfo( getDriveControllerName(swerveInstance), MotorControllerType.SparkMax, - CANBusId.RIO, + CANPort.CAN_S0, 28, steerMotorControllerOutputConfig ); @@ -106,7 +106,7 @@ public CANMotorControllerInfo getSteeringMotor(SwerveInstance swerveInstance) { new CANMotorControllerInfo( getDriveControllerName(swerveInstance), MotorControllerType.SparkMax, - CANBusId.RIO, + CANPort.CAN_S0, 39, steerMotorControllerOutputConfig ); @@ -114,7 +114,7 @@ public CANMotorControllerInfo getSteeringMotor(SwerveInstance swerveInstance) { new CANMotorControllerInfo( getDriveControllerName(swerveInstance), MotorControllerType.SparkMax, - CANBusId.RIO, + CANPort.CAN_S0, 20, steerMotorControllerOutputConfig ); @@ -124,17 +124,15 @@ public CANMotorControllerInfo getSteeringMotor(SwerveInstance swerveInstance) { @Override public DeviceInfo getSteeringEncoder(SwerveInstance swerveInstance) { - double simulationScalingValue = 1.0; - return switch (swerveInstance.label()) { case "FrontLeftDrive" -> - new DeviceInfo(getSteeringEncoderControllerName(swerveInstance), 51, false, simulationScalingValue); + new DeviceInfo(getSteeringEncoderControllerName(swerveInstance), CANPort.CAN_S0, 51, false); case "FrontRightDrive" -> - new DeviceInfo(getSteeringEncoderControllerName(swerveInstance), 52, false, simulationScalingValue); + new DeviceInfo(getSteeringEncoderControllerName(swerveInstance), CANPort.CAN_S0, 52, false); case "RearLeftDrive" -> - new DeviceInfo(getSteeringEncoderControllerName(swerveInstance), 53, false, simulationScalingValue); + new DeviceInfo(getSteeringEncoderControllerName(swerveInstance), CANPort.CAN_S0, 53, false); case "RearRightDrive" -> - new DeviceInfo(getSteeringEncoderControllerName(swerveInstance), 54, false, simulationScalingValue); + new DeviceInfo(getSteeringEncoderControllerName(swerveInstance), CANPort.CAN_S0, 54, false); default -> null; }; }