Package yams.math
Class LQRController
java.lang.Object
yams.math.LQRController
Linear Quadratic Regulator (Regulator is a type of controller)
-
Constructor Summary
ConstructorsConstructorDescriptionLQRController(LQRConfig config) Create a LQR Controller.LQRController(LQRConfig.LQRType type, LinearSystemLoop<?, ?, ?> loop, Time period) Create a LQR Controller. -
Method Summary
Modifier and TypeMethodDescriptioncalculate(Angle measured, Angle position, AngularVelocity velocity) Calculate the voltage for an Arm LQRcalculate(AngularVelocity measured, AngularVelocity velocity) Calculate the voltage for a Flywheel LQRcalculate(Distance measured, Distance position, LinearVelocity velocity) Calculate the voltage for a Elevator LQRcalculate(LinearVelocity measured, LinearVelocity velocity) Calculate the voltage for a Flywheel LQRGet theLQRConfigfor the LQR.getType()Get the type of LQR.voidreset(Angle angle, AngularVelocity velocity) Reset the Arm or Flywheel LQR.voidreset(Distance distance, LinearVelocity velocity) Reset the Elevator LQR.voidupdateConfig(LQRConfig config) Update LQR based off config.
-
Constructor Details
-
LQRController
Create a LQR Controller.- Parameters:
type- LQR Type.loop-LinearSystemLoopwhich can be derived fromLQRConfigperiod- Loop time.
-
LQRController
Create a LQR Controller.- Parameters:
config-LQRConfigto create the controller from.
-
-
Method Details
-
updateConfig
Update LQR based off config.- Parameters:
config-LQRConfig
-
reset
Reset the Arm or Flywheel LQR.- Parameters:
angle- Current angle.velocity- Current velocity.
-
reset
Reset the Elevator LQR.- Parameters:
distance- Current distance.velocity- Current velocity.
-
calculate
Calculate the voltage for an Arm LQR- Parameters:
measured- Measured angle from the arm.position-Anglesetpoint to go to.velocity-AngularVelocitysetpoint to go to.- Returns:
Voltageto apply to the arm.
-
calculate
Calculate the voltage for a Elevator LQR- Parameters:
measured- Measured distance of the elevator.position- Setpoint distance of the elevator from the motion profile.velocity- Setpoint velocity of the elevator from the motion profile.- Returns:
Voltageto apply to the elevator.
-
calculate
Calculate the voltage for a Flywheel LQR- Parameters:
measured- Measured velocity of the flywheel.velocity- Setpoint velocity of the flywheel.- Returns:
Voltageto apply to the flywheel.
-
calculate
Calculate the voltage for a Flywheel LQR- Parameters:
measured- Measured velocity of the flywheel.velocity- Setpoint velocity of the flywheel.- Returns:
Voltageto apply to the flywheel.
-
getType
Get the type of LQR.- Returns:
LQRConfig.LQRType
-
getConfig
Get theLQRConfigfor the LQR.- Returns:
LQRConfig
-