diff --git a/.github/workflows/build-simulation.yml b/.github/workflows/build-simulation.yml new file mode 100644 index 0000000..697337c --- /dev/null +++ b/.github/workflows/build-simulation.yml @@ -0,0 +1,22 @@ +name: Build (Simulation) + +on: + push: + +jobs: + build: + name: Build (Simulation) + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v5 + - name: Set up JDK 25 + uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 25 + cache: gradle + - name: Grant execute permission + run: chmod +x gradlew + - name: Build simulation + run: ./gradlew assemble test diff --git a/.github/workflows/build.yml b/.github/workflows/build-systemcore.yml similarity index 51% rename from .github/workflows/build.yml rename to .github/workflows/build-systemcore.yml index 0010805..28e85e9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build-systemcore.yml @@ -1,17 +1,17 @@ -name: Build +name: Build (SystemCore) on: push: jobs: build: - name: Build + name: Build (SystemCore) runs-on: ubuntu-latest - container: wpilib/roborio-cross-ubuntu:2024-22.04 + container: wpilib/systemcore-cross-ubuntu-minimal:2027-24.04 steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Grant execute permission run: chmod +x gradlew - name: Build robot code - run: ./gradlew build + run: ./gradlew assemble test diff --git a/.github/workflows/spotless.yml b/.github/workflows/spotless.yml index 3af5405..7bbfeec 100644 --- a/.github/workflows/spotless.yml +++ b/.github/workflows/spotless.yml @@ -9,13 +9,13 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 with: fetch-depth: 0 - - uses: actions/setup-java@v4 + - uses: actions/setup-java@v5 with: - distribution: 'zulu' - java-version: 17 + distribution: 'temurin' + java-version: 25 - name: Change wrapper permissions run: chmod +x ./gradlew - run: ./gradlew spotlessCheck --stacktrace diff --git a/build.gradle b/build.gradle index af62e3e..d16aa97 100644 --- a/build.gradle +++ b/build.gradle @@ -40,7 +40,7 @@ deploy { files = project.fileTree('src/main/deploy') directory = '/home/systemcore/deploy' deleteOldFiles = false // Change to true to delete files on systemcore that no - // longer exist in deploy directory of this project + // longer exist in deploy directory of this project } } } @@ -194,8 +194,7 @@ spotless { include "**/*.java" exclude "**/build/**", "**/build-*/**" } - toggleOffOn() - googleJavaFormat() + googleJavaFormat('1.35.0') removeUnusedImports() trimTrailingWhitespace() endWithNewline() diff --git a/src/main/java/frc/game/Field.java b/src/main/java/frc/game/Field.java index 08e2153..2ac3a85 100644 --- a/src/main/java/frc/game/Field.java +++ b/src/main/java/frc/game/Field.java @@ -2,13 +2,13 @@ import static org.wpilib.units.Units.*; +import java.util.List; +import org.littletonrobotics.junction.Logger; import org.wpilib.math.geometry.Pose2d; import org.wpilib.math.geometry.Rectangle2d; import org.wpilib.math.geometry.Rotation2d; import org.wpilib.math.geometry.Translation2d; import org.wpilib.units.measure.Distance; -import java.util.List; -import org.littletonrobotics.junction.Logger; public class Field { // Measured diff --git a/src/main/java/frc/game/GameState.java b/src/main/java/frc/game/GameState.java index a5256f4..59d3124 100644 --- a/src/main/java/frc/game/GameState.java +++ b/src/main/java/frc/game/GameState.java @@ -1,11 +1,12 @@ package frc.game; -import org.wpilib.wpilibj.DriverStation; -import org.wpilib.wpilibj.DriverStation.Alliance; import frc.robot.Robot; import java.util.List; import java.util.Optional; import org.littletonrobotics.junction.Logger; +import org.wpilib.driverstation.Alliance; +import org.wpilib.driverstation.MatchState; +import org.wpilib.driverstation.RobotState; public class GameState { @@ -43,10 +44,10 @@ private static int parseSeconds(String time) { private static Alliance myAlliance; public static GamePhase getCurrentPhase() { - if (!DriverStation.isDSAttached() && !DriverStation.isFMSAttached()) { + if (!RobotState.isDSAttached() && !RobotState.isFMSAttached()) { return GamePhase.None; } - if (DriverStation.isAutonomous()) { + if (RobotState.isAutonomous()) { return GamePhase.Autonomous; } // Must be in match and teleop @@ -61,29 +62,29 @@ public static GamePhase getCurrentPhase() { public static Alliance getMyAlliance() { if (myAlliance == null) { - // myAlliance = DriverStation.getAlliance().orElse(null); + // myAlliance = MatchState.getAlliance().orElse(null); myAlliance = Robot.allianceSelector.getAllianceColor(); } return myAlliance; } public static double getMatchTime() { - return DriverStation.getMatchTime(); + return MatchState.getMatchTime(); } public static Optional getAlliance() { - return DriverStation.getAlliance(); + return MatchState.getAlliance(); } public static void logValues() { getMyAlliance(); - Logger.recordOutput("GameState/IsDSAttached", DriverStation.isDSAttached()); - Logger.recordOutput("GameState/IsFMSAttached", DriverStation.isFMSAttached()); - Logger.recordOutput("GameState/MatchType", DriverStation.getMatchType()); - Logger.recordOutput("GameState/IsAutonomus", DriverStation.isAutonomous()); - Logger.recordOutput("GameState/MatchTime", DriverStation.getMatchTime()); + Logger.recordOutput("GameState/IsDSAttached", RobotState.isDSAttached()); + Logger.recordOutput("GameState/IsFMSAttached", RobotState.isFMSAttached()); + Logger.recordOutput("GameState/MatchType", MatchState.getMatchType()); + Logger.recordOutput("GameState/IsAutonomus", RobotState.isAutonomous()); + Logger.recordOutput("GameState/MatchTime", MatchState.getMatchTime()); Logger.recordOutput("GameState/Alliance", myAlliance); - Logger.recordOutput("GameState/GameData", DriverStation.getGameSpecificMessage()); + Logger.recordOutput("GameState/GameData", MatchState.getGameData().orElse("")); Logger.recordOutput("GameState/CurrentPhase", getCurrentPhase()); } } diff --git a/src/main/java/frc/lib/AllianceSelector.java b/src/main/java/frc/lib/AllianceSelector.java index 0134337..8fc68ca 100644 --- a/src/main/java/frc/lib/AllianceSelector.java +++ b/src/main/java/frc/lib/AllianceSelector.java @@ -1,10 +1,10 @@ package frc.lib; -import org.wpilib.wpilibj.DriverStation.Alliance; -import org.wpilib.wpilibj.event.BooleanEvent; -import org.wpilib.wpilibj.event.EventLoop; -import org.wpilib.commandsv2.button.Trigger; import org.littletonrobotics.junction.Logger; +import org.wpilib.command2.button.Trigger; +import org.wpilib.driverstation.Alliance; +import org.wpilib.event.BooleanEvent; +import org.wpilib.event.EventLoop; public class AllianceSelector { @@ -26,7 +26,7 @@ public AllianceSelector(int port) { * @return Whether the field is rotated from the driver's perspective */ public boolean fieldRotated() { - return inputs.allianceFromSwitch.equals(Alliance.Red); + return inputs.allianceFromSwitch.equals(Alliance.RED); } /** diff --git a/src/main/java/frc/lib/AllianceSelectorIO.java b/src/main/java/frc/lib/AllianceSelectorIO.java index 5ed08f4..8cc3976 100644 --- a/src/main/java/frc/lib/AllianceSelectorIO.java +++ b/src/main/java/frc/lib/AllianceSelectorIO.java @@ -1,10 +1,10 @@ package frc.lib; -import org.wpilib.wpilibj.DigitalInput; -import org.wpilib.wpilibj.DriverStation; -import org.wpilib.wpilibj.DriverStation.Alliance; import java.util.Optional; import org.littletonrobotics.junction.AutoLog; +import org.wpilib.driverstation.Alliance; +import org.wpilib.driverstation.MatchState; +import org.wpilib.hardware.discrete.DigitalInput; public class AllianceSelectorIO { @@ -17,13 +17,13 @@ public AllianceSelectorIO(int port) { @AutoLog public static class AllianceSelectorIOInputs { - public Alliance allianceFromSwitch = Alliance.Red; + public Alliance allianceFromSwitch = Alliance.RED; public boolean agreementInAllianceInputs = false; public boolean allianceChanged = false; } public void updateInputs(AllianceSelectorIOInputs inputs) { - inputs.allianceFromSwitch = allianceSelectionSwitch.get() ? Alliance.Red : Alliance.Blue; + inputs.allianceFromSwitch = allianceSelectionSwitch.get() ? Alliance.RED : Alliance.BLUE; inputs.agreementInAllianceInputs = agreementInAllianceInputs(inputs); inputs.allianceChanged = changedAlliance(inputs); } @@ -39,7 +39,7 @@ private boolean changedAlliance(AllianceSelectorIOInputs inputs) { } private boolean agreementInAllianceInputs(AllianceSelectorIOInputs inputs) { - Optional allianceFromFMS = DriverStation.getAlliance(); + Optional allianceFromFMS = MatchState.getAlliance(); if (allianceFromFMS.isPresent()) { return inputs.allianceFromSwitch.equals(allianceFromFMS.get()); } else return false; diff --git a/src/main/java/frc/lib/AutoOption.java b/src/main/java/frc/lib/AutoOption.java index 6739b49..8613ae5 100644 --- a/src/main/java/frc/lib/AutoOption.java +++ b/src/main/java/frc/lib/AutoOption.java @@ -1,12 +1,12 @@ package frc.lib; import choreo.trajectory.SwerveSample; -import org.wpilib.math.geometry.Pose2d; -import org.wpilib.wpilibj.DriverStation.Alliance; -import org.wpilib.wpilibj.util.Color; -import org.wpilib.commandsv2.Command; import frc.robot.auto.AutoMode; import java.util.Optional; +import org.wpilib.command2.Command; +import org.wpilib.driverstation.Alliance; +import org.wpilib.math.geometry.Pose2d; +import org.wpilib.util.Color; public class AutoOption { private final Alliance allianceColor; diff --git a/src/main/java/frc/lib/AutoSelector.java b/src/main/java/frc/lib/AutoSelector.java index 3438c96..7b39937 100644 --- a/src/main/java/frc/lib/AutoSelector.java +++ b/src/main/java/frc/lib/AutoSelector.java @@ -1,16 +1,17 @@ package frc.lib; -import org.wpilib.math.geometry.Pose2d; -import org.wpilib.wpilibj.DriverStation.Alliance; -import org.wpilib.wpilibj.event.BooleanEvent; -import org.wpilib.wpilibj.event.EventLoop; -import org.wpilib.commandsv2.Command; -import org.wpilib.commandsv2.button.Trigger; import java.util.ArrayList; import java.util.List; import java.util.Optional; import java.util.function.Supplier; import org.littletonrobotics.junction.Logger; +import org.wpilib.command2.Command; +import org.wpilib.command2.CommandScheduler; +import org.wpilib.command2.button.Trigger; +import org.wpilib.driverstation.Alliance; +import org.wpilib.event.BooleanEvent; +import org.wpilib.event.EventLoop; +import org.wpilib.math.geometry.Pose2d; public class AutoSelector implements Supplier> { @@ -72,8 +73,8 @@ public Trigger getChangedAutoSelection() { /** Schedules the command corresponding to the selected autonomous mode */ public void scheduleAuto() { - // TODO: schedule() in Command has been deprecated and marked for removal - currentAutoOption.ifPresent(ao -> ao.getAutoCommand().ifPresent(Command::schedule)); + currentAutoOption.ifPresent( + ao -> ao.getAutoCommand().ifPresent(CommandScheduler.getInstance()::schedule)); } /** Deschedules the command corresponding to the selected autonomous mode */ diff --git a/src/main/java/frc/lib/AutoSelectorIO.java b/src/main/java/frc/lib/AutoSelectorIO.java index ea11d65..8305d0c 100644 --- a/src/main/java/frc/lib/AutoSelectorIO.java +++ b/src/main/java/frc/lib/AutoSelectorIO.java @@ -1,7 +1,7 @@ package frc.lib; -import org.wpilib.wpilibj.DigitalInput; import org.littletonrobotics.junction.AutoLog; +import org.wpilib.hardware.discrete.DigitalInput; public class AutoSelectorIO { diff --git a/src/main/java/frc/lib/CommandZorroController.java b/src/main/java/frc/lib/CommandZorroController.java index d27faed..dba53cc 100644 --- a/src/main/java/frc/lib/CommandZorroController.java +++ b/src/main/java/frc/lib/CommandZorroController.java @@ -1,9 +1,9 @@ package frc.lib; -import org.wpilib.wpilibj.event.EventLoop; -import org.wpilib.commandsv2.CommandScheduler; -import org.wpilib.commandsv2.button.CommandGenericHID; -import org.wpilib.commandsv2.button.Trigger; +import org.wpilib.command2.CommandScheduler; +import org.wpilib.command2.button.CommandGenericHID; +import org.wpilib.command2.button.Trigger; +import org.wpilib.event.EventLoop; /** * A version of {@link ZorroController} with {@link Trigger} factories for command-based. diff --git a/src/main/java/frc/lib/ControllerSelector.java b/src/main/java/frc/lib/ControllerSelector.java index 691e899..e213dab 100644 --- a/src/main/java/frc/lib/ControllerSelector.java +++ b/src/main/java/frc/lib/ControllerSelector.java @@ -1,13 +1,13 @@ package frc.lib; -import org.wpilib.wpilibj.DriverStation; -import org.wpilib.wpilibj.GenericHID; -import org.wpilib.commandsv2.CommandScheduler; import frc.robot.Constants; import frc.robot.Constants.Mode; import java.util.Objects; import java.util.Set; import org.littletonrobotics.junction.Logger; +import org.wpilib.command2.CommandScheduler; +import org.wpilib.driverstation.GenericHID; +import org.wpilib.driverstation.internal.DriverStationBackend; /** * Manages the selection and binding of controllers for driver and operator roles as a singleton. @@ -172,7 +172,7 @@ public OperatorConfig( } } - private static final int NUM_CONTROLLER_PORTS = DriverStation.kJoystickPorts; + private static final int NUM_CONTROLLER_PORTS = DriverStationBackend.JOYSTICK_PORTS; private final ControllerConfig[] controllerConfigs; private final GenericHID[] controllers; diff --git a/src/main/java/frc/lib/LoggedCompressor.java b/src/main/java/frc/lib/LoggedCompressor.java index 4d54fd4..ce85798 100644 --- a/src/main/java/frc/lib/LoggedCompressor.java +++ b/src/main/java/frc/lib/LoggedCompressor.java @@ -1,14 +1,21 @@ package frc.lib; -import org.wpilib.wpilibj.Compressor; -import org.wpilib.wpilibj.PneumaticsModuleType; import org.littletonrobotics.junction.Logger; +import org.wpilib.hardware.pneumatic.Compressor; +import org.wpilib.hardware.pneumatic.PneumaticsModuleType; public class LoggedCompressor extends Compressor { private final String key; - public LoggedCompressor(PneumaticsModuleType moduleType, String logKey) { - super(moduleType); + /** + * Creates a logged compressor. + * + * @param busId the CAN bus ID (SystemCore transceiver number) + * @param moduleType the type of pneumatics module + * @param logKey the AdvantageKit log key prefix + */ + public LoggedCompressor(int busId, PneumaticsModuleType moduleType, String logKey) { + super(busId, moduleType); this.key = logKey; } diff --git a/src/main/java/frc/lib/LoggedPowerDistribution.java b/src/main/java/frc/lib/LoggedPowerDistribution.java index 89c3aaf..3d2a574 100644 --- a/src/main/java/frc/lib/LoggedPowerDistribution.java +++ b/src/main/java/frc/lib/LoggedPowerDistribution.java @@ -1,13 +1,21 @@ package frc.lib; -import org.wpilib.wpilibj.PowerDistribution; import org.littletonrobotics.junction.Logger; +import org.wpilib.hardware.power.PowerDistribution; public class LoggedPowerDistribution extends PowerDistribution { private final String key; - public LoggedPowerDistribution(int module, ModuleType moduleType, String logKey) { - super(module, moduleType); + /** + * Creates a logged power distribution module. + * + * @param busId the CAN bus ID (SystemCore transceiver number) + * @param module the CAN device ID of the power distribution module + * @param moduleType the type of power distribution module + * @param logKey the AdvantageKit log key prefix + */ + public LoggedPowerDistribution(int busId, int module, ModuleType moduleType, String logKey) { + super(busId, module, moduleType); this.key = logKey; } diff --git a/src/main/java/frc/lib/PneumaticsSimulator.java b/src/main/java/frc/lib/PneumaticsSimulator.java index 4382e49..7ee6595 100644 --- a/src/main/java/frc/lib/PneumaticsSimulator.java +++ b/src/main/java/frc/lib/PneumaticsSimulator.java @@ -7,11 +7,11 @@ package frc.lib; -import org.wpilib.wpilibj.DoubleSolenoid; -import org.wpilib.wpilibj.DriverStation; -import org.wpilib.wpilibj.simulation.DoubleSolenoidSim; -import org.wpilib.wpilibj.simulation.REVPHSim; import org.littletonrobotics.junction.Logger; +import org.wpilib.driverstation.RobotState; +import org.wpilib.hardware.pneumatic.DoubleSolenoid; +import org.wpilib.simulation.DoubleSolenoidSim; +import org.wpilib.simulation.REVPHSim; /** * Physics-based simulation of the robot's pneumatic system (Viair 90C + 2× Clippard AVT-PP-35). @@ -180,13 +180,13 @@ public void update(double dtSeconds) { double qRodNetScfm = 0.0; // positive = net inflow to rod side double qSupplyScfm = 0.0; // consumed from working volume - if (solenoidValue == DoubleSolenoid.Value.kForward) { + if (solenoidValue == DoubleSolenoid.Value.FORWARD) { // Extend: supply → bore, exhaust ← rod qSupplyScfm = flowScfm(CV_SOLENOID, pWorking, pBore); double qExhaustScfm = flowScfm(CV_EXHAUST, pRod, P_ATM_PSIA); qBoreNetScfm = +qSupplyScfm; qRodNetScfm = -qExhaustScfm; - } else if (solenoidValue == DoubleSolenoid.Value.kReverse) { + } else if (solenoidValue == DoubleSolenoid.Value.REVERSE) { // Retract: supply → rod, exhaust ← bore qSupplyScfm = flowScfm(CV_SOLENOID, pWorking, pRod); double qExhaustScfm = flowScfm(CV_EXHAUST, pBore, P_ATM_PSIA); @@ -205,7 +205,7 @@ public void update(double dtSeconds) { // ── Compressor flow: atmosphere → storage (Viair 90C) ───────────────── double pStorageGauge = pStorage - P_ATM_PSIA; - compressorRunning = DriverStation.isEnabled() && pStorageGauge < P_CUTOFF_PSIG; + compressorRunning = RobotState.isEnabled() && pStorageGauge < P_CUTOFF_PSIG; compressorCurrentAmps = compressorRunning ? AMP_INTERCEPT + AMP_SLOPE * pStorageGauge : 0.0; double qCompressorScfm = compressorRunning ? FLOW_INTERCEPT + FLOW_SLOPE * pStorageGauge : 0.0; diff --git a/src/main/java/frc/lib/Util.java b/src/main/java/frc/lib/Util.java index 3a9b919..163db4c 100644 --- a/src/main/java/frc/lib/Util.java +++ b/src/main/java/frc/lib/Util.java @@ -1,7 +1,7 @@ package frc.lib; -import org.wpilib.wpilibj.DriverStation.Alliance; -import org.wpilib.wpilibj.util.Color; +import org.wpilib.driverstation.Alliance; +import org.wpilib.util.Color; public interface Util { /** @@ -11,7 +11,7 @@ public interface Util { * @return the appropriate color */ public static Color allianceToColor(Alliance alliance) { - return alliance == Alliance.Blue ? Color.kBlue : Color.kRed; + return alliance == Alliance.BLUE ? Color.BLUE : Color.RED; } /** diff --git a/src/main/java/frc/lib/ZorroController.java b/src/main/java/frc/lib/ZorroController.java index 567af6d..e485bff 100644 --- a/src/main/java/frc/lib/ZorroController.java +++ b/src/main/java/frc/lib/ZorroController.java @@ -1,8 +1,8 @@ package frc.lib; +import org.wpilib.driverstation.GenericHID; import org.wpilib.util.sendable.Sendable; import org.wpilib.util.sendable.SendableBuilder; -import org.wpilib.wpilibj.GenericHID; public class ZorroController extends GenericHID implements Sendable { diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index e66b8f0..17a958d 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -11,7 +11,7 @@ package frc.robot; import com.ctre.phoenix6.CANBus; -import org.wpilib.wpilibj.RobotBase; +import org.wpilib.framework.RobotBase; /** * This class defines the runtime mode used by AdvantageKit. The mode is always "real" when running @@ -76,8 +76,14 @@ public static final class DIOPorts { public static final class CANBusPorts { - public static final class CAN2 { - public static final CANBus BUS = CANBus.roboRIO(); + /** + * SystemCore CAN bus 0 — low-speed bus for support/sensing devices. Supports the power + * distribution and gyro. + */ + public static final class SC0 { + public static final String NAME = "SC0"; + public static final int BUS_ID = 0; + public static final CANBus BUS = CANBus.systemcore(BUS_ID); // Power distribution public static final int PD = 1; @@ -86,10 +92,14 @@ public static final class CAN2 { public static final int GYRO = 0; } - public static final class CANHD { - // CAN bus that the devices are located on; - // All swerve devices must share the same CAN bus - public static final CANBus BUS = new CANBus("canivore"); + /** + * SystemCore CAN bus 1 — high-speed bus for swerve drivetrain devices. Supports TalonFX motor + * controllers and CANcoders. + */ + public static final class SC1 { + public static final String NAME = "SC1"; + public static final int BUS_ID = 1; + public static final CANBus BUS = CANBus.systemcore(BUS_ID); // Drivetrain public static final int BACK_LEFT_DRIVE = 10; diff --git a/src/main/java/frc/robot/Robot.java b/src/main/java/frc/robot/Robot.java index 5845023..da69678 100644 --- a/src/main/java/frc/robot/Robot.java +++ b/src/main/java/frc/robot/Robot.java @@ -13,22 +13,6 @@ import static frc.robot.subsystems.vision.VisionConstants.*; import com.ctre.phoenix6.SignalLogger; -import org.wpilib.math.filter.LinearFilter; -import org.wpilib.networktables.NetworkTableInstance; -import org.wpilib.wpilibj.DriverStation; -import org.wpilib.wpilibj.DriverStation.Alliance; -import org.wpilib.wpilibj.PowerDistribution.ModuleType; -import org.wpilib.wpilibj.RobotBase; -import org.wpilib.wpilibj.simulation.BatterySim; -import org.wpilib.wpilibj.simulation.RoboRioSim; -import org.wpilib.commandsv2.Command; -import org.wpilib.commandsv2.CommandScheduler; -import org.wpilib.commandsv2.Commands; -import org.wpilib.commandsv2.InstantCommand; -import org.wpilib.commandsv2.SubsystemBase; -import org.wpilib.commandsv2.button.CommandGenericHID; -import org.wpilib.commandsv2.button.CommandXboxController; -import org.wpilib.commandsv2.button.Trigger; import frc.game.Field; import frc.game.GameState; import frc.lib.AllianceSelector; @@ -40,7 +24,7 @@ import frc.lib.ControllerSelector.DriverController; import frc.lib.ControllerSelector.OperatorConfig; import frc.lib.LoggedPowerDistribution; -import frc.robot.Constants.CANBusPorts.CAN2; +import frc.robot.Constants.CANBusPorts.SC0; import frc.robot.Constants.DIOPorts; import frc.robot.Constants.FeatureFlags; import frc.robot.commands.DriveCommands; @@ -66,6 +50,23 @@ import org.littletonrobotics.junction.networktables.NT4Publisher; import org.littletonrobotics.junction.wpilog.WPILOGReader; import org.littletonrobotics.junction.wpilog.WPILOGWriter; +import org.wpilib.command2.Command; +import org.wpilib.command2.CommandScheduler; +import org.wpilib.command2.Commands; +import org.wpilib.command2.InstantCommand; +import org.wpilib.command2.SubsystemBase; +import org.wpilib.command2.button.CommandGenericHID; +import org.wpilib.command2.button.CommandNiDsXboxController; +import org.wpilib.command2.button.Trigger; +import org.wpilib.driverstation.Alliance; +import org.wpilib.driverstation.GenericHID; +import org.wpilib.driverstation.internal.DriverStationBackend; +import org.wpilib.framework.RobotBase; +import org.wpilib.hardware.power.PowerDistribution.ModuleType; +import org.wpilib.math.filter.LinearFilter; +import org.wpilib.networktables.NetworkTableInstance; +import org.wpilib.simulation.BatterySim; +import org.wpilib.simulation.RoboRioSim; /** * The VM is configured to automatically run this class, and to call the functions corresponding to @@ -93,7 +94,7 @@ public class Robot extends LoggedRobot { public static final AutoSelector autoSelector = new AutoSelector(DIOPorts.AUTONOMOUS_MODE_SELECTOR, allianceSelector::getAllianceColor); public final LoggedPowerDistribution powerDistribution = - new LoggedPowerDistribution(CAN2.PD, ModuleType.kRev, "PD"); + new LoggedPowerDistribution(SC0.BUS_ID, SC0.PD, ModuleType.REV, "PD"); private final java.util.Set activeCommands = new java.util.LinkedHashSet<>(); @@ -216,9 +217,6 @@ public Robot() { // Start AdvantageKit logger Logger.start(); - // Disable LiveWindow telemetry (subsystem motor sendables) — eliminates SmartDashboard overhead - org.wpilib.wpilibj.livewindow.LiveWindow.disableAllTelemetry(); - configureControlPanelBindings(); configureAutoOptions(); @@ -249,8 +247,8 @@ public void robotPeriodic() { CommandScheduler.getInstance().run(); long t1 = FeatureFlags.PROFILING_ENABLED ? System.nanoTime() : 0; - logCANBus("CAN2", Constants.CANBusPorts.CAN2.BUS); - logCANBus("CANHD", Constants.CANBusPorts.CANHD.BUS); + logCANBus(Constants.CANBusPorts.SC0.NAME, Constants.CANBusPorts.SC0.BUS); + logCANBus(Constants.CANBusPorts.SC1.NAME, Constants.CANBusPorts.SC1.BUS); powerDistribution.log(); logHIDs(); logScheduler(); @@ -338,7 +336,7 @@ public void teleopPeriodic() {} /** This function is called once when test mode is enabled. */ @Override - public void testInit() { + public void utilityInit() { // Cancels all running commands at the start of test mode. CommandScheduler.getInstance().cancelAll(); if (leds != null) leds.clear(); @@ -346,7 +344,7 @@ public void testInit() { /** This function is called periodically during test mode. */ @Override - public void testPeriodic() {} + public void utilityPeriodic() {} /** This function is called once when the robot is first started up. */ @Override @@ -423,7 +421,7 @@ public boolean getFieldRelativeInput() { } public DriverController bindXboxDriver(int port) { - var xboxDriver = new CommandXboxController(port); + var xboxDriver = new CommandNiDsXboxController(port); var controller = new DriverController() { @@ -525,21 +523,22 @@ public static long getUSBStorageFreeSpace() { } private static void logHIDs() { - for (int port = 0; port < DriverStation.kJoystickPorts; port++) { - if (!DriverStation.isJoystickConnected(port)) continue; + for (int port = 0; port < DriverStationBackend.JOYSTICK_PORTS; port++) { + var hid = new GenericHID(port); + if (!hid.isConnected()) continue; String prefix = "HID/Port" + port; - Logger.recordOutput(prefix + "/Name", DriverStation.getJoystickName(port)); - int axisCount = DriverStation.getStickAxisCount(port); + Logger.recordOutput(prefix + "/Name", hid.getName()); + int axisCount = hid.getAxesAvailable(); double[] axes = new double[axisCount]; - for (int i = 0; i < axisCount; i++) axes[i] = DriverStation.getStickAxis(port, i); + for (int i = 0; i < axisCount; i++) axes[i] = hid.getRawAxis(i); Logger.recordOutput(prefix + "/Axes", axes); - int buttonCount = DriverStation.getStickButtonCount(port); + int buttonCount = hid.getButtonsMaximumIndex(); boolean[] buttons = new boolean[buttonCount]; - for (int i = 0; i < buttonCount; i++) buttons[i] = DriverStation.getStickButton(port, i + 1); + for (int i = 0; i < buttonCount; i++) buttons[i] = hid.getRawButton(i + 1); Logger.recordOutput(prefix + "/Buttons", buttons); - int povCount = DriverStation.getStickPOVCount(port); - long[] povs = new long[povCount]; - for (int i = 0; i < povCount; i++) povs[i] = DriverStation.getStickPOV(port, i); + int povCount = hid.getPOVsAvailable(); + String[] povs = new String[povCount]; + for (int i = 0; i < povCount; i++) povs[i] = hid.getPOV(i).name(); Logger.recordOutput(prefix + "/POVs", povs); } } diff --git a/src/main/java/frc/robot/auto/AutoMode.java b/src/main/java/frc/robot/auto/AutoMode.java index 19ce36a..b36c1ca 100644 --- a/src/main/java/frc/robot/auto/AutoMode.java +++ b/src/main/java/frc/robot/auto/AutoMode.java @@ -11,11 +11,11 @@ import choreo.auto.AutoRoutine; import choreo.auto.AutoTrajectory; import choreo.trajectory.SwerveSample; -import org.wpilib.math.geometry.Pose2d; -import org.wpilib.commandsv2.Command; import frc.robot.commands.DriveCommands; import frc.robot.subsystems.drive.Drive; import java.util.Optional; +import org.wpilib.command2.Command; +import org.wpilib.math.geometry.Pose2d; public abstract class AutoMode { private final AutoFactory autoFactory; diff --git a/src/main/java/frc/robot/commands/DriveCommands.java b/src/main/java/frc/robot/commands/DriveCommands.java index 6bdfa6a..ec4aadc 100644 --- a/src/main/java/frc/robot/commands/DriveCommands.java +++ b/src/main/java/frc/robot/commands/DriveCommands.java @@ -10,22 +10,9 @@ package frc.robot.commands; -import static org.wpilib.units.Units.*; import static frc.robot.subsystems.drive.DriveConstants.*; +import static org.wpilib.units.Units.*; -import org.wpilib.math.MathUtil; -import org.wpilib.math.controller.ProfiledPIDController; -import org.wpilib.math.filter.SlewRateLimiter; -import org.wpilib.math.geometry.Pose2d; -import org.wpilib.math.geometry.Rotation2d; -import org.wpilib.math.geometry.Transform2d; -import org.wpilib.math.geometry.Translation2d; -import org.wpilib.math.kinematics.ChassisSpeeds; -import org.wpilib.math.trajectory.TrapezoidProfile; -import org.wpilib.math.util.Units; -import org.wpilib.wpilibj.Timer; -import org.wpilib.commandsv2.Command; -import org.wpilib.commandsv2.Commands; import frc.robot.subsystems.drive.Drive; import java.text.DecimalFormat; import java.text.NumberFormat; @@ -34,6 +21,19 @@ import java.util.function.BooleanSupplier; import java.util.function.DoubleSupplier; import java.util.function.Supplier; +import org.wpilib.command2.Command; +import org.wpilib.command2.Commands; +import org.wpilib.math.controller.ProfiledPIDController; +import org.wpilib.math.filter.SlewRateLimiter; +import org.wpilib.math.geometry.Pose2d; +import org.wpilib.math.geometry.Rotation2d; +import org.wpilib.math.geometry.Transform2d; +import org.wpilib.math.geometry.Translation2d; +import org.wpilib.math.kinematics.ChassisVelocities; +import org.wpilib.math.trajectory.TrapezoidProfile; +import org.wpilib.math.util.MathUtil; +import org.wpilib.math.util.Units; +import org.wpilib.system.Timer; public class DriveCommands { private static final double DEADBAND = 0.035; @@ -111,21 +111,20 @@ public static Command joystickDrive( // Square rotation value for more precise control omega = Math.copySign(omega * omega, omega); - ChassisSpeeds speeds = - new ChassisSpeeds( - linearVelocity.getX() * drive.getMaxLinearSpeedMetersPerSec(), - linearVelocity.getY() * drive.getMaxLinearSpeedMetersPerSec(), - omega * drive.getMaxAngularSpeedRadPerSec()); + ChassisVelocities velocities = + new ChassisVelocities( + linearVelocity.getX() * drive.getMaxLinearVelocityMetersPerSec(), + linearVelocity.getY() * drive.getMaxLinearVelocityMetersPerSec(), + omega * drive.getMaxAngularVelocityRadPerSec()); - // Convert to field relative speeds + // Convert to field relative velocities if (fieldRelativeSupplier.getAsBoolean()) { - speeds = - ChassisSpeeds.fromFieldRelativeSpeeds( - speeds, + velocities = + velocities.toRobotRelative( getDriverRelativeHeading(drive, fieldRotatedSupplier.getAsBoolean())); } - drive.runVelocity(speeds); + drive.runVelocity(velocities); }, drive) .withName("Joystick Drive"); @@ -152,15 +151,14 @@ public static Command fieldRelativeJoystickDrive( // Square rotation value for more precise control omega = Math.copySign(omega * omega, omega); - // Convert to field relative speeds & send command - ChassisSpeeds speeds = - new ChassisSpeeds( - linearVelocity.getX() * drive.getMaxLinearSpeedMetersPerSec(), - linearVelocity.getY() * drive.getMaxLinearSpeedMetersPerSec(), - omega * drive.getMaxAngularSpeedRadPerSec()); + // Convert to field relative velocities & send command + ChassisVelocities velocities = + new ChassisVelocities( + linearVelocity.getX() * drive.getMaxLinearVelocityMetersPerSec(), + linearVelocity.getY() * drive.getMaxLinearVelocityMetersPerSec(), + omega * drive.getMaxAngularVelocityRadPerSec()); drive.runVelocity( - ChassisSpeeds.fromFieldRelativeSpeeds( - speeds, + velocities.toRobotRelative( getDriverRelativeHeading(drive, fieldRotatedSupplier.getAsBoolean()))); }, drive) @@ -187,12 +185,12 @@ public static Command robotRelativeJoystickDrive( // Square rotation value for more precise control omega = Math.copySign(omega * omega, omega); - ChassisSpeeds speeds = - new ChassisSpeeds( - linearVelocity.getX() * drive.getMaxLinearSpeedMetersPerSec(), - linearVelocity.getY() * drive.getMaxLinearSpeedMetersPerSec(), - omega * drive.getMaxAngularSpeedRadPerSec()); - drive.runVelocity(speeds); + ChassisVelocities velocities = + new ChassisVelocities( + linearVelocity.getX() * drive.getMaxLinearVelocityMetersPerSec(), + linearVelocity.getY() * drive.getMaxLinearVelocityMetersPerSec(), + omega * drive.getMaxAngularVelocityRadPerSec()); + drive.runVelocity(velocities); }, drive) .withName("Robot Relative Joystick Drive"); @@ -226,21 +224,20 @@ public static Command joystickDriveAtFixedOrientation( Translation2d linearVelocity = getLinearVelocityFromJoysticks(xSupplier.getAsDouble(), ySupplier.getAsDouble()); - // Calculate angular speed + // Calculate angular velocity double omega = angleController.calculate( drive.getPose().getRotation().getRadians(), rotationSupplier.get().getRadians()); - // Convert to field relative speeds & send command - ChassisSpeeds speeds = - new ChassisSpeeds( - linearVelocity.getX() * drive.getMaxLinearSpeedMetersPerSec(), - linearVelocity.getY() * drive.getMaxLinearSpeedMetersPerSec(), + // Convert to field relative velocities & send command + ChassisVelocities velocities = + new ChassisVelocities( + linearVelocity.getX() * drive.getMaxLinearVelocityMetersPerSec(), + linearVelocity.getY() * drive.getMaxLinearVelocityMetersPerSec(), omega); drive.runVelocity( - ChassisSpeeds.fromFieldRelativeSpeeds( - speeds, + velocities.toRobotRelative( getDriverRelativeHeading(drive, fieldRotatedSupplier.getAsBoolean()))); }, drive) @@ -273,20 +270,20 @@ public static Command joystickDrivePointedForward( Translation2d linearVelocity = getLinearVelocityFromJoysticks(xSupplier.getAsDouble(), ySupplier.getAsDouble()); - // Calculate angular speed + // Calculate angular velocity Rotation2d driverHeading = getDriverRelativeHeading(drive, fieldRotatedSupplier.getAsBoolean()); double omega = angleController.calculate( driverHeading.getRadians(), linearVelocity.getAngle().getRadians()); - // Convert to field relative speeds & send command - ChassisSpeeds speeds = - new ChassisSpeeds( - linearVelocity.getX() * drive.getMaxLinearSpeedMetersPerSec(), - linearVelocity.getY() * drive.getMaxLinearSpeedMetersPerSec(), + // Convert to field relative velocities & send command + ChassisVelocities velocities = + new ChassisVelocities( + linearVelocity.getX() * drive.getMaxLinearVelocityMetersPerSec(), + linearVelocity.getY() * drive.getMaxLinearVelocityMetersPerSec(), omega); - drive.runVelocity(ChassisSpeeds.fromFieldRelativeSpeeds(speeds, driverHeading)); + drive.runVelocity(velocities.toRobotRelative(driverHeading)); }, drive) .withName("Forward Orientated Joystick Drive") @@ -320,14 +317,13 @@ public static Command pointAtTarget( return Commands.run( () -> { - // Calculate angular speed + // Calculate angular velocity double omega = angleController.calculate(yawErrorSupplier.get().getRadians(), 0); - // Convert to field relative speeds & send command - ChassisSpeeds speeds = new ChassisSpeeds(0, 0, omega); + // Convert to field relative velocities & send command + ChassisVelocities velocities = new ChassisVelocities(0, 0, omega); drive.runVelocity( - ChassisSpeeds.fromFieldRelativeSpeeds( - speeds, + velocities.toRobotRelative( getDriverRelativeHeading(drive, fieldRotatedSupplier.getAsBoolean()))); }, drive) @@ -429,14 +425,14 @@ public static Command wheelRadiusCharacterization(Drive drive) { Commands.run( () -> { double speed = limiter.calculate(WHEEL_RADIUS_MAX_VELOCITY); - drive.runVelocity(new ChassisSpeeds(0.0, 0.0, speed)); + drive.runVelocity(new ChassisVelocities(0.0, 0.0, speed)); }, drive)), // Measurement sequence Commands.sequence( // Wait for modules to fully orient before starting measurement - Commands.waitSeconds(1.0), + Commands.waitTime(Seconds.of(1.0)), // Record starting measurement Commands.runOnce( diff --git a/src/main/java/frc/robot/commands/PathCommands.java b/src/main/java/frc/robot/commands/PathCommands.java index 8d410be..1521d92 100644 --- a/src/main/java/frc/robot/commands/PathCommands.java +++ b/src/main/java/frc/robot/commands/PathCommands.java @@ -7,26 +7,26 @@ package frc.robot.commands; -import static org.wpilib.units.Units.*; import static frc.robot.subsystems.drive.DriveConstants.*; +import static org.wpilib.units.Units.*; import com.pathplanner.lib.auto.AutoBuilder; import com.pathplanner.lib.path.GoalEndState; import com.pathplanner.lib.path.PathPlannerPath; import com.pathplanner.lib.path.Waypoint; +import frc.robot.subsystems.drive.Drive; +import java.util.List; +import java.util.Set; +import java.util.function.Supplier; +import org.wpilib.command2.Command; +import org.wpilib.command2.Commands; +import org.wpilib.command2.DeferredCommand; +import org.wpilib.driverstation.DriverStationErrors; import org.wpilib.math.geometry.Pose2d; import org.wpilib.math.geometry.Rotation2d; import org.wpilib.math.geometry.Transform2d; import org.wpilib.math.geometry.Translation2d; import org.wpilib.units.measure.Distance; -import org.wpilib.wpilibj.DriverStation; -import org.wpilib.commandsv2.Command; -import org.wpilib.commandsv2.Commands; -import org.wpilib.commandsv2.DeferredCommand; -import frc.robot.subsystems.drive.Drive; -import java.util.List; -import java.util.Set; -import java.util.function.Supplier; public class PathCommands { @@ -150,7 +150,7 @@ public static Command getPathFromFileCommand() { // Create a path following command using AutoBuilder. This will also trigger event markers. return AutoBuilder.followPath(path); } catch (Exception e) { - DriverStation.reportError("Big oops: " + e.getMessage(), e.getStackTrace()); + DriverStationErrors.reportError("Big oops: " + e.getMessage(), e.getStackTrace()); return Commands.none(); } } diff --git a/src/main/java/frc/robot/subsystems/drive/Drive.java b/src/main/java/frc/robot/subsystems/drive/Drive.java index aac0946..6dedf64 100644 --- a/src/main/java/frc/robot/subsystems/drive/Drive.java +++ b/src/main/java/frc/robot/subsystems/drive/Drive.java @@ -10,8 +10,8 @@ package frc.robot.subsystems.drive; -import static org.wpilib.units.Units.*; import static frc.robot.subsystems.drive.DriveConstants.*; +import static org.wpilib.units.Units.*; import choreo.trajectory.SwerveSample; import com.ctre.phoenix6.CANBus; @@ -20,37 +20,34 @@ import com.pathplanner.lib.controllers.PPHolonomicDriveController; import com.pathplanner.lib.pathfinding.Pathfinding; import com.pathplanner.lib.util.PathPlannerLogging; -import org.wpilib.hal.FRCNetComm.tInstances; -import org.wpilib.hal.FRCNetComm.tResourceType; -import org.wpilib.hal.HAL; -import org.wpilib.math.Matrix; +import frc.robot.Constants; +import frc.robot.Constants.FeatureFlags; +import frc.robot.Constants.Mode; +import frc.robot.util.LocalADStarAK; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; +import org.littletonrobotics.junction.AutoLogOutput; +import org.littletonrobotics.junction.Logger; +import org.wpilib.command2.Command; +import org.wpilib.command2.SubsystemBase; +import org.wpilib.command2.sysid.SysIdRoutine; +import org.wpilib.driverstation.Alert; +import org.wpilib.driverstation.Alliance; +import org.wpilib.driverstation.MatchState; +import org.wpilib.driverstation.RobotState; +import org.wpilib.hardware.hal.HAL; import org.wpilib.math.controller.PIDController; import org.wpilib.math.estimator.SwerveDrivePoseEstimator; import org.wpilib.math.geometry.Pose2d; import org.wpilib.math.geometry.Rotation2d; import org.wpilib.math.geometry.Twist2d; -import org.wpilib.math.kinematics.ChassisSpeeds; +import org.wpilib.math.kinematics.ChassisVelocities; import org.wpilib.math.kinematics.SwerveDriveKinematics; import org.wpilib.math.kinematics.SwerveModulePosition; -import org.wpilib.math.kinematics.SwerveModuleState; +import org.wpilib.math.kinematics.SwerveModuleVelocity; +import org.wpilib.math.linalg.Matrix; import org.wpilib.math.numbers.N1; import org.wpilib.math.numbers.N3; -import org.wpilib.wpilibj.Alert; -import org.wpilib.wpilibj.Alert.AlertType; -import org.wpilib.wpilibj.DriverStation; -import org.wpilib.wpilibj.DriverStation.Alliance; -import org.wpilib.wpilibj.RobotState; -import org.wpilib.commandsv2.Command; -import org.wpilib.commandsv2.SubsystemBase; -import org.wpilib.commandsv2.sysid.SysIdRoutine; -import frc.robot.Constants; -import frc.robot.Constants.FeatureFlags; -import frc.robot.Constants.Mode; -import frc.robot.util.LocalADStarAK; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; -import org.littletonrobotics.junction.AutoLogOutput; -import org.littletonrobotics.junction.Logger; public class Drive extends SubsystemBase { static final double ODOMETRY_FREQUENCY = @@ -62,7 +59,7 @@ public class Drive extends SubsystemBase { private final Module[] modules = new Module[4]; // FL, FR, BL, BR private final SysIdRoutine sysId; private final Alert gyroDisconnectedAlert = - new Alert("Disconnected gyro, using kinematics as fallback.", AlertType.kError); + new Alert("Disconnected gyro, using kinematics as fallback.", Alert.Level.HIGH); private SwerveDriveKinematics kinematics = new SwerveDriveKinematics(MODULE_TRANSLATIONS); private Rotation2d rawGyroRotation = Rotation2d.kZero; @@ -78,10 +75,10 @@ public class Drive extends SubsystemBase { private boolean firstVisionEstimate = true; private boolean poseInitialized = false; - private static final ChassisSpeeds ZERO_SPEEDS = new ChassisSpeeds(); - private final SwerveModuleState[] emptyModuleStates = new SwerveModuleState[] {}; + private static final ChassisVelocities ZERO_VELOCITIES = new ChassisVelocities(); + private final SwerveModuleVelocity[] emptyModuleStates = new SwerveModuleVelocity[] {}; // Pre-allocated for getModuleStates()/getModulePositions() to avoid array allocation each call - private final SwerveModuleState[] measuredStates = new SwerveModuleState[4]; + private final SwerveModuleVelocity[] measuredStates = new SwerveModuleVelocity[4]; private final SwerveModulePosition[] measuredPositions = new SwerveModulePosition[4]; private SwerveModulePosition[] modulePositions = new SwerveModulePosition[4]; // Pre-allocated to avoid allocations in odometry loop - fields are mutated in place @@ -90,7 +87,7 @@ public class Drive extends SubsystemBase { new SwerveModulePosition(), new SwerveModulePosition(), new SwerveModulePosition(), new SwerveModulePosition() }; - private ChassisSpeeds chassisSpeeds; + private ChassisVelocities chassisVelocities; // PID controllers for following Choreo trajectories private final PIDController xController = new PIDController(8.01, 0.0, 0.0); @@ -110,7 +107,8 @@ public Drive( modules[3] = new Module(brModuleIO, "BackRight"); // Usage reporting for swerve template - HAL.report(tResourceType.kResourceType_RobotDrive, tInstances.kRobotDriveSwerve_AdvantageKit); + // TODO: update instance string to match the official 2027 AKit template when released. + HAL.reportUsage("RobotDrive", "SwerveAdvantageKit"); // Start odometry thread PhoenixOdometryThread.getInstance().start(); @@ -119,12 +117,12 @@ public Drive( AutoBuilder.configure( this::getPose, this::setPose, - this::getRobotRelativeChassisSpeeds, + this::getRobotRelativeChassisVelocities, this::runVelocity, new PPHolonomicDriveController( new PIDConstants(5.0, 0.0, 0.0), new PIDConstants(5.0, 0.0, 0.0)), PP_CONFIG, - () -> DriverStation.getAlliance().orElse(Alliance.Blue) == Alliance.Red, + () -> MatchState.getAlliance().orElse(Alliance.BLUE) == Alliance.RED, this); Pathfinding.setPathfinder(new LocalADStarAK()); PathPlannerLogging.setLogActivePathCallback( @@ -168,14 +166,14 @@ public void periodic() { ODOMETRY_LOCK.unlock(); // Stop moving when disabled - if (DriverStation.isDisabled()) { + if (RobotState.isDisabled()) { for (var module : modules) { module.stop(); } } // Log empty setpoint states when disabled - if (DriverStation.isDisabled()) { + if (RobotState.isDisabled()) { Logger.recordOutput("SwerveStates/Setpoints", emptyModuleStates); Logger.recordOutput("SwerveStates/SetpointsOptimized", emptyModuleStates); } @@ -191,9 +189,8 @@ public void periodic() { for (int moduleIndex = 0; moduleIndex < 4; moduleIndex++) { modulePositions[moduleIndex] = modules[moduleIndex].getOdometryPositions()[i]; // Mutate pre-allocated delta objects to avoid allocations - moduleDeltas[moduleIndex].distanceMeters = - modulePositions[moduleIndex].distanceMeters - - lastModulePositions[moduleIndex].distanceMeters; + moduleDeltas[moduleIndex].distance = + modulePositions[moduleIndex].distance - lastModulePositions[moduleIndex].distance; moduleDeltas[moduleIndex].angle = modulePositions[moduleIndex].angle; lastModulePositions[moduleIndex] = modulePositions[moduleIndex]; } @@ -211,7 +208,7 @@ public void periodic() { // Apply update visionPose.updateWithTime(sampleTimestamps[i], rawGyroRotation, modulePositions); - chassisSpeeds = kinematics.toChassisSpeeds(getModuleStates()); + chassisVelocities = kinematics.toChassisVelocities(getModuleStates()); } long t6 = FeatureFlags.PROFILING_ENABLED ? System.nanoTime() : 0; @@ -247,33 +244,36 @@ public void periodic() { /** * Runs the drive at the desired velocity. * - * @param speeds Speeds in meters/sec + * @param velocities Velocities in meters/sec */ - public void runVelocity(ChassisSpeeds speeds) { + public void runVelocity(ChassisVelocities velocities) { - // 1️: Convert continuous speeds to module states - SwerveModuleState[] states = kinematics.toSwerveModuleStates(speeds); + // 1️: Convert continuous velocities to module states + SwerveModuleVelocity[] states = kinematics.toSwerveModuleVelocities(velocities); // Log unoptimized setpoints - Logger.recordOutput("SwerveChassisSpeeds/Setpoints", speeds); + Logger.recordOutput("SwerveChassisVelocities/Setpoints", velocities); Logger.recordOutput("SwerveStates/Setpoints", states); // 2: Desaturate (apply wheel limits FIRST) - SwerveDriveKinematics.desaturateWheelSpeeds(states, DRIVETRAIN_SPEED_LIMIT.in(MetersPerSecond)); + states = + SwerveDriveKinematics.desaturateWheelVelocities( + states, DRIVETRAIN_SPEED_LIMIT.in(MetersPerSecond)); - // 3: Reconstruct the ACTUAL chassis speeds after limiting - ChassisSpeeds limitedSpeeds = kinematics.toChassisSpeeds(states); + // 3: Reconstruct the ACTUAL chassis velocities after limiting + ChassisVelocities limitedVelocities = kinematics.toChassisVelocities(states); - // 4: Now discretize the LIMITED speeds - ChassisSpeeds discreteSpeeds = ChassisSpeeds.discretize(limitedSpeeds, 0.02); + // 4: Now discretize the LIMITED velocities + ChassisVelocities discreteVelocities = limitedVelocities.discretize(0.02); - // 5: Convert discretized speeds back to module states - SwerveModuleState[] finalStates = kinematics.toSwerveModuleStates(discreteSpeeds); + // 5: Convert discretized velocities back to module states + SwerveModuleVelocity[] finalStates = kinematics.toSwerveModuleVelocities(discreteVelocities); // (Optional but usually unnecessary) // desaturate again for safety - SwerveDriveKinematics.desaturateWheelSpeeds( - finalStates, DRIVETRAIN_SPEED_LIMIT.in(MetersPerSecond)); + finalStates = + SwerveDriveKinematics.desaturateWheelVelocities( + finalStates, DRIVETRAIN_SPEED_LIMIT.in(MetersPerSecond)); // 6: Send to modules for (int i = 0; i < 4; i++) { @@ -288,16 +288,16 @@ public void followTrajectory(SwerveSample sample) { // Get the current pose of the robot Pose2d pose = getPose(); - // Generate the next speeds for the robot - ChassisSpeeds speeds = - new ChassisSpeeds( + // Generate the next velocities for the robot + ChassisVelocities velocities = + new ChassisVelocities( sample.vx + xController.calculate(pose.getX(), sample.x), sample.vy + yController.calculate(pose.getY(), sample.y), sample.omega + headingController.calculate(pose.getRotation().getRadians(), sample.heading)); - // Apply the generated speeds - runVelocity(ChassisSpeeds.fromFieldRelativeSpeeds(speeds, pose.getRotation())); + // Apply the generated velocities + runVelocity(velocities.toRobotRelative(pose.getRotation())); } /** Runs the drive in a straight line with the specified drive output. */ @@ -309,7 +309,7 @@ public void runCharacterization(double output) { /** Stops the drive. */ public void stop() { - runVelocity(ZERO_SPEEDS); + runVelocity(ZERO_VELOCITIES); } /** @@ -339,7 +339,7 @@ public Command sysIdDynamic(SysIdRoutine.Direction direction) { /** Returns the module states (turn angles and drive velocities) for all of the modules. */ @AutoLogOutput(key = "SwerveStates/Measured") - private SwerveModuleState[] getModuleStates() { + private SwerveModuleVelocity[] getModuleStates() { for (int i = 0; i < 4; i++) { measuredStates[i] = modules[i].getState(); } @@ -354,10 +354,10 @@ private SwerveModulePosition[] getModulePositions() { return measuredPositions; } - /** Returns the measured chassis speeds of the robot. */ - @AutoLogOutput(key = "SwerveChassisSpeeds/Measured") - public ChassisSpeeds getRobotRelativeChassisSpeeds() { - return chassisSpeeds; + /** Returns the measured chassis velocities of the robot. */ + @AutoLogOutput(key = "SwerveChassisVelocities/Measured") + public ChassisVelocities getRobotRelativeChassisVelocities() { + return chassisVelocities; } /** Returns the position of each module in radians. */ @@ -418,13 +418,13 @@ public void addVisionMeasurement( visionRobotPoseMeters, timestampSeconds, visionMeasurementStdDevs); } - /** Returns the maximum linear speed in meters per sec. */ - public double getMaxLinearSpeedMetersPerSec() { + /** Returns the maximum linear velocity in meters per sec. */ + public double getMaxLinearVelocityMetersPerSec() { return MAX_CHASSIS_VELOCITY.in(MetersPerSecond); } - /** Returns the maximum angular speed in radians per sec. */ - public double getMaxAngularSpeedRadPerSec() { + /** Returns the maximum angular velocity in radians per sec. */ + public double getMaxAngularVelocityRadPerSec() { return MAX_CHASSIS_ANGULAR_VELOCITY.in(RadiansPerSecond); } diff --git a/src/main/java/frc/robot/subsystems/drive/DriveConstants.java b/src/main/java/frc/robot/subsystems/drive/DriveConstants.java index 72caad1..addfea9 100644 --- a/src/main/java/frc/robot/subsystems/drive/DriveConstants.java +++ b/src/main/java/frc/robot/subsystems/drive/DriveConstants.java @@ -28,11 +28,13 @@ import com.pathplanner.lib.config.ModuleConfig; import com.pathplanner.lib.config.RobotConfig; import com.pathplanner.lib.path.PathConstraints; -import org.wpilib.math.Matrix; +import frc.robot.Constants.CANBusPorts.SC1; +import frc.robot.Constants.MotorConstants.KrakenX60Constants; import org.wpilib.math.geometry.Translation2d; +import org.wpilib.math.linalg.Matrix; import org.wpilib.math.numbers.N1; import org.wpilib.math.numbers.N3; -import org.wpilib.math.system.plant.DCMotor; +import org.wpilib.math.system.DCMotor; import org.wpilib.units.measure.AngularAcceleration; import org.wpilib.units.measure.AngularVelocity; import org.wpilib.units.measure.Distance; @@ -41,8 +43,6 @@ import org.wpilib.units.measure.Mass; import org.wpilib.units.measure.MomentOfInertia; import org.wpilib.units.measure.Voltage; -import frc.robot.Constants.CANBusPorts.CANHD; -import frc.robot.Constants.MotorConstants.KrakenX60Constants; public class DriveConstants { @@ -74,7 +74,7 @@ public class DriveConstants { MetersPerSecond.of( 0.9 * (WHEEL_RADIUS_METERS * 2.0 * Math.PI) - * DRIVE_GEARBOX.freeSpeedRadPerSec + * DRIVE_GEARBOX.freeSpeed / (2.0 * Math.PI) / DRIVE_MOTOR_REDUCTION); @@ -208,7 +208,7 @@ public class DriveConstants { private static final Voltage DRIVE_FRICTION_VOLTAGE = Volts.of(0.2); public static final SwerveDrivetrainConstants DRIVETRAIN_CONSTANTS = - new SwerveDrivetrainConstants().withCANBusName(CANHD.BUS.getName()); + new SwerveDrivetrainConstants().withCANBusName(SC1.BUS.getName()); private static final SwerveModuleConstantsFactory< TalonFXConfiguration, TalonFXConfiguration, CANcoderConfiguration> @@ -239,9 +239,9 @@ public class DriveConstants { TalonFXConfiguration, TalonFXConfiguration, CANcoderConfiguration> FRONT_LEFT = CONSTANT_CREATOR.createModuleConstants( - CANHD.FRONT_LEFT_TURN, - CANHD.FRONT_LEFT_DRIVE, - CANHD.FRONT_LEFT_TURN_ABS_ENC, + SC1.FRONT_LEFT_TURN, + SC1.FRONT_LEFT_DRIVE, + SC1.FRONT_LEFT_TURN_ABS_ENC, Rotations.of(0), WHEEL_BASE.div(2.0), TRACK_WIDTH.div(2.0), @@ -252,9 +252,9 @@ public class DriveConstants { TalonFXConfiguration, TalonFXConfiguration, CANcoderConfiguration> FRONT_RIGHT = CONSTANT_CREATOR.createModuleConstants( - CANHD.FRONT_RIGHT_TURN, - CANHD.FRONT_RIGHT_DRIVE, - CANHD.FRONT_RIGHT_TURN_ABS_ENC, + SC1.FRONT_RIGHT_TURN, + SC1.FRONT_RIGHT_DRIVE, + SC1.FRONT_RIGHT_TURN_ABS_ENC, Rotations.of(0), WHEEL_BASE.div(2.0), TRACK_WIDTH.div(-2.0), @@ -265,9 +265,9 @@ public class DriveConstants { TalonFXConfiguration, TalonFXConfiguration, CANcoderConfiguration> BACK_LEFT = CONSTANT_CREATOR.createModuleConstants( - CANHD.BACK_LEFT_TURN, - CANHD.BACK_LEFT_DRIVE, - CANHD.BACK_LEFT_TURN_ABS_ENC, + SC1.BACK_LEFT_TURN, + SC1.BACK_LEFT_DRIVE, + SC1.BACK_LEFT_TURN_ABS_ENC, Rotations.of(0), WHEEL_BASE.div(-2.0), TRACK_WIDTH.div(2.0), @@ -278,9 +278,9 @@ public class DriveConstants { TalonFXConfiguration, TalonFXConfiguration, CANcoderConfiguration> BACK_RIGHT = CONSTANT_CREATOR.createModuleConstants( - CANHD.BACK_RIGHT_TURN, - CANHD.BACK_RIGHT_DRIVE, - CANHD.BACK_RIGHT_TURN_ABS_ENC, + SC1.BACK_RIGHT_TURN, + SC1.BACK_RIGHT_DRIVE, + SC1.BACK_RIGHT_TURN_ABS_ENC, Rotations.of(0), WHEEL_BASE.div(-2.0), TRACK_WIDTH.div(-2.0), diff --git a/src/main/java/frc/robot/subsystems/drive/GyroIO.java b/src/main/java/frc/robot/subsystems/drive/GyroIO.java index 2c0e591..bc47c1a 100644 --- a/src/main/java/frc/robot/subsystems/drive/GyroIO.java +++ b/src/main/java/frc/robot/subsystems/drive/GyroIO.java @@ -7,8 +7,8 @@ package frc.robot.subsystems.drive; -import org.wpilib.math.geometry.Rotation2d; import org.littletonrobotics.junction.AutoLog; +import org.wpilib.math.geometry.Rotation2d; public interface GyroIO { @AutoLog diff --git a/src/main/java/frc/robot/subsystems/drive/GyroIOBoron.java b/src/main/java/frc/robot/subsystems/drive/GyroIOBoron.java index f9413f0..d44fe14 100644 --- a/src/main/java/frc/robot/subsystems/drive/GyroIOBoron.java +++ b/src/main/java/frc/robot/subsystems/drive/GyroIOBoron.java @@ -8,12 +8,12 @@ package frc.robot.subsystems.drive; import com.reduxrobotics.sensors.canandgyro.Canandgyro; -import org.wpilib.math.geometry.Rotation2d; -import org.wpilib.math.util.Units; -import frc.robot.Constants.CANBusPorts.CAN2; +import frc.robot.Constants.CANBusPorts.SC0; import frc.robot.util.CanandgyroThread; import frc.robot.util.CanandgyroThread.GyroInputs; import java.util.Queue; +import org.wpilib.math.geometry.Rotation2d; +import org.wpilib.math.util.Units; /** IO implementation for Redux Canandgyro. */ public class GyroIOBoron implements GyroIO { @@ -23,7 +23,7 @@ public class GyroIOBoron implements GyroIO { private final Queue yawPositionQueue; public GyroIOBoron() { - canandgyro = new Canandgyro(CAN2.GYRO); + canandgyro = new Canandgyro(SC0.GYRO); gyroInputs = CanandgyroThread.getInstance().registerCanandgyro(canandgyro); yawTimestampQueue = PhoenixOdometryThread.getInstance().makeTimestampQueue(); yawPositionQueue = PhoenixOdometryThread.getInstance().registerSignal(canandgyro::getYaw); diff --git a/src/main/java/frc/robot/subsystems/drive/Module.java b/src/main/java/frc/robot/subsystems/drive/Module.java index c6afc99..0df62ed 100644 --- a/src/main/java/frc/robot/subsystems/drive/Module.java +++ b/src/main/java/frc/robot/subsystems/drive/Module.java @@ -12,14 +12,13 @@ import static frc.robot.subsystems.drive.DriveConstants.*; -import org.wpilib.math.geometry.Rotation2d; -import org.wpilib.math.kinematics.SwerveModulePosition; -import org.wpilib.math.kinematics.SwerveModuleState; -import org.wpilib.wpilibj.Alert; -import org.wpilib.wpilibj.Alert.AlertType; -import org.wpilib.wpilibj.Preferences; import frc.robot.Constants.FeatureFlags; import org.littletonrobotics.junction.Logger; +import org.wpilib.driverstation.Alert; +import org.wpilib.math.geometry.Rotation2d; +import org.wpilib.math.kinematics.SwerveModulePosition; +import org.wpilib.math.kinematics.SwerveModuleVelocity; +import org.wpilib.util.Preferences; public class Module { private final ModuleIO io; @@ -34,9 +33,9 @@ public Module(ModuleIO io, String name) { this.io = io; this.name = name; driveDisconnectedAlert = - new Alert("Disconnected drive motor on module " + name + ".", AlertType.kError); + new Alert("Disconnected drive motor on module " + name + ".", Alert.Level.HIGH); turnDisconnectedAlert = - new Alert("Disconnected turn motor on module " + name + ".", AlertType.kError); + new Alert("Disconnected turn motor on module " + name + ".", Alert.Level.HIGH); // Set turn zero from preferences Rotation2d turnZeroFromCancoder = inputs.turnZero; @@ -90,14 +89,12 @@ public void periodic() { } } - /** Runs the module with the specified setpoint state. Mutates the state to optimize it. */ - public void runSetpoint(SwerveModuleState state) { - // Optimize velocity setpoint - state.optimize(getAngle()); - state.cosineScale(inputs.turnPosition); + /** Runs the module with the specified setpoint state. */ + public void runSetpoint(SwerveModuleVelocity state) { + state = state.optimize(getAngle()); + state = state.cosineScale(inputs.turnPosition); - // Apply setpoints - io.setDriveVelocity(state.speedMetersPerSecond / WHEEL_RADIUS_METERS); + io.setDriveVelocity(state.velocity / WHEEL_RADIUS_METERS); io.setTurnPosition(state.angle); } @@ -134,8 +131,8 @@ public SwerveModulePosition getPosition() { } /** Returns the module state (turn angle and drive velocity). */ - public SwerveModuleState getState() { - return new SwerveModuleState(getVelocityMetersPerSec(), getAngle()); + public SwerveModuleVelocity getState() { + return new SwerveModuleVelocity(getVelocityMetersPerSec(), getAngle()); } /** Returns the module positions received this cycle. */ diff --git a/src/main/java/frc/robot/subsystems/drive/ModuleIO.java b/src/main/java/frc/robot/subsystems/drive/ModuleIO.java index 9be5fa0..64d9e3e 100644 --- a/src/main/java/frc/robot/subsystems/drive/ModuleIO.java +++ b/src/main/java/frc/robot/subsystems/drive/ModuleIO.java @@ -7,8 +7,8 @@ package frc.robot.subsystems.drive; -import org.wpilib.math.geometry.Rotation2d; import org.littletonrobotics.junction.AutoLog; +import org.wpilib.math.geometry.Rotation2d; public interface ModuleIO { @AutoLog diff --git a/src/main/java/frc/robot/subsystems/drive/ModuleIOSimWPI.java b/src/main/java/frc/robot/subsystems/drive/ModuleIOSimWPI.java index b85c4d3..bd821da 100644 --- a/src/main/java/frc/robot/subsystems/drive/ModuleIOSimWPI.java +++ b/src/main/java/frc/robot/subsystems/drive/ModuleIOSimWPI.java @@ -10,14 +10,13 @@ import com.ctre.phoenix6.configs.CANcoderConfiguration; import com.ctre.phoenix6.configs.TalonFXConfiguration; import com.ctre.phoenix6.swerve.SwerveModuleConstants; -import org.wpilib.math.MathUtil; import org.wpilib.math.controller.PIDController; import org.wpilib.math.geometry.Rotation2d; -import org.wpilib.math.system.plant.LinearSystemId; +import org.wpilib.math.system.Models; import org.wpilib.math.util.Units; -import org.wpilib.wpilibj.Timer; -import org.wpilib.wpilibj.simulation.DCMotorSim; -import org.wpilib.wpilibj.simulation.RoboRioSim; +import org.wpilib.simulation.DCMotorSim; +import org.wpilib.simulation.RoboRioSim; +import org.wpilib.system.Timer; /** Physics sim implementation of module IO. */ public class ModuleIOSimWPI implements ModuleIO { @@ -47,14 +46,14 @@ public ModuleIOSimWPI( // Create drive and turn sim models driveSim = new DCMotorSim( - LinearSystemId.createDCMotorSystem( + Models.singleJointedArmFromPhysicalConstants( DriveConstants.DRIVE_GEARBOX, constants.DriveInertia, constants.DriveMotorGearRatio), DriveConstants.DRIVE_GEARBOX); turnSim = new DCMotorSim( - LinearSystemId.createDCMotorSystem( + Models.singleJointedArmFromPhysicalConstants( DriveConstants.TURN_GEARBOX, constants.SteerInertia, constants.SteerMotorGearRatio), DriveConstants.TURN_GEARBOX); @@ -66,42 +65,41 @@ public ModuleIOSimWPI( public void updateInputs(ModuleIOInputs inputs) { // Run closed-loop control if (driveClosedLoop) { - driveAppliedVolts = - driveFFVolts + driveController.calculate(driveSim.getAngularVelocityRadPerSec()); + driveAppliedVolts = driveFFVolts + driveController.calculate(driveSim.getAngularVelocity()); } else { driveController.reset(); } if (turnClosedLoop) { - turnAppliedVolts = turnController.calculate(turnSim.getAngularPositionRad()); + turnAppliedVolts = turnController.calculate(turnSim.getAngularPosition()); } else { turnController.reset(); } // Update simulation state double busVoltage = RoboRioSim.getVInVoltage(); - driveSim.setInputVoltage(MathUtil.clamp(driveAppliedVolts, -busVoltage, busVoltage)); - turnSim.setInputVoltage(MathUtil.clamp(turnAppliedVolts, -busVoltage, busVoltage)); + driveSim.setInputVoltage(Math.clamp(driveAppliedVolts, -busVoltage, busVoltage)); + turnSim.setInputVoltage(Math.clamp(turnAppliedVolts, -busVoltage, busVoltage)); driveSim.update(0.02); turnSim.update(0.02); // Update drive inputs inputs.driveConnected = true; - inputs.drivePositionRad = driveSim.getAngularPositionRad(); - inputs.driveVelocityRadPerSec = driveSim.getAngularVelocityRadPerSec(); + inputs.drivePositionRad = driveSim.getAngularPosition(); + inputs.driveVelocityRadPerSec = driveSim.getAngularVelocity(); inputs.driveAppliedVolts = driveAppliedVolts; - inputs.driveCurrentAmps = Math.abs(driveSim.getCurrentDrawAmps()); + inputs.driveCurrentAmps = Math.abs(driveSim.getCurrentDraw()); // Update turn inputs inputs.turnConnected = true; inputs.turnEncoderConnected = true; - inputs.turnAbsolutePosition = new Rotation2d(turnSim.getAngularPositionRad()); - inputs.turnPosition = new Rotation2d(turnSim.getAngularPositionRad()); - inputs.turnVelocityRadPerSec = turnSim.getAngularVelocityRadPerSec(); + inputs.turnAbsolutePosition = new Rotation2d(turnSim.getAngularPosition()); + inputs.turnPosition = new Rotation2d(turnSim.getAngularPosition()); + inputs.turnVelocityRadPerSec = turnSim.getAngularVelocity(); inputs.turnAppliedVolts = turnAppliedVolts; - inputs.turnCurrentAmps = Math.abs(turnSim.getCurrentDrawAmps()); + inputs.turnCurrentAmps = Math.abs(turnSim.getCurrentDraw()); // Update odometry inputs (50Hz because high-frequency odometry in sim doesn't matter) - inputs.odometryTimestamps = new double[] {Timer.getFPGATimestamp()}; + inputs.odometryTimestamps = new double[] {Timer.getTimestamp()}; inputs.odometryDrivePositionsRad = new double[] {inputs.drivePositionRad}; inputs.odometryTurnPositions = new Rotation2d[] {inputs.turnPosition}; } diff --git a/src/main/java/frc/robot/subsystems/drive/ModuleIOTalonFX.java b/src/main/java/frc/robot/subsystems/drive/ModuleIOTalonFX.java index 7dc6cd3..e2c8d4b 100644 --- a/src/main/java/frc/robot/subsystems/drive/ModuleIOTalonFX.java +++ b/src/main/java/frc/robot/subsystems/drive/ModuleIOTalonFX.java @@ -27,6 +27,8 @@ import com.ctre.phoenix6.signals.NeutralModeValue; import com.ctre.phoenix6.signals.SensorDirectionValue; import com.ctre.phoenix6.swerve.SwerveModuleConstants; +import frc.robot.Constants.CANBusPorts.SC1; +import java.util.Queue; import org.wpilib.math.filter.Debouncer; import org.wpilib.math.geometry.Rotation2d; import org.wpilib.math.util.Units; @@ -34,8 +36,6 @@ import org.wpilib.units.measure.AngularVelocity; import org.wpilib.units.measure.Current; import org.wpilib.units.measure.Voltage; -import frc.robot.Constants.CANBusPorts.CANHD; -import java.util.Queue; /** * Module IO implementation for Talon FX drive motor controller, Talon FX turn motor controller, and @@ -96,9 +96,9 @@ public ModuleIOTalonFX( SwerveModuleConstants constants) { this.constants = constants; - driveTalon = new TalonFX(constants.DriveMotorId, CANHD.BUS); - turnTalon = new TalonFX(constants.SteerMotorId, CANHD.BUS); - cancoder = new CANcoder(constants.EncoderId, CANHD.BUS); + driveTalon = new TalonFX(constants.DriveMotorId, SC1.BUS); + turnTalon = new TalonFX(constants.SteerMotorId, SC1.BUS); + cancoder = new CANcoder(constants.EncoderId, SC1.BUS); // Configure drive motor var driveConfig = constants.DriveMotorInitialConfigs; diff --git a/src/main/java/frc/robot/subsystems/drive/PhoenixOdometryThread.java b/src/main/java/frc/robot/subsystems/drive/PhoenixOdometryThread.java index 61e6082..9ec41d2 100644 --- a/src/main/java/frc/robot/subsystems/drive/PhoenixOdometryThread.java +++ b/src/main/java/frc/robot/subsystems/drive/PhoenixOdometryThread.java @@ -12,8 +12,6 @@ import com.ctre.phoenix6.BaseStatusSignal; import com.ctre.phoenix6.CANBus; import com.ctre.phoenix6.StatusSignal; -import org.wpilib.units.measure.Angle; -import org.wpilib.wpilibj.RobotController; import java.util.ArrayList; import java.util.List; import java.util.Queue; @@ -21,6 +19,8 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import java.util.function.DoubleSupplier; +import org.wpilib.system.Timer; +import org.wpilib.units.measure.Angle; /** * Provides an interface for asynchronously reading high-frequency measurements to a set of queues. @@ -133,7 +133,7 @@ public void run() { // Sample timestamp is current FPGA time minus average CAN latency // Default timestamps from Phoenix are NOT compatible with // FPGA timestamps, this solution is imperfect but close - double timestamp = RobotController.getFPGATime() / 1e6; + double timestamp = Timer.getTimestamp(); double totalLatency = 0.0; for (BaseStatusSignal signal : phoenixSignals) { totalLatency += signal.getTimestamp().getLatency(); diff --git a/src/main/java/frc/robot/subsystems/leds/LEDController.java b/src/main/java/frc/robot/subsystems/leds/LEDController.java index b0bdf66..9cc45dd 100644 --- a/src/main/java/frc/robot/subsystems/leds/LEDController.java +++ b/src/main/java/frc/robot/subsystems/leds/LEDController.java @@ -10,16 +10,17 @@ import static org.wpilib.units.Units.Centimeters; import static org.wpilib.units.Units.Seconds; -import org.wpilib.math.MathUtil; -import org.wpilib.math.geometry.Pose2d; -import org.wpilib.wpilibj.DriverStation; -import org.wpilib.wpilibj.DriverStation.Alliance; -import org.wpilib.wpilibj.LEDPattern; -import org.wpilib.wpilibj.util.Color; -import org.wpilib.commandsv2.SubsystemBase; import frc.game.GameState; import frc.robot.Robot; import java.util.function.Supplier; +import org.wpilib.command2.SubsystemBase; +import org.wpilib.driverstation.Alliance; +import org.wpilib.driverstation.MatchState; +import org.wpilib.driverstation.RobotState; +import org.wpilib.hardware.led.LEDPattern; +import org.wpilib.math.geometry.Pose2d; +import org.wpilib.math.util.MathUtil; +import org.wpilib.util.Color; /** * A subsystem to control the LEDs on the robot. @@ -47,9 +48,7 @@ public static synchronized LEDController getInstance() { return instance; } - private LEDController() { - LEDStrip.startAll(); - } + private LEDController() {} /** Pushes LED buffer data to all physical strips each cycle. */ @Override @@ -122,27 +121,27 @@ public void displayPoseSeek(Pose2d currentPose, Pose2d targetPose) { // ==================== PRE-ALLOCATED PATTERNS ==================== /** LEDs off */ - public static final LEDPattern solidBlackPattern = LEDPattern.solid(Color.kBlack); + public static final LEDPattern solidBlackPattern = LEDPattern.solid(Color.BLACK); /** Solid color patterns */ - public static final LEDPattern solidYellowPattern = LEDPattern.solid(Color.kYellow); + public static final LEDPattern solidYellowPattern = LEDPattern.solid(Color.YELLOW); - public static final LEDPattern solidRedPattern = LEDPattern.solid(Color.kRed); - public static final LEDPattern solidGreenPattern = LEDPattern.solid(Color.kGreen); - public static final LEDPattern solidWhitePattern = LEDPattern.solid(Color.kWhite); - public static final LEDPattern solidOrangeRedPattern = LEDPattern.solid(Color.kOrangeRed); + public static final LEDPattern solidRedPattern = LEDPattern.solid(Color.RED); + public static final LEDPattern solidGreenPattern = LEDPattern.solid(Color.GREEN); + public static final LEDPattern solidWhitePattern = LEDPattern.solid(Color.WHITE); + public static final LEDPattern solidOrangeRedPattern = LEDPattern.solid(Color.ORANGE_RED); /** Blinking yellow pattern (0.5s period) for missing auto selection. */ public static final LEDPattern blinkingYellowPattern = - LEDPattern.solid(Color.kYellow).blink(Seconds.of(0.5)); + LEDPattern.solid(Color.YELLOW).blink(Seconds.of(0.5)); /** Bounce ripple pattern in yellow (spindexing, not on target). */ public static final LEDPattern bounceRippleYellowPattern = - LEDCustomPattern.bounceRipple(Color.kYellow); + LEDCustomPattern.bounceRipple(Color.YELLOW); /** Bounce ripple pattern in green (spindexing, on target). */ public static final LEDPattern bounceRippleGreenPattern = - LEDCustomPattern.bounceRipple(Color.kGreen); + LEDCustomPattern.bounceRipple(Color.GREEN); /** * Pattern displaying the selected auto routine as counting blocks in alliance color. The number @@ -170,10 +169,10 @@ public void displayPoseSeek(Pose2d currentPose, Pose2d targetPose) { 10.0, // Fill color () -> { - return GameState.getMyAlliance() == Alliance.Blue ? Color.kBlue : Color.kRed; + return GameState.getMyAlliance() == Alliance.BLUE ? Color.BLUE : Color.RED; }, // Background color - Color.kBlack, + Color.BLACK, // Blink period (0.25s = 4Hz flash) 0.25); @@ -191,7 +190,7 @@ public void displayAutoSelection() { () -> LEDSeries.AUTO_SELECTION.applyPattern(blinkingYellowPattern)); // Display yellow warning pixel if alliance disagreement - DriverStation.getAlliance() + MatchState.getAlliance() .ifPresent( alliance -> { if (alliance != Robot.allianceSelector.getAllianceColor()) { @@ -217,7 +216,7 @@ public void displayAutoSelection() { * Otherwise uses X_AXIS_BODY (LEDs 15-35), leaving WARNING_COMPRESSOR free for other indicators. */ public void displayHubCountdown() { - if (DriverStation.isFMSAttached()) { + if (RobotState.isFMSAttached()) { LEDSeries.X_AXIS_FULL.applyPattern(hubCountdownPattern); } else { LEDSeries.X_AXIS_BODY.applyPattern(hubCountdownPattern); diff --git a/src/main/java/frc/robot/subsystems/leds/LEDCustomPattern.java b/src/main/java/frc/robot/subsystems/leds/LEDCustomPattern.java index 3c95297..dc92470 100644 --- a/src/main/java/frc/robot/subsystems/leds/LEDCustomPattern.java +++ b/src/main/java/frc/robot/subsystems/leds/LEDCustomPattern.java @@ -7,13 +7,15 @@ package frc.robot.subsystems.leds; -import org.wpilib.wpilibj.DriverStation.Alliance; -import org.wpilib.wpilibj.LEDPattern; -import org.wpilib.wpilibj.Timer; -import org.wpilib.wpilibj.util.Color; +import static org.wpilib.units.Units.Hertz; + import frc.robot.Robot; import java.util.function.BooleanSupplier; import java.util.function.Supplier; +import org.wpilib.driverstation.Alliance; +import org.wpilib.hardware.led.LEDPattern; +import org.wpilib.system.Timer; +import org.wpilib.util.Color; /** * Custom LED patterns for the robot. These patterns follow the WPILib LEDPattern design: stateless @@ -33,7 +35,7 @@ private LEDCustomPattern() {} * @return the stacked blocks pattern */ public static LEDPattern stackedBlocks(Color color, int blockSize, int gapSize) { - return stackedBlocks(color, blockSize, gapSize, Color.kBlack); + return stackedBlocks(color, blockSize, gapSize, Color.BLACK); } /** @@ -88,8 +90,7 @@ public static LEDPattern scrollingBlocks(Color color) { * @return a scrolling stacked blocks pattern */ public static LEDPattern scrollingBlocks(Color color, int blockSize, int gapSize) { - return stackedBlocks(color, blockSize, gapSize) - .scrollAtRelativeSpeed(org.wpilib.units.Units.Hertz.of(2)); + return stackedBlocks(color, blockSize, gapSize).scrollAtRelativeVelocity(Hertz.of(2)); } /** @@ -148,8 +149,7 @@ public static LEDPattern urgentCountdown( } // Blink in urgent mode - boolean showFill = - !urgent || ((int) (Timer.getFPGATimestamp() / blinkPeriodSeconds)) % 2 == 0; + boolean showFill = !urgent || ((int) (Timer.getTimestamp() / blinkPeriodSeconds)) % 2 == 0; int filledLeds = (int) Math.ceil(length * Math.max(0, Math.min(1, progress))); Color fillColor = showFill ? colorSupplier.get() : backgroundColor; @@ -201,7 +201,7 @@ public static LEDPattern countingBlocks( if (i < maxLed && (i % period) < blockSize) { writer.setLED(i, color); } else { - writer.setLED(i, Color.kBlack); + writer.setLED(i, Color.BLACK); } } }; @@ -225,7 +225,7 @@ public static LEDPattern bounceRipple( int halfLength = length / 2; // Triangle wave for ping-pong motion (0 to 1 to 0) - double time = Timer.getFPGATimestamp(); + double time = Timer.getTimestamp(); double phase = time * cyclesPerSecond; double sawtooth = phase % 1.0; // 0 -> 1 double triangleWave = Math.abs(sawtooth * 2 - 1); // 0 -> 1 -> 0 @@ -265,7 +265,7 @@ else if (tailLength > 0) { i, new Color(color.red * brightness, color.green * brightness, color.blue * brightness)); } else { - writer.setLED(i, Color.kBlack); + writer.setLED(i, Color.BLACK); } } }; @@ -302,7 +302,7 @@ public static LEDPattern bounceRipple(Color color) { public static LEDPattern allianceColor() { if (allianceColorPattern == null) { allianceColorPattern = - solidIf(() -> Robot.getAlliance() == Alliance.Blue, Color.kBlue, Color.kRed); + solidIf(() -> Robot.getAlliance() == Alliance.BLUE, Color.BLUE, Color.RED); } return allianceColorPattern; } diff --git a/src/main/java/frc/robot/subsystems/leds/LEDGroup.java b/src/main/java/frc/robot/subsystems/leds/LEDGroup.java index 4af3576..b180394 100644 --- a/src/main/java/frc/robot/subsystems/leds/LEDGroup.java +++ b/src/main/java/frc/robot/subsystems/leds/LEDGroup.java @@ -7,10 +7,10 @@ package frc.robot.subsystems.leds; -import org.wpilib.wpilibj.AddressableLEDBufferView; -import org.wpilib.wpilibj.LEDPattern; -import org.wpilib.wpilibj.LEDReader; -import org.wpilib.wpilibj.LEDWriter; +import org.wpilib.hardware.led.AddressableLEDBufferView; +import org.wpilib.hardware.led.LEDPattern; +import org.wpilib.hardware.led.LEDReader; +import org.wpilib.hardware.led.LEDWriter; /** * Defines logical LED groups on the robot. Each group can span multiple physical strips, composed diff --git a/src/main/java/frc/robot/subsystems/leds/LEDSeries.java b/src/main/java/frc/robot/subsystems/leds/LEDSeries.java index 18e0105..10f89f6 100644 --- a/src/main/java/frc/robot/subsystems/leds/LEDSeries.java +++ b/src/main/java/frc/robot/subsystems/leds/LEDSeries.java @@ -7,10 +7,10 @@ package frc.robot.subsystems.leds; -import org.wpilib.wpilibj.AddressableLEDBufferView; -import org.wpilib.wpilibj.LEDPattern; -import org.wpilib.wpilibj.LEDReader; -import org.wpilib.wpilibj.LEDWriter; +import org.wpilib.hardware.led.AddressableLEDBufferView; +import org.wpilib.hardware.led.LEDPattern; +import org.wpilib.hardware.led.LEDReader; +import org.wpilib.hardware.led.LEDWriter; /** * Defines logical LED series on the robot. Each series can span multiple physical strips, composed diff --git a/src/main/java/frc/robot/subsystems/leds/LEDStrip.java b/src/main/java/frc/robot/subsystems/leds/LEDStrip.java index d6eab7a..22bf8a2 100644 --- a/src/main/java/frc/robot/subsystems/leds/LEDStrip.java +++ b/src/main/java/frc/robot/subsystems/leds/LEDStrip.java @@ -7,9 +7,9 @@ package frc.robot.subsystems.leds; -import org.wpilib.wpilibj.AddressableLED; -import org.wpilib.wpilibj.AddressableLEDBuffer; -import org.wpilib.wpilibj.AddressableLEDBufferView; +import org.wpilib.hardware.led.AddressableLED; +import org.wpilib.hardware.led.AddressableLEDBuffer; +import org.wpilib.hardware.led.AddressableLEDBufferView; /** * Defines the physical LED strips on the robot. Each strip is connected to a PWM port and has a @@ -27,7 +27,6 @@ public enum LEDStrip { private final int length; private AddressableLED led; private AddressableLEDBuffer buffer; - private boolean started = false; LEDStrip(int port, int length) { this.port = port; @@ -58,15 +57,6 @@ public AddressableLEDBufferView createReversedView(int start, int end) { return getBuffer().createView(start, end).reversed(); } - /** Starts this strip. Must be called before the strip will display anything. */ - public void start() { - if (!started) { - getBuffer(); // Ensure LED and buffer are created - led.start(); - started = true; - } - } - /** Pushes buffer data to the physical LED strip. */ public void update() { if (led != null) { @@ -74,13 +64,6 @@ public void update() { } } - /** Starts all physical LED strips. Call once during robot initialization. */ - public static void startAll() { - for (LEDStrip strip : values()) { - strip.start(); - } - } - /** Updates all physical LED strips with their current buffer data. */ public static void updateAll() { for (LEDStrip strip : values()) { diff --git a/src/main/java/frc/robot/subsystems/vision/Vision.java b/src/main/java/frc/robot/subsystems/vision/Vision.java index eac12ae..5d390b1 100644 --- a/src/main/java/frc/robot/subsystems/vision/Vision.java +++ b/src/main/java/frc/robot/subsystems/vision/Vision.java @@ -12,19 +12,6 @@ import static frc.robot.subsystems.vision.VisionConstants.*; -import org.wpilib.apriltag.AprilTagFieldLayout; -import org.wpilib.math.Matrix; -import org.wpilib.math.VecBuilder; -import org.wpilib.math.filter.LinearFilter; -import org.wpilib.math.geometry.Pose2d; -import org.wpilib.math.geometry.Pose3d; -import org.wpilib.math.geometry.Rotation2d; -import org.wpilib.math.numbers.N1; -import org.wpilib.math.numbers.N3; -import org.wpilib.wpilibj.Alert; -import org.wpilib.wpilibj.Alert.AlertType; -import org.wpilib.wpilibj.DriverStation; -import org.wpilib.commandsv2.SubsystemBase; import frc.robot.Constants.FeatureFlags; import frc.robot.subsystems.vision.VisionFilter.FusedObservation; import frc.robot.subsystems.vision.VisionFilter.Test; @@ -36,6 +23,18 @@ import java.util.EnumSet; import java.util.function.Supplier; import org.littletonrobotics.junction.Logger; +import org.wpilib.command2.SubsystemBase; +import org.wpilib.driverstation.Alert; +import org.wpilib.driverstation.RobotState; +import org.wpilib.math.filter.LinearFilter; +import org.wpilib.math.geometry.Pose2d; +import org.wpilib.math.geometry.Pose3d; +import org.wpilib.math.geometry.Rotation2d; +import org.wpilib.math.linalg.Matrix; +import org.wpilib.math.linalg.VecBuilder; +import org.wpilib.math.numbers.N1; +import org.wpilib.math.numbers.N3; +import org.wpilib.vision.apriltag.AprilTagFieldLayout; public class Vision extends SubsystemBase { private final VisionConsumer consumer; @@ -107,7 +106,7 @@ public Vision(VisionConsumer consumer, Supplier gyroYawSupplier, Vis for (int i = 0; i < inputs.length; i++) { disconnectedAlerts[i] = new Alert( - "Vision camera " + Integer.toString(i) + " is disconnected.", AlertType.kWarning); + "Vision camera " + Integer.toString(i) + " is disconnected.", Alert.Level.MEDIUM); } } @@ -314,7 +313,7 @@ public void accept( public static synchronized AprilTagFieldLayout getAprilTagLayout() { if (cachedLayout == null) { // Try to load custom layout only if requested and not connected to FMS - if (USE_CUSTOM_APRIL_TAG_LAYOUT && !DriverStation.isFMSAttached()) { + if (USE_CUSTOM_APRIL_TAG_LAYOUT && !RobotState.isFMSAttached()) { try { cachedLayout = new AprilTagFieldLayout(CUSTOM_APRIL_TAG_LAYOUT_PATH); } catch (IOException e) { diff --git a/src/main/java/frc/robot/subsystems/vision/VisionConstants.java b/src/main/java/frc/robot/subsystems/vision/VisionConstants.java index b710ecb..37dea89 100644 --- a/src/main/java/frc/robot/subsystems/vision/VisionConstants.java +++ b/src/main/java/frc/robot/subsystems/vision/VisionConstants.java @@ -9,21 +9,21 @@ import static org.wpilib.units.Units.*; -import org.wpilib.apriltag.AprilTagFields; +import frc.robot.subsystems.drive.DriveConstants; import org.wpilib.math.geometry.Quaternion; import org.wpilib.math.geometry.Rotation3d; import org.wpilib.math.geometry.Transform3d; +import org.wpilib.system.Filesystem; import org.wpilib.units.measure.Angle; import org.wpilib.units.measure.Distance; -import org.wpilib.wpilibj.Filesystem; -import frc.robot.subsystems.drive.DriveConstants; +import org.wpilib.vision.apriltag.AprilTagFields; public class VisionConstants { public static String CUSTOM_APRIL_TAG_LAYOUT_PATH = Filesystem.getDeployDirectory() + "/stemgym-2026.json"; public static Boolean USE_CUSTOM_APRIL_TAG_LAYOUT = false; - public static AprilTagFields DEFAULT_APRIL_TAG_FIELD_LAYOUT = AprilTagFields.k2026RebuiltAndymark; + public static AprilTagFields DEFAULT_APRIL_TAG_FIELD_LAYOUT = AprilTagFields.kDefaultField; /** Pairs a camera's coprocessor name with its robot-to-camera transform. */ public record CameraConfig(String name, Transform3d robotToCamera) {} diff --git a/src/main/java/frc/robot/subsystems/vision/VisionFilter.java b/src/main/java/frc/robot/subsystems/vision/VisionFilter.java index b71e19a..4f5762e 100644 --- a/src/main/java/frc/robot/subsystems/vision/VisionFilter.java +++ b/src/main/java/frc/robot/subsystems/vision/VisionFilter.java @@ -9,11 +9,6 @@ import static frc.robot.subsystems.vision.VisionConstants.*; -import org.wpilib.math.MathUtil; -import org.wpilib.math.geometry.Pose2d; -import org.wpilib.math.geometry.Rectangle2d; -import org.wpilib.math.geometry.Rotation2d; -import org.wpilib.math.geometry.Translation2d; import frc.robot.subsystems.vision.VisionIO.PoseObservation; import java.util.ArrayList; import java.util.EnumMap; @@ -22,6 +17,11 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; +import org.wpilib.math.geometry.Pose2d; +import org.wpilib.math.geometry.Rectangle2d; +import org.wpilib.math.geometry.Rotation2d; +import org.wpilib.math.geometry.Translation2d; +import org.wpilib.math.util.MathUtil; /** * Handles scoring and filtering of vision observations. diff --git a/src/main/java/frc/robot/subsystems/vision/VisionIO.java b/src/main/java/frc/robot/subsystems/vision/VisionIO.java index 1e4b469..9c5ba3d 100644 --- a/src/main/java/frc/robot/subsystems/vision/VisionIO.java +++ b/src/main/java/frc/robot/subsystems/vision/VisionIO.java @@ -10,9 +10,9 @@ package frc.robot.subsystems.vision; +import org.littletonrobotics.junction.AutoLog; import org.wpilib.math.geometry.Pose3d; import org.wpilib.math.geometry.Rotation2d; -import org.littletonrobotics.junction.AutoLog; public interface VisionIO { public static final TargetObservation EMPTY_TARGET = diff --git a/src/main/java/frc/robot/subsystems/vision/VisionIOPhotonVision.java b/src/main/java/frc/robot/subsystems/vision/VisionIOPhotonVision.java index a8e27cd..4e59bef 100644 --- a/src/main/java/frc/robot/subsystems/vision/VisionIOPhotonVision.java +++ b/src/main/java/frc/robot/subsystems/vision/VisionIOPhotonVision.java @@ -10,17 +10,17 @@ package frc.robot.subsystems.vision; -import org.wpilib.math.geometry.Pose3d; -import org.wpilib.math.geometry.Rotation2d; -import org.wpilib.math.geometry.Transform3d; -import org.wpilib.networktables.DoubleSubscriber; -import org.wpilib.networktables.NetworkTableInstance; import frc.robot.subsystems.vision.VisionConstants.CameraConfig; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import org.photonvision.PhotonCamera; +import org.wpilib.math.geometry.Pose3d; +import org.wpilib.math.geometry.Rotation2d; +import org.wpilib.math.geometry.Transform3d; +import org.wpilib.networktables.DoubleSubscriber; +import org.wpilib.networktables.NetworkTableInstance; /** IO implementation for real PhotonVision hardware. */ public class VisionIOPhotonVision implements VisionIO { diff --git a/src/main/java/frc/robot/subsystems/vision/VisionIOPhotonVisionSim.java b/src/main/java/frc/robot/subsystems/vision/VisionIOPhotonVisionSim.java index c044821..26de377 100644 --- a/src/main/java/frc/robot/subsystems/vision/VisionIOPhotonVisionSim.java +++ b/src/main/java/frc/robot/subsystems/vision/VisionIOPhotonVisionSim.java @@ -10,13 +10,13 @@ package frc.robot.subsystems.vision; -import org.wpilib.math.geometry.Pose2d; -import org.wpilib.math.geometry.Rotation2d; import frc.robot.subsystems.vision.VisionConstants.CameraConfig; import java.util.function.Supplier; import org.photonvision.simulation.PhotonCameraSim; import org.photonvision.simulation.SimCameraProperties; import org.photonvision.simulation.VisionSystemSim; +import org.wpilib.math.geometry.Pose2d; +import org.wpilib.math.geometry.Rotation2d; /** IO implementation for physics sim using PhotonVision simulator. */ public class VisionIOPhotonVisionSim extends VisionIOPhotonVision { diff --git a/src/main/java/frc/robot/util/CanandgyroThread.java b/src/main/java/frc/robot/util/CanandgyroThread.java index 23c8758..f4af46d 100644 --- a/src/main/java/frc/robot/util/CanandgyroThread.java +++ b/src/main/java/frc/robot/util/CanandgyroThread.java @@ -8,11 +8,11 @@ package frc.robot.util; import com.reduxrobotics.sensors.canandgyro.Canandgyro; -import org.wpilib.wpilibj.Notifier; -import org.wpilib.wpilibj.RobotController; import java.util.ArrayList; import java.util.List; import java.util.concurrent.locks.ReentrantLock; +import org.wpilib.system.Notifier; +import org.wpilib.system.Timer; /** * Provides an interface for asynchronously reading Canandgyro inputs on a background thread, @@ -47,7 +47,7 @@ private void update() { calibrating = gyro.isCalibrating(); yaw = gyro.getYaw(); angularVelocityYaw = gyro.getAngularVelocityYaw(); - timestamp = RobotController.getFPGATime() / 1e6; + timestamp = Timer.getTimestamp(); } // Getters for cached values (called from main thread) diff --git a/src/main/java/frc/robot/util/KernelLogMonitor.java b/src/main/java/frc/robot/util/KernelLogMonitor.java index f3655aa..2093474 100644 --- a/src/main/java/frc/robot/util/KernelLogMonitor.java +++ b/src/main/java/frc/robot/util/KernelLogMonitor.java @@ -7,7 +7,6 @@ package frc.robot.util; -import org.wpilib.wpilibj.RobotBase; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -20,6 +19,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Pattern; import org.littletonrobotics.junction.Logger; +import org.wpilib.framework.RobotBase; /** * Monitors RoboRIO kernel logs for unexpected events (USB disconnects, ESD events, hardware errors) diff --git a/src/main/java/frc/robot/util/LocalADStarAK.java b/src/main/java/frc/robot/util/LocalADStarAK.java index ab33b63..0736e63 100644 --- a/src/main/java/frc/robot/util/LocalADStarAK.java +++ b/src/main/java/frc/robot/util/LocalADStarAK.java @@ -13,14 +13,14 @@ import com.pathplanner.lib.path.PathPoint; import com.pathplanner.lib.pathfinding.LocalADStar; import com.pathplanner.lib.pathfinding.Pathfinder; -import org.wpilib.math.Pair; -import org.wpilib.math.geometry.Translation2d; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.littletonrobotics.junction.LogTable; import org.littletonrobotics.junction.Logger; import org.littletonrobotics.junction.inputs.LoggableInputs; +import org.wpilib.math.geometry.Translation2d; +import org.wpilib.math.util.Pair; // NOTE: This file is available at // https://gist.github.com/mjansen4857/a8024b55eb427184dbd10ae8923bd57d diff --git a/src/main/java/frc/robot/util/SparkOdometryThread.java b/src/main/java/frc/robot/util/SparkOdometryThread.java index f235dc2..16286c6 100644 --- a/src/main/java/frc/robot/util/SparkOdometryThread.java +++ b/src/main/java/frc/robot/util/SparkOdometryThread.java @@ -8,15 +8,16 @@ package frc.robot.util; import com.revrobotics.AbsoluteEncoder; -import com.revrobotics.REVLibError; import com.revrobotics.RelativeEncoder; import com.revrobotics.spark.SparkBase; -import org.wpilib.wpilibj.Notifier; -import org.wpilib.wpilibj.RobotController; +import com.revrobotics.util.Signal; import java.util.ArrayList; import java.util.List; import java.util.concurrent.locks.ReentrantLock; import java.util.function.DoubleSupplier; +import java.util.function.Supplier; +import org.wpilib.system.Notifier; +import org.wpilib.system.Timer; /** * Provides an interface for asynchronously reading SparkMax/SparkFlex inputs on a background @@ -33,8 +34,8 @@ public class SparkOdometryThread { /** Cached inputs for a single SparkMax/SparkFlex device. */ public static class SparkInputs { private final SparkBase spark; - private final DoubleSupplier positionSupplier; - private final DoubleSupplier velocitySupplier; + private final Supplier> positionSignal; + private final Supplier> velocitySignal; private final DoubleSupplier[] additionalSuppliers; // Cached values (volatile for thread safety) @@ -50,18 +51,18 @@ public static class SparkInputs { * Creates SparkInputs for a device. * * @param spark The SparkBase device - * @param positionSupplier Supplier for encoder position - * @param velocitySupplier Supplier for encoder velocity + * @param positionSignal Supplier for encoder position Signal + * @param velocitySignal Supplier for encoder velocity Signal * @param additionalSuppliers Optional additional values to read */ public SparkInputs( SparkBase spark, - DoubleSupplier positionSupplier, - DoubleSupplier velocitySupplier, + Supplier> positionSignal, + Supplier> velocitySignal, DoubleSupplier... additionalSuppliers) { this.spark = spark; - this.positionSupplier = positionSupplier; - this.velocitySupplier = velocitySupplier; + this.positionSignal = positionSignal; + this.velocitySignal = velocitySignal; this.additionalSuppliers = additionalSuppliers; this.additionalValues = new double[additionalSuppliers.length]; } @@ -70,47 +71,40 @@ public SparkInputs( private void update() { boolean ok = true; - double pos = positionSupplier.getAsDouble(); - if (spark.getLastError() == REVLibError.kOk) { - position = pos; + Signal posSig = positionSignal.get(); + if (posSig.isValid()) { + position = posSig.get(); } else { ok = false; } - double vel = velocitySupplier.getAsDouble(); - if (spark.getLastError() == REVLibError.kOk) { - velocity = vel; + Signal velSig = velocitySignal.get(); + if (velSig.isValid()) { + velocity = velSig.get(); } else { ok = false; } - double output = spark.getAppliedOutput(); - boolean outputOk = spark.getLastError() == REVLibError.kOk; - double voltage = spark.getBusVoltage(); - boolean voltageOk = spark.getLastError() == REVLibError.kOk; - if (outputOk && voltageOk) { - appliedVolts = output * voltage; + Signal outputSig = spark.getAppliedOutput(); + Signal voltageSig = spark.getBusVoltage(); + if (outputSig.isValid() && voltageSig.isValid()) { + appliedVolts = outputSig.get() * voltageSig.get(); } else { ok = false; } - double current = spark.getOutputCurrent(); - if (spark.getLastError() == REVLibError.kOk) { - outputCurrent = current; + Signal currentSig = spark.getOutputCurrent(); + if (currentSig.isValid()) { + outputCurrent = currentSig.get(); } else { ok = false; } for (int i = 0; i < additionalSuppliers.length; i++) { - double val = additionalSuppliers[i].getAsDouble(); - if (spark.getLastError() == REVLibError.kOk) { - additionalValues[i] = val; - } else { - ok = false; - } + additionalValues[i] = additionalSuppliers[i].getAsDouble(); } - timestamp = RobotController.getFPGATime() / 1e6; + timestamp = Timer.getTimestamp(); connected = ok; } diff --git a/src/main/java/frc/robot/util/VisionThread.java b/src/main/java/frc/robot/util/VisionThread.java index 5c3de4a..20e364e 100644 --- a/src/main/java/frc/robot/util/VisionThread.java +++ b/src/main/java/frc/robot/util/VisionThread.java @@ -7,7 +7,6 @@ package frc.robot.util; -import org.wpilib.wpilibj.Notifier; import frc.robot.subsystems.vision.VisionIO; import frc.robot.subsystems.vision.VisionIO.PoseObservation; import frc.robot.subsystems.vision.VisionIO.TargetObservation; @@ -15,6 +14,7 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.locks.ReentrantLock; +import org.wpilib.system.Notifier; /** * Provides an interface for asynchronously reading vision inputs on a background thread, avoiding diff --git a/src/test/java/frc/robot/subsystems/vision/VisionFilterTest.java b/src/test/java/frc/robot/subsystems/vision/VisionFilterTest.java index 055fb11..db586da 100644 --- a/src/test/java/frc/robot/subsystems/vision/VisionFilterTest.java +++ b/src/test/java/frc/robot/subsystems/vision/VisionFilterTest.java @@ -2,10 +2,6 @@ import static org.junit.jupiter.api.Assertions.*; -import org.wpilib.math.geometry.Pose2d; -import org.wpilib.math.geometry.Pose3d; -import org.wpilib.math.geometry.Rotation2d; -import org.wpilib.math.geometry.Rotation3d; import frc.robot.subsystems.vision.VisionFilter.FusedObservation; import frc.robot.subsystems.vision.VisionFilter.Test; import frc.robot.subsystems.vision.VisionFilter.TestContext; @@ -17,6 +13,10 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Nested; +import org.wpilib.math.geometry.Pose2d; +import org.wpilib.math.geometry.Pose3d; +import org.wpilib.math.geometry.Rotation2d; +import org.wpilib.math.geometry.Rotation3d; class VisionFilterTest { diff --git a/vendordeps/AdvantageKit.json b/vendordeps/AdvantageKit.json index 177ee85..1a8abd5 100644 --- a/vendordeps/AdvantageKit.json +++ b/vendordeps/AdvantageKit.json @@ -1,35 +1,35 @@ { - "fileName": "AdvantageKit.json", - "name": "AdvantageKit", - "version": "27.0.0-alpha-4", - "uuid": "d820cc26-74e3-11ec-90d6-0242ac120003", - "wpilibYear": "2027_alpha5", - "mavenUrls": [ - "https://frcmaven.wpi.edu/artifactory/littletonrobotics-mvn-release/" - ], - "jsonUrl": "https://github.com/Mechanical-Advantage/AdvantageKit/releases/latest/download/AdvantageKit.json", - "javaDependencies": [ - { - "groupId": "org.littletonrobotics.akit", - "artifactId": "akit-java", - "version": "27.0.0-alpha-4" - } - ], - "jniDependencies": [ - { - "groupId": "org.littletonrobotics.akit", - "artifactId": "akit-wpilibio", - "version": "27.0.0-alpha-4", - "skipInvalidPlatforms": false, - "isJar": false, - "validPlatforms": [ - "linuxsystemcore", - "linuxx86-64", - "linuxarm64", - "osxuniversal", - "windowsx86-64" - ] - } - ], - "cppDependencies": [] -} \ No newline at end of file + "fileName": "AdvantageKit.json", + "name": "AdvantageKit", + "version": "27.0.0-alpha-4", + "uuid": "d820cc26-74e3-11ec-90d6-0242ac120003", + "wpilibYear": "2027_alpha5", + "mavenUrls": [ + "https://frcmaven.wpi.edu/artifactory/littletonrobotics-mvn-release/" + ], + "jsonUrl": "https://github.com/Mechanical-Advantage/AdvantageKit/releases/latest/download/AdvantageKit.json", + "javaDependencies": [ + { + "groupId": "org.littletonrobotics.akit", + "artifactId": "akit-java", + "version": "27.0.0-alpha-4" + } + ], + "jniDependencies": [ + { + "groupId": "org.littletonrobotics.akit", + "artifactId": "akit-wpilibio", + "version": "27.0.0-alpha-4", + "skipInvalidPlatforms": false, + "isJar": false, + "validPlatforms": [ + "linuxsystemcore", + "linuxx86-64", + "linuxarm64", + "osxuniversal", + "windowsx86-64" + ] + } + ], + "cppDependencies": [] +} diff --git a/vendordeps/ChoreoLib2026.json b/vendordeps/ChoreoLib2027Alpha.json similarity index 72% rename from vendordeps/ChoreoLib2026.json rename to vendordeps/ChoreoLib2027Alpha.json index 7665da4..1b6447e 100644 --- a/vendordeps/ChoreoLib2026.json +++ b/vendordeps/ChoreoLib2027Alpha.json @@ -1,19 +1,18 @@ { - "fileName": "ChoreoLib2026.json", + "fileName": "ChoreoLib2027Alpha.json", "name": "ChoreoLib", - "version": "2026.0.3", + "version": "2027.0.0-alpha-1", "uuid": "b5e23f0a-dac9-4ad2-8dd6-02767c520aca", - "frcYear": "2026", + "wpilibYear": "2027_alpha5", "mavenUrls": [ - "https://frcmaven.wpi.edu/artifactory/sleipnirgroup-mvn-release/", - "https://repo1.maven.org/maven2" + "https://frcmaven.wpi.edu/artifactory/sleipnirgroup-mvn-release/" ], - "jsonUrl": "https://choreo.autos/lib/ChoreoLib2026.json", + "jsonUrl": "https://choreo.autos/lib/ChoreoLib2027Alpha.json", "javaDependencies": [ { "groupId": "choreo", "artifactId": "ChoreoLib-java", - "version": "2026.0.3" + "version": "2027.0.0-alpha-1" }, { "groupId": "com.google.code.gson", @@ -26,7 +25,7 @@ { "groupId": "choreo", "artifactId": "ChoreoLib-cpp", - "version": "2026.0.3", + "version": "2027.0.0-alpha-1", "libName": "ChoreoLib", "headerClassifier": "headers", "sharedLibrary": false, @@ -35,9 +34,9 @@ "windowsx86-64", "linuxx86-64", "osxuniversal", - "linuxathena", "linuxarm32", - "linuxarm64" + "linuxarm64", + "linuxsystemcore" ] } ] diff --git a/vendordeps/PathplannerLibSystemCoreAlpha.json b/vendordeps/PathplannerLibSystemCoreAlpha.json index 24d3c8c..9b36d2b 100644 --- a/vendordeps/PathplannerLibSystemCoreAlpha.json +++ b/vendordeps/PathplannerLibSystemCoreAlpha.json @@ -1,37 +1,37 @@ { - "fileName": "PathplannerLibSystemCoreAlpha.json", - "name": "PathplannerLib", - "version": "2027.0.0-alpha-3", - "uuid": "1b42324f-17c6-4875-8e77-1c312bc8c786", - "wpilibYear": "2027_alpha5", - "mavenUrls": [ - "https://3015rangerrobotics.github.io/pathplannerlib/repo" - ], - "jsonUrl": "https://3015rangerrobotics.github.io/pathplannerlib/PathplannerLibSystemCoreAlpha.json", - "javaDependencies": [ - { - "groupId": "com.pathplanner.lib", - "artifactId": "PathplannerLib-java", - "version": "2027.0.0-alpha-3" - } - ], - "jniDependencies": [], - "cppDependencies": [ - { - "groupId": "com.pathplanner.lib", - "artifactId": "PathplannerLib-cpp", - "version": "2027.0.0-alpha-3", - "libName": "PathplannerLib", - "headerClassifier": "headers", - "sharedLibrary": false, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "osxuniversal", - "linuxsystemcore", - "linuxarm64" - ] - } - ] -} \ No newline at end of file + "fileName": "PathplannerLibSystemCoreAlpha.json", + "name": "PathplannerLib", + "version": "2027.0.0-alpha-3", + "uuid": "1b42324f-17c6-4875-8e77-1c312bc8c786", + "wpilibYear": "2027_alpha5", + "mavenUrls": [ + "https://3015rangerrobotics.github.io/pathplannerlib/repo" + ], + "jsonUrl": "https://3015rangerrobotics.github.io/pathplannerlib/PathplannerLibSystemCoreAlpha.json", + "javaDependencies": [ + { + "groupId": "com.pathplanner.lib", + "artifactId": "PathplannerLib-java", + "version": "2027.0.0-alpha-3" + } + ], + "jniDependencies": [], + "cppDependencies": [ + { + "groupId": "com.pathplanner.lib", + "artifactId": "PathplannerLib-cpp", + "version": "2027.0.0-alpha-3", + "libName": "PathplannerLib", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "osxuniversal", + "linuxsystemcore", + "linuxarm64" + ] + } + ] +} diff --git a/vendordeps/Phoenix6-26.50.0-alpha-1.json b/vendordeps/Phoenix6-26.50.0-alpha-1.json index f7db60a..40dd410 100644 --- a/vendordeps/Phoenix6-26.50.0-alpha-1.json +++ b/vendordeps/Phoenix6-26.50.0-alpha-1.json @@ -1,449 +1,449 @@ { - "fileName": "Phoenix6-26.50.0-alpha-1.json", - "name": "CTRE-Phoenix (v6)", - "version": "26.50.0-alpha-1", - "wpilibYear": "2027_alpha5", - "uuid": "e995de00-2c64-4df5-8831-c1441420ff19", - "mavenUrls": [ - "https://maven.ctr-electronics.com/release/" - ], - "jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-frc2027-latest.json", - "conflictsWith": [ - { - "uuid": "e7900d8d-826f-4dca-a1ff-182f658e98af", - "errorMessage": "Users cannot have both the replay and regular Phoenix 6 vendordeps in their robot program.", - "offlineFileName": "Phoenix6-replay-frc2027-latest.json" - } - ], - "javaDependencies": [ - { - "groupId": "com.ctre.phoenix6", - "artifactId": "wpiapi-java", - "version": "26.50.0-alpha-1" - } - ], - "jniDependencies": [ - { - "groupId": "com.ctre.phoenix6", - "artifactId": "api-cpp", - "version": "26.50.0-alpha-1", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "linuxsystemcore" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix6", - "artifactId": "tools", - "version": "26.50.0-alpha-1", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "linuxsystemcore" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "api-cpp-sim", - "version": "26.50.0-alpha-1", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "tools-sim", - "version": "26.50.0-alpha-1", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simTalonSRX", - "version": "26.50.0-alpha-1", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simVictorSPX", - "version": "26.50.0-alpha-1", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simPigeonIMU", - "version": "26.50.0-alpha-1", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProTalonFX", - "version": "26.50.0-alpha-1", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProTalonFXS", - "version": "26.50.0-alpha-1", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProCANcoder", - "version": "26.50.0-alpha-1", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProPigeon2", - "version": "26.50.0-alpha-1", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProCANrange", - "version": "26.50.0-alpha-1", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProCANdi", - "version": "26.50.0-alpha-1", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProCANdle", - "version": "26.50.0-alpha-1", - "isJar": false, - "skipInvalidPlatforms": true, - "validPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - } - ], - "cppDependencies": [ - { - "groupId": "com.ctre.phoenix6", - "artifactId": "wpiapi-cpp", - "version": "26.50.0-alpha-1", - "libName": "CTRE_Phoenix6_WPI", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "linuxsystemcore" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix6", - "artifactId": "tools", - "version": "26.50.0-alpha-1", - "libName": "CTRE_PhoenixTools", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "linuxsystemcore" - ], - "simMode": "hwsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "wpiapi-cpp-sim", - "version": "26.50.0-alpha-1", - "libName": "CTRE_Phoenix6_WPISim", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "tools-sim", - "version": "26.50.0-alpha-1", - "libName": "CTRE_PhoenixTools_Sim", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simTalonSRX", - "version": "26.50.0-alpha-1", - "libName": "CTRE_SimTalonSRX", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simVictorSPX", - "version": "26.50.0-alpha-1", - "libName": "CTRE_SimVictorSPX", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simPigeonIMU", - "version": "26.50.0-alpha-1", - "libName": "CTRE_SimPigeonIMU", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProTalonFX", - "version": "26.50.0-alpha-1", - "libName": "CTRE_SimProTalonFX", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProTalonFXS", - "version": "26.50.0-alpha-1", - "libName": "CTRE_SimProTalonFXS", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProCANcoder", - "version": "26.50.0-alpha-1", - "libName": "CTRE_SimProCANcoder", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProPigeon2", - "version": "26.50.0-alpha-1", - "libName": "CTRE_SimProPigeon2", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProCANrange", - "version": "26.50.0-alpha-1", - "libName": "CTRE_SimProCANrange", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProCANdi", - "version": "26.50.0-alpha-1", - "libName": "CTRE_SimProCANdi", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - }, - { - "groupId": "com.ctre.phoenix6.sim", - "artifactId": "simProCANdle", - "version": "26.50.0-alpha-1", - "libName": "CTRE_SimProCANdle", - "headerClassifier": "headers", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxx86-64", - "linuxarm64", - "osxuniversal" - ], - "simMode": "swsim" - } - ] -} \ No newline at end of file + "fileName": "Phoenix6-26.50.0-alpha-1.json", + "name": "CTRE-Phoenix (v6)", + "version": "26.50.0-alpha-1", + "wpilibYear": "2027_alpha5", + "uuid": "e995de00-2c64-4df5-8831-c1441420ff19", + "mavenUrls": [ + "https://maven.ctr-electronics.com/release/" + ], + "jsonUrl": "https://maven.ctr-electronics.com/release/com/ctre/phoenix6/latest/Phoenix6-frc2027-latest.json", + "conflictsWith": [ + { + "uuid": "e7900d8d-826f-4dca-a1ff-182f658e98af", + "errorMessage": "Users cannot have both the replay and regular Phoenix 6 vendordeps in their robot program.", + "offlineFileName": "Phoenix6-replay-frc2027-latest.json" + } + ], + "javaDependencies": [ + { + "groupId": "com.ctre.phoenix6", + "artifactId": "wpiapi-java", + "version": "26.50.0-alpha-1" + } + ], + "jniDependencies": [ + { + "groupId": "com.ctre.phoenix6", + "artifactId": "api-cpp", + "version": "26.50.0-alpha-1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "linuxsystemcore" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6", + "artifactId": "tools", + "version": "26.50.0-alpha-1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "linuxsystemcore" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "api-cpp-sim", + "version": "26.50.0-alpha-1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "tools-sim", + "version": "26.50.0-alpha-1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonSRX", + "version": "26.50.0-alpha-1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simVictorSPX", + "version": "26.50.0-alpha-1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simPigeonIMU", + "version": "26.50.0-alpha-1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFX", + "version": "26.50.0-alpha-1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFXS", + "version": "26.50.0-alpha-1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANcoder", + "version": "26.50.0-alpha-1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProPigeon2", + "version": "26.50.0-alpha-1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANrange", + "version": "26.50.0-alpha-1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANdi", + "version": "26.50.0-alpha-1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANdle", + "version": "26.50.0-alpha-1", + "isJar": false, + "skipInvalidPlatforms": true, + "validPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + } + ], + "cppDependencies": [ + { + "groupId": "com.ctre.phoenix6", + "artifactId": "wpiapi-cpp", + "version": "26.50.0-alpha-1", + "libName": "CTRE_Phoenix6_WPI", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "linuxsystemcore" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6", + "artifactId": "tools", + "version": "26.50.0-alpha-1", + "libName": "CTRE_PhoenixTools", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "linuxsystemcore" + ], + "simMode": "hwsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "wpiapi-cpp-sim", + "version": "26.50.0-alpha-1", + "libName": "CTRE_Phoenix6_WPISim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "tools-sim", + "version": "26.50.0-alpha-1", + "libName": "CTRE_PhoenixTools_Sim", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simTalonSRX", + "version": "26.50.0-alpha-1", + "libName": "CTRE_SimTalonSRX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simVictorSPX", + "version": "26.50.0-alpha-1", + "libName": "CTRE_SimVictorSPX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simPigeonIMU", + "version": "26.50.0-alpha-1", + "libName": "CTRE_SimPigeonIMU", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFX", + "version": "26.50.0-alpha-1", + "libName": "CTRE_SimProTalonFX", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProTalonFXS", + "version": "26.50.0-alpha-1", + "libName": "CTRE_SimProTalonFXS", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANcoder", + "version": "26.50.0-alpha-1", + "libName": "CTRE_SimProCANcoder", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProPigeon2", + "version": "26.50.0-alpha-1", + "libName": "CTRE_SimProPigeon2", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANrange", + "version": "26.50.0-alpha-1", + "libName": "CTRE_SimProCANrange", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANdi", + "version": "26.50.0-alpha-1", + "libName": "CTRE_SimProCANdi", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + }, + { + "groupId": "com.ctre.phoenix6.sim", + "artifactId": "simProCANdle", + "version": "26.50.0-alpha-1", + "libName": "CTRE_SimProCANdle", + "headerClassifier": "headers", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxx86-64", + "linuxarm64", + "osxuniversal" + ], + "simMode": "swsim" + } + ] +} diff --git a/vendordeps/REVLib.json b/vendordeps/REVLib.json index 0a3ae50..2b6bd6b 100644 --- a/vendordeps/REVLib.json +++ b/vendordeps/REVLib.json @@ -1,126 +1,126 @@ { - "fileName": "REVLib.json", - "name": "REVLib", - "version": "2027.0.0-alpha-4", - "wpilibYear": "2027_alpha5", - "uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb", - "mavenUrls": [ - "https://maven.revrobotics.com/" - ], - "jsonUrl": "https://software-metadata.revrobotics.com/REVLib-2027.json", - "javaDependencies": [ - { - "groupId": "com.revrobotics.frc", - "artifactId": "REVLib-java", - "version": "2027.0.0-alpha-4" - } - ], - "jniDependencies": [ - { - "groupId": "com.revrobotics.frc", - "artifactId": "REVLib-driver", - "version": "2027.0.0-alpha-4", - "skipInvalidPlatforms": true, - "isJar": false, - "validPlatforms": [ - "windowsx86-64", - "linuxarm64", - "linuxx86-64", - "linuxsystemcore", - "osxuniversal" - ] - }, - { - "groupId": "com.revrobotics.frc", - "artifactId": "RevLibBackendDriver", - "version": "2027.0.0-alpha-4", - "skipInvalidPlatforms": true, - "isJar": false, - "validPlatforms": [ - "windowsx86-64", - "linuxarm64", - "linuxx86-64", - "linuxsystemcore", - "osxuniversal" - ] - }, - { - "groupId": "com.revrobotics.frc", - "artifactId": "RevLibWpiBackendDriver", - "version": "2027.0.0-alpha-4", - "skipInvalidPlatforms": true, - "isJar": false, - "validPlatforms": [ - "windowsx86-64", - "linuxarm64", - "linuxx86-64", - "linuxsystemcore", - "osxuniversal" - ] - } - ], - "cppDependencies": [ - { - "groupId": "com.revrobotics.frc", - "artifactId": "REVLib-cpp", - "version": "2027.0.0-alpha-4", - "libName": "REVLib", - "headerClassifier": "headers", - "sharedLibrary": false, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxarm64", - "linuxx86-64", - "linuxsystemcore", - "osxuniversal" - ] - }, - { - "groupId": "com.revrobotics.frc", - "artifactId": "REVLib-driver", - "version": "2027.0.0-alpha-4", - "libName": "REVLibDriver", - "headerClassifier": "headers", - "sharedLibrary": false, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxarm64", - "linuxx86-64", - "linuxsystemcore", - "osxuniversal" - ] - }, - { - "groupId": "com.revrobotics.frc", - "artifactId": "RevLibBackendDriver", - "version": "2027.0.0-alpha-4", - "libName": "BackendDriver", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxarm64", - "linuxx86-64", - "linuxsystemcore", - "osxuniversal" - ] - }, - { - "groupId": "com.revrobotics.frc", - "artifactId": "RevLibWpiBackendDriver", - "version": "2027.0.0-alpha-4", - "libName": "REVLibWpi", - "sharedLibrary": true, - "skipInvalidPlatforms": true, - "binaryPlatforms": [ - "windowsx86-64", - "linuxarm64", - "linuxx86-64", - "linuxsystemcore", - "osxuniversal" - ] - } - ] -} \ No newline at end of file + "fileName": "REVLib.json", + "name": "REVLib", + "version": "2027.0.0-alpha-4", + "wpilibYear": "2027_alpha5", + "uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb", + "mavenUrls": [ + "https://maven.revrobotics.com/" + ], + "jsonUrl": "https://software-metadata.revrobotics.com/REVLib-2027.json", + "javaDependencies": [ + { + "groupId": "com.revrobotics.frc", + "artifactId": "REVLib-java", + "version": "2027.0.0-alpha-4" + } + ], + "jniDependencies": [ + { + "groupId": "com.revrobotics.frc", + "artifactId": "REVLib-driver", + "version": "2027.0.0-alpha-4", + "skipInvalidPlatforms": true, + "isJar": false, + "validPlatforms": [ + "windowsx86-64", + "linuxarm64", + "linuxx86-64", + "linuxsystemcore", + "osxuniversal" + ] + }, + { + "groupId": "com.revrobotics.frc", + "artifactId": "RevLibBackendDriver", + "version": "2027.0.0-alpha-4", + "skipInvalidPlatforms": true, + "isJar": false, + "validPlatforms": [ + "windowsx86-64", + "linuxarm64", + "linuxx86-64", + "linuxsystemcore", + "osxuniversal" + ] + }, + { + "groupId": "com.revrobotics.frc", + "artifactId": "RevLibWpiBackendDriver", + "version": "2027.0.0-alpha-4", + "skipInvalidPlatforms": true, + "isJar": false, + "validPlatforms": [ + "windowsx86-64", + "linuxarm64", + "linuxx86-64", + "linuxsystemcore", + "osxuniversal" + ] + } + ], + "cppDependencies": [ + { + "groupId": "com.revrobotics.frc", + "artifactId": "REVLib-cpp", + "version": "2027.0.0-alpha-4", + "libName": "REVLib", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxarm64", + "linuxx86-64", + "linuxsystemcore", + "osxuniversal" + ] + }, + { + "groupId": "com.revrobotics.frc", + "artifactId": "REVLib-driver", + "version": "2027.0.0-alpha-4", + "libName": "REVLibDriver", + "headerClassifier": "headers", + "sharedLibrary": false, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxarm64", + "linuxx86-64", + "linuxsystemcore", + "osxuniversal" + ] + }, + { + "groupId": "com.revrobotics.frc", + "artifactId": "RevLibBackendDriver", + "version": "2027.0.0-alpha-4", + "libName": "BackendDriver", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxarm64", + "linuxx86-64", + "linuxsystemcore", + "osxuniversal" + ] + }, + { + "groupId": "com.revrobotics.frc", + "artifactId": "RevLibWpiBackendDriver", + "version": "2027.0.0-alpha-4", + "libName": "REVLibWpi", + "sharedLibrary": true, + "skipInvalidPlatforms": true, + "binaryPlatforms": [ + "windowsx86-64", + "linuxarm64", + "linuxx86-64", + "linuxsystemcore", + "osxuniversal" + ] + } + ] +} diff --git a/vendordeps/ReduxLib-2027.0.0-alpha-2.json b/vendordeps/ReduxLib-2027.0.0-alpha-2.json index 15d7cff..d82a3ff 100644 --- a/vendordeps/ReduxLib-2027.0.0-alpha-2.json +++ b/vendordeps/ReduxLib-2027.0.0-alpha-2.json @@ -2,7 +2,7 @@ "fileName": "ReduxLib-2027.0.0-alpha-2.json", "name": "ReduxLib", "version": "2027.0.0-alpha-2", - "frcYear": "2027_alpha1", + "wpilibYear": "2027_alpha5", "uuid": "151ecca8-670b-4026-8160-cdd2679ef2bd", "mavenUrls": [ "https://maven.reduxrobotics.com/"