Public Member Functions | |
MotorSafetyHelper (MotorSafety *safeObject) | |
void | Feed () |
void | SetExpiration (float expirationTime) |
float | GetExpiration () |
bool | IsAlive () |
void | Check () |
void | SetSafetyEnabled (bool enabled) |
bool | IsSafetyEnabled () |
Public Member Functions inherited from ErrorBase | |
virtual Error & | GetError () |
Retrieve the current error. Get the current error information associated with this sensor. | |
virtual const Error & | GetError () const |
virtual void | SetErrnoError (const char *contextMessage, const char *filename, const char *function, uint32_t 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 char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const |
Set the current error information associated from the nivision Imaq API. More... | |
virtual void | SetError (Error::Code code, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const |
Set the current error information associated with this sensor. More... | |
virtual void | SetWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) const |
Set the current error information associated with this sensor. More... | |
virtual void | CloneError (ErrorBase *rhs) const |
virtual void | ClearError () const |
Clear the current error information associated with this sensor. | |
virtual bool | StatusIsFatal () const |
Check if the current error code represents a fatal error. More... | |
Static Public Member Functions | |
static void | CheckMotors () |
Static Public Member Functions inherited from ErrorBase | |
static void | SetGlobalError (Error::Code code, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) |
static void | SetGlobalWPIError (const char *errorMessage, const char *contextMessage, const char *filename, const char *function, uint32_t lineNumber) |
static Error & | GetGlobalError () |
Additional Inherited Members | |
Protected Member Functions inherited from ErrorBase | |
ErrorBase () | |
Initialize the instance status to 0 for now. | |
Protected Attributes inherited from ErrorBase | |
Error | m_error |
Static Protected Attributes inherited from ErrorBase | |
static SEM_ID | _globalErrorMutex = semMCreate(SEM_Q_PRIORITY | SEM_DELETE_SAFE | SEM_INVERSION_SAFE) |
static Error | _globalError |
Definition at line 16 of file MotorSafetyHelper.h.
MotorSafetyHelper::MotorSafetyHelper | ( | MotorSafety * | safeObject | ) |
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. |
Definition at line 28 of file MotorSafetyHelper.cpp.
void 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.
Definition at line 105 of file MotorSafetyHelper.cpp.
|
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.
Definition at line 149 of file MotorSafetyHelper.cpp.
float MotorSafetyHelper::GetExpiration | ( | ) |
Retrieve the timeout value for the corresponding motor safety object.
Definition at line 83 of file MotorSafetyHelper.cpp.
bool MotorSafetyHelper::IsAlive | ( | ) |
Determine if the motor is still operating or has timed out.
Definition at line 93 of file MotorSafetyHelper.cpp.
bool MotorSafetyHelper::IsSafetyEnabled | ( | ) |
Return the state of the motor safety enabled flag Return if the motor safety is currently enabled for this devicce.
Definition at line 138 of file MotorSafetyHelper.cpp.
void 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 |
Definition at line 127 of file MotorSafetyHelper.cpp.