"

2013 FRC Java API

"

edu.wpi.first.wpilibj
Class Watchdog

java.lang.Object
  extended by edu.wpi.first.wpilibj.SensorBase
      extended by edu.wpi.first.wpilibj.Watchdog
All Implemented Interfaces:
IDevice, IUtility

public class Watchdog
extends SensorBase
implements IUtility

Watchdog timer class. The watchdog timer is designed to keep the robots safe. The idea is that the robot program must constantly "feed" the watchdog otherwise it will shut down all the motor outputs. That way if a program breaks, rather than having the robot continue to operate at the last known speed, the motors will be shut down. This is serious business. Don't just disable the watchdog. You can't afford it! http://thedailywtf.com/Articles/_0x2f__0x2f_TODO_0x3a__Uncomment_Later.aspx


Field Summary
static double kDefaultWatchdogExpiration
          Default expiration for the watchdog in seconds
 
Fields inherited from class edu.wpi.first.wpilibj.SensorBase
kAnalogChannels, kAnalogModules, kDigitalChannels, kPwmChannels, kRelayChannels, kSolenoidChannels, kSolenoidModules, kSystemClockTicksPerMicrosecond
 
Constructor Summary
protected Watchdog()
          The Watchdog is born.
 
Method Summary
 void feed()
          Throw the dog a bone.
 boolean getEnabled()
          Find out if the watchdog is currently enabled or disabled (mortal or immortal).
 double getExpiration()
          Read what the current expiration is.
static Watchdog getInstance()
          Get an instance of the watchdog
 double getTimer()
          Read how long it has been since the watchdog was last fed.
 boolean isAlive()
          Check in on the watchdog and make sure he's still kicking.
 boolean isSystemActive()
          Check on the overall status of the system.
 void kill()
          Put the watchdog out of its misery.
 void setEnabled(boolean enabled)
          Enable or disable the watchdog timer.
 void setExpiration(double expiration)
          Configure how many seconds your watchdog can be neglected before it starves to death.
 
Methods inherited from class edu.wpi.first.wpilibj.SensorBase
checkAnalogChannel, checkAnalogModule, checkDigitalChannel, checkDigitalModule, checkPWMChannel, checkPWMModule, checkRelayChannel, checkRelayModule, checkSolenoidChannel, checkSolenoidModule, free, getDefaultAnalogModule, getDefaultDigitalModule, getDefaultSolenoidModule, setDefaultAnalogModule, setDefaultDigitalModule, setDefaultSolenoidModule
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kDefaultWatchdogExpiration

public static final double kDefaultWatchdogExpiration
Default expiration for the watchdog in seconds

See Also:
Constant Field Values
Constructor Detail

Watchdog

protected Watchdog()
The Watchdog is born.

Method Detail

getInstance

public static Watchdog getInstance()
Get an instance of the watchdog

Returns:
an instance of the watchdog

feed

public void feed()
Throw the dog a bone. When everything is going well, you feed your dog when you get home. Let's hope you don't drive your car off a bridge on the way home... Your dog won't get fed and he will starve to death. By the way, it's not cool to ask the neighbor (some random task) to feed your dog for you. He's your responsibility!


kill

public void kill()
Put the watchdog out of its misery. Don't wait for your dying robot to starve when there is a problem. Kill it quickly, cleanly, and humanely.


getTimer

public double getTimer()
Read how long it has been since the watchdog was last fed.

Returns:
The number of seconds since last meal.

getExpiration

public double getExpiration()
Read what the current expiration is.

Returns:
The number of seconds before starvation following a meal (watchdog starves if it doesn't eat this often).

setExpiration

public void setExpiration(double expiration)
Configure how many seconds your watchdog can be neglected before it starves to death.

Parameters:
expiration - The number of seconds before starvation following a meal (watchdog starves if it doesn't eat this often).

getEnabled

public boolean getEnabled()
Find out if the watchdog is currently enabled or disabled (mortal or immortal).

Returns:
Enabled or disabled.

setEnabled

public void setEnabled(boolean enabled)
Enable or disable the watchdog timer. When enabled, you must keep feeding the watchdog timer to keep the watchdog active, and hence the dangerous parts (motor outputs, etc.) can keep functioning. When disabled, the watchdog is immortal and will remain active even without being fed. It will also ignore any kill commands while disabled.

Parameters:
enabled - Enable or disable the watchdog.

isAlive

public boolean isAlive()
Check in on the watchdog and make sure he's still kicking. This indicates that your watchdog is allowing the system to operate. It is still possible that the network communications is not allowing the system to run, but you can check this to make sure it's not your fault. Check isSystemActive() for overall system status. If the watchdog is disabled, then your watchdog is immortal.

Returns:
Is the watchdog still alive?

isSystemActive

public boolean isSystemActive()
Check on the overall status of the system.

Returns:
Is the system active (i.e. PWM motor outputs, etc. enabled)?

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"