Class ClosedLoopGeneralConfigs
- All Implemented Interfaces:
ParentConfiguration,ISerializable,Cloneable
Includes Continuous Wrap features.
-
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanWrap position error within [-0.5, +0.5) mechanism rotations.booleanWrap differential difference position error within [-0.5, +0.5) mechanism rotations.doubleThe position closed-loop error threshold for gain scheduling.The behavior of kP output as the error crosses the GainSchedErrorThreshold during gain scheduling. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()final StatusCodedeserialize(String to_deserialize) Take a string and deserialize it to this configuration group.final AngleHelper method to get this configuration's GainSchedErrorThreshold parameter converted to a unit type.final StringGet the serialized form of this configuration group.toString()final ClosedLoopGeneralConfigswithContinuousWrap(boolean newContinuousWrap) Modifies this configuration's ContinuousWrap parameter and returns itself for method-chaining and easier to use config API.final ClosedLoopGeneralConfigswithDifferentialContinuousWrap(boolean newDifferentialContinuousWrap) Modifies this configuration's DifferentialContinuousWrap parameter and returns itself for method-chaining and easier to use config API.final ClosedLoopGeneralConfigswithGainSchedErrorThreshold(double newGainSchedErrorThreshold) Modifies this configuration's GainSchedErrorThreshold parameter and returns itself for method-chaining and easier to use config API.final ClosedLoopGeneralConfigswithGainSchedErrorThreshold(Angle newGainSchedErrorThreshold) Modifies this configuration's GainSchedErrorThreshold parameter and returns itself for method-chaining and easier to use config API.final ClosedLoopGeneralConfigswithGainSchedKpBehavior(GainSchedKpBehaviorValue newGainSchedKpBehavior) Modifies this configuration's GainSchedKpBehavior parameter and returns itself for method-chaining and easier to use config API.
-
Field Details
-
ContinuousWrap
Wrap position error within [-0.5, +0.5) mechanism rotations. Typically used for continuous position closed-loops like swerve azimuth.This uses the mechanism rotation value. If there is a gear ratio between the sensor and the mechanism, make sure to apply a SensorToMechanismRatio so the closed loop operates on the full rotation.
- Default Value: False
-
DifferentialContinuousWrap
Wrap differential difference position error within [-0.5, +0.5) mechanism rotations. Typically used for continuous position closed-loops like a differential wrist.This uses the differential difference rotation value. If there is a gear ratio on the difference axis, make sure to apply a SensorToDifferentialRatio so the closed loop operates on the full rotation.
- Default Value: False
-
GainSchedErrorThreshold
The position closed-loop error threshold for gain scheduling. When the absolute value of the closed-loop error is within the threshold (inclusive), the PID controller will automatically switch gains according to the configured GainSchedBehavior of the slot.When this is zero (default), no gain scheduling will occur. Additionally, this does not take effect for velocity closed-loop controls.
This can be used to implement a closed-loop deadband or, less commonly, to switch to weaker gains when close to the target.
- Minimum Value: 0.0
- Maximum Value: 1.0
- Default Value: 0.0
- Units: rotations
-
GainSchedKpBehavior
The behavior of kP output as the error crosses the GainSchedErrorThreshold during gain scheduling. The output of kP can be adjusted to maintain continuity in output, or it can be left discontinuous.
-
-
Constructor Details
-
ClosedLoopGeneralConfigs
public ClosedLoopGeneralConfigs()
-
-
Method Details
-
withContinuousWrap
Modifies this configuration's ContinuousWrap parameter and returns itself for method-chaining and easier to use config API.Wrap position error within [-0.5, +0.5) mechanism rotations. Typically used for continuous position closed-loops like swerve azimuth.
This uses the mechanism rotation value. If there is a gear ratio between the sensor and the mechanism, make sure to apply a SensorToMechanismRatio so the closed loop operates on the full rotation.
- Default Value: False
- Parameters:
newContinuousWrap- Parameter to modify- Returns:
- Itself
-
withDifferentialContinuousWrap
public final ClosedLoopGeneralConfigs withDifferentialContinuousWrap(boolean newDifferentialContinuousWrap) Modifies this configuration's DifferentialContinuousWrap parameter and returns itself for method-chaining and easier to use config API.Wrap differential difference position error within [-0.5, +0.5) mechanism rotations. Typically used for continuous position closed-loops like a differential wrist.
This uses the differential difference rotation value. If there is a gear ratio on the difference axis, make sure to apply a SensorToDifferentialRatio so the closed loop operates on the full rotation.
- Default Value: False
- Parameters:
newDifferentialContinuousWrap- Parameter to modify- Returns:
- Itself
-
withGainSchedErrorThreshold
public final ClosedLoopGeneralConfigs withGainSchedErrorThreshold(double newGainSchedErrorThreshold) Modifies this configuration's GainSchedErrorThreshold parameter and returns itself for method-chaining and easier to use config API.The position closed-loop error threshold for gain scheduling. When the absolute value of the closed-loop error is within the threshold (inclusive), the PID controller will automatically switch gains according to the configured GainSchedBehavior of the slot.
When this is zero (default), no gain scheduling will occur. Additionally, this does not take effect for velocity closed-loop controls.
This can be used to implement a closed-loop deadband or, less commonly, to switch to weaker gains when close to the target.
- Minimum Value: 0.0
- Maximum Value: 1.0
- Default Value: 0.0
- Units: rotations
- Parameters:
newGainSchedErrorThreshold- Parameter to modify- Returns:
- Itself
-
withGainSchedErrorThreshold
Modifies this configuration's GainSchedErrorThreshold parameter and returns itself for method-chaining and easier to use config API.The position closed-loop error threshold for gain scheduling. When the absolute value of the closed-loop error is within the threshold (inclusive), the PID controller will automatically switch gains according to the configured GainSchedBehavior of the slot.
When this is zero (default), no gain scheduling will occur. Additionally, this does not take effect for velocity closed-loop controls.
This can be used to implement a closed-loop deadband or, less commonly, to switch to weaker gains when close to the target.
- Minimum Value: 0.0
- Maximum Value: 1.0
- Default Value: 0.0
- Units: rotations
- Parameters:
newGainSchedErrorThreshold- Parameter to modify- Returns:
- Itself
-
getGainSchedErrorThresholdMeasure
Helper method to get this configuration's GainSchedErrorThreshold parameter converted to a unit type. If not using the Java units library,GainSchedErrorThresholdcan be accessed directly instead.The position closed-loop error threshold for gain scheduling. When the absolute value of the closed-loop error is within the threshold (inclusive), the PID controller will automatically switch gains according to the configured GainSchedBehavior of the slot.
When this is zero (default), no gain scheduling will occur. Additionally, this does not take effect for velocity closed-loop controls.
This can be used to implement a closed-loop deadband or, less commonly, to switch to weaker gains when close to the target.
- Minimum Value: 0.0
- Maximum Value: 1.0
- Default Value: 0.0
- Units: rotations
- Returns:
- GainSchedErrorThreshold
-
withGainSchedKpBehavior
public final ClosedLoopGeneralConfigs withGainSchedKpBehavior(GainSchedKpBehaviorValue newGainSchedKpBehavior) Modifies this configuration's GainSchedKpBehavior parameter and returns itself for method-chaining and easier to use config API.The behavior of kP output as the error crosses the GainSchedErrorThreshold during gain scheduling. The output of kP can be adjusted to maintain continuity in output, or it can be left discontinuous.
- Parameters:
newGainSchedKpBehavior- Parameter to modify- Returns:
- Itself
-
toString
-
serialize
Get the serialized form of this configuration group.- Specified by:
serializein interfaceISerializable- Returns:
- Serialized form of this config group
-
deserialize
Take a string and deserialize it to this configuration group.- Specified by:
deserializein interfaceParentConfiguration- Returns:
- Return code of the deserialize method
-
clone
-