diff --git a/lib/src/main/java/com/team2813/lib2813/control/Encoder.java b/lib/src/main/java/com/team2813/lib2813/control/Encoder.java index aa377279..a4bb8836 100644 --- a/lib/src/main/java/com/team2813/lib2813/control/Encoder.java +++ b/lib/src/main/java/com/team2813/lib2813/control/Encoder.java @@ -15,22 +15,11 @@ */ package com.team2813.lib2813.control; -import edu.wpi.first.units.Units; import edu.wpi.first.units.measure.Angle; import edu.wpi.first.units.measure.AngularVelocity; /** Specifies a device that can perceive rotational positions. */ public interface Encoder { - /** - * Gets the position of the encoder - * - * @return the position of the encoder - * @deprecated This method does not specify position in a specific measurement, so it is not safe - * to use. Use {@link #getPositionMeasure()} instead - */ - @Deprecated(forRemoval = true) - double position(); - /** * Gets the position of the encoder * @@ -42,32 +31,13 @@ public interface Encoder { * Sets the position of the encoder * * @param position the position of the encoder - * @deprecated This method does not specify a unit, so it is not safe to use. Use {@link - * #setPosition(Angle)} instead. - */ - @Deprecated(forRemoval = true) - void setPosition(double position); - - default void setPosition(Angle position) { - setPosition(position.in(Units.Radians)); - } - - /** - * Gets the velocity of the encoder - * - * @return the velocity that the encoder perceives - * @deprecated This method does not specify velocity in a specific measurement, so it is not safe - * to use. Use {@link #getVelocityMeasure()} instead */ - @Deprecated(forRemoval = true) - double getVelocity(); + void setPosition(Angle position); /** * Gets the velocity of the encoder * * @return The velocity as a measure */ - default AngularVelocity getVelocityMeasure() { - return Units.RadiansPerSecond.of(getVelocity()); - } + AngularVelocity getVelocityMeasure(); } diff --git a/lib/src/main/java/com/team2813/lib2813/control/encoders/CancoderWrapper.java b/lib/src/main/java/com/team2813/lib2813/control/encoders/CancoderWrapper.java index 3d031e46..e62cf3d4 100644 --- a/lib/src/main/java/com/team2813/lib2813/control/encoders/CancoderWrapper.java +++ b/lib/src/main/java/com/team2813/lib2813/control/encoders/CancoderWrapper.java @@ -37,23 +37,11 @@ public CancoderWrapper(int id) { info = new DeviceInformation(id); } - @Deprecated - @Override - public double position() { - return cancoder.getPosition().getValueAsDouble(); - } - @Override public Angle getPositionMeasure() { return Units.Rotations.of(cancoder.getPosition().getValueAsDouble()); } - @Deprecated - @Override - public void setPosition(double position) { - ConfigUtils.phoenix6Config(() -> cancoder.setPosition(position)); - } - @Override public void setPosition(Angle position) { ConfigUtils.phoenix6Config(() -> cancoder.setPosition(position.in(Units.Rotations))); @@ -63,12 +51,6 @@ public CANcoder encoder() { return cancoder; } - @Deprecated - @Override - public double getVelocity() { - return cancoder.getVelocity().getValueAsDouble(); - } - @Override public AngularVelocity getVelocityMeasure() { return cancoder.getVelocity().getValue(); diff --git a/lib/src/main/java/com/team2813/lib2813/control/motors/SparkMaxWrapper.java b/lib/src/main/java/com/team2813/lib2813/control/motors/SparkMaxWrapper.java index 27308856..2f9f8c74 100644 --- a/lib/src/main/java/com/team2813/lib2813/control/motors/SparkMaxWrapper.java +++ b/lib/src/main/java/com/team2813/lib2813/control/motors/SparkMaxWrapper.java @@ -81,11 +81,6 @@ public void set(ControlMode controlMode, double demand, double feedForward) { } } - @Override - public double position() { - return encoder.getPosition(); - } - @Override public Angle getPositionMeasure() { return Units.Rotations.of(encoder.getPosition()); @@ -101,21 +96,11 @@ public void stopMotor() { motor.stopMotor(); } - @Override - public void setPosition(double position) { - encoder.setPosition(position); - } - @Override public void setPosition(Angle position) { encoder.setPosition(position.in(Units.Rotations)); } - @Override - public double getVelocity() { - return encoder.getVelocity(); - } - @Override public AngularVelocity getVelocityMeasure() { return Units.Rotations.per(Units.Minute).of(encoder.getVelocity()); diff --git a/lib/src/main/java/com/team2813/lib2813/control/motors/TalonFXWrapper.java b/lib/src/main/java/com/team2813/lib2813/control/motors/TalonFXWrapper.java index 6882dbed..a336ed18 100644 --- a/lib/src/main/java/com/team2813/lib2813/control/motors/TalonFXWrapper.java +++ b/lib/src/main/java/com/team2813/lib2813/control/motors/TalonFXWrapper.java @@ -142,11 +142,6 @@ public void set(ControlMode controlMode, double demand, double feedForward) { } } - @Override - public double position() { - return getPositionMeasure().in(Units.Rotations); - } - @Override public Angle getPositionMeasure() { return Units.Rotations.of(motor.getPosition().getValueAsDouble()); @@ -157,21 +152,11 @@ public Current getAppliedCurrent() { return motor.getStatorCurrent().getValue(); } - @Override - public void setPosition(double position) { - motor.setPosition(position); - } - @Override public void setPosition(Angle position) { motor.setPosition(position.in(Units.Rotations)); } - @Override - public double getVelocity() { - return motor.getVelocity().getValueAsDouble(); - } - @Override public AngularVelocity getVelocityMeasure() { return Units.RotationsPerSecond.of(motor.getVelocity().getValueAsDouble()); diff --git a/lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java b/lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java index b996514a..bac2e7e3 100644 --- a/lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java +++ b/lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java @@ -247,34 +247,16 @@ protected final double getMeasurement() { return encoder.getPositionMeasure().in(rotationUnit); } - @Override - @Deprecated(forRemoval = true) - public double position() { - return encoder.position(); - } - @Override public Angle getPositionMeasure() { return encoder.getPositionMeasure(); } - @Override - @Deprecated(forRemoval = true) - public void setPosition(double position) { - encoder.setPosition(position); - } - @Override public void setPosition(Angle position) { encoder.setPosition(position); } - @Override - @Deprecated(forRemoval = true) - public double getVelocity() { - return encoder.getVelocity(); - } - @Override public AngularVelocity getVelocityMeasure() { return encoder.getVelocityMeasure(); diff --git a/testing/src/main/java/com/team2813/lib2813/testing/FakePIDMotor.java b/testing/src/main/java/com/team2813/lib2813/testing/FakePIDMotor.java deleted file mode 100644 index 6415a48d..00000000 --- a/testing/src/main/java/com/team2813/lib2813/testing/FakePIDMotor.java +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright 2025 Prospect Robotics SWENext Club - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ -package com.team2813.lib2813.testing; - -import com.team2813.lib2813.control.PIDMotor; -import edu.wpi.first.units.Units; - -/** - * A fake implementation of {@link PIDMotor}; used for testing. - * - *
This class simulates motor behavior by storing the most recent control mode and demand value. - * It also includes methods that make it easier to verify the current state of the motor. - */ -public abstract class FakePIDMotor extends FakeMotor implements PIDMotor { - - @Deprecated - public double getVoltage() { - return getMotorVoltage().in(Units.Volts); - } - - @Override - public double getVelocity() { - throw new AssertionError("Called deprecated method"); - } -}