WPILibC++ 2023.4.3
|
A helper class that computes feedforward voltages for a simple permanent-magnet DC motor. More...
#include <frc/controller/SimpleMotorFeedforward.h>
Public Types | |
using | Velocity = units::compound_unit< Distance, units::inverse< units::seconds > > |
using | Acceleration = units::compound_unit< Velocity, units::inverse< units::seconds > > |
using | kv_unit = units::compound_unit< units::volts, units::inverse< Velocity > > |
using | ka_unit = units::compound_unit< units::volts, units::inverse< Acceleration > > |
Public Member Functions | |
constexpr | SimpleMotorFeedforward ()=default |
constexpr | SimpleMotorFeedforward (units::volt_t kS, units::unit_t< kv_unit > kV, units::unit_t< ka_unit > kA=units::unit_t< ka_unit >(0)) |
Creates a new SimpleMotorFeedforward with the specified gains. More... | |
constexpr units::volt_t | Calculate (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::volt_t | Calculate (units::unit_t< Velocity > currentVelocity, units::unit_t< Velocity > nextVelocity, units::second_t dt) const |
Calculates the feedforward from the gains and setpoints. More... | |
constexpr units::unit_t< Velocity > | MaxAchievableVelocity (units::volt_t maxVoltage, units::unit_t< Acceleration > acceleration) const |
Calculates the maximum achievable velocity given a maximum voltage supply and an acceleration. More... | |
constexpr units::unit_t< Velocity > | MinAchievableVelocity (units::volt_t maxVoltage, units::unit_t< Acceleration > acceleration) const |
Calculates the minimum achievable velocity given a maximum voltage supply and an acceleration. More... | |
constexpr units::unit_t< Acceleration > | MaxAchievableAcceleration (units::volt_t maxVoltage, units::unit_t< Velocity > velocity) const |
Calculates the maximum achievable acceleration given a maximum voltage supply and a velocity. More... | |
constexpr units::unit_t< Acceleration > | MinAchievableAcceleration (units::volt_t maxVoltage, units::unit_t< Velocity > velocity) const |
Calculates the minimum achievable acceleration given a maximum voltage supply and a velocity. More... | |
Public Attributes | |
units::volt_t | kS {0} |
units::unit_t< kv_unit > | kV {0} |
units::unit_t< ka_unit > | kA {0} |
A helper class that computes feedforward voltages for a simple permanent-magnet DC motor.
using frc::SimpleMotorFeedforward< Distance >::Acceleration = units::compound_unit<Velocity, units::inverse<units::seconds> > |
using frc::SimpleMotorFeedforward< Distance >::ka_unit = units::compound_unit<units::volts, units::inverse<Acceleration> > |
using frc::SimpleMotorFeedforward< Distance >::kv_unit = units::compound_unit<units::volts, units::inverse<Velocity> > |
using frc::SimpleMotorFeedforward< Distance >::Velocity = units::compound_unit<Distance, units::inverse<units::seconds> > |
|
constexprdefault |
|
inlineconstexpr |
Creates a new SimpleMotorFeedforward with the specified gains.
kS | The static gain, in volts. |
kV | The velocity gain, in volt seconds per distance. |
kA | The acceleration gain, in volt secondsĀ² per distance. |
|
inline |
Calculates the feedforward from the gains and setpoints.
currentVelocity | The current velocity setpoint, in distance per second. |
nextVelocity | The next velocity setpoint, in distance per second. |
dt | Time between velocity setpoints in seconds. |
|
inlineconstexpr |
Calculates the feedforward from the gains and setpoints.
velocity | The velocity setpoint, in distance per second. |
acceleration | The acceleration setpoint, in distance per secondĀ². |
|
inlineconstexpr |
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.
maxVoltage | The maximum voltage that can be supplied to the motor. |
velocity | The velocity of the motor. |
|
inlineconstexpr |
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.
maxVoltage | The maximum voltage that can be supplied to the motor. |
acceleration | The acceleration of the motor. |
|
inlineconstexpr |
Calculates the minimum 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.
maxVoltage | The maximum voltage that can be supplied to the motor. |
velocity | The velocity of the motor. |
|
inlineconstexpr |
Calculates the minimum 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.
maxVoltage | The maximum voltage that can be supplied to the motor. |
acceleration | The acceleration of the motor. |
units::unit_t<ka_unit> frc::SimpleMotorFeedforward< Distance >::kA {0} |
units::volt_t frc::SimpleMotorFeedforward< Distance >::kS {0} |
units::unit_t<kv_unit> frc::SimpleMotorFeedforward< Distance >::kV {0} |