[wpimath] Add setters to Feedforward gains (#7784)

Signed-off-by: Jade Turner <spacey-sooty@proton.me>
This commit is contained in:
Jade
2025-02-14 13:09:28 +08:00
committed by GitHub
parent e22f76ce73
commit 4d126b158c
6 changed files with 189 additions and 11 deletions

View File

@@ -4,6 +4,8 @@
#pragma once
#include <cstdlib>
#include <wpi/MathExtras.h>
#include <wpi/SymbolExports.h>
@@ -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<kv_unit> GetKv() const { return kV; }
/**
* Returns the velocity gain.
*
* @param kV The velocity gain.
*/
constexpr void SetKv(units::unit_t<kv_unit> kV) { this->kV = kV; }
/**
* Returns the acceleration gain.
*
@@ -270,6 +293,13 @@ class WPILIB_DLLEXPORT ArmFeedforward {
*/
constexpr units::unit_t<ka_unit> GetKa() const { return kA; }
/**
* Returns the acceleration gain.
*
* @param kA The acceleration gain.
*/
constexpr void SetKa(units::unit_t<ka_unit> kA) { this->kA = kA; }
private:
/// The static gain, in volts.
units::volt_t kS;

View File

@@ -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<kv_unit> GetKv() const { return kV; }
/**
* Returns the velocity gain.
*
* @param kV The velocity gain.
*/
constexpr void SetKv(units::unit_t<kv_unit> kV) { this->kV = kV; }
/**
* Returns the acceleration gain.
*
@@ -244,6 +265,13 @@ class ElevatorFeedforward {
*/
constexpr units::unit_t<ka_unit> GetKa() const { return kA; }
/**
* Returns the acceleration gain.
*
* @param kA The acceleration gain.
*/
constexpr void SetKa(units::unit_t<ka_unit> kA) { this->kA = kA; }
private:
/// The static gain.
units::volt_t kS;

View File

@@ -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<kv_unit> GetKv() const { return kV; }
/**
* Returns the velocity gain.
*
* @param kV The velocity gain.
*/
constexpr void SetKv(units::unit_t<kv_unit> kV) { this->kV = kV; }
/**
* Returns the acceleration gain.
*
@@ -215,6 +229,13 @@ class SimpleMotorFeedforward {
*/
constexpr units::unit_t<ka_unit> GetKa() const { return kA; }
/**
* Returns the acceleration gain.
*
* @param kA The acceleration gain.
*/
constexpr void SetKa(units::unit_t<ka_unit> kA) { this->kA = kA; }
/**
* Returns the period.
*