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

[wpimath] Fix up order and docs for Feedforward gain setters #7788

Merged
merged 5 commits into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -87,75 +87,75 @@ public ArmFeedforward(double ks, double kg, double kv) {
}

/**
* Returns the static gain in volts.
* Sets the static gain.
*
* @return The static gain in volts.
* @param ks The static gain in volts.
*/
public double getKs() {
return ks;
public void setKs(double ks) {
this.ks = ks;
}

/**
* Sets the static gain.
* Sets the gravity gain.
*
* @param ks The static gain in volts.
* @param kg The gravity gain in volts.
*/
public void setKs(double ks) {
this.ks = ks;
public void setKg(double kg) {
this.kg = kg;
}

/**
* Returns the gravity gain in volts.
* Sets the velocity gain.
*
* @return The gravity gain in volts.
* @param kv The velocity gain in V/(rad/s).
*/
public double getKg() {
return kg;
public void setKv(double kv) {
this.kv = kv;
}

/**
* Sets the gravity gain.
* Sets the acceleration gain.
*
* @param kg The gravity gain in volts.
* @param ka The acceleration gain in V/(rad/s²).
*/
public void setKg(double kg) {
this.kg = kg;
public void setKa(double ka) {
this.ka = ka;
}

/**
* Returns the velocity gain in V/(rad/s).
* Returns the static gain in volts.
*
* @return The velocity gain.
* @return The static gain in volts.
*/
public double getKv() {
return kv;
public double getKs() {
return ks;
}

/**
* Sets the velocity gain.
* Returns the gravity gain in volts.
*
* @param kv The velocity gain in V/(rad/s).
* @return The gravity gain in volts.
*/
public void setKv(double kv) {
this.kv = kv;
public double getKg() {
return kg;
}

/**
* Returns the acceleration gain in V/(rad/s²).
* Returns the velocity gain in V/(rad/s).
*
* @return The acceleration gain.
* @return The velocity gain.
*/
public double getKa() {
return ka;
public double getKv() {
return kv;
}

/**
* Sets the acceleration gain.
* Returns the acceleration gain in V/(rad/s²).
*
* @param ka The acceleration gain in V/(rad/2²).
* @return The acceleration gain.
*/
public void setKa(double ka) {
this.ka = ka;
public double getKa() {
return ka;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,75 +87,75 @@ public ElevatorFeedforward(double ks, double kg, double kv) {
}

/**
* Returns the static gain in volts.
* Sets the static gain.
*
* @return The static gain in volts.
* @param ks The static gain in volts.
*/
public double getKs() {
return ks;
public void setKs(double ks) {
this.ks = ks;
}

/**
* Sets the static gain.
* Sets the gravity gain.
*
* @param ks The static gain in volts.
* @param kg The gravity gain in volts.
*/
public void setKs(double ks) {
this.ks = ks;
public void setKg(double kg) {
this.kg = kg;
}

/**
* Returns the gravity gain in volts.
* Sets the velocity gain.
*
* @return The gravity gain in volts.
* @param kv The velocity gain in V/(rad/s).
*/
public double getKg() {
return kg;
public void setKv(double kv) {
this.kv = kv;
}

/**
* Sets the gravity gain.
* Sets the acceleration gain.
*
* @param kg The gravity gain in volts.
* @param ka The acceleration gain in V/(rad/s²).
*/
public void setKg(double kg) {
this.kg = kg;
public void setKa(double ka) {
this.ka = ka;
}

/**
* Returns the velocity gain in V/(m/s).
* Returns the static gain in volts.
*
* @return The velocity gain.
* @return The static gain in volts.
*/
public double getKv() {
return kv;
public double getKs() {
return ks;
}

/**
* Sets the velocity gain.
* Returns the gravity gain in volts.
*
* @param kv The velocity gain in V/(rad/s).
* @return The gravity gain in volts.
*/
public void setKv(double kv) {
this.kv = kv;
public double getKg() {
return kg;
}

/**
* Returns the acceleration gain in V/(m/s²).
* Returns the velocity gain in V/(m/s).
*
* @return The acceleration gain.
* @return The velocity gain.
*/
public double getKa() {
return ka;
public double getKv() {
return kv;
}

/**
* Sets the acceleration gain.
* Returns the acceleration gain in V/(m/s²).
*
* @param ka The acceleration gain in V/(rad/2²).
* @return The acceleration gain.
*/
public void setKa(double ka) {
this.ka = ka;
public double getKa() {
return ka;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,6 @@ public SimpleMotorFeedforward(double ks, double kv) {
this(ks, kv, 0);
}

/**
* Returns the static gain in volts.
*
* @return The static gain in volts.
*/
public double getKs() {
return ks;
}

/**
* Sets the static gain.
*
Expand All @@ -102,43 +93,52 @@ public void setKs(double ks) {
}

/**
* Returns the velocity gain in V/(units/s).
* Sets the velocity gain.
*
* <p>The units should be radians for angular systems and meters for linear systems.
* @param kv The velocity gain in V/(rad/s).
*/
public void setKv(double kv) {
this.kv = kv;
}

/**
* Sets the acceleration gain.
*
* @return The velocity gain in V/(units/s).
* @param ka The acceleration gain in V/(rad/2²).
*/
public double getKv() {
return kv;
public void setKa(double ka) {
this.ka = ka;
}

/**
* Sets the velocity gain.
* Returns the static gain in volts.
*
* @param kv The velocity gain in V/(rad/s).
* @return The static gain in volts.
*/
public void setKv(double kv) {
this.kv = kv;
public double getKs() {
return ks;
}

/**
* Returns the acceleration gain in V/(units/s²).
* Returns the velocity gain in V/(units/s).
*
* <p>The units should be radians for angular systems and meters for linear systems.
*
* @return The acceleration gain in V/(units/s²).
* @return The velocity gain in V/(units/s).
*/
public double getKa() {
return ka;
public double getKv() {
return kv;
}

/**
* Sets the acceleration gain.
* Returns the acceleration gain in V/(units/s²).
*
* @param ka The acceleration gain in V/(rad/2²).
* <p>The units should be radians for angular systems and meters for linear systems.
*
* @return The acceleration gain in V/(units/s²).
*/
public void setKa(double ka) {
this.ka = ka;
public double getKa() {
return ka;
}

/**
Expand Down
46 changes: 23 additions & 23 deletions wpimath/src/main/native/include/frc/controller/ArmFeedforward.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,60 +245,60 @@ class WPILIB_DLLEXPORT ArmFeedforward {
}

/**
* Returns the static gain.
* Sets the static gain.
*
* @return The static gain.
* @param kS The static gain.
*/
constexpr units::volt_t GetKs() const { return kS; }
constexpr void SetKs(units::volt_t kS) { this->kS = kS; }

/**
* Returns the static gain.
* Sets the gravity gain.
*
* @param kS The static gain.
* @param kG The gravity gain.
*/
constexpr void SetKs(units::volt_t kS) { this->kS = kS; }
constexpr void SetKg(units::volt_t kG) { this->kG = kG; }

/**
* Returns the gravity gain.
* Sets the velocity gain.
*
* @return The gravity gain.
* @param kV The velocity gain.
*/
constexpr units::volt_t GetKg() const { return kG; }
constexpr void SetKv(units::unit_t<kv_unit> kV) { this->kV = kV; }

/**
* Returns the gravity gain.
* Sets the acceleration gain.
*
* @param kG The gravity gain.
* @param kA The acceleration gain.
*/
constexpr void SetKg(units::volt_t kG) { this->kG = kG; }
constexpr void SetKa(units::unit_t<ka_unit> kA) { this->kA = kA; }

/**
* Returns the velocity gain.
* Returns the static gain.
*
* @return The velocity gain.
* @return The static gain.
*/
constexpr units::unit_t<kv_unit> GetKv() const { return kV; }
constexpr units::volt_t GetKs() const { return kS; }

/**
* Returns the velocity gain.
* Returns the gravity gain.
*
* @param kV The velocity gain.
* @return The gravity gain.
*/
constexpr void SetKv(units::unit_t<kv_unit> kV) { this->kV = kV; }
constexpr units::volt_t GetKg() const { return kG; }

/**
* Returns the acceleration gain.
* Returns the velocity gain.
*
* @return The acceleration gain.
* @return The velocity gain.
*/
constexpr units::unit_t<ka_unit> GetKa() const { return kA; }
constexpr units::unit_t<kv_unit> GetKv() const { return kV; }

/**
* Returns the acceleration gain.
*
* @param kA The acceleration gain.
* @return The acceleration gain.
*/
constexpr void SetKa(units::unit_t<ka_unit> kA) { this->kA = kA; }
constexpr units::unit_t<ka_unit> GetKa() const { return kA; }

private:
/// The static gain, in volts.
Expand Down
Loading
Loading