20template <
class Distance>
55 return kS *
wpi::sgn(velocity) +
kV * velocity +
kA * acceleration;
69 units::second_t dt)
const {
70 auto plant = LinearSystemId::IdentifyVelocitySystem<Distance>(
kV,
kA);
77 units::volt_t{feedforward.Calculate(r, nextR)(0)};
95 units::volt_t maxVoltage,
98 return (maxVoltage -
kS -
kA * acceleration) /
kV;
113 units::volt_t maxVoltage,
116 return (-maxVoltage +
kS -
kA * acceleration) /
kV;
132 return (maxVoltage -
kS *
wpi::sgn(velocity) -
kV * velocity) /
kA;
Constructs a plant inversion model-based feedforward from a LinearSystem.
Definition: LinearPlantInversionFeedforward.h:32
A helper class that computes feedforward voltages for a simple permanent-magnet DC motor.
Definition: SimpleMotorFeedforward.h:21
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.
Definition: SimpleMotorFeedforward.h:112
units::volt_t kS
Definition: SimpleMotorFeedforward.h:151
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.
Definition: SimpleMotorFeedforward.h:67
units::compound_unit< Distance, units::inverse< units::seconds > > Velocity
Definition: SimpleMotorFeedforward.h:24
units::compound_unit< units::volts, units::inverse< Acceleration > > ka_unit
Definition: SimpleMotorFeedforward.h:29
units::unit_t< kv_unit > kV
Definition: SimpleMotorFeedforward.h:152
units::unit_t< ka_unit > kA
Definition: SimpleMotorFeedforward.h:153
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.
Definition: SimpleMotorFeedforward.h:52
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.
Definition: SimpleMotorFeedforward.h:130
units::compound_unit< units::volts, units::inverse< Velocity > > kv_unit
Definition: SimpleMotorFeedforward.h:27
units::compound_unit< Velocity, units::inverse< units::seconds > > Acceleration
Definition: SimpleMotorFeedforward.h:26
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.
Definition: SimpleMotorFeedforward.h:146
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.
Definition: SimpleMotorFeedforward.h:40
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.
Definition: SimpleMotorFeedforward.h:94
constexpr SimpleMotorFeedforward()=default
constexpr underlying_type value() const noexcept
unit value
Definition: base.h:2118
typename units::detail::compound_impl< U, Us... >::type compound_unit
Represents a unit type made up from other units.
Definition: base.h:1445
Definition: AprilTagPoseEstimator.h:15
Eigen::Vector< double, Size > Vectord
Definition: EigenCore.h:12
constexpr int sgn(T val)
Definition: MathExtras.h:936