Package com.revrobotics.spark
Class SparkMax
java.lang.Object
com.revrobotics.spark.SparkLowLevel
com.revrobotics.spark.SparkBase
com.revrobotics.spark.SparkMax
- All Implemented Interfaces:
MotorController
,AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from class com.revrobotics.spark.SparkBase
SparkBase.ControlType, SparkBase.Faults, SparkBase.PersistMode, SparkBase.ResetMode, SparkBase.Warnings
Nested classes/interfaces inherited from class com.revrobotics.spark.SparkLowLevel
SparkLowLevel.MotorType, SparkLowLevel.PeriodicFrame, SparkLowLevel.PeriodicStatus0, SparkLowLevel.PeriodicStatus1, SparkLowLevel.PeriodicStatus2, SparkLowLevel.SparkModel
-
Field Summary
Modifier and TypeFieldDescriptionfinal SparkMaxConfigAccessor
Accessor for SPARK parameter values.Fields inherited from class com.revrobotics.spark.SparkBase
absoluteEncoder, absoluteEncoderLock, analogSensor, analogSensorLock, closedLoopController, closedLoopControllerLock, encoder, encoderLock, forwardLimitSwitch, forwardLimitSwitchLock, reverseLimitSwitch, reverseLimitSwitchLock
Fields inherited from class com.revrobotics.spark.SparkLowLevel
expectedSparkModel, isClosed, kAPIBuildVersion, kAPIMajorVersion, kAPIMinorVersion, kAPIVersion, motorType, sparkHandle
-
Constructor Summary
ConstructorDescriptionSparkMax
(int deviceId, SparkLowLevel.MotorType type) Create a new object to control a SPARK MAX motor Controller -
Method Summary
Modifier and TypeMethodDescriptionconfigure
(SparkBaseConfig config, SparkBase.ResetMode resetMode, SparkBase.PersistMode persistMode) Extended Functions ******Returns an object for interfacing with a connected absolute encoder.Returns an object for interfacing with a quadrature encoder connected to the alternate encoder mode data port pins.Returns an object for interfacing with the forward limit switch connected to the appropriate pins on the data port.Returns an object for interfacing with the reverse limit switch connected to the appropriate pins on the data port.Methods inherited from class com.revrobotics.spark.SparkBase
clearFaults, disable, get, getAnalog, getAppliedOutput, getBusVoltage, getClosedLoopController, getEncoder, getFaults, getInverted, getLastError, getMotorTemperature, getOutputCurrent, getStickyFaults, getStickyWarnings, getWarnings, hasActiveFault, hasActiveWarning, hasStickyFault, hasStickyWarning, isFollower, pauseFollowerMode, resumeFollowerMode, set, setCANTimeout, setInverted, setVoltage, stopMotor
Methods inherited from class com.revrobotics.spark.SparkLowLevel
close, createSimFaultManager, getDeviceId, getFirmwareString, getFirmwareVersion, getMotorType, getSafeFloat, getSerialNumber, setCANMaxRetries, setControlFramePeriodMs, setPeriodicFrameTimeout, throwIfClosed
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.wpi.first.wpilibj.motorcontrol.MotorController
setVoltage
-
Field Details
-
configAccessor
Accessor for SPARK parameter values. This object contains fields and methods to retrieve parameters that have been applied to the device. To set parameters, seeSparkBaseConfig
andSparkBase.configure(SparkBaseConfig, SparkBase.ResetMode, SparkBase.PersistMode)
.NOTE: This uses calls that are blocking to retrieve parameters and should be used infrequently.
-
-
Constructor Details
-
SparkMax
Create a new object to control a SPARK MAX motor Controller- Parameters:
deviceId
- The device ID.type
- The motor type connected to the controller. Brushless motor wires must be connected to their matching colors and the hall sensor must be plugged in. Brushed motors must be connected to the Red and Black terminals only.
-
-
Method Details
-
configure
public REVLibError configure(SparkBaseConfig config, SparkBase.ResetMode resetMode, SparkBase.PersistMode persistMode) Extended Functions ******- Overrides:
configure
in classSparkBase
- Parameters:
config
- The desired SPARK configurationresetMode
- Whether to reset safe parameters before setting the configurationpersistMode
- Whether to persist the parameters after setting the configuration- Returns:
REVLibError.kOk
if successful
-
getAlternateEncoder
Returns an object for interfacing with a quadrature encoder connected to the alternate encoder mode data port pins. These are defined as:- Pin 4 (Forward Limit Switch): Index
- Pin 6 (Multi-function): Encoder A
- Pin 8 (Reverse Limit Switch): Encoder B
This call will disable support for the limit switch inputs.
- Returns:
- An object for interfacing with a quadrature encoder connected to the alternate encoder mode data port pins
-
getAbsoluteEncoder
Description copied from class:SparkBase
Returns an object for interfacing with a connected absolute encoder.- Overrides:
getAbsoluteEncoder
in classSparkBase
- Returns:
- An object for interfacing with a connected absolute encoder
-
getForwardLimitSwitch
Description copied from class:SparkBase
Returns an object for interfacing with the forward limit switch connected to the appropriate pins on the data port.- Overrides:
getForwardLimitSwitch
in classSparkBase
- Returns:
- An object for interfacing with the forward limit switch.
-
getReverseLimitSwitch
Description copied from class:SparkBase
Returns an object for interfacing with the reverse limit switch connected to the appropriate pins on the data port.- Overrides:
getReverseLimitSwitch
in classSparkBase
- Returns:
- An object for interfacing with the reverse limit switch.
-