Class SparkBaseConfig
- Direct Known Subclasses:
SparkFlexConfig,SparkMaxConfig
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.revrobotics.config.BaseConfig
BaseConfig.CANType -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal AbsoluteEncoderConfigfinal AnalogSensorConfigfinal ClosedLoopConfigfinal EncoderConfigfinal LimitSwitchConfigfinal SignalsConfigfinal SoftLimitConfig -
Method Summary
Modifier and TypeMethodDescriptionapply(AbsoluteEncoderConfig config) Applies settings from anAbsoluteEncoderConfigto thisSparkBaseConfig.apply(AnalogSensorConfig config) Applies settings from anAnalogSensorConfigto thisSparkBaseConfig.apply(ClosedLoopConfig config) Applies settings from aClosedLoopConfigto thisSparkBaseConfig.apply(EncoderConfig config) Applies settings from anEncoderConfigto thisSparkBaseConfig.apply(LimitSwitchConfig config) Applies settings from aLimitSwitchConfigto thisSparkBaseConfig.apply(SignalsConfig config) Applies settings from aSignalsConfigto thisSparkBaseConfig.apply(SoftLimitConfig config) Applies settings from aSoftLimitConfigto thisSparkBaseConfig.apply(SparkBaseConfig config) Applies settings from anotherSparkBaseConfigto this one, including all of its nested configurations.closedLoopRampRate(double rate) Sets the ramp rate for closed loop control modes.Disables follower mode on the controller.Disables the voltage compensation setting for all modes on the SPARK.flatten()follow(int leaderCanId) Causes this controller's output to mirror the provided leader.follow(int leaderCanId, boolean invert) Causes this controller's output to mirror the provided leader.Causes this controller's output to mirror the provided leader.Causes this controller's output to mirror the provided leader.idleMode(SparkBaseConfig.IdleMode idleMode) Sets the idle mode setting for the SPARK.inverted(boolean inverted) Common interface for inverting direction of a speed controller.openLoopRampRate(double rate) Sets the ramp rate for open loop control modes.secondaryCurrentLimit(double limit) Sets the secondary current limit in Amps.secondaryCurrentLimit(double limit, int chopCycles) Sets the secondary current limit in Amps.smartCurrentLimit(int stallLimit) Sets the current limit in Amps.smartCurrentLimit(int stallLimit, int freeLimit) Sets the current limit in Amps.smartCurrentLimit(int stallLimit, int freeLimit, int limitRpm) Sets the current limit in Amps.voltageCompensation(double nominalVoltage) Sets the voltage compensation setting for all modes on the SPARK and enables voltage compensation.Methods inherited from class com.revrobotics.config.BaseConfig
apply, getParameter, getParameter, putParameter, putParameter, putParameter, removeParameter, removeParameter
-
Field Details
-
absoluteEncoder
-
analogSensor
-
encoder
-
limitSwitch
-
softLimit
-
closedLoop
-
signals
-
-
Method Details
-
apply
Applies settings from anotherSparkBaseConfigto 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- TheSparkBaseConfigto copy settings from- Returns:
- The updated
SparkBaseConfigfor method chaining
-
apply
Applies settings from anAbsoluteEncoderConfigto thisSparkBaseConfig.Settings in the provided config will overwrite existing values in this object. Settings not specified in the provided config remain unchanged.
- Parameters:
config- TheAbsoluteEncoderConfigto copy settings from- Returns:
- The updated
SparkBaseConfigfor method chaining
-
apply
Applies settings from anAnalogSensorConfigto thisSparkBaseConfig.Settings in the provided config will overwrite existing values in this object. Settings not specified in the provided config remain unchanged.
- Parameters:
config- TheAnalogSensorConfigto copy settings from- Returns:
- The updated
SparkBaseConfigfor method chaining
-
apply
Applies settings from anEncoderConfigto thisSparkBaseConfig.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
SparkBaseConfigfor method chaining
-
apply
Applies settings from aLimitSwitchConfigto thisSparkBaseConfig.Settings in the provided config will overwrite existing values in this object. Settings not specified in the provided config remain unchanged.
- Parameters:
config- TheLimitSwitchConfigto copy settings from- Returns:
- The updated
SparkBaseConfigfor method chaining
-
apply
Applies settings from aSoftLimitConfigto thisSparkBaseConfig.Settings in the provided config will overwrite existing values in this object. Settings not specified in the provided config remain unchanged.
- Parameters:
config- TheSoftLimitConfigto copy settings from- Returns:
- The updated
SparkBaseConfigfor method chaining
-
apply
Applies settings from aClosedLoopConfigto thisSparkBaseConfig.Settings in the provided config will overwrite existing values in this object. Settings not specified in the provided config remain unchanged.
- Parameters:
config- TheClosedLoopConfigto copy settings from- Returns:
- The updated
SparkBaseConfigfor method chaining
-
apply
Applies settings from aSignalsConfigto thisSparkBaseConfig.Settings in the provided config will overwrite existing values in this object. Settings not specified in the provided config remain unchanged.
- Parameters:
config- TheSignalsConfigto copy settings from- Returns:
- The updated
SparkBaseConfigfor method chaining
-
idleMode
Sets the idle mode setting for the SPARK.- Parameters:
idleMode- Coast or brake- Returns:
- The modified
SparkBaseConfigobject for method chaining
-
inverted
Common interface for inverting direction of a speed controller.This call has no effect if the controller is a follower. To invert a follower, see the follow() method.
- Parameters:
inverted- True for inverted- Returns:
- The modified
SparkBaseConfigobject for method chaining
-
smartCurrentLimit
Sets the current limit in Amps.The motor controller will reduce the controller voltage output to avoid surpassing this limit. This limit is enabled by default and used for brushless only. This limit is highly recommended when using the NEO brushless motor.
The NEO Brushless Motor has a low internal resistance, which can mean large current spikes that could be enough to cause damage to the motor and controller. This current limit provides a smarter strategy to deal with high current draws and keep the motor and controller operating in a safe region.
- Parameters:
stallLimit- The current limit in Amps.- Returns:
- The modified
SparkBaseConfigobject for method chaining
-
smartCurrentLimit
Sets the current limit in Amps.The motor controller will reduce the controller voltage output to avoid surpassing this limit. This limit is enabled by default and used for brushless only. This limit is highly recommended when using the NEO brushless motor.
The NEO Brushless Motor has a low internal resistance, which can mean large current spikes that could be enough to cause damage to the motor and controller. This current limit provides a smarter strategy to deal with high current draws and keep the motor and controller operating in a safe region.
The controller can also limit the current based on the RPM of the motor in a linear fashion to help with controllability in closed loop control. For a response that is linear the entire RPM range leave limit RPM at 0.
- Parameters:
stallLimit- The current limit in Amps at 0 RPM.freeLimit- The current limit at free speed (5700RPM for NEO).- Returns:
- The modified
SparkBaseConfigobject for method chaining
-
smartCurrentLimit
Sets the current limit in Amps.The motor controller will reduce the controller voltage output to avoid surpassing this limit. This limit is enabled by default and used for brushless only. This limit is highly recommended when using the NEO brushless motor.
The NEO Brushless Motor has a low internal resistance, which can mean large current spikes that could be enough to cause damage to the motor and controller. This current limit provides a smarter strategy to deal with high current draws and keep the motor and controller operating in a safe region.
The controller can also limit the current based on the RPM of the motor in a linear fashion to help with controllability in closed loop control. For a response that is linear the entire RPM range leave limit RPM at 0.
- Parameters:
stallLimit- The current limit in Amps at 0 RPM.freeLimit- The current limit at free speed (5700RPM for NEO).limitRpm- RPM less than this value will be set to the stallLimit, RPM values greater than limitRpm will scale linearly to freeLimit- Returns:
- The modified
SparkBaseConfigobject for method chaining
-
secondaryCurrentLimit
Sets the secondary current limit in Amps.The motor controller will disable the output of the controller briefly if the current limit is exceeded to reduce the current. This limit is a simplified 'on/off' controller. This limit is enabled by default but is set higher than the default Smart Current Limit.
The time the controller is off after the current limit is reached is determined by the parameter limitCycles, which is the number of PWM cycles (20kHz). The recommended value is the default of 0 which is the minimum time and is part of a PWM cycle from when the over current is detected. This allows the controller to regulate the current close to the limit value.
The total time is set by the equation
t = (50us - t0) + 50us * limitCycles t = total off time after over current t0 = time from the start of the PWM cycle until over current is detected- Parameters:
limit- The current limit in Amps.- Returns:
- The modified
SparkBaseConfigobject for method chaining
-
secondaryCurrentLimit
Sets the secondary current limit in Amps.The motor controller will disable the output of the controller briefly if the current limit is exceeded to reduce the current. This limit is a simplified 'on/off' controller. This limit is enabled by default but is set higher than the default Smart Current Limit.
The time the controller is off after the current limit is reached is determined by the parameter limitCycles, which is the number of PWM cycles (20kHz). The recommended value is the default of 0 which is the minimum time and is part of a PWM cycle from when the over current is detected. This allows the controller to regulate the current close to the limit value.
The total time is set by the equation
t = (50us - t0) + 50us * limitCycles t = total off time after over current t0 = time from the start of the PWM cycle until over current is detected- Parameters:
limit- The current limit in Amps.chopCycles- The number of additional PWM cycles to turn the driver off after overcurrent is detected.- Returns:
- The modified
SparkBaseConfigobject for method chaining
-
openLoopRampRate
Sets the ramp rate for open loop control modes.This is the maximum rate at which the motor controller's output is allowed to change.
- Parameters:
rate- Time in seconds to go from 0 to full throttle.- Returns:
- The modified
SparkBaseConfigobject for method chaining
-
closedLoopRampRate
Sets the ramp rate for closed loop control modes.This is the maximum rate at which the motor controller's output is allowed to change.
- Parameters:
rate- Time in seconds to go from 0 to full throttle.- Returns:
- The modified
SparkBaseConfigobject for method chaining
-
voltageCompensation
Sets the voltage compensation setting for all modes on the SPARK and enables voltage compensation.- Parameters:
nominalVoltage- Nominal voltage to compensate output to- Returns:
- The modified
SparkBaseConfigobject for method chaining
-
disableVoltageCompensation
Disables the voltage compensation setting for all modes on the SPARK.- Returns:
- The modified
SparkBaseConfigobject for method chaining
-
follow
Causes this controller's output to mirror the provided leader.Only voltage output is mirrored. Settings changed on the leader do not affect the follower.
The motor will spin in the same direction as the leader. This can be changed by passing a true constant after the leader parameter.
Following anything other than a CAN-enabled SPARK is not officially supported.
- Parameters:
leader- The motor controller to follow.- Returns:
- The modified
SparkBaseConfigobject for method chaining
-
follow
Causes this controller's output to mirror the provided leader.Only voltage output is mirrored. Settings changed on the leader do not affect the follower.
Following anything other than a CAN-enabled SPARK is not officially supported.
- Parameters:
leader- The motor controller to follow.invert- Set the follower to output opposite of the leader- Returns:
- The modified
SparkBaseConfigobject for method chaining
-
follow
Causes this controller's output to mirror the provided leader.Only voltage output is mirrored. Settings changed on the leader do not affect the follower.
The motor will spin in the same direction as the leader. This can be changed by passing a true constant after the deviceID parameter.
Following anything other than a CAN-enabled SPARK is not officially supported.
- Parameters:
leaderCanId- The CAN ID of the device to follow.- Returns:
- The modified
SparkBaseConfigobject for method chaining
-
follow
Causes this controller's output to mirror the provided leader.Only voltage output is mirrored. Settings changed on the leader do not affect the follower.
Following anything other than a CAN-enabled SPARK is not officially supported.
- Parameters:
leaderCanId- The CAN ID of the device to follow.invert- Set the follower to output opposite of the leader- Returns:
- The modified
SparkBaseConfigobject for method chaining
-
disableFollowerMode
Disables follower mode on the controller.- Returns:
- The modified
SparkBaseConfigobject for method chaining
-
flatten
- Overrides:
flattenin classBaseConfig
-