ElevatorFeedforward
- class wpimath.ElevatorFeedforward(s: wpimath.units.volts, g: wpimath.units.volts, v: wpimath.units.volt_seconds_per_meter, a: wpimath.units.volt_seconds_squared_per_meter = 0.0, dt: wpimath.units.seconds = 0.02)
Bases:
pybind11_objectA helper class that computes feedforward outputs for a simple elevator (modeled as a motor acting against the force of gravity).
Creates a new ElevatorFeedforward with the specified gains.
- Parameters:
s – The static gain, in volts.
g – The gravity gain, in volts.
v – The velocity gain, in volt seconds per distance.
a – 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.
- WPIStruct = <capsule object "WPyStruct">
- calculate(*args, **kwargs)
Overloaded function.
calculate(self: wpimath._wpimath.ElevatorFeedforward, current_velocity: wpimath.units.meters_per_second) -> wpimath.units.volts
Calculates the feedforward from the gains and setpoint assuming discrete control. Use this method when the setpoint does not change.
- Parameters:
current_velocity – The velocity setpoint.
- Returns:
The computed feedforward, in volts.
calculate(self: wpimath._wpimath.ElevatorFeedforward, current_velocity: wpimath.units.meters_per_second, next_velocity: wpimath.units.meters_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:
current_velocity – The current velocity setpoint.
next_velocity – The next velocity setpoint.
- Returns:
The computed feedforward, in volts.
- get_ka() wpimath.units.volt_seconds_squared_per_meter
Returns the acceleration gain.
- Returns:
The acceleration gain.
- get_kg() wpimath.units.volts
Returns the gravity gain.
- Returns:
The gravity gain.
- get_ks() wpimath.units.volts
Returns the static gain.
- Returns:
The static gain.
- get_kv() wpimath.units.volt_seconds_per_meter
Returns the velocity gain.
- Returns:
The velocity gain.
- max_achievable_acceleration(max_voltage: wpimath.units.volts, velocity: wpimath.units.meters_per_second) wpimath.units.meters_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:
max_voltage – The maximum voltage that can be supplied to the elevator.
velocity – The velocity of the elevator.
- Returns:
The maximum possible acceleration at the given velocity.
- max_achievable_velocity(max_voltage: wpimath.units.volts, acceleration: wpimath.units.meters_per_second_squared) wpimath.units.meters_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:
max_voltage – The maximum voltage that can be supplied to the elevator.
acceleration – The acceleration of the elevator.
- Returns:
The maximum possible velocity at the given acceleration.
- min_achievable_acceleration(max_voltage: wpimath.units.volts, velocity: wpimath.units.meters_per_second) wpimath.units.meters_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:
max_voltage – The maximum voltage that can be supplied to the elevator.
velocity – The velocity of the elevator.
- Returns:
The minimum possible acceleration at the given velocity.
- min_achievable_velocity(max_voltage: wpimath.units.volts, acceleration: wpimath.units.meters_per_second_squared) wpimath.units.meters_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:
max_voltage – The maximum voltage that can be supplied to the elevator.
acceleration – The acceleration of the elevator.
- Returns:
The minimum possible velocity at the given acceleration.
- set_ka(a: wpimath.units.volt_seconds_squared_per_meter) None
Sets the acceleration gain.
- Parameters:
a – The acceleration gain.
- set_kg(g: wpimath.units.volts) None
Sets the gravity gain.
- Parameters:
g – The gravity gain.
- set_ks(s: wpimath.units.volts) None
Sets the static gain.
- Parameters:
s – The static gain.
- set_kv(v: wpimath.units.volt_seconds_per_meter) None
Sets the velocity gain.
- Parameters:
v – The velocity gain.