diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/ArmFeedforward.java b/wpimath/src/main/java/edu/wpi/first/math/controller/ArmFeedforward.java index d918f07fd8..af30cdbbdf 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/ArmFeedforward.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/ArmFeedforward.java @@ -16,16 +16,16 @@ import edu.wpi.first.util.struct.StructSerializable; */ public class ArmFeedforward implements ProtobufSerializable, StructSerializable { /** The static gain, in volts. */ - private final double ks; + private double ks; /** The gravity gain, in volts. */ - private final double kg; + private double kg; /** The velocity gain, in V/(rad/s). */ - private final double kv; + private double kv; /** The acceleration gain, in V/(rad/s²). */ - private final double ka; + private double ka; /** The period, in seconds. */ private final double m_dt; @@ -95,6 +95,15 @@ public class ArmFeedforward implements ProtobufSerializable, StructSerializable return ks; } + /** + * Sets the static gain. + * + * @param ks The static gain in volts. + */ + public void setKs(double ks) { + this.ks = ks; + } + /** * Returns the gravity gain in volts. * @@ -104,6 +113,15 @@ public class ArmFeedforward implements ProtobufSerializable, StructSerializable return kg; } + /** + * Sets the gravity gain. + * + * @param kg The gravity gain in volts. + */ + public void setKg(double kg) { + this.kg = kg; + } + /** * Returns the velocity gain in V/(rad/s). * @@ -113,6 +131,15 @@ public class ArmFeedforward implements ProtobufSerializable, StructSerializable return kv; } + /** + * Sets the velocity gain. + * + * @param kv The velocity gain in V/(rad/s). + */ + public void setKv(double kv) { + this.kv = kv; + } + /** * Returns the acceleration gain in V/(rad/s²). * @@ -122,6 +149,15 @@ public class ArmFeedforward implements ProtobufSerializable, StructSerializable return ka; } + /** + * Sets the acceleration gain. + * + * @param ka The acceleration gain in V/(rad/2²). + */ + public void setKa(double ka) { + this.ka = ka; + } + /** * Returns the period in seconds. * diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/ElevatorFeedforward.java b/wpimath/src/main/java/edu/wpi/first/math/controller/ElevatorFeedforward.java index 60060bb610..816d2bb086 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/ElevatorFeedforward.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/ElevatorFeedforward.java @@ -15,16 +15,16 @@ import edu.wpi.first.util.struct.StructSerializable; */ public class ElevatorFeedforward implements ProtobufSerializable, StructSerializable { /** The static gain, in volts. */ - private final double ks; + private double ks; /** The gravity gain, in volts. */ - private final double kg; + private double kg; /** The velocity gain, in V/(m/s). */ - private final double kv; + private double kv; /** The acceleration gain, in V/(m/s²). */ - private final double ka; + private double ka; /** The period, in seconds. */ private final double m_dt; @@ -95,6 +95,15 @@ public class ElevatorFeedforward implements ProtobufSerializable, StructSerializ return ks; } + /** + * Sets the static gain. + * + * @param ks The static gain in volts. + */ + public void setKs(double ks) { + this.ks = ks; + } + /** * Returns the gravity gain in volts. * @@ -104,6 +113,15 @@ public class ElevatorFeedforward implements ProtobufSerializable, StructSerializ return kg; } + /** + * Sets the gravity gain. + * + * @param kg The gravity gain in volts. + */ + public void setKg(double kg) { + this.kg = kg; + } + /** * Returns the velocity gain in V/(m/s). * @@ -113,6 +131,15 @@ public class ElevatorFeedforward implements ProtobufSerializable, StructSerializ return kv; } + /** + * Sets the velocity gain. + * + * @param kv The velocity gain in V/(rad/s). + */ + public void setKv(double kv) { + this.kv = kv; + } + /** * Returns the acceleration gain in V/(m/s²). * @@ -122,6 +149,15 @@ public class ElevatorFeedforward implements ProtobufSerializable, StructSerializ return ka; } + /** + * Sets the acceleration gain. + * + * @param ka The acceleration gain in V/(rad/2²). + */ + public void setKa(double ka) { + this.ka = ka; + } + /** * Returns the period in seconds. * diff --git a/wpimath/src/main/java/edu/wpi/first/math/controller/SimpleMotorFeedforward.java b/wpimath/src/main/java/edu/wpi/first/math/controller/SimpleMotorFeedforward.java index b7603a6bfb..73ff6dc342 100644 --- a/wpimath/src/main/java/edu/wpi/first/math/controller/SimpleMotorFeedforward.java +++ b/wpimath/src/main/java/edu/wpi/first/math/controller/SimpleMotorFeedforward.java @@ -12,13 +12,13 @@ import edu.wpi.first.util.struct.StructSerializable; /** A helper class that computes feedforward outputs for a simple permanent-magnet DC motor. */ public class SimpleMotorFeedforward implements ProtobufSerializable, StructSerializable { /** The static gain, in volts. */ - private final double ks; + private double ks; /** The velocity gain, in V/(units/s). */ - private final double kv; + private double kv; /** The acceleration gain, in V/(units/s²). */ - private final double ka; + private double ka; /** The period, in seconds. */ private final double m_dt; @@ -92,6 +92,15 @@ public class SimpleMotorFeedforward implements ProtobufSerializable, StructSeria return ks; } + /** + * Sets the static gain. + * + * @param ks The static gain in volts. + */ + public void setKs(double ks) { + this.ks = ks; + } + /** * Returns the velocity gain in V/(units/s). * @@ -103,6 +112,15 @@ public class SimpleMotorFeedforward implements ProtobufSerializable, StructSeria return kv; } + /** + * Sets the velocity gain. + * + * @param kv The velocity gain in V/(rad/s). + */ + public void setKv(double kv) { + this.kv = kv; + } + /** * Returns the acceleration gain in V/(units/s²). * @@ -114,6 +132,15 @@ public class SimpleMotorFeedforward implements ProtobufSerializable, StructSeria return ka; } + /** + * Sets the acceleration gain. + * + * @param ka The acceleration gain in V/(rad/2²). + */ + public void setKa(double ka) { + this.ka = ka; + } + /** * Returns the period in seconds. * diff --git a/wpimath/src/main/native/include/frc/controller/ArmFeedforward.h b/wpimath/src/main/native/include/frc/controller/ArmFeedforward.h index ace4b9c06f..aa524ef936 100644 --- a/wpimath/src/main/native/include/frc/controller/ArmFeedforward.h +++ b/wpimath/src/main/native/include/frc/controller/ArmFeedforward.h @@ -4,6 +4,8 @@ #pragma once +#include + #include #include @@ -249,6 +251,13 @@ class WPILIB_DLLEXPORT ArmFeedforward { */ constexpr units::volt_t GetKs() const { return kS; } + /** + * Returns the static gain. + * + * @param kS The static gain. + */ + constexpr void SetKs(units::volt_t kS) { this->kS = kS; } + /** * Returns the gravity gain. * @@ -256,6 +265,13 @@ class WPILIB_DLLEXPORT ArmFeedforward { */ constexpr units::volt_t GetKg() const { return kG; } + /** + * Returns the gravity gain. + * + * @param kG The gravity gain. + */ + constexpr void SetKg(units::volt_t kG) { this->kG = kG; } + /** * Returns the velocity gain. * @@ -263,6 +279,13 @@ class WPILIB_DLLEXPORT ArmFeedforward { */ constexpr units::unit_t GetKv() const { return kV; } + /** + * Returns the velocity gain. + * + * @param kV The velocity gain. + */ + constexpr void SetKv(units::unit_t kV) { this->kV = kV; } + /** * Returns the acceleration gain. * @@ -270,6 +293,13 @@ class WPILIB_DLLEXPORT ArmFeedforward { */ constexpr units::unit_t GetKa() const { return kA; } + /** + * Returns the acceleration gain. + * + * @param kA The acceleration gain. + */ + constexpr void SetKa(units::unit_t kA) { this->kA = kA; } + private: /// The static gain, in volts. units::volt_t kS; diff --git a/wpimath/src/main/native/include/frc/controller/ElevatorFeedforward.h b/wpimath/src/main/native/include/frc/controller/ElevatorFeedforward.h index 9be72a4ff6..68565b0fac 100644 --- a/wpimath/src/main/native/include/frc/controller/ElevatorFeedforward.h +++ b/wpimath/src/main/native/include/frc/controller/ElevatorFeedforward.h @@ -223,6 +223,13 @@ class ElevatorFeedforward { */ constexpr units::volt_t GetKs() const { return kS; } + /** + * Returns the static gain. + * + * @param kS The static gain. + */ + constexpr void SetKs(units::volt_t kS) { this->kS = kS; } + /** * Returns the gravity gain. * @@ -230,6 +237,13 @@ class ElevatorFeedforward { */ constexpr units::volt_t GetKg() const { return kG; } + /** + * Returns the gravity gain. + * + * @param kG The gravity gain. + */ + constexpr void SetKg(units::volt_t kG) { this->kG = kG; } + /** * Returns the velocity gain. * @@ -237,6 +251,13 @@ class ElevatorFeedforward { */ constexpr units::unit_t GetKv() const { return kV; } + /** + * Returns the velocity gain. + * + * @param kV The velocity gain. + */ + constexpr void SetKv(units::unit_t kV) { this->kV = kV; } + /** * Returns the acceleration gain. * @@ -244,6 +265,13 @@ class ElevatorFeedforward { */ constexpr units::unit_t GetKa() const { return kA; } + /** + * Returns the acceleration gain. + * + * @param kA The acceleration gain. + */ + constexpr void SetKa(units::unit_t kA) { this->kA = kA; } + private: /// The static gain. units::volt_t kS; diff --git a/wpimath/src/main/native/include/frc/controller/SimpleMotorFeedforward.h b/wpimath/src/main/native/include/frc/controller/SimpleMotorFeedforward.h index 87099047f5..297bee8003 100644 --- a/wpimath/src/main/native/include/frc/controller/SimpleMotorFeedforward.h +++ b/wpimath/src/main/native/include/frc/controller/SimpleMotorFeedforward.h @@ -201,6 +201,13 @@ class SimpleMotorFeedforward { */ constexpr units::volt_t GetKs() const { return kS; } + /** + * Returns the static gain. + * + * @param kS The static gain. + */ + constexpr void SetKs(units::volt_t kS) { this->kS = kS; } + /** * Returns the velocity gain. * @@ -208,6 +215,13 @@ class SimpleMotorFeedforward { */ constexpr units::unit_t GetKv() const { return kV; } + /** + * Returns the velocity gain. + * + * @param kV The velocity gain. + */ + constexpr void SetKv(units::unit_t kV) { this->kV = kV; } + /** * Returns the acceleration gain. * @@ -215,6 +229,13 @@ class SimpleMotorFeedforward { */ constexpr units::unit_t GetKa() const { return kA; } + /** + * Returns the acceleration gain. + * + * @param kA The acceleration gain. + */ + constexpr void SetKa(units::unit_t kA) { this->kA = kA; } + /** * Returns the period. *