Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes from previous PR #8

Merged
merged 2 commits into from
Mar 28, 2023
Merged

Changes from previous PR #8

merged 2 commits into from
Mar 28, 2023

Conversation

MathNerd28
Copy link
Member

  • DTSendable forces subclasses to implement AutoCloseable
  • DTSendable convenience methods to limit NetworkTables entry refresh rate
  • Remove CURRENTLIMITTYPE generic parameter from DTMotor and change to a single int parameter
  • Add type-specific configCurrentLimit() methods to DTTalonFX and DTNeo
  • Rename DTMotor::internal() to 'getMotorImpl()`
  • Rename 'DTMotorFaults::internal() to 'getFaultsImpl()
  • Add DTMotor::getMaxVelocity() and getStallTorque() methods to interface
  • Bugfixes

- `DTSendable` forces subclasses to  implement `AutoCloseable`
- `DTSendable` convenience methods to limit NetworkTables entry refresh rate
- Remove `CURRENTLIMITTYPE` generic parameter from `DTMotor` and change to a single `int` parameter
- Add type-specific `configCurrentLimit()` methods to `DTTalonFX` and `DTNeo`
- Rename `DTMotor::internal()` to 'getMotorImpl()`
- Rename 'DTMotorFaults::internal()` to 'getFaultsImpl()`
- Add `DTMotor::getMaxVelocity()` and `getStallTorque()` methods to interface
- Bugfixes
@@ -1,7 +1,7 @@
package org.victorrobotics.frc.dtlib.actuator.motor;

public interface DTMotorFaults<FAULT_TYPE> {
FAULT_TYPE internal();
FAULT_TYPE getFaultsImpl();
Copy link
Member

Choose a reason for hiding this comment

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

Not sure this is needed since the motor fault objects both provide the same methods.

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe, but in some cases it might be nice to get something more specific. I suppose you probably could do DTMotor.getMotorImpl().[faults-method] though.

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I wasn't clear. I meant that the parameter wasn't needed because both concrete fault classes have the same methods. Having the internal fault object doesn't buy you anything.

new SupplyCurrentLimitConfiguration(true, maxSupplyCurrent, maxSupplyCurrent, 0));
}

public void configCurrentLimit(SupplyCurrentLimitConfiguration currentConfig) {
Copy link
Member

Choose a reason for hiding this comment

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

This method could take the limits directly and construct the SupplyCurrentLimitConfiguration object.

Copy link
Member Author

Choose a reason for hiding this comment

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

True, good idea

@@ -197,7 +206,7 @@ public double getEncoderPosition() {

@Override
public double getEncoderVelocity() {
return internal.getSelectedSensorVelocity() / TICKS_PER_REV * 10;
return internal.getSelectedSensorVelocity() / TICKS_PER_REV * 10 * SECONDS_PER_MINUTE;
Copy link
Member

Choose a reason for hiding this comment

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

This returns the velocity in RPM, which is an important capability. Consider renaming this to something like getMotorRPM or getRPM.

Copy link
Member Author

Choose a reason for hiding this comment

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

How about getEncoderVelocityRPM or getVelocityRPM? I don’t think getRPM is specific enough (could just be commanded velocity), and the word “motor” shouldn’t appear in a DTMotor method.

@MathNerd28 MathNerd28 requested a review from mmarchetti March 28, 2023 00:29
@MathNerd28 MathNerd28 merged commit 99ec95e into master Mar 28, 2023
@MathNerd28 MathNerd28 deleted the dtmotor branch March 28, 2023 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants