Package com.revrobotics.spark
Class SparkFlex
java.lang.Object
com.revrobotics.spark.SparkLowLevel
com.revrobotics.spark.SparkBase
com.revrobotics.spark.SparkFlex
- 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 SparkFlexConfigAccessor
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
ConstructorDescriptionSparkFlex
(int deviceId, SparkLowLevel.MotorType type) Create a new object to control a SPARK Flex motor Controller -
Method Summary
Modifier and TypeMethodDescriptionReturns an object for interfacing with an external quadrature encoderMethods inherited from class com.revrobotics.spark.SparkBase
clearFaults, configure, disable, get, getAbsoluteEncoder, getAnalog, getAppliedOutput, getBusVoltage, getClosedLoopController, getEncoder, getFaults, getForwardLimitSwitch, getInverted, getLastError, getMotorTemperature, getOutputCurrent, getReverseLimitSwitch, 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
-
SparkFlex
Create a new object to control a SPARK Flex 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
-
getExternalEncoder
Returns an object for interfacing with an external quadrature encoder- Returns:
- An object for interfacing with an external quadrature encoder
-