Class AlternateEncoderConfig
java.lang.Object
com.revrobotics.config.BaseConfig
com.revrobotics.spark.config.AlternateEncoderConfig
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumNested classes/interfaces inherited from class BaseConfig
BaseConfig.CANType -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new object to configure an AlternateEncoder. -
Method Summary
Modifier and TypeMethodDescriptionapply(AlternateEncoderConfig config) Applies settings from anotherAlternateEncoderConfigto this one.averageDepth(int depth) Set the sampling depth of the velocity calculation process of the alternate encoder.countsPerRevolution(int cpr) Set the counts per revolutions of the alternate encoder.inverted(boolean inverted) Set the phase of the alternate encoder so that it is in phase with the motor itself.measurementPeriod(int periodMs) Set the position measurement period used to calculate the velocity of the alternate encoder.Configures the data port to use the alternate encoder, which is specifically required for SPARK MAX.Methods inherited from class BaseConfig
apply, flatten, getParameter, getParameter, putParameter, putParameter, putParameter, removeParameter, removeParameter
-
Constructor Details
-
AlternateEncoderConfig
public AlternateEncoderConfig()Create a new object to configure an AlternateEncoder.
-
-
Method Details
-
apply
Applies settings from anotherAlternateEncoderConfigto this one.Settings in the provided config will overwrite existing values in this object. Settings not specified in the provided config remain unchanged.
- Parameters:
config- TheAlternateEncoderConfigto copy settings from- Returns:
- The updated
AlternateEncoderConfigfor method chaining
-
setSparkMaxDataPortConfig
Configures the data port to use the alternate encoder, which is specifically required for SPARK MAX.NOTE: This method is only necessary when using an alternate encoder with a SPARK MAX without configuring any of its settings
IMPORTANT: SPARK MAX does not support using an alternate encoder in conjunction with an absolute encoder and/or limit switches.
- Returns:
- The modified
AlternateEncoderConfigobject for method chaining
-
countsPerRevolution
Set the counts per revolutions of the alternate encoder.- Parameters:
cpr- The counts per rotation- Returns:
- The modified
AlternateEncoderConfigobject for method chaining
-
inverted
Set the phase of the alternate encoder so that it is in phase with the motor itself.- Parameters:
inverted- The phase of the encoder- Returns:
- The modified
AlternateEncoderConfigobject for method chaining
-
averageDepth
Set the sampling depth of the velocity calculation process of the alternate encoder. This value sets the number of samples in the average for velocity readings. For a quadrature encoder, this can be any value from 1 to 64. Default is 8.- Parameters:
depth- The velocity calculation process's sampling depth- Returns:
- The modified
AlternateEncoderConfigobject for method chaining
-
measurementPeriod
Set the position measurement period used to calculate the velocity of the alternate encoder. For a quadrature encoder, this number may be between 1 and 100. Default is 10ms (sample delta 20).The basic formula to calculate velocity is change in position / change in time. This parameter sets the change in time for measurement.
- Parameters:
periodMs- Measurement period in milliseconds- Returns:
- The modified
AlternateEncoderConfigobject for method chaining
-