Cheetah Software
1.0
|
#include <PeriodicTask.h>
Public Member Functions | |
PeriodicTask (PeriodicTaskManager *taskManager, float period, std::string name) | |
void | start () |
void | stop () |
void | printStatus () |
void | clearMax () |
bool | isSlow () |
virtual void | init ()=0 |
virtual void | run ()=0 |
virtual void | cleanup ()=0 |
virtual | ~PeriodicTask () |
float | getPeriod () |
float | getRuntime () |
float | getMaxPeriod () |
float | getMaxRuntime () |
Private Member Functions | |
void | loopFunction () |
Private Attributes | |
float | _period |
volatile bool | _running = false |
float | _lastRuntime = 0 |
float | _lastPeriodTime = 0 |
float | _maxPeriod = 0 |
float | _maxRuntime = 0 |
std::string | _name |
std::thread | _thread |
A single periodic task which will call run() at the given frequency
Definition at line 19 of file PeriodicTask.h.
PeriodicTask::PeriodicTask | ( | PeriodicTaskManager * | taskManager, |
float | period, | ||
std::string | name | ||
) |
Definition at line 14 of file PeriodicTask.cpp.
References PeriodicTaskManager::addTask().
|
inlinevirtual |
Definition at line 31 of file PeriodicTask.h.
References stop().
|
pure virtual |
Implemented in PeriodicMemberFunction< T >, PrintTaskStatus, PeriodicFunction, RobotInterface, RobotRunner, and TestPeriodicTask.
void PeriodicTask::clearMax | ( | ) |
|
inline |
|
inline |
Definition at line 39 of file PeriodicTask.h.
References _maxRuntime, and loopFunction().
|
inline |
|
inline |
|
pure virtual |
Implemented in PeriodicMemberFunction< T >, PrintTaskStatus, PeriodicFunction, RobotInterface, RobotRunner, and TestPeriodicTask.
bool PeriodicTask::isSlow | ( | ) |
Definition at line 44 of file PeriodicTask.cpp.
References _maxPeriod, _maxRuntime, and _period.
|
private |
Definition at line 65 of file PeriodicTask.cpp.
References _lastPeriodTime, _lastRuntime, _maxPeriod, _maxRuntime, _name, _period, _running, f(), Timer::getSeconds(), run(), and Timer::start().
void PeriodicTask::printStatus | ( | ) |
Definition at line 53 of file PeriodicTask.cpp.
References _lastPeriodTime, _lastRuntime, _maxPeriod, _maxRuntime, _name, _period, _running, isSlow(), printf_color(), and Red.
|
pure virtual |
Implemented in PeriodicMemberFunction< T >, PrintTaskStatus, PeriodicFunction, RobotInterface, RobotRunner, and TestPeriodicTask.
void PeriodicTask::start | ( | ) |
Definition at line 20 of file PeriodicTask.cpp.
References _name, _running, _thread, init(), and loopFunction().
void PeriodicTask::stop | ( | ) |
|
private |
Definition at line 47 of file PeriodicTask.h.
|
private |
Definition at line 46 of file PeriodicTask.h.
|
private |
Definition at line 48 of file PeriodicTask.h.
|
private |
Definition at line 49 of file PeriodicTask.h.
|
private |
Definition at line 50 of file PeriodicTask.h.
|
private |
Definition at line 44 of file PeriodicTask.h.
|
private |
Definition at line 45 of file PeriodicTask.h.
|
private |
Definition at line 51 of file PeriodicTask.h.