Package com.revrobotics.spark.config
Class AbsoluteEncoderConfig
java.lang.Object
com.revrobotics.spark.config.BaseConfig
com.revrobotics.spark.config.AbsoluteEncoderConfig
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionapply
(AbsoluteEncoderConfig config) Applies settings from anotherAbsoluteEncoderConfig
to this one.averageDepth
(int depth) Set the average sampling depth of the absolute encoder.endPulseUs
(double endPulseUs) Set the length of the end pulse for this encoder.inverted
(boolean inverted) Set the phase of the absolute encoder so that it is in phase with the motor itself.positionConversionFactor
(double factor) Set the conversion factor for the position of the absolute encoder.Configures the data port to use the absolute encoder, which is specifically required for SPARK MAX.startPulseUs
(double startPulseUs) Set the length of the start pulse for this encoder.velocityConversionFactor
(double factor) Set the conversion factor for the velocity of the absolute encoder.zeroOffset
(double offset) Set the zero offset of the absolute encoder, the position that is reported as zero.Methods inherited from class com.revrobotics.spark.config.BaseConfig
flatten
-
Constructor Details
-
AbsoluteEncoderConfig
public AbsoluteEncoderConfig()
-
-
Method Details
-
apply
Applies settings from anotherAbsoluteEncoderConfig
to 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
- TheAbsoluteEncoderConfig
to copy settings from- Returns:
- The updated
AbsoluteEncoderConfig
for method chaining
-
setSparkMaxDataPortConfig
Configures the data port to use the absolute encoder, which is specifically required for SPARK MAX.NOTE: This method is only necessary when using an absolute encoder with a SPARK MAX without configuring any of its settings
IMPORTANT: SPARK MAX does not support using an absolute encoder in conjunction with an alternate encoder.
- Returns:
- The modified
AbsoluteEncoderConfig
object for method chaining
-
inverted
Set the phase of the absolute 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
AbsoluteEncoderConfig
object for method chaining
-
positionConversionFactor
Set the conversion factor for the position of the absolute encoder. Position is returned in native units of rotations and will be multiplied by this conversion factor.- Parameters:
factor
- The conversion factor to multiply the native units by- Returns:
- The modified
AbsoluteEncoderConfig
object for method chaining
-
velocityConversionFactor
Set the conversion factor for the velocity of the absolute encoder. Velocity is returned in native units of rotations per minute and will be multiplied by this conversion factor.- Parameters:
factor
- The conversion factor to multiply the native units by- Returns:
- The modified
AbsoluteEncoderConfig
object for method chaining
-
zeroOffset
Set the zero offset of the absolute encoder, the position that is reported as zero.The zero offset is specified as the reported position of the encoder in the desired zero position as if the zero offset was set to 0, the position conversion factor was set to 1, and inverted was set to false.
- Parameters:
offset
- The zero offset in the range [0, 1)- Returns:
- The modified
AbsoluteEncoderConfig
object for method chaining
-
averageDepth
Set the average sampling depth of the absolute encoder. This is a bit size and should be either 1, 2, 4, 8, 16, 32, 64, or 128 (default).- Parameters:
depth
- The average sampling depth of 1, 2, 4, 8, 16, 32, 64, or 128- Returns:
- The modified
AbsoluteEncoderConfig
object for method chaining
-
startPulseUs
Set the length of the start pulse for this encoder. This pulse will be treated as the 0.0 position.- Parameters:
startPulseUs
- The minimum high pulse in microseconds- Returns:
- The modified
AbsoluteEncoderConfig
object for method chaining
-
endPulseUs
Set the length of the end pulse for this encoder. This pulse will be treated as the 1.0 position.- Parameters:
endPulseUs
- The minimum low pulse in microseconds- Returns:
- The modified
AbsoluteEncoderConfig
object for method chaining
-