SparkLowLevel

class rev.SparkLowLevel

Bases: MotorController

class ControlType(value: SupportsInt)

Bases: pybind11_object

Members:

kDutyCycle

kVelocity

kVoltage

kPosition

kSmartMotion :

Deprecated:
It is recommended to migrate to MAXMotion Velocity mode

instead.

kCurrent

kSmartVelocity :

Deprecated:
It is recommended to migrate to MAXMotion Velocity mode

instead.

kMAXMotionPositionControl

kMAXMotionVelocityControl

kCurrent = <ControlType.kCurrent: 5>
kDutyCycle = <ControlType.kDutyCycle: 0>
kMAXMotionPositionControl = <ControlType.kMAXMotionPositionControl: 7>
kMAXMotionVelocityControl = <ControlType.kMAXMotionVelocityControl: 8>
kPosition = <ControlType.kPosition: 3>
kSmartMotion = <ControlType.kSmartMotion: 4>
kSmartVelocity = <ControlType.kSmartVelocity: 6>
kVelocity = <ControlType.kVelocity: 1>
kVoltage = <ControlType.kVoltage: 2>
property name
property value
class MotorType(value: SupportsInt)

Bases: pybind11_object

Members:

kBrushed

kBrushless

kBrushed = <MotorType.kBrushed: 0>
kBrushless = <MotorType.kBrushless: 1>
property name
property value
class ParameterStatus(value: SupportsInt)

Bases: pybind11_object

Members:

kOK

kInvalidID

kMismatchType

kAccessMode

kInvalid

kNotImplementedDeprecated

kAccessMode = <ParameterStatus.kAccessMode: 3>
kInvalid = <ParameterStatus.kInvalid: 4>
kInvalidID = <ParameterStatus.kInvalidID: 1>
kMismatchType = <ParameterStatus.kMismatchType: 2>
kNotImplementedDeprecated = <ParameterStatus.kNotImplementedDeprecated: 5>
kOK = <ParameterStatus.kOK: 0>
property name
property value
class PeriodicFrame(value: SupportsInt)

Bases: pybind11_object

Members:

kStatus0

kStatus1

kStatus2

kStatus3

kStatus4

kStatus5

kStatus6

kStatus7

kStatus0 = <PeriodicFrame.kStatus0: 0>
kStatus1 = <PeriodicFrame.kStatus1: 1>
kStatus2 = <PeriodicFrame.kStatus2: 2>
kStatus3 = <PeriodicFrame.kStatus3: 3>
kStatus4 = <PeriodicFrame.kStatus4: 4>
kStatus5 = <PeriodicFrame.kStatus5: 5>
kStatus6 = <PeriodicFrame.kStatus6: 6>
kStatus7 = <PeriodicFrame.kStatus7: 7>
property name
property value
class PeriodicStatus0

Bases: pybind11_object

property appliedOutput
property current
property hardForwardLimitReached
property hardReverseLimitReached
property inverted
property motorTemperature
property primaryHeartbeatLock
property softForwardLimitReached
property softReverseLimitReached
property timestamp
property voltage
class PeriodicStatus1

Bases: pybind11_object

property brownoutStickyWarning
property brownoutWarning
property canFault
property canStickyFault
property drvFault
property drvStickyFault
property escEepromFault
property escEepromStickyFault
property escEepromStickyWarning
property escEepromWarning
property extEepromStickyWarning
property extEepromWarning
property firmwareFault
property firmwareStickyFault
property hasResetStickyWarning
property hasResetWarning
property isFollower
property motorTypeFault
property motorTypeStickyFault
property otherFault
property otherStickyFault
property otherStickyWarning
property otherWarning
property overcurrentStickyWarning
property overcurrentWarning
property sensorFault
property sensorStickyFault
property sensorStickyWarning
property sensorWarning
property stallStickyWarning
property stallWarning
property temperatureFault
property temperatureStickyFault
property timestamp
class PeriodicStatus2

Bases: pybind11_object

property primaryEncoderPosition
property primaryEncoderVelocity
property timestamp
class PeriodicStatus3

Bases: pybind11_object

property analogPosition
property analogVelocity
property analogVoltage
property timestamp
class PeriodicStatus4

Bases: pybind11_object

property externalOrAltEncoderPosition
property externalOrAltEncoderVelocity
property timestamp
class PeriodicStatus5

Bases: pybind11_object

property dutyCycleEncoderPosition
property dutyCycleEncoderVelocity
property timestamp
class PeriodicStatus6

Bases: pybind11_object

property dutyCycleNoSignal
property dutyCyclePeriod
property timestamp
property unadjustedDutyCycle
class PeriodicStatus7

Bases: pybind11_object

property iAccumulation
property timestamp
class SparkModel(value: SupportsInt)

Bases: pybind11_object

Members:

kSparkMax

kSparkFlex

kUnknown

kSparkFlex = <SparkModel.kSparkFlex: 1>
kSparkMax = <SparkModel.kSparkMax: 0>
kUnknown = <SparkModel.kUnknown: 255>
property name
property value
createSimFaultManager() None

Create the sim gui Fault Manager for this Spark Device

getDeviceId() int

Get the configured Device ID of the SPARK.

Returns:

int device ID

getFirmwareString() str

Get the firmware version of the SPARK as a string.

Returns:

std::string Human readable firmware version string

getFirmwareVersion(*args, **kwargs)

Overloaded function.

  1. getFirmwareVersion(self: rev._rev.SparkLowLevel) -> int

Get the firmware version of the SPARK.

Returns:

uint32_t Firmware version integer. Value is represented as 4 bytes, Major.Minor.Build H.Build L

  1. getFirmwareVersion(self: rev._rev.SparkLowLevel) -> tuple[int, bool]

getMotorType() rev._rev.SparkLowLevel.MotorType

Get the motor type setting for the SPARK.

Returns:

MotorType Motor type setting

getSerialNumber() list[int]

Get the unique serial number of the SPARK. Currently not implemented.

Returns:

std::vector<uint8_t> Vector of bytes representig the unique serial number

kAPIBuildVersion = 3
kAPIMajorVersion = 233
kAPIMinorVersion = 0
kAPIVersion = 132710403
setCANMaxRetries(numRetries: SupportsInt) None

Set the maximum number of times to retry an RTR CAN frame. This applies to calls such as SetParameter* and GetParameter* where a request is made to the SPARK motor controller and a response is expected. Anytime sending the request or receiving the response fails, it will retry the request a number of times, no more than the value set by this method. If an attempt succeeds, it will immediately return. The minimum number of retries is 0, where only a single attempt will be made and will return regardless of success or failure.

The default maximum is 5 retries.

Parameters:

numRetries – The maximum number of retries

setControlFramePeriodMs(periodMs: SupportsInt) None

Set the control frame send period for the native CAN Send thread. To disable periodic sends, set periodMs to 0.

Parameters:

periodMs – The send period in milliseconds between 1ms and 100ms or set to 0 to disable periodic sends. Note this is not updated until the next call to Set() or SetReference().

setPeriodicFrameTimeout(timeoutMs: SupportsInt) None

Set the amount of time to wait for a periodic status frame before returning a timeout error. This timeout will apply to all periodic status frames for the SPARK motor controller.

To prevent invalid timeout errors, the minimum timeout for a given periodic status is 2.1 times its period. To use the minimum timeout for all status frames, set timeoutMs to 0.

The default timeout is 500ms.

Parameters:

timeoutMs – The timeout in milliseconds