WPILibC++ 2023.4.3-108-ge5452e3
|
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). More...
#include <frc/controller/ArmFeedforward.h>
Public Types | |
using | Angle = units::radians |
using | Velocity = units::radians_per_second |
using | Acceleration = units::compound_unit< units::radians_per_second, units::inverse< units::second > > |
using | kv_unit = units::compound_unit< units::volts, units::inverse< units::radians_per_second > > |
using | ka_unit = units::compound_unit< units::volts, units::inverse< Acceleration > > |
Public Member Functions | |
constexpr | ArmFeedforward ()=default |
constexpr | ArmFeedforward (units::volt_t kS, units::volt_t kG, units::unit_t< kv_unit > kV, units::unit_t< ka_unit > kA=units::unit_t< ka_unit >(0)) |
Creates a new ArmFeedforward with the specified gains. More... | |
units::volt_t | Calculate (units::unit_t< Angle > angle, units::unit_t< Velocity > velocity, units::unit_t< Acceleration > acceleration=units::unit_t< Acceleration >(0)) const |
Calculates the feedforward from the gains and setpoints. More... | |
units::unit_t< Velocity > | MaxAchievableVelocity (units::volt_t maxVoltage, units::unit_t< Angle > angle, units::unit_t< Acceleration > acceleration) |
Calculates the maximum achievable velocity given a maximum voltage supply, a position, and an acceleration. More... | |
units::unit_t< Velocity > | MinAchievableVelocity (units::volt_t maxVoltage, units::unit_t< Angle > angle, units::unit_t< Acceleration > acceleration) |
Calculates the minimum achievable velocity given a maximum voltage supply, a position, and an acceleration. More... | |
units::unit_t< Acceleration > | MaxAchievableAcceleration (units::volt_t maxVoltage, units::unit_t< Angle > angle, units::unit_t< Velocity > velocity) |
Calculates the maximum achievable acceleration given a maximum voltage supply, a position, and a velocity. More... | |
units::unit_t< Acceleration > | MinAchievableAcceleration (units::volt_t maxVoltage, units::unit_t< Angle > angle, units::unit_t< Velocity > velocity) |
Calculates the minimum achievable acceleration given a maximum voltage supply, a position, and a velocity. More... | |
Public Attributes | |
units::volt_t | kS {0} |
units::volt_t | kG {0} |
units::unit_t< kv_unit > | kV {0} |
units::unit_t< ka_unit > | kA {0} |
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).
using frc::ArmFeedforward::Acceleration = units::compound_unit<units::radians_per_second, units::inverse<units::second> > |
using frc::ArmFeedforward::Angle = units::radians |
using frc::ArmFeedforward::ka_unit = units::compound_unit<units::volts, units::inverse<Acceleration> > |
using frc::ArmFeedforward::kv_unit = units::compound_unit<units::volts, units::inverse<units::radians_per_second> > |
using frc::ArmFeedforward::Velocity = units::radians_per_second |
|
constexprdefault |
|
inlineconstexpr |
Creates a new ArmFeedforward with the specified gains.
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. |
|
inline |
Calculates the feedforward from the gains and setpoints.
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Ā². |
|
inline |
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.
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. |
|
inline |
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.
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. |
|
inline |
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.
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. |
|
inline |
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.
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. |
units::unit_t<ka_unit> frc::ArmFeedforward::kA {0} |
units::volt_t frc::ArmFeedforward::kG {0} |
units::volt_t frc::ArmFeedforward::kS {0} |
units::unit_t<kv_unit> frc::ArmFeedforward::kV {0} |