Merge branch 'main' into 2027

This commit is contained in:
Peter Johnson
2025-02-20 00:26:23 -08:00
123 changed files with 4634 additions and 2291 deletions

View File

@@ -4,6 +4,8 @@
#pragma once
#include <cstdlib>
#include <wpi/MathExtras.h>
#include <wpi/SymbolExports.h>
@@ -242,6 +244,34 @@ class WPILIB_DLLEXPORT ArmFeedforward {
return MaxAchievableAcceleration(-maxVoltage, angle, velocity);
}
/**
* Sets the static gain.
*
* @param kS The static gain.
*/
constexpr void SetKs(units::volt_t kS) { this->kS = kS; }
/**
* Sets the gravity gain.
*
* @param kG The gravity gain.
*/
constexpr void SetKg(units::volt_t kG) { this->kG = kG; }
/**
* Sets the velocity gain.
*
* @param kV The velocity gain.
*/
constexpr void SetKv(units::unit_t<kv_unit> kV) { this->kV = kV; }
/**
* Sets the acceleration gain.
*
* @param kA The acceleration gain.
*/
constexpr void SetKa(units::unit_t<ka_unit> kA) { this->kA = kA; }
/**
* Returns the static gain.
*

View File

@@ -216,6 +216,34 @@ class ElevatorFeedforward {
return MaxAchievableAcceleration(-maxVoltage, velocity);
}
/**
* Sets the static gain.
*
* @param kS The static gain.
*/
constexpr void SetKs(units::volt_t kS) { this->kS = kS; }
/**
* Sets the gravity gain.
*
* @param kG The gravity gain.
*/
constexpr void SetKg(units::volt_t kG) { this->kG = kG; }
/**
* Sets the velocity gain.
*
* @param kV The velocity gain.
*/
constexpr void SetKv(units::unit_t<kv_unit> kV) { this->kV = kV; }
/**
* Sets the acceleration gain.
*
* @param kA The acceleration gain.
*/
constexpr void SetKa(units::unit_t<ka_unit> kA) { this->kA = kA; }
/**
* Returns the static gain.
*

View File

@@ -178,6 +178,27 @@ class SimpleMotorFeedforward {
return MaxAchievableAcceleration(-maxVoltage, velocity);
}
/**
* Sets the static gain.
*
* @param kS The static gain.
*/
constexpr void SetKs(units::volt_t kS) { this->kS = kS; }
/**
* Sets the velocity gain.
*
* @param kV The velocity gain.
*/
constexpr void SetKv(units::unit_t<kv_unit> kV) { this->kV = kV; }
/**
* Sets the acceleration gain.
*
* @param kA The acceleration gain.
*/
constexpr void SetKa(units::unit_t<ka_unit> kA) { this->kA = kA; }
/**
* Returns the static gain.
*

View File

@@ -59,7 +59,11 @@ struct WPILIB_DLLEXPORT ChassisSpeeds {
* y-axis, and omega * dt around the z-axis).
*
* This is useful for compensating for translational skew when translating and
* rotating a swerve drivetrain.
* rotating a holonomic (swerve or mecanum) drivetrain. However, scaling down
* the ChassisSpeeds after discretizing (e.g., when desaturating swerve module
* speeds) rotates the direction of net motion in the opposite direction of
* rotational velocity, introducing a different translational skew which is
* not accounted for by discretization.
*
* @param dt The duration of the timestep the speeds should be applied for.
* @return Discretized ChassisSpeeds.

View File

@@ -333,6 +333,11 @@ class SwerveDriveKinematics
* the absolute threshold, while maintaining the ratio of speeds between
* modules.
*
* Scaling down the module speeds rotates the direction of net motion in the
* opposite direction of rotational velocity, which makes discretizing the
* chassis speeds inaccurate because the discretization did not account for
* this translational skew.
*
* @param moduleStates Reference to array of module states. The array will be
* mutated with the normalized speeds!
* @param attainableMaxSpeed The absolute max speed that a module can reach.
@@ -368,6 +373,11 @@ class SwerveDriveKinematics
* the absolute threshold, while maintaining the ratio of speeds between
* modules.
*
* Scaling down the module speeds rotates the direction of net motion in the
* opposite direction of rotational velocity, which makes discretizing the
* chassis speeds inaccurate because the discretization did not account for
* this translational skew.
*
* @param moduleStates Reference to array of module states. The array will be
* mutated with the normalized speeds!
* @param desiredChassisSpeed The desired speed of the robot