Package me.nabdev.oxconfig.sampleClasses
Class ConfigurablePIDController
java.lang.Object
edu.wpi.first.math.controller.PIDController
me.nabdev.oxconfig.sampleClasses.ConfigurablePIDController
- All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable
,AutoCloseable
,ConfigurableClass
public class ConfigurablePIDController
extends edu.wpi.first.math.controller.PIDController
implements ConfigurableClass
A WPILib PIDController that can be configured by OxConfig.
This class is an example of implementing ConfigurableClass, but is safe for
competition use.
-
Constructor Summary
ConstructorsConstructorDescriptionConfigurablePIDController
(double kp, double ki, double kd, String key) Allocates a ConfigurablePIDController and registers it to OxConfig with the given constants for kp, ki, and kd and a default period of 0.02 seconds.ConfigurablePIDController
(double kp, double ki, double kd, String key, String prettyName) Allocates a ConfigurablePIDController and registers it to OxConfig with the given constants for kp, ki, and kd and a default period of 0.02 seconds. -
Method Summary
Modifier and TypeMethodDescriptiongetKey()
Gets the key of the configurable class (e.g.Gets the parameters of the configurable classGets the pretty name of the configurable class (e.g.Methods inherited from class edu.wpi.first.math.controller.PIDController
atSetpoint, calculate, calculate, close, disableContinuousInput, enableContinuousInput, getAccumulatedError, getD, getError, getErrorDerivative, getErrorDerivativeTolerance, getErrorTolerance, getI, getIZone, getP, getPeriod, getPositionError, getPositionTolerance, getSetpoint, getVelocityError, getVelocityTolerance, initSendable, isContinuousInputEnabled, reset, setD, setI, setIntegratorRange, setIZone, setP, setPID, setSetpoint, setTolerance, setTolerance
-
Constructor Details
-
ConfigurablePIDController
Allocates a ConfigurablePIDController and registers it to OxConfig with the given constants for kp, ki, and kd and a default period of 0.02 seconds.- Parameters:
kp
- The proportional coefficient.ki
- The integral coefficient.kd
- The derivative coefficient.key
- The json key for the controller to be stored in
-
ConfigurablePIDController
Allocates a ConfigurablePIDController and registers it to OxConfig with the given constants for kp, ki, and kd and a default period of 0.02 seconds.- Parameters:
kp
- The proportional coefficient.ki
- The integral coefficient.kd
- The derivative coefficient.key
- The json key for the controller to be stored inprettyName
- The display name of this controller
-
-
Method Details
-
getParameters
Description copied from interface:ConfigurableClass
Gets the parameters of the configurable class- Specified by:
getParameters
in interfaceConfigurableClass
- Returns:
- The parameters of the configurable class
-
getKey
Description copied from interface:ConfigurableClass
Gets the key of the configurable class (e.g. "Arm"), must not include commas- Specified by:
getKey
in interfaceConfigurableClass
- Returns:
- The key of the configurable class
-
getPrettyName
Description copied from interface:ConfigurableClass
Gets the pretty name of the configurable class (e.g. "Arm")- Specified by:
getPrettyName
in interfaceConfigurableClass
- Returns:
- The pretty name of the configurable class
-