![]() |
WPILibC++ 2025.3.2
|
A helper class that computes feedforward voltages for a simple permanent-magnet DC motor. More...
#include <frc/controller/SimpleMotorFeedforward.h>
Public Types | |
| using | Velocity |
| using | Acceleration |
| using | kv_unit = units::compound_unit<units::volts, units::inverse<Velocity>> |
| using | ka_unit |
Public Member Functions | |
| constexpr | SimpleMotorFeedforward (units::volt_t kS, units::unit_t< kv_unit > kV, units::unit_t< ka_unit > kA=units::unit_t< ka_unit >(0), units::second_t dt=20_ms) |
| Creates a new SimpleMotorFeedforward with the specified gains. | |
| constexpr units::volt_t | Calculate (units::unit_t< Velocity > velocity, units::unit_t< Acceleration > acceleration) const |
| Calculates the feedforward from the gains and setpoints assuming continuous control. | |
| constexpr units::volt_t | Calculate (units::unit_t< Velocity > velocity) const |
| Calculates the feedforward from the gains and velocity setpoint assuming discrete control. | |
| constexpr units::volt_t | Calculate (units::unit_t< Velocity > currentVelocity, units::unit_t< Velocity > nextVelocity) const |
| Calculates the feedforward from the gains and setpoints assuming discrete control. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| constexpr void | SetKs (units::volt_t kS) |
| Sets the static gain. | |
| constexpr void | SetKv (units::unit_t< kv_unit > kV) |
| Sets the velocity gain. | |
| constexpr void | SetKa (units::unit_t< ka_unit > kA) |
| Sets the acceleration gain. | |
| constexpr units::volt_t | GetKs () const |
| Returns the static gain. | |
| constexpr units::unit_t< kv_unit > | GetKv () const |
| Returns the velocity gain. | |
| constexpr units::unit_t< ka_unit > | GetKa () const |
| Returns the acceleration gain. | |
| constexpr units::second_t | GetDt () const |
| Returns the period. | |
A helper class that computes feedforward voltages for a simple permanent-magnet DC motor.
| using frc::SimpleMotorFeedforward< Distance >::Acceleration |
| using frc::SimpleMotorFeedforward< Distance >::ka_unit |
| using frc::SimpleMotorFeedforward< Distance >::kv_unit = units::compound_unit<units::volts, units::inverse<Velocity>> |
| using frc::SimpleMotorFeedforward< Distance >::Velocity |
|
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. |
| dt | The period in seconds. |
|
inlineconstexpr |
Calculates the feedforward from the gains and setpoints assuming discrete control.
Note this method is inaccurate when the velocity crosses 0.
| currentVelocity | The current velocity setpoint. |
| nextVelocity | The next velocity setpoint. |
|
inlineconstexpr |
Calculates the feedforward from the gains and velocity setpoint assuming discrete control.
Use this method when the velocity setpoint does not change.
| velocity | The velocity setpoint. |
|
inlineconstexpr |
Calculates the feedforward from the gains and setpoints assuming continuous control.
| velocity | The velocity setpoint. |
| acceleration | The acceleration setpoint. |
|
inlineconstexpr |
Returns the period.
|
inlineconstexpr |
Returns the acceleration gain.
|
inlineconstexpr |
Returns the static gain.
|
inlineconstexpr |
Returns the velocity gain.
|
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. |
|
inlineconstexpr |
Sets the acceleration gain.
| kA | The acceleration gain. |
|
inlineconstexpr |
Sets the static gain.
| kS | The static gain. |
|
inlineconstexpr |
Sets the velocity gain.
| kV | The velocity gain. |