Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ tasks.withType(JavaCompile) {
options.compilerArgs.add '-XDstringConcat=inline'
}

version = '1.3.0-alpha.1'
version = '2.0.0-alpha.1'

repositories {
// Use Maven Central for resolving dependencies.
Expand Down
10 changes: 10 additions & 0 deletions lib/src/main/java/com/team2813/lib2813/control/Motor.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.team2813.lib2813.control;

import edu.wpi.first.units.measure.Current;

public interface Motor {
// motor control

Expand All @@ -19,4 +21,12 @@ public interface Motor {
* @param feedForward The feedForward to apply to the motor
*/
void set(ControlMode mode, double demand, double feedForward);

/**
* Gets the current that is being applied onto the motor
*
* @since 2.0.0
* @return The current applied current
*/
Current getAppliedCurrent();

@kcooney kcooney Apr 30, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this isn't a backwards-compatible change. Since the version of 'lib' specified in build.gradle is "1.3.0-alpha.1" I'm guessing that's okay with you.

Optional: Perhaps add @since 1.3.0 to the Javadoc?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it is backwards incompatible, shouldn't we bump the major version?
I could change the build.gradle version to 2.0.0-alpha.1, so that the next release is 2.0.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it is backwards incompatible, shouldn't we bump the major version?

If you want to follow the recommendations at https://semver.org/ then yes. You don't have to (JUnit didn't).

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import edu.wpi.first.units.Units;
import edu.wpi.first.units.measure.Angle;
import edu.wpi.first.units.measure.AngularVelocity;
import edu.wpi.first.units.measure.Current;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -75,6 +76,11 @@ public Angle getPositionMeasure() {
return Units.Rotations.of(encoder.getPosition());
}

@Override
public Current getAppliedCurrent() {
return Units.Amps.of(motor.getOutputCurrent());
}

@Override
public void setPosition(double position) {
encoder.setPosition(position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import edu.wpi.first.units.Units;
import edu.wpi.first.units.measure.Angle;
import edu.wpi.first.units.measure.AngularVelocity;
import edu.wpi.first.units.measure.Current;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -132,6 +133,11 @@ public Angle getPositionMeasure() {
return Units.Rotations.of(motor.getPosition().getValueAsDouble());
}

@Override
public Current getAppliedCurrent() {
return motor.getStatorCurrent().getValue();
}

@Override
public void setPosition(double position) {
motor.setPosition(position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
* constructor; see <a href="https://www.baeldung.com/java-records-custom-constructor">Custom
* Constructor in Java Records</a> for details.
*
* @since 1.3.0
* @since 2.0.0
*/
public final class PersistedConfiguration {
// The below package-scope fields are for the self-tests.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
*
* @deprecated Use {@link PersistedConfiguration}
*/
@Deprecated(since = "1.3.0", forRemoval = true)
@Deprecated(since = "2.0.0", forRemoval = true)
public class PreferencesInjector {
private static final char PATH_SEPARATOR = '.';

Expand Down
Loading