WPILib 2012
WPILibRoboticsLibraryforFRC
Public Member Functions
SafePWM Class Reference

#include <SafePWM.h>

Inheritance diagram for SafePWM:
PWM MotorSafety SensorBase ErrorBase Jaguar Servo Victor

List of all members.

Public Member Functions

 SafePWM (UINT32 channel)
 SafePWM (UINT8 moduleNumber, UINT32 channel)
void SetExpiration (float timeout)
float GetExpiration ()
bool IsAlive ()
void StopMotor ()
bool IsSafetyEnabled ()
void SetSafetyEnabled (bool enabled)
void GetDescription (char *desc)
virtual void SetSpeed (float speed)

Detailed Description

A safe version of the PWM class. It is safe because it implements the MotorSafety interface that provides timeouts in the event that the motor value is not updated before the expiration time. This delegates the actual work to a MotorSafetyHelper object that is used for all objects that implement MotorSafety.


Constructor & Destructor Documentation

SafePWM::SafePWM ( UINT32  channel) [explicit]

Constructor for a SafePWM object taking a channel number

Parameters:
channelThe channel number to be used for the underlying PWM object
SafePWM::SafePWM ( UINT8  moduleNumber,
UINT32  channel 
)

Constructor for a SafePWM object taking channel and slot numbers.

Parameters:
moduleNumberThe digital module (1 or 2).
channelThe PWM channel number on the module (1..10).

Member Function Documentation

float SafePWM::GetExpiration ( ) [virtual]

Return the expiration time for the PWM object.

Returns:
The expiration time value.

Implements MotorSafety.

bool SafePWM::IsAlive ( ) [virtual]

Check if the PWM object is currently alive or stopped due to a timeout.

Returns:
a bool value that is true if the motor has NOT timed out and should still be running.

Implements MotorSafety.

bool SafePWM::IsSafetyEnabled ( ) [virtual]

Check if motor safety is enabled for this object

Returns:
True if motor safety is enforced for this object

Implements MotorSafety.

void SafePWM::SetSafetyEnabled ( bool  enabled) [virtual]

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

Implements MotorSafety.

void SafePWM::SetSpeed ( float  speed) [virtual]

Feed the MotorSafety timer when setting the speed. This method is called by the subclass motor whenever it updates its speed, thereby reseting the timeout value.

Parameters:
speedValue to pass to the PWM class

Reimplemented from PWM.

void SafePWM::StopMotor ( ) [virtual]

Stop the motor associated with this PWM object. This is called by the MotorSafetyHelper object when it has a timeout for this PWM and needs to stop it from running.

Implements MotorSafety.


The documentation for this class was generated from the following files:
 All Classes Functions Variables