|
REVLib - C++
|
#include <A301.h>
Classes | |
| struct | Faults |
| struct | FirmwareVersion |
| struct | Warnings |
Public Types | |
| enum class | GearboxRPM { kRPM_Unknown , kRPM_215 , kRPM_500 } |
|
strong |
|
explicit |
Create a new object to control a FIRST A301 motor
NOTE: If busId indicates a Motioncore bus, the device ID will be auto-detected and deviceId will be ignored.
| busId | The CAN bus ID this device will be on. |
| deviceId | The device ID. |
|
overridedefault |
Closes the A301
| int A301::GetBusId | ( | ) | const |
Get the configured CAN Bus ID of the FIRST A301.
| int A301::GetDeviceId | ( | ) | const |
Get the configured Device ID of the FIRST A301.
| A301::FirmwareVersion A301::GetFirmwareVersion | ( | ) | const |
Get the firmware version of the FIRST A301.
| std::string A301::GetFirmwareString | ( | ) | const |
Get the firmware version of the FIRST A301 as a string.
| Signal< bool > A301::HasActiveFault | ( | ) | const |
Get whether the A301 has one or more active faults.
| Signal< bool > A301::HasStickyFault | ( | ) | const |
Get whether the A301 has one or more sticky faults.
| Signal< bool > A301::HasActiveWarning | ( | ) | const |
Get whether the A301 has one or more active warnings.
| Signal< bool > A301::HasStickyWarning | ( | ) | const |
Get whether the A301 has one or more sticky warnings.
| Signal< A301::Faults > A301::GetFaults | ( | ) | const |
| Signal< A301::Faults > A301::GetStickyFaults | ( | ) | const |
Get the sticky faults that were present on the A301 at one point since the sticky faults were last cleared. Faults are fatal errors that prevent the motor from running.
Sticky faults can be cleared with A301::ClearFaults().
| Signal< A301::Warnings > A301::GetWarnings | ( | ) | const |
| Signal< A301::Warnings > A301::GetStickyWarnings | ( | ) | const |
| Signal< double > A301::GetBusVoltage | ( | ) | const |
Returns the voltage fed into the A301.
| Signal< double > A301::GetAppliedOutput | ( | ) | const |
Returns the A301's output duty cycle.
| Signal< double > A301::GetMotorCurrent | ( | ) | const |
Returns A301's motor current in Amps.
| Signal< double > A301::GetMotorTemperature | ( | ) | const |
Returns the motor temperature in Celsius.
| Signal< A301::GearboxRPM > A301::GetGearboxRPM | ( | ) | const |
Returns the RPM of the A301's attached gearbox.
| Signal< double > A301::GetRelativeEncoderPosition | ( | ) | const |
Get the position of the motor. This returns the native units of 'rotations'.
| Signal< double > A301::GetEncoderVelocity | ( | ) | const |
Get the velocity of the motor. This returns the native units of 'RPM'.
| Signal< double > A301::GetAbsoluteEncoderPosition | ( | ) | const |
Get the absolute position of the motor. This returns the native units of 'rotations'.
| rev::REVLibError A301::SetRelativeEncoderPosition | ( | double | position | ) |
Set the position of the relative encoder.
| position | Number of rotations of the motor |
| rev::REVLibError A301::SetAbsoluteEncoderPosition | ( | double | position | ) |
Set the position of the absolute encoder.
| position | Number of rotations of the motor |
| rev::REVLibError A301::ClearFaults | ( | ) |
Clears all sticky faults.
| rev::REVLibError A301::SetVelocity | ( | double | velocity | ) |
Sets the velocity of the A301.
| velocity | The velocity (in RPM) to set |
| rev::REVLibError A301::SetRelativePosition | ( | double | position | ) |
Sets the relative position of the A301 (with maximum speed).
| position | The relative position (in Rotations) to set |
| rev::REVLibError A301::SetRelativePositionWithSpeed | ( | double | position, |
| double | speed | ||
| ) |
Sets the relative position of the A301 with a specific speed.
| position | The relative position (in Rotations) to set |
| speed | The speed to approach the position at (in RPM) |
| rev::REVLibError A301::SetAbsolutePosition | ( | double | absPosition | ) |
Sets the absolute position of the A301 (with maximum speed).
| absPosition | The absolute position (-0.5 to 0.5) to set |
| rev::REVLibError A301::SetAbsolutePositionWithSpeed | ( | double | absPosition, |
| double | speed | ||
| ) |
Sets the absolute position of the A301 with a specific speed.
Setting speed <= 0 will apply maximum speed)
| absPosition | The absolute position (-0.5 to 0.5) to set |
| speed | The speed to approach the position at (in RPM) |
| rev::REVLibError A301::EnableAbsolutePositionContinuousInput | ( | ) |
Enables continuous input for absolute position control.
| rev::REVLibError A301::DisableAbsolutePositionContinuousInput | ( | ) |
Disables continuous input for absolute position control.
| bool A301::IsAbsolutePositionContinuousInputEnabled | ( | ) | const |
Queries the continuous input for absolute position control.
| rev::REVLibError A301::SetCurrent | ( | double | current | ) |
Sets the motor current of the A301.
| current | The current (in Amps) to drive the motor at |
|
override |
Sets the throttle of the motor controller.
| throttle | The throttle where -1.0 indicates full reverse and 1.0 indicates full forward. |
|
override |
Gets the throttle of the motor controller.
|
override |
Sets the voltage output of the SpeedController. The behavior of this call differs slightly from the WPILib documentation for this call since the device internally sets the desired voltage (not a compensation value). That means that this can be a 'set-and-forget' call.
| output | The voltage to output. (-12.0 V to 12.0 V) |
|
override |
Common interface for setting the inversion state of the motor controller.
| isInverted | The inversion state. |
|
override |
Common interface for getting the inversion state of the motor controller.
|
override |
Common interface for disabling a motor.
| first::a301::A301 & A301::FaultsPeriodMs | ( | int | period_ms | ) |
Set the period (ms) of the status frame that provides the signal returned by GetFaults() and GetStickyFaults().
The default period is 50ms. The maximum period is 1000ms (1s).
If multiple periods are set for signals within the same status frame, the minimum given value will be used.
| period_ms | The period in milliseconds |
| int A301::GetFaultsPeriodMs | ( | ) | const |
Get the period (ms) of the status frame that provides the signal returned by GetFaults() and GetStickyFaults().
| first::a301::A301 & A301::WarningsPeriodMs | ( | int | period_ms | ) |
Set the period (ms) of the status frame that provides the signal returned by GetWarnings() and GetStickyWarnings().
The default period is 50ms. The maximum period is 1000ms (1s).
If multiple periods are set for signals within the same status frame, the minimum given value will be used.
| period_ms | The period in milliseconds |
| int A301::GetWarningsPeriodMs | ( | ) | const |
Get the period (ms) of the status frame that provides the signal returned by GetWarnings() and GetStickyWarnings().
| first::a301::A301 & A301::BusVoltagePeriodMs | ( | int | period_ms | ) |
Set the period (ms) of the status frame that provides the signal returned by GetBusVoltage().
The default period is 10ms. The maximum period is 1000ms (1s).
If multiple periods are set for signals within the same status frame, the minimum given value will be used.
| period_ms | The period in milliseconds |
| int A301::GetBusVoltagePeriodMs | ( | ) | const |
Get the period (ms) of the status frame that provides the signal returned by GetBusVoltage().
| first::a301::A301 & A301::AppliedOutputPeriodMs | ( | int | period_ms | ) |
Set the period (ms) of the status frame that provides the signal returned by GetAppliedOutput().
The default period is 10ms. The maximum period is 1000ms (1s).
If multiple periods are set for signals within the same status frame, the minimum given value will be used.
| period_ms | The period in milliseconds |
| int A301::GetAppliedOutputPeriodMs | ( | ) | const |
Get the period (ms) of the status frame that provides the signal returned by GetAppliedOutput().
| first::a301::A301 & A301::MotorCurrentPeriodMs | ( | int | period_ms | ) |
Set the period (ms) of the status frame that provides the signal returned by GetMotorCurrent().
The default period is 10ms. The maximum period is 1000ms (1s).
If multiple periods are set for signals within the same status frame, the minimum given value will be used.
| period_ms | The period in milliseconds |
| int A301::GetMotorCurrentPeriodMs | ( | ) | const |
Get the period (ms) of the status frame that provides the signal returned by GetMotorCurrent().
| first::a301::A301 & A301::MotorTemperaturePeriodMs | ( | int | period_ms | ) |
Set the period (ms) of the status frame that provides the signal returned by GetMotorTemperature().
The default period is 10ms. The maximum period is 1000ms (1s).
If multiple periods are set for signals within the same status frame, the minimum given value will be used.
| period_ms | The period in milliseconds |
| int A301::GetMotorTemperaturePeriodMs | ( | ) | const |
Get the period (ms) of the status frame that provides the signal returned by GetMotorTemperature().
| first::a301::A301 & A301::RelativeEncoderPositionPeriodMs | ( | int | period_ms | ) |
Set the period (ms) of the status frame that provides the signal returned by GetRelativeEncoderPosition().
The default period is 20ms. The maximum period is 1000ms (1s).
If multiple periods are set for signals within the same status frame, the minimum given value will be used.
| period_ms | The period in milliseconds |
| int A301::GetRelativeEncoderPositionPeriodMs | ( | ) | const |
Get the period (ms) of the status frame that provides the signal returned by GetRelativeEncoderPosition().
| first::a301::A301 & A301::EncoderVelocityPeriodMs | ( | int | period_ms | ) |
Set the period (ms) of the status frame that provides the signal returned by GetEncoderVelocity().
The default period is 20ms. The maximum period is 1000ms (1s).
If multiple periods are set for signals within the same status frame, the minimum given value will be used.
| period_ms | The period in milliseconds |
| int A301::GetEncoderVelocityPeriodMs | ( | ) | const |
Get the period (ms) of the status frame that provides the signal returned by GetEncoderVelocity().
| first::a301::A301 & A301::AbsoluteEncoderPositionPeriodMs | ( | int | period_ms | ) |
Set the period (ms) of the status frame that provides the signal returned by GetAbsoluteEncoderPosition().
The default period is 20ms. The maximum period is 1000ms (1s).
If multiple periods are set for signals within the same status frame, the minimum given value will be used.
| period_ms | The period in milliseconds |
| int A301::GetAbsoluteEncoderPositionPeriodMs | ( | ) | const |
Get the period (ms) of the status frame that provides the signal returned by GetAbsoluteEncoderPosition().