SimpleMotorFeedforwardRadians
- class wpimath.SimpleMotorFeedforwardRadians(kS: wpimath.units.volts, kV: wpimath.units.volt_seconds_per_radian, kA: wpimath.units.volt_seconds_squared_per_radian = 0.0, dt: wpimath.units.seconds = 0.02)
Bases:
pybind11_objectA helper class that computes feedforward voltages for a simple permanent-magnet DC motor.
Creates a new SimpleMotorFeedforward with the specified gains.
- Parameters:
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. @throws IllegalArgumentException for kv < zero. @throws IllegalArgumentException for ka < zero. @throws IllegalArgumentException for period ≤ zero.
- calculate(*args, **kwargs)
Overloaded function.
calculate(self: wpimath._wpimath.SimpleMotorFeedforwardRadians, velocity: wpimath.units.radians_per_second) -> wpimath.units.volts
Calculates the feedforward from the gains and velocity setpoint assuming discrete control. Use this method when the velocity setpoint does not change.
- Parameters:
velocity – The velocity setpoint.
- Returns:
The computed feedforward, in volts.
calculate(self: wpimath._wpimath.SimpleMotorFeedforwardRadians, currentVelocity: wpimath.units.radians_per_second, nextVelocity: wpimath.units.radians_per_second) -> wpimath.units.volts
Calculates the feedforward from the gains and setpoints assuming discrete control.
Note this method is inaccurate when the velocity crosses 0.
- Parameters:
currentVelocity – The current velocity setpoint.
nextVelocity – The next velocity setpoint.
- Returns:
The computed feedforward, in volts.
- getDt() wpimath.units.seconds
Returns the period.
- Returns:
The period.
- getKa() wpimath.units.volt_seconds_squared_per_radian
Returns the acceleration gain.
- Returns:
The acceleration gain.
- getKs() wpimath.units.volts
Returns the static gain.
- Returns:
The static gain.
- getKv() wpimath.units.volt_seconds_per_radian
Returns the velocity gain.
- Returns:
The velocity gain.
- maxAchievableAcceleration(maxVoltage: wpimath.units.volts, velocity: wpimath.units.radians_per_second) wpimath.units.radians_per_second_squared
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.
- Parameters:
maxVoltage – The maximum voltage that can be supplied to the motor.
velocity – The velocity of the motor.
- Returns:
The maximum possible acceleration at the given velocity.
- maxAchievableVelocity(maxVoltage: wpimath.units.volts, acceleration: wpimath.units.radians_per_second_squared) wpimath.units.radians_per_second
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.
- Parameters:
maxVoltage – The maximum voltage that can be supplied to the motor.
acceleration – The acceleration of the motor.
- Returns:
The maximum possible velocity at the given acceleration.
- minAchievableAcceleration(maxVoltage: wpimath.units.volts, velocity: wpimath.units.radians_per_second) wpimath.units.radians_per_second_squared
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.
- Parameters:
maxVoltage – The maximum voltage that can be supplied to the motor.
velocity – The velocity of the motor.
- Returns:
The minimum possible acceleration at the given velocity.
- minAchievableVelocity(maxVoltage: wpimath.units.volts, acceleration: wpimath.units.radians_per_second_squared) wpimath.units.radians_per_second
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.
- Parameters:
maxVoltage – The maximum voltage that can be supplied to the motor.
acceleration – The acceleration of the motor.
- Returns:
The minimum possible velocity at the given acceleration.
- setKa(kA: wpimath.units.volt_seconds_squared_per_radian) None
Sets the acceleration gain.
- Parameters:
kA – The acceleration gain.
- setKs(kS: wpimath.units.volts) None
Sets the static gain.
- Parameters:
kS – The static gain.
- setKv(kV: wpimath.units.volt_seconds_per_radian) None
Sets the velocity gain.
- Parameters:
kV – The velocity gain.