WPILib  2014.0
WPIRoboticsLibraryforFRC
 All Classes Functions Variables Pages
Public Member Functions | Static Public Member Functions | List of all members
MotorSafetyHelper Class Reference
Inheritance diagram for MotorSafetyHelper:
ErrorBase

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 ErrorGetError ()
 Retrieve the current error. Get the current error information associated with this sensor.
 
virtual const ErrorGetError () 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 ErrorGetGlobalError ()
 

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
 

Constructor & Destructor Documentation

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.

Parameters
safeObjecta pointer to the motor object implementing MotorSafety. This is used to call the Stop() method on the motor.

Member Function Documentation

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.

void MotorSafetyHelper::CheckMotors ( )
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.

float MotorSafetyHelper::GetExpiration ( )

Retrieve the timeout value for the corresponding motor safety object.

Returns
the timeout value in seconds.
bool MotorSafetyHelper::IsAlive ( )

Determine if the motor is still operating or has timed out.

Returns
a true value if the motor is still operating normally and hasn't timed out.
bool MotorSafetyHelper::IsSafetyEnabled ( )

Return the state of the motor safety enabled flag Return if the motor safety is currently enabled for this devicce.

Returns
True if motor safety is enforced for this device
void MotorSafetyHelper::SetSafetyEnabled ( bool  enabled)

Enable/disable motor safety for this device Turn on and off the motor safety option for this PWM object.

Parameters
enabledTrue if motor safety is enforced for this object

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