#include <CANSparkMaxLowLevel.h>
Inherits frc::MotorController.
Inherited by rev::CANSparkMax.
|
enum class | MotorType { kBrushed = 0
, kBrushless = 1
} |
|
enum class | ControlType {
kDutyCycle = 0
, kVelocity = 1
, kVoltage = 2
, kPosition = 3
,
kSmartMotion = 4
, kCurrent = 5
, kSmartVelocity = 6
} |
|
enum class | ParameterStatus {
kOK = 0
, kInvalidID = 1
, kMismatchType = 2
, kAccessMode = 3
,
kInvalid = 4
, kNotImplementedDeprecated = 5
} |
|
enum class | PeriodicFrame {
kStatus0 = 0
, kStatus1 = 1
, kStatus2 = 2
, kStatus3 = 3
,
kStatus4 = 4
, kStatus5 = 5
, kStatus6 = 6
} |
|
enum class | TelemetryID {
kBusVoltage = 0
, kOutputCurrent
, kVelocity
, kPosition
,
kIAccum
, kAppliedOutput
, kMotorTemp
, kFaults
,
kStickyFaults
, kAnalogVoltage
, kAnalogPosition
, kAnalogVelocity
,
kAltEncPosition
, kAltEncVelocity
, kTotalStreams
} |
|
◆ MotorType
Enumerator |
---|
kBrushed | |
kBrushless | |
◆ ControlType
Enumerator |
---|
kDutyCycle | |
kVelocity | |
kVoltage | |
kPosition | |
kSmartMotion | |
kCurrent | |
kSmartVelocity | |
◆ ParameterStatus
Enumerator |
---|
kOK | |
kInvalidID | |
kMismatchType | |
kAccessMode | |
kInvalid | |
kNotImplementedDeprecated | |
◆ PeriodicFrame
Enumerator |
---|
kStatus0 | |
kStatus1 | |
kStatus2 | |
kStatus3 | |
kStatus4 | |
kStatus5 | |
kStatus6 | |
◆ TelemetryID
Enumerator |
---|
kBusVoltage | |
kOutputCurrent | |
kVelocity | |
kPosition | |
kIAccum | |
kAppliedOutput | |
kMotorTemp | |
kFaults | |
kStickyFaults | |
kAnalogVoltage | |
kAnalogPosition | |
kAnalogVelocity | |
kAltEncPosition | |
kAltEncVelocity | |
kTotalStreams | |
◆ FeedbackSensorType
Enumerator |
---|
kNoSensor | |
kHallSensor | |
kQuadrature | |
kSensorless | |
kAnalog | |
kAltQuadrature | |
kDutyCycleSensor | |
◆ ~CANSparkMaxLowLevel()
virtual rev::CANSparkMaxLowLevel::~CANSparkMaxLowLevel |
( |
| ) |
|
|
virtual |
Closes the SPARK MAX Controller
◆ GetFirmwareVersion() [1/2]
uint32_t rev::CANSparkMaxLowLevel::GetFirmwareVersion |
( |
| ) |
|
Get the firmware version of the SPARK MAX.
- Returns
- uint32_t Firmware version integer. Value is represented as 4 bytes, Major.Minor.Build H.Build L
◆ GetFirmwareVersion() [2/2]
uint32_t rev::CANSparkMaxLowLevel::GetFirmwareVersion |
( |
bool & |
isDebugBuild | ) |
|
◆ GetFirmwareString()
std::string rev::CANSparkMaxLowLevel::GetFirmwareString |
( |
| ) |
|
Get the firmware version of the SPARK MAX as a string.
- Returns
- std::string Human readable firmware version string
◆ GetSerialNumber()
std::vector< uint8_t > rev::CANSparkMaxLowLevel::GetSerialNumber |
( |
| ) |
|
Get the unique serial number of the SPARK MAX. Currently not implemented.
- Returns
- std::vector<uint8_t> Vector of bytes representig the unique serial number
◆ GetDeviceId()
int rev::CANSparkMaxLowLevel::GetDeviceId |
( |
| ) |
const |
Get the configured Device ID of the SPARK MAX.
- Returns
- int device ID
◆ GetInitialMotorType()
MotorType rev::CANSparkMaxLowLevel::GetInitialMotorType |
( |
| ) |
|
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.
- Returns
- MotorType Motor type setting
- Deprecated:
- Use GetMotorType() instead
◆ GetMotorType()
MotorType rev::CANSparkMaxLowLevel::GetMotorType |
( |
| ) |
|
Get the motor type setting for the SPARK MAX.
- Returns
- MotorType Motor type setting
◆ SetPeriodicFramePeriod()
Set the rate of transmission for periodic frames from the SPARK MAX
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
This value is not stored in the FLASH after calling burnFlash() and is reset on powerup.
Refer to the SPARK MAX 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
◆ SetControlFramePeriodMs()
void rev::CANSparkMaxLowLevel::SetControlFramePeriodMs |
( |
int |
periodMs | ) |
|
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(). |
◆ RestoreFactoryDefaults()
REVLibError rev::CANSparkMaxLowLevel::RestoreFactoryDefaults |
( |
bool |
persist = false | ) |
|
Restore motor controller parameters to factory default
- Parameters
-
persist | If true, burn the flash with the factory default parameters |
- Returns
- REVLibError::kOk if successful
◆ EnableExternalUSBControl()
static void rev::CANSparkMaxLowLevel::EnableExternalUSBControl |
( |
bool |
enable | ) |
|
|
static |
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 |
◆ SetEnable()
static void rev::CANSparkMaxLowLevel::SetEnable |
( |
bool |
enable | ) |
|
|
static |
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 |
◆ GetPeriodicStatus0()
◆ GetPeriodicStatus1()
◆ GetPeriodicStatus2()
◆ SetFollow()
◆ SetpointCommand()
◆ GetSafeFloat()
float rev::CANSparkMaxLowLevel::GetSafeFloat |
( |
float |
f | ) |
|
|
protected |
◆ CANAnalog
◆ CANDigitalInput
◆ CANEncoder
◆ CANPIDController
◆ CANSensor
◆ CANSparkMax
◆ MotorFeedbackSensor
◆ SparkMaxAnalogSensor
◆ SparkMaxAlternateEncoder
◆ SparkMaxLimitSwitch
◆ SparkMaxPIDController
◆ SparkMaxRelativeEncoder
◆ SparkMaxAbsoluteEncoder
◆ ::ConfigBase
friend class ::ConfigBase |
|
friend |
◆ kAPIMajorVersion
const uint8_t rev::CANSparkMaxLowLevel::kAPIMajorVersion |
|
static |
◆ kAPIMinorVersion
const uint8_t rev::CANSparkMaxLowLevel::kAPIMinorVersion |
|
static |
◆ kAPIBuildVersion
const uint8_t rev::CANSparkMaxLowLevel::kAPIBuildVersion |
|
static |
◆ kAPIVersion
const uint32_t rev::CANSparkMaxLowLevel::kAPIVersion |
|
static |
◆ m_motorType
MotorType rev::CANSparkMaxLowLevel::m_motorType |
|
protected |
◆ m_sparkMaxHandle
void* rev::CANSparkMaxLowLevel::m_sparkMaxHandle |
|
protected |
The documentation for this class was generated from the following file: