Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.wpi.first.wpilibj
Class MotorSafetyHelper

    java.lang.Object
      edu.wpi.first.wpilibj.MotorSafetyHelper

    public class MotorSafetyHelper

extends Object

The MotorSafetyHelper 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.

Author:
  brad

Constructor Summary
`MotorSafetyHelper(MotorSafety safeObject)` The constructor for a MotorSafetyHelper object.

Method Summary
`void` | `check()` Check if this motor has exceeded its timeout.
`static void` | `checkMotors()` Check the motors to see if any have timed out.
`void` | `feed()` Feed the motor safety object.
`double` | `getExpiration()` Retrieve the timeout value for the corresponding motor safety object.
`boolean` | `isAlive()` Determine of the motor is still operating or has timed out.
`boolean` | `isSafetyEnabled()` Return the state of the motor safety enabled flag Return if the motor safety is currently enabled for this devicce.
`void` | `setExpiration(double expirationTime)` Set the expiration time for the corresponding motor safety object.
`void` | `setSafetyEnabled(boolean enabled)` Enable/disable motor safety for this device Turn on and off the motor safety option for this PWM object.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### MotorSafetyHelper

    public 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:
    `safeObject` - a pointer to the motor object implementing MotorSafety. This is used to call the Stop() method on the motor.

Method Detail

### feed

    public void feed()

  Feed the motor safety object. Resets the timer on this object that is used to do the timeouts.

### setExpiration

    public void setExpiration(double expirationTime)

  Set the expiration time for the corresponding motor safety object.

  Parameters:
    `expirationTime` - The timeout value in seconds.

### getExpiration

    public double getExpiration()

  Retrieve the timeout value for the corresponding motor safety object.

  Returns:
    the timeout value in seconds.

### isAlive

    public boolean isAlive()

  Determine of 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.

### check

    public void 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.

### setSafetyEnabled

    public void setSafetyEnabled(boolean enabled)

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

  Parameters:
    `enabled` - True if motor safety is enforced for this object

### isSafetyEnabled

    public boolean 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

### checkMotors

    public static void checkMotors()

  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.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

"
For updated information see the Java FRC site
"