CANSparkLowLevel
- class rev.CANSparkLowLevel
Bases:
MotorController
- class ControlType(value: int)
Bases:
pybind11_object
Members:
kDutyCycle
kVelocity
kVoltage
kPosition
kSmartMotion
kCurrent
kSmartVelocity
- kCurrent = <ControlType.kCurrent: 5>
- kDutyCycle = <ControlType.kDutyCycle: 0>
- 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: int)
Bases:
pybind11_object
Members:
kBrushed
kBrushless
- kBrushed = <MotorType.kBrushed: 0>
- kBrushless = <MotorType.kBrushless: 1>
- property name
- property value
- class ParameterStatus(value: int)
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: int)
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 faults
- property isFollower
- property isInverted
- property lock
- property motorType
- property roboRIO
- property stickyFaults
- property timestamp
- class PeriodicStatus1
Bases:
pybind11_object
- property busVoltage
- property motorTemperature
- property outputCurrent
- property sensorVelocity
- property timestamp
- class PeriodicStatus2
Bases:
pybind11_object
- property iAccum
- property sensorPosition
- property timestamp
- class SparkModel(value: int)
Bases:
pybind11_object
Members:
kSparkMax
kSparkFlex
kUnknown
- kSparkFlex = <SparkModel.kSparkFlex: 1>
- kSparkMax = <SparkModel.kSparkMax: 0>
- kUnknown = <SparkModel.kUnknown: 255>
- property name
- property value
- class TelemetryID(value: int)
Bases:
pybind11_object
Members:
kBusVoltage
kOutputCurrent
kVelocity
kPosition
kIAccum
kAppliedOutput
kMotorTemp
kFaults
kStickyFaults
kAnalogVoltage
kAnalogPosition
kAnalogVelocity
kAltEncPosition
kAltEncVelocity
kTotalStreams
- kAltEncPosition = <TelemetryID.kAltEncPosition: 12>
- kAltEncVelocity = <TelemetryID.kAltEncVelocity: 13>
- kAnalogPosition = <TelemetryID.kAnalogPosition: 10>
- kAnalogVelocity = <TelemetryID.kAnalogVelocity: 11>
- kAnalogVoltage = <TelemetryID.kAnalogVoltage: 9>
- kAppliedOutput = <TelemetryID.kAppliedOutput: 5>
- kBusVoltage = <TelemetryID.kBusVoltage: 0>
- kFaults = <TelemetryID.kFaults: 7>
- kIAccum = <TelemetryID.kIAccum: 4>
- kMotorTemp = <TelemetryID.kMotorTemp: 6>
- kOutputCurrent = <TelemetryID.kOutputCurrent: 1>
- kPosition = <TelemetryID.kPosition: 3>
- kStickyFaults = <TelemetryID.kStickyFaults: 8>
- kTotalStreams = <TelemetryID.kTotalStreams: 14>
- kVelocity = <TelemetryID.kVelocity: 2>
- property name
- property value
- class TelemetryMessage
Bases:
pybind11_object
- property id
- property lowerBnd
- property name
- property timestamp
- property units
- property upperBnd
- property value
- static enableExternalUSBControl(enable: bool) None
Allow external controllers to recieve control commands over USB. For example, a configuration where the heartbeat (and enable/disable) is sent by the main controller, but control frames are sent by other CAN devices over USB.
This is global for all controllers on the same bus.
This does not disable sending control frames from this device. To prevent conflicts, do not enable this feature and also send Set() for SetReference() from the controllers you wish to control.
- Parameters:
enable – Enable or disable external control
- 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() 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
- getInitialMotorType() rev._rev.CANSparkLowLevel.MotorType
Get the motor type setting from when the SparkMax was created.
This does not use the Get Parameter API which means it does not read what motor type is stored on the SparkMax itself. Instead, it reads the stored motor type from when the SparkMax object was first created.
- Deprecated:
Use GetMotorType() instead
- Returns:
MotorType Motor type setting
- getMotorType() rev._rev.CANSparkLowLevel.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 = 232
- kAPIMinorVersion = 2
- kAPIVersion = 132645379
- restoreFactoryDefaults(persist: bool = False) rev._rev.REVLibError
Restore motor controller parameters to factory default
- Parameters:
persist – If true, burn the flash with the factory default parameters
- Returns:
REVLibError::kOk if successful
- setControlFramePeriodMs(periodMs: int) 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().
- static setEnable(enable: bool) None
Send enabled or disabled command to controllers. This is global for all controllers on the same bus, and will only work for non-roboRIO targets in non-competiton use. This function will also not work if a roboRIO is present on the CAN bus.
This does not disable sending control frames from this device. To prevent conflicts, do not enable this feature and also send Set() for SetReference() from the controllers you wish to control.
- Parameters:
enable – Enable or disable external control
- setPeriodicFramePeriod(frame: rev._rev.CANSparkLowLevel.PeriodicFrame, periodMs: int) rev._rev.REVLibError
Set the rate of transmission for periodic frames from the SPARK
Each motor controller sends back status frames with different data at set rates. Use this function to change the default rates.
Defaults: Status0 - 10ms Status1 - 20ms Status2 - 20ms Status3 - 50ms Status4 - 20ms Status5 - 200ms Status6 - 200ms Status7 - 250ms
This value is not stored in the FLASH after calling burnFlash() and is reset on powerup.
Refer to the SPARK reference manual on details for how and when to configure this parameter.
- Parameters:
frame – Which periodic frame to change the period of
periodMs – The rate the controller sends the frame to the controller.
- Returns:
REVLibError::kOk if successful