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
1 change: 1 addition & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions lib/src/main/java/com/team2813/lib2813/control/Motor.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,7 @@ public interface Motor {
* @return The current applied current
*/
Current getAppliedCurrent();

/** Stops the motor. */
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.

Do you know: does this only cut power off, or does it also actively apply the break to the motor?

I see that for the TalonFXWrapper you can control this, so you might have to clarify here:

Depending on the motor setting, this can cruise or break... or something along those lines.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This method depends on the individual implementation of the motor controller, it is out of our hands I believe.

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.

If you are correct that the behavior may differ by motor then let's please update the Javadoc to mention that.

CC @cuttestkittensrule in case he has knowledge about how the APIs of the motors we use might differ.

void disable();
}
Copy link
Copy Markdown
Contributor

@kcooney kcooney Oct 14, 2025

Choose a reason for hiding this comment

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

@spderman3333 as mentioned in the other PR, disable() is a confusing name since the reader could think this disables the controller (especially if a class implements Motor and Controller) and/or that you need to re-enable it somehow.

Given the description of this method, could you please send a PR renaming this to stopMotor()?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The scope of the PR does not cover refactoring, as the method is introduced as "disable()" in MotorSubsystem, i have decided to name the method accordingly.

Copy link
Copy Markdown
Contributor

@kcooney kcooney Oct 14, 2025

Choose a reason for hiding this comment

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

This PR was submitted. My request is to send another, renaming Motor.disable() to stopMotor()

We could deprecate MotorSubsystem.disable() if you'd like

Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ public Current getAppliedCurrent() {
return Units.Amps.of(motor.getOutputCurrent());
}

@Override
public void disable() {
motor.stopMotor();
}

@Override
public void setPosition(double position) {
encoder.setPosition(position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.team2813.lib2813.control.DeviceInformation;
import com.team2813.lib2813.control.InvertType;
import com.team2813.lib2813.control.PIDMotor;
import com.team2813.lib2813.subsystems.MotorSubsystem;
import com.team2813.lib2813.util.InvalidCanIdException;
import edu.wpi.first.units.Units;
import edu.wpi.first.units.measure.Angle;
Expand Down Expand Up @@ -162,10 +163,31 @@ public TalonFX motor() {
return motor;
}

/**
* Sets the behavior the motor should exhibit upon receiving a request to stop: {@link
* MotorSubsystem#disable()}
*
* <ul>
* <li>Coast: The motor stops applying an input, but continues to move with its inertia.
* <li>Brake: The motor stops applying an input, and actively opposes its inertia.
* </ul>
Comment on lines +170 to +173
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same as prior PR; CTRE may add, remove, or modify the meaning of the neutral mode values, so enumerating them isn't a good idea.

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.

+1

*
* @param mode
*/
public void setNeutralMode(NeutralModeValue mode) {
motor.setNeutralMode(mode);
}

/**
* Sends a disable command to the motor, placing it in its neutral value.
*
* @see TalonFXWrapper#setNeutralMode(NeutralModeValue)
*/
@Override
public void disable() {
motor.disable();
}

@Override
public void configPIDF(int slot, double p, double i, double d, double f) {
SlotConfigs conf = new SlotConfigs();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public final void enable() {
*/
public final void disable() {
isEnabled = false;
motor.set(controlMode, 0);
motor.disable();
}

/**
Expand Down
Loading