mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Merge branch 'main' into 2027
This commit is contained in:
@@ -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;
|
||||
@@ -85,6 +85,42 @@ public class ArmFeedforward implements ProtobufSerializable, StructSerializable
|
||||
this(ks, kg, kv, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the static gain.
|
||||
*
|
||||
* @param ks The static gain in volts.
|
||||
*/
|
||||
public void setKs(double ks) {
|
||||
this.ks = ks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the gravity gain.
|
||||
*
|
||||
* @param kg The gravity gain in volts.
|
||||
*/
|
||||
public void setKg(double kg) {
|
||||
this.kg = kg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the velocity gain.
|
||||
*
|
||||
* @param kv The velocity gain in V/(rad/s).
|
||||
*/
|
||||
public void setKv(double kv) {
|
||||
this.kv = kv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the acceleration gain.
|
||||
*
|
||||
* @param ka The acceleration gain in V/(rad/s²).
|
||||
*/
|
||||
public void setKa(double ka) {
|
||||
this.ka = ka;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the static gain in volts.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
@@ -85,6 +85,42 @@ public class ElevatorFeedforward implements ProtobufSerializable, StructSerializ
|
||||
this(ks, kg, kv, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the static gain.
|
||||
*
|
||||
* @param ks The static gain in volts.
|
||||
*/
|
||||
public void setKs(double ks) {
|
||||
this.ks = ks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the gravity gain.
|
||||
*
|
||||
* @param kg The gravity gain in volts.
|
||||
*/
|
||||
public void setKg(double kg) {
|
||||
this.kg = kg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the velocity gain.
|
||||
*
|
||||
* @param kv The velocity gain in V/(m/s).
|
||||
*/
|
||||
public void setKv(double kv) {
|
||||
this.kv = kv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the acceleration gain.
|
||||
*
|
||||
* @param ka The acceleration gain in V/(m/s²).
|
||||
*/
|
||||
public void setKa(double ka) {
|
||||
this.ka = ka;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the static gain in volts.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
@@ -82,6 +82,33 @@ public class SimpleMotorFeedforward implements ProtobufSerializable, StructSeria
|
||||
this(ks, kv, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the static gain.
|
||||
*
|
||||
* @param ks The static gain in volts.
|
||||
*/
|
||||
public void setKs(double ks) {
|
||||
this.ks = ks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the velocity gain.
|
||||
*
|
||||
* @param kv The velocity gain in V/(units/s).
|
||||
*/
|
||||
public void setKv(double kv) {
|
||||
this.kv = kv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the acceleration gain.
|
||||
*
|
||||
* @param ka The acceleration gain in V/(units/s²).
|
||||
*/
|
||||
public void setKa(double ka) {
|
||||
this.ka = ka;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the static gain in volts.
|
||||
*
|
||||
|
||||
@@ -90,7 +90,10 @@ public class ChassisSpeeds implements ProtobufSerializable, StructSerializable {
|
||||
* along the y-axis, and omega * dt around the z-axis).
|
||||
*
|
||||
* <p>This is useful for compensating for translational skew when translating and rotating a
|
||||
* swerve drivetrain.
|
||||
* 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 in seconds the speeds should be applied for.
|
||||
* @return Discretized ChassisSpeeds.
|
||||
|
||||
@@ -257,6 +257,10 @@ public class SwerveDriveKinematics
|
||||
* reduce all the wheel speeds to make sure that all requested module speeds are at-or-below the
|
||||
* absolute threshold, while maintaining the ratio of speeds between modules.
|
||||
*
|
||||
* <p>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 in meters per second that a module can reach.
|
||||
@@ -282,6 +286,10 @@ public class SwerveDriveKinematics
|
||||
* reduce all the wheel speeds to make sure that all requested module speeds are at-or-below the
|
||||
* absolute threshold, while maintaining the ratio of speeds between modules.
|
||||
*
|
||||
* <p>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 in meters per second that a module can reach.
|
||||
@@ -300,6 +308,10 @@ public class SwerveDriveKinematics
|
||||
* reduce all the wheel speeds to make sure that all requested module speeds are at-or-below the
|
||||
* absolute threshold, while maintaining the ratio of speeds between modules.
|
||||
*
|
||||
* <p>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
|
||||
@@ -346,6 +358,10 @@ public class SwerveDriveKinematics
|
||||
* reduce all the wheel speeds to make sure that all requested module speeds are at-or-below the
|
||||
* absolute threshold, while maintaining the ratio of speeds between modules.
|
||||
*
|
||||
* <p>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
|
||||
|
||||
Reference in New Issue
Block a user