Class EncoderConfig
java.lang.Object
com.revrobotics.config.BaseConfig
com.revrobotics.spark.config.EncoderConfig
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class BaseConfig
BaseConfig.CANType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(EncoderConfig config) Applies settings from anotherEncoderConfigto this one.countsPerRevolution(int cpr) Set the counts per revolutions of the encoder.inverted(boolean inverted) Set the phase of the encoder so that it is in phase with the motor itself.quadratureAverageDepth(int depth) Set the sampling depth of the velocity calculation process of the encoder.quadratureMeasurementPeriod(int periodMs) Set the position measurement period used to calculate the velocity of the encoder.Methods inherited from class BaseConfig
apply, flatten, getParameter, getParameter, putParameter, putParameter, putParameter, removeParameter, removeParameter
-
Constructor Details
-
EncoderConfig
public EncoderConfig()Create a new object to configure an Encoder.
-
-
Method Details
-
apply
Applies settings from anotherEncoderConfigto 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- TheEncoderConfigto copy settings from- Returns:
- The updated
EncoderConfigfor method chaining
-
countsPerRevolution
Set the counts per revolutions of the encoder.NOTE: This only applies to an encoder used in brushed mode.
- Parameters:
cpr- The counts per rotation- Returns:
- The modified
EncoderConfigobject for method chaining
-
inverted
Set the phase of the encoder so that it is in phase with the motor itself.NOTE: This only applies to an encoder used in brushed mode.
- Parameters:
inverted- The phase of the encoder- Returns:
- The modified
EncoderConfigobject for method chaining
-
quadratureAverageDepth
Set the sampling depth of the velocity calculation process of the encoder. This value sets the number of samples in the average for velocity readings. This value must be in the range [1, 64]. The default value is 8.- Parameters:
depth- The velocity calculation process's sampling depth- Returns:
- The modified
EncoderConfigobject for method chaining
-
quadratureMeasurementPeriod
Set the position measurement period used to calculate the velocity of the encoder. This value is in units of milliseconds and must be in a range [1, 100]. The default value 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
EncoderConfigobject for method chaining
-