Skip to content

Commit

Permalink
[wpimath] Improve SimpleMotorFeedforward argument names and deprecati…
Browse files Browse the repository at this point in the history
…on message
  • Loading branch information
calcmogul committed Dec 5, 2024
1 parent 60198c0 commit b36bccc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public double calculate(double velocity, double acceleration) {
*
* @param velocity The velocity setpoint.
* @return The computed feedforward.
* @deprecated Use the current/next velocity overload instead.
* @deprecated Use {@link #calculate(Measure) the unit-taking velocity overload} instead.
*/
@SuppressWarnings("removal")
@Deprecated(forRemoval = true, since = "2025")
Expand All @@ -159,15 +159,15 @@ public double calculate(double velocity) {
}

/**
* Calculates the feedforward from the gains and setpoints assuming discrete control when the
* setpoint does not change.
* Calculates the feedforward from the gains and velocity setpoint assuming discrete control when
* the velocity setpoint does not change.
*
* @param <U> The velocity parameter either as distance or angle.
* @param setpoint The velocity setpoint.
* @param velocity The velocity setpoint.
* @return The computed feedforward.
*/
public <U extends Unit> Voltage calculate(Measure<? extends PerUnit<U, TimeUnit>> setpoint) {
return calculate(setpoint, setpoint);
public <U extends Unit> Voltage calculate(Measure<? extends PerUnit<U, TimeUnit>> velocity) {
return calculate(velocity, velocity);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,15 @@ class SimpleMotorFeedforward {
}

/**
* Calculates the feedforward from the gains and setpoint assuming discrete
* control. Use this method when the setpoint does not change.
* Calculates the feedforward from the gains and velocity setpoint assuming
* discrete control. Use this method when the velocity setpoint does not
* change.
*
* @param setpoint The velocity setpoint.
* @param velocity The velocity setpoint.
* @return The computed feedforward, in volts.
*/
constexpr units::volt_t Calculate(units::unit_t<Velocity> setpoint) const {
return Calculate(setpoint, setpoint);
constexpr units::volt_t Calculate(units::unit_t<Velocity> velocity) const {
return Calculate(velocity, velocity);
}

/**
Expand Down

0 comments on commit b36bccc

Please sign in to comment.