Package lib.subsystems.motor
Class TelescopingArmExtensionFeedForward
java.lang.Object
lib.subsystems.motor.TelescopingArmExtensionFeedForward
Computes feed-forward values for an elevator motor, which is mounted on a varying angle.
Internally composes a wpilib ElevatorFeedForward.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal doublefinal doublefinal doublefinal double -
Constructor Summary
ConstructorsConstructorDescriptionTelescopingArmExtensionFeedForward(double ks, double vertical_kg, double kv, double ka) Computes elevator feed-forward values with a varying cg based on rotation. -
Method Summary
Modifier and TypeMethodDescriptiondoublecalculate(double posRads, double velMetersPerSec) doublemaxAchievableAcceleration(double maxVoltage, double posRads, double velocity) Calculates the maximum achievable acceleration given a maximum voltage supply and a velocity.doublemaxAchievableVelocity(double maxVoltage, double posRads, double acceleration) Calculates the maximum achievable velocity given a maximum voltage supply and an acceleration.doubleminAchievableAcceleration(double maxVoltage, double posRads, double velocity) Calculates the minimum achievable acceleration given a minimum voltage supply and a velocity.doubleminAchievableVelocity(double maxVoltage, double posRads, double acceleration) Calculates the minimum achievable velocity given a minimum voltage supply and an acceleration.
-
Field Details
-
ks
public final double ks -
kg_vertical
public final double kg_vertical -
kv
public final double kv -
ka
public final double ka
-
-
Constructor Details
-
TelescopingArmExtensionFeedForward
public TelescopingArmExtensionFeedForward(double ks, double vertical_kg, double kv, double ka) Computes elevator feed-forward values with a varying cg based on rotation.- Parameters:
ks- Static gain: volts needed to overcome static frictionvertical_kg- Gravity gain: usually found by characterizing the arm as an elevator in the vertical orientation, equals volts needed to hold the arm up against gravity when orinteted vertically (max cg).kv- Velocity gainka- Acceleration gain. Zero is usually an okay default.
-
-
Method Details
-
calculate
public double calculate(double posRads, double velMetersPerSec) - Parameters:
posRads- Position of the arm, in radians from horizontal. 0 = horizontal, PI/2 = vertical.velMetersPerSec- Velocity setpoint
-
maxAchievableVelocity
public double maxAchievableVelocity(double maxVoltage, double posRads, double acceleration) Calculates the maximum achievable velocity given a maximum voltage supply and an acceleration. Useful for ensuring that velocity and acceleration constraints for a trapezoidal profile are simultaneously achievable - enter the acceleration constraint, and this will give you a simultaneously-achievable velocity constraint. -
minAchievableVelocity
public double minAchievableVelocity(double maxVoltage, double posRads, double acceleration) Calculates the minimum achievable velocity given a minimum voltage supply and an acceleration. Useful for ensuring that velocity and acceleration constraints for a trapezoidal profile are simultaneously achievable - enter the acceleration constraint, and this will give you a simultaneously-achievable velocity constraint. -
maxAchievableAcceleration
public double maxAchievableAcceleration(double maxVoltage, double posRads, double velocity) Calculates the maximum achievable acceleration given a maximum voltage supply and a velocity. Useful for ensuring that velocity and acceleration constraints for a trapezoidal profile are simultaneously achievable - enter the velocity constraint, and this will give you a simultaneously-achievable acceleration constraint. -
minAchievableAcceleration
public double minAchievableAcceleration(double maxVoltage, double posRads, double velocity) Calculates the minimum achievable acceleration given a minimum voltage supply and a velocity. Useful for ensuring that velocity and acceleration constraints for a trapezoidal profile are simultaneously achievable - enter the velocity constraint, and this will give you a simultaneously-achievable acceleration constraint.
-