Watchdog Class Reference
#include <Watchdog.h>


Public Member Functions | |
| Watchdog () | |
| virtual | ~Watchdog () |
| bool | Feed () |
| void | Kill () |
| double | GetTimer () |
| double | GetExpiration () |
| void | SetExpiration (double expiration) |
| bool | GetEnabled () |
| void | SetEnabled (bool enabled) |
| bool | IsAlive () |
| bool | IsSystemActive () |
Static Public Attributes | |
| static const double | kDefaultWatchdogExpiration = 0.5 |
Detailed Description
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
Definition at line 25 of file Watchdog.h.
Constructor & Destructor Documentation
| Watchdog::Watchdog | ( | ) |
The Watchdog is born.
Definition at line 14 of file Watchdog.cpp.
| Watchdog::~Watchdog | ( | ) | [virtual] |
Time to bury him in the back yard.
Definition at line 27 of file Watchdog.cpp.
Member Function Documentation
| bool Watchdog::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!
- Returns:
- Returns the previous state of the watchdog before feeding it.
Definition at line 46 of file Watchdog.cpp.
| bool Watchdog::GetEnabled | ( | ) |
Find out if the watchdog is currently enabled or disabled (mortal or immortal).
- Returns:
- Enabled or disabled.
Definition at line 111 of file Watchdog.cpp.
| double Watchdog::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).
Definition at line 86 of file Watchdog.cpp.
| double Watchdog::GetTimer | ( | ) |
Read how long it has been since the watchdog was last fed.
- Returns:
- The number of seconds since last meal.
Definition at line 73 of file Watchdog.cpp.
| bool Watchdog::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?
Definition at line 150 of file Watchdog.cpp.
| bool Watchdog::IsSystemActive | ( | ) |
Check on the overall status of the system.
- Returns:
- Is the system active (i.e. PWM motor outputs, etc. enabled)?
Definition at line 163 of file Watchdog.cpp.
| void Watchdog::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.
Definition at line 61 of file Watchdog.cpp.
| void Watchdog::SetEnabled | ( | bool | 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.
Definition at line 131 of file Watchdog.cpp.
| void Watchdog::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).
Definition at line 99 of file Watchdog.cpp.
The documentation for this class was generated from the following files:
Generated on Thu Jan 12 2012 22:35:38 for WPILibC++ by
1.7.1