Class ClosedLoopConfig
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static enum
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionapply
(ClosedLoopConfig config) Applies settings from anotherClosedLoopConfig
to this one, including all of its nested configurations.apply
(MAXMotionConfig config) Applies settings from aMAXMotionConfig
to thisClosedLoopConfig
.apply
(SmartMotionConfig config) Applies settings from aSmartMotionConfig
to thisClosedLoopConfig
.d
(double d) Set the derivative gain of the controller.d
(double d, ClosedLoopConfig.ClosedLoopSlot slot) Set the derivative gain of the controller for a specific closed loop slot.dFilter
(double dFilter) Set the derivative filter of the controller.dFilter
(double dFilter, ClosedLoopConfig.ClosedLoopSlot slot) Set the derivative filter of the controller for a specific closed loop slot.Set the feedback sensor of the controller.flatten()
i
(double i) Set the integral gain of the controller.i
(double i, ClosedLoopConfig.ClosedLoopSlot slot) Set the integral gain of the controller for a specific closed loop slot.iMaxAccum
(double iMaxAccum) Set the maximum I accumulator of the controller.iMaxAccum
(double iMaxAccum, ClosedLoopConfig.ClosedLoopSlot slot) Set the maximum I accumulator of the controller for a specific closed loop slot.iZone
(double iZone) Set the integral zone of the controller.iZone
(double iZone, ClosedLoopConfig.ClosedLoopSlot slot) Set the integral zone of the controller for a specific closed loop slot.maxOutput
(double maxOutput) Set the maximum output of the controller.maxOutput
(double maxOutput, ClosedLoopConfig.ClosedLoopSlot slot) Set the maximum output of the controller for a specific closed loop slot.minOutput
(double minOutput) Set the minimum output of the controller.minOutput
(double minOutput, ClosedLoopConfig.ClosedLoopSlot slot) Set the minimum output of the controller for a specific closed loop slot.outputRange
(double minOutput, double maxOutput) Set the output range of the controller.outputRange
(double minOutput, double maxOutput, ClosedLoopConfig.ClosedLoopSlot slot) Set the output range of the controller for a specific closed loop slot.p
(double p) Set the proportional gain of the controller.p
(double p, ClosedLoopConfig.ClosedLoopSlot slot) Set the proportional gain of the controller for a specific closed loop slot.pid
(double p, double i, double d) Set the PID gains of the controller.pid
(double p, double i, double d, ClosedLoopConfig.ClosedLoopSlot slot) Set the PID gains of the controller for a specific closed loop slot.pidf
(double p, double i, double d, double ff) Set the PIDF gains of the controller.pidf
(double p, double i, double d, double ff, ClosedLoopConfig.ClosedLoopSlot slot) Set the PIDF gains of the controller for a specific closed loop slot.positionWrappingEnabled
(boolean enabled) Enable or disable PID wrapping for position closed loop control.positionWrappingInputRange
(double minInput, double maxInput) Set the input range for PID wrapping with position closed loop controlpositionWrappingMaxInput
(double maxInput) Set the maximum input value for PID wrapping with position closed loop controlpositionWrappingMinInput
(double minInput) Set the minimum input value for PID wrapping with position closed loop control.velocityFF
(double ff) Set the velocity feedforward gain of the controller.velocityFF
(double ff, ClosedLoopConfig.ClosedLoopSlot slot) Set the velocity feedforward gain of the controller for a specific closed loop slot.
-
Field Details
-
smartMotion
-
maxMotion
-
-
Constructor Details
-
ClosedLoopConfig
public ClosedLoopConfig()
-
-
Method Details
-
apply
Applies settings from anotherClosedLoopConfig
to this one, including all of its nested configurations.Settings in the provided config will overwrite existing values in this object. Settings not specified in the provided config remain unchanged.
- Parameters:
config
- TheClosedLoopConfig
to copy settings from- Returns:
- The updated
ClosedLoopConfig
for method chaining
-
apply
Applies settings from aSmartMotionConfig
to thisClosedLoopConfig
.Settings in the provided config will overwrite existing values in this object. Settings not specified in the provided config remain unchanged.
- Parameters:
config
- TheSmartMotionConfig
to copy settings from- Returns:
- The updated
ClosedLoopConfig
for method chaining
-
apply
Applies settings from aMAXMotionConfig
to thisClosedLoopConfig
.Settings in the provided config will overwrite existing values in this object. Settings not specified in the provided config remain unchanged.
- Parameters:
config
- TheMAXMotionConfig
to copy settings from- Returns:
- The updated
ClosedLoopConfig
for method chaining
-
pidf
Set the PIDF gains of the controller. This will set the gains for closed loop slot 0.To set the gains for a specific closed loop slot, use
pidf(double, double, double, double, ClosedLoopSlot)
.- Parameters:
p
- The proportional gain valuei
- The integral gain valued
- The derivative gain valueff
- The velocity feedforward value- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
pidf
public ClosedLoopConfig pidf(double p, double i, double d, double ff, ClosedLoopConfig.ClosedLoopSlot slot) Set the PIDF gains of the controller for a specific closed loop slot.- Parameters:
p
- The proportional gain valuei
- The integral gain valued
- The derivative gain valueff
- The velocity feedforward valueslot
- The closed loop slot to set the values for- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
pid
Set the PID gains of the controller. This will set the gains for closed loop slot 0.To set the gains for a specific closed loop slot, use
pid(double, double, double, ClosedLoopSlot)
.- Parameters:
p
- The proportional gain valuei
- The integral gain valued
- The derivative gain value- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
pid
Set the PID gains of the controller for a specific closed loop slot.- Parameters:
p
- The proportional gain valuei
- The integral gain valued
- The derivative gain valueslot
- The closed loop slot to set the values for- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
p
Set the proportional gain of the controller.This will set the value for closed loop slot 0. To set the value for a specific closed loop slot, use
p(double, ClosedLoopSlot)
.- Parameters:
p
- The proportional gain value- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
p
Set the proportional gain of the controller for a specific closed loop slot.- Parameters:
p
- The proportional gain valueslot
- The closed loop slot to set the values for- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
i
Set the integral gain of the controller.This will set the value for closed loop slot 0. To set the value for a specific closed loop slot, use
i(double, ClosedLoopSlot)
.- Parameters:
i
- The integral gain value- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
i
Set the integral gain of the controller for a specific closed loop slot.- Parameters:
i
- The integral gain valueslot
- The closed loop slot to set the values for- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
d
Set the derivative gain of the controller.This will set the value for closed loop slot 0. To set the value for a specific closed loop slot, use
d(double, ClosedLoopSlot)
.- Parameters:
d
- The derivative gain value- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
d
Set the derivative gain of the controller for a specific closed loop slot.- Parameters:
d
- The derivative gain valueslot
- The closed loop slot to set the values for- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
velocityFF
Set the velocity feedforward gain of the controller.This will set the value for closed loop slot 0. To set the value for a specific closed loop slot, use
velocityFF(double, ClosedLoopSlot)
.- Parameters:
ff
- The velocity feedforward gain value- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
velocityFF
Set the velocity feedforward gain of the controller for a specific closed loop slot.- Parameters:
ff
- The velocity feedforward gain valueslot
- The closed loop slot to set the values for- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
dFilter
Set the derivative filter of the controller.This will set the value for closed loop slot 0. To set the value for a specific closed loop slot, use
dFilter(double, ClosedLoopSlot)
.- Parameters:
dFilter
- The derivative filter value- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
dFilter
Set the derivative filter of the controller for a specific closed loop slot.- Parameters:
dFilter
- The derivative filter valueslot
- The closed loop slot to set the values for- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
iZone
Set the integral zone of the controller.This will set the value for closed loop slot 0. To set the value for a specific closed loop slot, use
dFilter(double, ClosedLoopSlot)
.- Parameters:
iZone
- The integral zone value- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
iZone
Set the integral zone of the controller for a specific closed loop slot.- Parameters:
iZone
- The integral zone valueslot
- The closed loop slot to set the values for- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
minOutput
Set the minimum output of the controller.This will set the value for closed loop slot 0. To set the value for a specific closed loop slot, use
minOutput(double, ClosedLoopSlot)
.- Parameters:
minOutput
- The minimum output value in the range [-1, 1]- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
minOutput
Set the minimum output of the controller for a specific closed loop slot.- Parameters:
minOutput
- The minimum output value in the range [-1, 1]slot
- The closed loop slot to set the values for- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
maxOutput
Set the maximum output of the controller.This will set the value for closed loop slot 0. To set the value for a specific closed loop slot, use
maxOutput(double, ClosedLoopSlot)
.- Parameters:
maxOutput
- The maximum output value in the range [-1, 1]- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
maxOutput
Set the maximum output of the controller for a specific closed loop slot.- Parameters:
maxOutput
- The maximum output value in the range [-1, 1]slot
- The closed loop slot to set the values for- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
outputRange
Set the output range of the controller.This will set the value for closed loop slot 0. To set the value for a specific closed loop slot, use
outputRange(double, double, ClosedLoopSlot)
.- Parameters:
minOutput
- The minimum output value in the range [-1, 1]maxOutput
- The maximum output value in the range [-1, 1]- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
outputRange
public ClosedLoopConfig outputRange(double minOutput, double maxOutput, ClosedLoopConfig.ClosedLoopSlot slot) Set the output range of the controller for a specific closed loop slot.- Parameters:
minOutput
- The minimum output value in the range [-1, 1]maxOutput
- The maximum output value in the range [-1, 1]slot
- The closed loop slot to set the values for- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
iMaxAccum
Set the maximum I accumulator of the controller. This value is used to constrain the I accumulator to help manage integral wind-up.This will set the value for closed loop slot 0. To set the value for a specific closed loop slot, use
iMaxAccum(double, ClosedLoopSlot)
.- Parameters:
iMaxAccum
- The max value to constrain the I accumulator to- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
iMaxAccum
Set the maximum I accumulator of the controller for a specific closed loop slot. This value is used to constrain the I accumulator to help manage integral wind-up.- Parameters:
iMaxAccum
- The max value to constrain the I accumulator toslot
- The closed loop slot to set the values for- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
positionWrappingEnabled
Enable or disable PID wrapping for position closed loop control.- Parameters:
enabled
- True to enable position PID wrapping- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
positionWrappingMinInput
Set the minimum input value for PID wrapping with position closed loop control.- Parameters:
minInput
- The value of min input for the position- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
positionWrappingMaxInput
Set the maximum input value for PID wrapping with position closed loop control- Parameters:
maxInput
- The value of max input for the position- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
positionWrappingInputRange
Set the input range for PID wrapping with position closed loop control- Parameters:
minInput
- The value of min input for the positionmaxInput
- The value of max input for the position- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
feedbackSensor
Set the feedback sensor of the controller. The controller will use this sensor as the source of feedback for its closed loop control.The default feedback sensor is assumed to be the primary encoder for either brushless or brushed mode. This can be changed to another feedback sensor for the controller such as an analog sensor, absolute encoder, or alternate/external encoder.
- Parameters:
sensor
- The feedback sensor- Returns:
- The modified
ClosedLoopConfig
object for method chaining
-
flatten
- Overrides:
flatten
in classBaseConfig
-