From 883bc7f730fc756ed2b629315e3dbe20dda14b57 Mon Sep 17 00:00:00 2001 From: Spderman3333 <118777573+spderman3333@users.noreply.github.com> Date: Tue, 28 Oct 2025 15:28:28 -0700 Subject: [PATCH 1/4] Made methods non final, so we can override them --- .../lib2813/subsystems/MotorSubsystem.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) 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 c33a905f..8cb5373e 100644 --- a/lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java +++ b/lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java @@ -73,7 +73,7 @@ protected MotorSubsystem(MotorSubsystemConfiguration builder) { * * @param position the position to go to. */ - public final void setSetpoint(T position) { + public void setSetpoint(T position) { if (!isEnabled()) { enable(); } @@ -86,17 +86,17 @@ public final void setSetpoint(T position) { * * @param setpoint the position to go to. */ - public final Command setSetpointCommand(T setpoint) { + public Command setSetpointCommand(T setpoint) { return new InstantCommand(() -> this.setSetpoint(setpoint), this); } /** Returns the current setpoint as an angle. */ - public final Angle getSetpoint() { + public Angle getSetpoint() { return rotationUnit.of(controller.getSetpoint()); } /** Determines if the motor is at the current setpoint, within the acceptable error. */ - public final boolean atPosition() { + public boolean atPosition() { return Math.abs(getMeasurement() - controller.getSetpoint()) <= acceptableError; } @@ -106,7 +106,7 @@ public final boolean atPosition() { *
Additionally, this method disables PID control of the subsystem */ @Override - public final void set(ControlMode mode, double demand, double feedForward) { + public void set(ControlMode mode, double demand, double feedForward) { if (isEnabled()) { disable(); } @@ -114,7 +114,7 @@ public final void set(ControlMode mode, double demand, double feedForward) { } @Override - public final Current getAppliedCurrent() { + public Current getAppliedCurrent() { return motor.getAppliedCurrent(); } @@ -124,7 +124,7 @@ public final Current getAppliedCurrent() { *
The motor voltage will be periodically updated to move the motor towards the current * setupoint. */ - public final void enable() { + public void enable() { isEnabled = true; } @@ -134,7 +134,7 @@ public final void enable() { *
The motor voltage will be set to zero, and the motor will not adjust to move towards the * current setpoint. */ - public final void disable() { + public void disable() { isEnabled = false; motor.disable(); } @@ -144,7 +144,7 @@ public final void disable() { * * @return Whether the controller is enabled. */ - public final boolean isEnabled() { + public boolean isEnabled() { return isEnabled; } @@ -155,7 +155,7 @@ public final boolean isEnabled() { * the provided value. */ @Override - public final void set(ControlMode mode, double demand) { + public void set(ControlMode mode, double demand) { isEnabled = false; motor.set(mode, demand); } @@ -197,7 +197,7 @@ protected double clampOutput(double output) { return output; } - protected final double getMeasurement() { + protected double getMeasurement() { return encoder.getPositionMeasure().in(rotationUnit); } @@ -208,7 +208,7 @@ public double position() { } @Override - public final Angle getPositionMeasure() { + public Angle getPositionMeasure() { return encoder.getPositionMeasure(); } @@ -219,7 +219,7 @@ public void setPosition(double position) { } @Override - public final void setPosition(Angle position) { + public void setPosition(Angle position) { encoder.setPosition(position); } @@ -230,7 +230,7 @@ public double getVelocity() { } @Override - public final AngularVelocity getVelocityMeasure() { + public AngularVelocity getVelocityMeasure() { return encoder.getVelocityMeasure(); } From 6dbf0020c9ea066a4ff78c4ccec5d776ac29746d Mon Sep 17 00:00:00 2001 From: Spderman3333 <118777573+spderman3333@users.noreply.github.com> Date: Wed, 29 Oct 2025 16:26:48 -0700 Subject: [PATCH 2/4] made setSetpointCommand and setSetpoint protected --- .../java/com/team2813/lib2813/subsystems/MotorSubsystem.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 8cb5373e..28221003 100644 --- a/lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java +++ b/lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java @@ -73,7 +73,7 @@ protected MotorSubsystem(MotorSubsystemConfiguration builder) { * * @param position the position to go to. */ - public void setSetpoint(T position) { + protected void setSetpoint(T position) { if (!isEnabled()) { enable(); } @@ -86,7 +86,7 @@ public void setSetpoint(T position) { * * @param setpoint the position to go to. */ - public Command setSetpointCommand(T setpoint) { + protected Command setSetpointCommand(T setpoint) { return new InstantCommand(() -> this.setSetpoint(setpoint), this); } From d6a3c3d8e15c4a4b080fdff882bde0d5c2366736 Mon Sep 17 00:00:00 2001 From: Spderman3333 <118777573+spderman3333@users.noreply.github.com> Date: Wed, 29 Oct 2025 16:31:58 -0700 Subject: [PATCH 3/4] oops --- .../java/com/team2813/lib2813/subsystems/MotorSubsystem.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 28221003..88d5edc7 100644 --- a/lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java +++ b/lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java @@ -73,7 +73,7 @@ protected MotorSubsystem(MotorSubsystemConfiguration builder) { * * @param position the position to go to. */ - protected void setSetpoint(T position) { + public void setSetpoint(T position) { if (!isEnabled()) { enable(); } From de6dcdafc5655b3a5e852997301553f74e5f57ee Mon Sep 17 00:00:00 2001 From: spderman3333 <118777573+spderman3333@users.noreply.github.com> Date: Thu, 30 Oct 2025 21:34:47 -0700 Subject: [PATCH 4/4] Address suggestions --- .../java/com/team2813/lib2813/subsystems/MotorSubsystem.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 88d5edc7..48ef98a7 100644 --- a/lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java +++ b/lib/src/main/java/com/team2813/lib2813/subsystems/MotorSubsystem.java @@ -86,7 +86,7 @@ public void setSetpoint(T position) { * * @param setpoint the position to go to. */ - protected Command setSetpointCommand(T setpoint) { + public final Command setSetpointCommand(T setpoint) { return new InstantCommand(() -> this.setSetpoint(setpoint), this); } @@ -96,7 +96,7 @@ public Angle getSetpoint() { } /** Determines if the motor is at the current setpoint, within the acceptable error. */ - public boolean atPosition() { + public final boolean atPosition() { return Math.abs(getMeasurement() - controller.getSetpoint()) <= acceptableError; }