![]() |
Laelaps
2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
|
#include <laeThreadWd.h>
Public Member Functions | |
LaeThreadWd (LaeWd &hwif) | |
Default constructor. | |
virtual | ~LaeThreadWd () |
Destructor. | |
int | reload (const LaeTunes &tunes) |
Reload tunable paramaters. More... | |
![]() | |
LaeThread (const std::string &strThreadName) | |
Default constructor. | |
virtual | ~LaeThread () |
Destructor. | |
virtual int | createThread (int nPriority) |
Create the thread. More... | |
virtual int | runThread (const double fHz) |
Run the thread. More... | |
virtual int | terminateThread () |
Terminate the thread. More... | |
virtual void | setHz (const double fHz) |
Calculate thread new full cycle run rate. More... | |
std::string | getThreadName () const |
Get assigned thread name. More... | |
int | getThreadPriority () const |
Get thread system scheduling priority. More... | |
double | getThreadHz () const |
Get thread run full cycle rate. More... | |
Static Public Member Functions | |
static double | optimizeHz (const double fWatchDogTimeout) |
Optimize thread hertz rate given the watchdog timeout value. More... | |
Static Public Attributes | |
static const double | ThreadWdPrioDft = 50 |
default priority | |
static const double | ThreadWdHzDft = 1.0 |
default run rate | |
![]() | |
static const int | ThreadPriorityMin = 1 |
minimum scheduling priority | |
static const int | ThreadPriorityMax = 99 |
maximum scheduling priority | |
static const double | ThreadMinHz = 0.001 |
minimum thread Hertz More... | |
Protected Member Functions | |
virtual void | exec () |
Execute watchdog task within scheduled cycle. More... | |
![]() | |
void | lock () |
Lock the I2C bus. More... | |
void | unlock () |
Unlock the I2C bus. More... | |
void | changeState (ThreadState eNewState) |
Change the thread state. More... | |
void | timedWait (const struct timespec &tsTimeout) |
Timed wait until state change or time out. More... | |
virtual void | readyBlock () |
Block indefinitely while in the ready state. More... | |
virtual void | schedBlock () |
Block the thread until the next subcycle task is to be run. More... | |
virtual void | transToReady () |
Uninitialized to Ready state transition function. More... | |
virtual void | transToRunning () |
Ready to Running state transition function. More... | |
virtual void | transToExit () |
Any to Exit state transition function. More... | |
Protected Attributes | |
LaeWd & | m_hwif |
hardware interface | |
LaeWatchDogReset | m_reset |
sub-processor reset | |
LaeBattery | m_battery |
battery and energy monitor | |
LaeAlarms | m_alarms |
alarm monitor | |
![]() | |
std::string | m_strThreadName |
thread identifying name | |
ThreadState | m_eState |
thread state | |
pthread_mutex_t | m_mutexSync |
synchonization mutex | |
pthread_cond_t | m_condSync |
synchonization condition | |
pthread_t | m_thread |
pthread identifier | |
int | m_nPriority |
thread OS scheduling priority | |
double | m_fHz |
thread cycle run rate (Hertz) | |
double | m_fTExec |
task execution cycle period (seconds) | |
struct timespec | m_tsExecPeriod |
task execution period (converted) | |
struct timespec | m_tsJitter |
allowable scheduling jitter | |
struct timespec | m_tsSched |
working scheduler time stamp | |
struct timespec | m_tsExecLast |
start of last execution time stamp | |
struct timespec | m_tsExecThis |
start of this execution time stamp | |
int | m_nSlipErrCnt |
slipped error count leaky bucket | |
Additional Inherited Members | |
![]() | |
enum | ThreadState { ThreadStateUninit, ThreadStateReady, ThreadStateStart, ThreadStateRunning, ThreadStateExit } |
Kinematics thread states. More... | |
![]() | |
static void * | thread (void *pArg) |
The thread. More... | |
Watchdog thread class.
Definition at line 89 of file laeThreadWd.h.
|
protectedvirtual |
Execute watchdog task within scheduled cycle.
This function executes under the lock/unlock mutex.
Reimplemented from laelaps::LaeThread.
Definition at line 112 of file laeThreadWd.cxx.
References laelaps::LaeWd::exec(), m_alarms, m_battery, m_hwif, laelaps::LaeBattery::update(), and laelaps::LaeAlarms::update().
|
static |
Optimize thread hertz rate given the watchdog timeout value.
fWatchDogTimeout | Seconds. |
Definition at line 79 of file laeThreadWd.cxx.
Referenced by laelaps::LaeRobot::startCoreThreads().
int LaeThreadWd::reload | ( | const LaeTunes & | tunes | ) |
Reload tunable paramaters.
This function executes under the lock/unlock mutex.
Definition at line 99 of file laeThreadWd.cxx.
References laelaps::LaeThread::lock(), m_hwif, laelaps::LaeWd::reload(), and laelaps::LaeThread::unlock().
Referenced by laelaps::LaeRobot::reload().