WPILibC++
2018.4.1-20180920010257-1187-gd2a5aaa
|
Public Member Functions | |
MotorSafetyHelper (MotorSafety *safeObject) | |
The constructor for a MotorSafetyHelper object. More... | |
void | Feed () |
Feed the motor safety object. More... | |
void | SetExpiration (double expirationTime) |
Set the expiration time for the corresponding motor safety object. More... | |
double | GetExpiration () const |
Retrieve the timeout value for the corresponding motor safety object. More... | |
bool | IsAlive () const |
Determine if the motor is still operating or has timed out. More... | |
void | Check () |
Check if this motor has exceeded its timeout. More... | |
void | SetSafetyEnabled (bool enabled) |
Enable/disable motor safety for this device. More... | |
bool | IsSafetyEnabled () const |
Return the state of the motor safety enabled flag. More... | |
![]() | |
ErrorBase (const ErrorBase &)=delete | |
ErrorBase & | operator= (const ErrorBase &)=delete |
virtual Error & | GetError () |
Retrieve the current error. More... | |
virtual const Error & | GetError () const |
Retrieve the current error. More... | |
virtual void | ClearError () const |
Clear the current error information associated with this sensor. | |
virtual void | SetErrnoError (const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const |
Set error information associated with a C library call that set an error to the "errno" global variable. More... | |
virtual void | SetImaqError (int success, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const |
Set the current error information associated from the nivision Imaq API. More... | |
virtual void | SetError (Error::Code code, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const |
Set the current error information associated with this sensor. More... | |
virtual void | SetErrorRange (Error::Code code, int32_t minRange, int32_t maxRange, int32_t requestedValue, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const |
Set the current error information associated with this sensor. More... | |
virtual void | SetWPIError (const wpi::Twine &errorMessage, Error::Code code, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) const |
Set the current error information associated with this sensor. More... | |
virtual void | CloneError (const ErrorBase &rhs) const |
virtual bool | StatusIsFatal () const |
Check if the current error code represents a fatal error. More... | |
Static Public Member Functions | |
static void | CheckMotors () |
Check the motors to see if any have timed out. More... | |
![]() | |
static void | SetGlobalError (Error::Code code, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) |
static void | SetGlobalWPIError (const wpi::Twine &errorMessage, const wpi::Twine &contextMessage, wpi::StringRef filename, wpi::StringRef function, int lineNumber) |
static const Error & | GetGlobalError () |
Retrieve the current global error. | |
Additional Inherited Members | |
![]() | |
Error | m_error |
|
explicit |
The constructor for a MotorSafetyHelper object.
The helper object is constructed for every object that wants to implement the Motor Safety protocol. The helper object has the code to actually do the timing and call the motors Stop() method when the timeout expires. The motor object is expected to call the Feed() method whenever the motors value is updated.
safeObject | a pointer to the motor object implementing MotorSafety. This is used to call the Stop() method on the motor. |
void frc::MotorSafetyHelper::Check | ( | ) |
Check if this motor has exceeded its timeout.
This method is called periodically to determine if this motor has exceeded its timeout value. If it has, the stop method is called, and the motor is shut down until its value is updated again.
|
static |
Check the motors to see if any have timed out.
This static method is called periodically to poll all the motors and stop any that have timed out.
void frc::MotorSafetyHelper::Feed | ( | ) |
Feed the motor safety object.
Resets the timer on this object that is used to do the timeouts.
double frc::MotorSafetyHelper::GetExpiration | ( | ) | const |
Retrieve the timeout value for the corresponding motor safety object.
bool frc::MotorSafetyHelper::IsAlive | ( | ) | const |
Determine if the motor is still operating or has timed out.
bool frc::MotorSafetyHelper::IsSafetyEnabled | ( | ) | const |
Return the state of the motor safety enabled flag.
Return if the motor safety is currently enabled for this devicce.
void frc::MotorSafetyHelper::SetExpiration | ( | double | expirationTime | ) |
Set the expiration time for the corresponding motor safety object.
expirationTime | The timeout value in seconds. |
void frc::MotorSafetyHelper::SetSafetyEnabled | ( | bool | enabled | ) |
Enable/disable motor safety for this device.
Turn on and off the motor safety option for this PWM object.
enabled | True if motor safety is enforced for this object |