ArmFeedforward

class wpimath.controller.ArmFeedforward(kS: wpimath.units.volts, kG: wpimath.units.volts, kV: wpimath.units.volt_seconds_per_radian, kA: wpimath.units.volt_seconds_squared_per_radian = 0.0)

Bases: pybind11_object

A helper class that computes feedforward outputs for a simple arm (modeled as a motor acting against the force of gravity on a beam suspended at an angle).

Creates a new ArmFeedforward with the specified gains.

Parameters:
  • kS – The static gain, in volts.

  • kG – The gravity gain, in volts.

  • kV – The velocity gain, in volt seconds per radian.

  • kA – The acceleration gain, in volt seconds² per radian.

WPIStruct = <capsule object "WPyStruct">
calculate(angle: wpimath.units.radians, velocity: wpimath.units.radians_per_second, acceleration: wpimath.units.radians_per_second_squared = 0.0) wpimath.units.volts

Calculates the feedforward from the gains and setpoints.

Parameters:
  • angle – The angle setpoint, in radians. This angle should be measured from the horizontal (i.e. if the provided angle is 0, the arm should be parallel to the floor). If your encoder does not follow this convention, an offset should be added.

  • velocity – The velocity setpoint, in radians per second.

  • acceleration – The acceleration setpoint, in radians per second².

Returns:

The computed feedforward, in volts.

property kA wpimath.units.volt_seconds_squared_per_radian

The acceleration gain, in volt seconds² per radian.

property kG wpimath.units.volts

The gravity gain, in volts.

property kS wpimath.units.volts

The static gain, in volts.

property kV wpimath.units.volt_seconds_per_radian

The velocity gain, in volt seconds per radian.

maxAchievableAcceleration(maxVoltage: wpimath.units.volts, angle: wpimath.units.radians, velocity: wpimath.units.radians_per_second) wpimath.units.radians_per_second_squared

Calculates the maximum achievable acceleration given a maximum voltage supply, a position, 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.

Parameters:
  • maxVoltage – The maximum voltage that can be supplied to the arm.

  • angle – The angle of the arm. This angle should be measured from the horizontal (i.e. if the provided angle is 0, the arm should be parallel to the floor). If your encoder does not follow this convention, an offset should be added.

  • velocity – The velocity of the arm.

Returns:

The maximum possible acceleration at the given velocity and angle.

maxAchievableVelocity(maxVoltage: wpimath.units.volts, angle: wpimath.units.radians, acceleration: wpimath.units.radians_per_second_squared) wpimath.units.radians_per_second

Calculates the maximum achievable velocity given a maximum voltage supply, a position, 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.

Parameters:
  • maxVoltage – The maximum voltage that can be supplied to the arm.

  • angle – The angle of the arm. This angle should be measured from the horizontal (i.e. if the provided angle is 0, the arm should be parallel to the floor). If your encoder does not follow this convention, an offset should be added.

  • acceleration – The acceleration of the arm.

Returns:

The maximum possible velocity at the given acceleration and angle.

minAchievableAcceleration(maxVoltage: wpimath.units.volts, angle: wpimath.units.radians, velocity: wpimath.units.radians_per_second) wpimath.units.radians_per_second_squared

Calculates the minimum achievable acceleration given a maximum voltage supply, a position, 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.

Parameters:
  • maxVoltage – The maximum voltage that can be supplied to the arm.

  • angle – The angle of the arm. This angle should be measured from the horizontal (i.e. if the provided angle is 0, the arm should be parallel to the floor). If your encoder does not follow this convention, an offset should be added.

  • velocity – The velocity of the arm.

Returns:

The minimum possible acceleration at the given velocity and angle.

minAchievableVelocity(maxVoltage: wpimath.units.volts, angle: wpimath.units.radians, acceleration: wpimath.units.radians_per_second_squared) wpimath.units.radians_per_second

Calculates the minimum achievable velocity given a maximum voltage supply, a position, 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.

Parameters:
  • maxVoltage – The maximum voltage that can be supplied to the arm.

  • angle – The angle of the arm. This angle should be measured from the horizontal (i.e. if the provided angle is 0, the arm should be parallel to the floor). If your encoder does not follow this convention, an offset should be added.

  • acceleration – The acceleration of the arm.

Returns:

The minimum possible velocity at the given acceleration and angle.