REVLib - C++
first::a301::A301 Class Reference

#include <A301.h>

Inherits wpi::MotorController.

Classes

struct  Faults
 
struct  Warnings
 

Public Member Functions

 A301 (int busId, int deviceId=defaultDeviceId)
 
 ~A301 () override
 
int GetBusId () const
 
int GetDeviceId () const
 
uint32_t GetFirmwareVersion ()
 
uint32_t GetFirmwareVersion (bool &isDebugBuild)
 
std::string GetFirmwareString ()
 
rev::util::Signal< bool > HasActiveFault () const
 
rev::util::Signal< bool > HasStickyFault () const
 
rev::util::Signal< bool > HasActiveWarning () const
 
rev::util::Signal< bool > HasStickyWarning () const
 
rev::util::Signal< FaultsGetFaults () const
 
rev::util::Signal< FaultsGetStickyFaults () const
 
rev::util::Signal< WarningsGetWarnings () const
 
rev::util::Signal< WarningsGetStickyWarnings () const
 
rev::util::Signal< double > GetBusVoltage () const
 
rev::util::Signal< double > GetAppliedOutput () const
 
rev::util::Signal< double > GetMotorCurrent () const
 
rev::util::Signal< double > GetMotorTemperature () const
 
rev::util::Signal< double > GetRelativeEncoderPosition () const
 
rev::util::Signal< double > GetEncoderVelocity () const
 
rev::util::Signal< double > GetAbsoluteEncoderPosition () const
 
rev::REVLibError SetRelativeEncoderPosition (double position)
 
rev::REVLibError ClearFaults ()
 
rev::REVLibError SetVelocity (double velocity)
 
rev::REVLibError SetPosition (double position)
 
rev::REVLibError SetAbsolutePosition (double absPosition, bool isContinuous)
 
rev::REVLibError SetCurrent (double current)
 
void SetThrottle (double throttle) override
 
double GetThrottle () const override
 
void SetVoltage (wpi::units::volt_t output) override
 
void SetInverted (bool isInverted) override
 
bool GetInverted () const override
 
void Disable () override
 

Constructor & Destructor Documentation

◆ A301()

A301::A301 ( int  busId,
int  deviceId = defaultDeviceId 
)
explicit

Create a new object to control a FIRST A301 motor

The default A301 device ID is set to 3 out of the factory.

Parameters
busIdThe CAN bus ID this device will be on.
deviceIdThe device ID.

◆ ~A301()

A301::~A301 ( )
overridedefault

Closes the A301

Member Function Documentation

◆ GetBusId()

int A301::GetBusId ( ) const

Get the configured CAN Bus ID of the FIRST A301.

Returns
int CAN bus ID

◆ GetDeviceId()

int A301::GetDeviceId ( ) const

Get the configured Device ID of the FIRST A301.

Returns
int device ID

◆ GetFirmwareVersion() [1/2]

uint32_t A301::GetFirmwareVersion ( )

Get the firmware version of the FIRST A301.

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

◆ GetFirmwareVersion() [2/2]

uint32_t A301::GetFirmwareVersion ( bool &  isDebugBuild)

◆ GetFirmwareString()

std::string A301::GetFirmwareString ( )

Get the firmware version of the FIRST A301 as a string.

Returns
std::string Human readable firmware version string

◆ HasActiveFault()

Signal< bool > A301::HasActiveFault ( ) const

Get whether the A301 has one or more active faults.

Returns
Signal containing true if there is an active fault
See also
GetFaults()

◆ HasStickyFault()

Signal< bool > A301::HasStickyFault ( ) const

Get whether the A301 has one or more sticky faults.

Returns
Signal containing true if there is a sticky fault
See also
GetStickyFaults()

◆ HasActiveWarning()

Signal< bool > A301::HasActiveWarning ( ) const

Get whether the A301 has one or more active warnings.

Returns
Signal containing true if there is an active warning
See also
GetWarnings()

◆ HasStickyWarning()

Signal< bool > A301::HasStickyWarning ( ) const

Get whether the A301 has one or more sticky warnings.

Returns
Signal containing true if there is a sticky warning
See also
GetStickyWarnings()

◆ GetFaults()

Signal< A301::Faults > A301::GetFaults ( ) const

Get the active faults that are currently present on the A301. Faults are fatal errors that prevent the motor from running.

Returns
Signal containing each fault and their active value

◆ GetStickyFaults()

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().

Returns
Signal containing each fault and their sticky value

◆ GetWarnings()

Signal< A301::Warnings > A301::GetWarnings ( ) const

Get the active warnings that are currently present on the A301. Warnings are non-fatal errors.

Returns
Signal containing each warning and their active value

◆ GetStickyWarnings()

Signal< A301::Warnings > A301::GetStickyWarnings ( ) const

Get the sticky warnings that were present on the A301 at one point since the sticky warnings were last cleared. Warnings are non-fatal errors.

Sticky warnings can be cleared with A301::clearFaults().

Returns
Signal containing each warning and their sticky value

◆ GetBusVoltage()

Signal< double > A301::GetBusVoltage ( ) const

Returns the voltage fed into the A301.

Returns
Signal containing the bus voltage

◆ GetAppliedOutput()

Signal< double > A301::GetAppliedOutput ( ) const

Returns the A301's output duty cycle.

Returns
Signal containing the applied output duty cycle

◆ GetMotorCurrent()

Signal< double > A301::GetMotorCurrent ( ) const

Returns A301's motor current in Amps.

Returns
Signal containing the motor current in Amps

◆ GetMotorTemperature()

Signal< double > A301::GetMotorTemperature ( ) const

Returns the motor temperature in Celsius.

Returns
Signal containing the motor temperature in Celsius

◆ GetRelativeEncoderPosition()

Signal< double > A301::GetRelativeEncoderPosition ( ) const

Get the position of the motor. This returns the native units of 'rotations'.

Returns
Signal containing the number of rotations of the motor

◆ GetEncoderVelocity()

Signal< double > A301::GetEncoderVelocity ( ) const

Get the velocity of the motor. This returns the native units of 'RPM'.

Returns
Signal containing the RPM of the motor

◆ GetAbsoluteEncoderPosition()

Signal< double > A301::GetAbsoluteEncoderPosition ( ) const

Get the absolute position of the motor. This returns the native units of 'rotations'.

Returns
Signal containing the number of rotations of the motor

◆ SetRelativeEncoderPosition()

rev::REVLibError A301::SetRelativeEncoderPosition ( double  position)

Set the position of the relative encoder.

Parameters
positionNumber of rotations of the motor
Returns
REVLibError::kOk if successful

◆ ClearFaults()

rev::REVLibError A301::ClearFaults ( )

Clears all sticky faults.

◆ SetVelocity()

rev::REVLibError A301::SetVelocity ( double  velocity)

Sets the velocity of the A301.

Parameters
velocityThe velocity (in RPM) to set
Returns
REVLibError::kOk if successful

◆ SetPosition()

rev::REVLibError A301::SetPosition ( double  position)

Sets the relative position of the A301.

Parameters
positionThe relative position (in Rotations) to set
Returns
REVLibError::kOk if successful

◆ SetAbsolutePosition()

rev::REVLibError A301::SetAbsolutePosition ( double  absPosition,
bool  isContinuous 
)

Sets the absolute position of the A301 with optional continuous rotation.

Parameters
absPositionThe absolute position (-0.5 to 0.5) to set
isContinuousShould the position flip when it reaches an endpoint?
Returns
REVLibError::kOk if successful

◆ SetCurrent()

rev::REVLibError A301::SetCurrent ( double  current)

Sets the motor current of the A301.

Parameters
currentThe current (in Amps) to drive the motor at
Returns
REVLibError::kOk if successful

◆ SetThrottle()

void A301::SetThrottle ( double  throttle)
override

Sets the throttle of the motor controller.

Parameters
throttleThe throttle where -1.0 indicates full reverse and 1.0 indicates full forward.

◆ GetThrottle()

double A301::GetThrottle ( ) const
override

Gets the throttle of the motor controller.

Returns
The throttle where -1.0 represents full reverse and 1.0 represents full forward.

◆ SetVoltage()

void A301::SetVoltage ( wpi::units::volt_t  output)
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.

Parameters
outputThe voltage to output. (-12.0 V to 12.0 V)

◆ SetInverted()

void A301::SetInverted ( bool  isInverted)
override

Common interface for setting the inversion state of the motor controller.

Parameters
isInvertedThe inversion state.

◆ GetInverted()

bool A301::GetInverted ( ) const
override

Common interface for getting the inversion state of the motor controller.

Returns
The inversion state.

◆ Disable()

void A301::Disable ( )
override

Common interface for disabling a motor.


The documentation for this class was generated from the following files: