WPILibC++  2020.3.2-60-g3011ebe
frc::ArmFeedforward Class Reference

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 <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 (units::volt_t kS, units::volt_t kCos, 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 kCos {0}
 
units::unit_t< kv_unit > kV {0}
 
units::unit_t< ka_unit > kA {0}
 

Detailed Description

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).

Constructor & Destructor Documentation

◆ ArmFeedforward()

constexpr frc::ArmFeedforward::ArmFeedforward ( units::volt_t  kS,
units::volt_t  kCos,
units::unit_t< kv_unit >  kV,
units::unit_t< ka_unit >  kA = units::unit_t<ka_unit>(0) 
)
inlineconstexpr

Creates a new ArmFeedforward with the specified gains.

Parameters
kSThe static gain, in volts.
kCosThe gravity gain, in volts.
kVThe velocity gain, in volt seconds per radian.
kAThe acceleration gain, in volt seconds^2 per radian.

Member Function Documentation

◆ Calculate()

units::volt_t frc::ArmFeedforward::Calculate ( units::unit_t< Angle >  angle,
units::unit_t< Velocity >  velocity,
units::unit_t< Acceleration >  acceleration = units::unit_t<Acceleration>(0) 
) const
inline

Calculates the feedforward from the gains and setpoints.

Parameters
angleThe angle setpoint, in radians.
velocityThe velocity setpoint, in radians per second.
accelerationThe acceleration setpoint, in radians per second^2.
Returns
The computed feedforward, in volts.

◆ MaxAchievableAcceleration()

units::unit_t<Acceleration> frc::ArmFeedforward::MaxAchievableAcceleration ( units::volt_t  maxVoltage,
units::unit_t< Angle >  angle,
units::unit_t< Velocity >  velocity 
)
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.

Parameters
maxVoltageThe maximum voltage that can be supplied to the arm.
angleThe angle of the arm
velocityThe velocity of the arm.
Returns
The maximum possible acceleration at the given velocity and angle.

◆ MaxAchievableVelocity()

units::unit_t<Velocity> frc::ArmFeedforward::MaxAchievableVelocity ( units::volt_t  maxVoltage,
units::unit_t< Angle >  angle,
units::unit_t< Acceleration >  acceleration 
)
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.

Parameters
maxVoltageThe maximum voltage that can be supplied to the arm.
angleThe angle of the arm
accelerationThe acceleration of the arm.
Returns
The maximum possible velocity at the given acceleration and angle.

◆ MinAchievableAcceleration()

units::unit_t<Acceleration> frc::ArmFeedforward::MinAchievableAcceleration ( units::volt_t  maxVoltage,
units::unit_t< Angle >  angle,
units::unit_t< Velocity >  velocity 
)
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.

Parameters
maxVoltageThe maximum voltage that can be supplied to the arm.
angleThe angle of the arm
velocityThe velocity of the arm.
Returns
The minimum possible acceleration at the given velocity and angle.

◆ MinAchievableVelocity()

units::unit_t<Velocity> frc::ArmFeedforward::MinAchievableVelocity ( units::volt_t  maxVoltage,
units::unit_t< Angle >  angle,
units::unit_t< Acceleration >  acceleration 
)
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.

Parameters
maxVoltageThe maximum voltage that can be supplied to the arm.
angleThe angle of the arm
accelerationThe acceleration of the arm.
Returns
The minimum possible velocity at the given acceleration and angle.

The documentation for this class was generated from the following file: