Laelaps  2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
laelaps::LaeThreadWd Class Reference

#include <laeThreadWd.h>

Inheritance diagram for laelaps::LaeThreadWd:
laelaps::LaeThread

Public Member Functions

 LaeThreadWd (LaeWd &hwif)
 Default constructor.
 
virtual ~LaeThreadWd ()
 Destructor.
 
int reload (const LaeTunes &tunes)
 Reload tunable paramaters. More...
 
- Public Member Functions inherited from laelaps::LaeThread
 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 Public Attributes inherited from laelaps::LaeThread
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...
 
- Protected Member Functions inherited from laelaps::LaeThread
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

LaeWdm_hwif
 hardware interface
 
LaeWatchDogReset m_reset
 sub-processor reset
 
LaeBattery m_battery
 battery and energy monitor
 
LaeAlarms m_alarms
 alarm monitor
 
- Protected Attributes inherited from laelaps::LaeThread
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

- Public Types inherited from laelaps::LaeThread
enum  ThreadState {
  ThreadStateUninit,
  ThreadStateReady,
  ThreadStateStart,
  ThreadStateRunning,
  ThreadStateExit
}
 Kinematics thread states. More...
 
- Static Protected Member Functions inherited from laelaps::LaeThread
static void * thread (void *pArg)
 The thread. More...
 

Detailed Description

Watchdog thread class.

Definition at line 89 of file laeThreadWd.h.

Member Function Documentation

void LaeThreadWd::exec ( )
protectedvirtual

Execute watchdog task within scheduled cycle.

This function executes under the lock/unlock mutex.

Context:
This thread.

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().

113 {
114  m_hwif.exec();
115  m_battery.update();
116  m_alarms.update();
117 }
virtual void update()
Update alarm and warning state.
Definition: laeAlarms.cxx:105
LaeWd & m_hwif
hardware interface
Definition: laeThreadWd.h:122
LaeBattery m_battery
battery and energy monitor
Definition: laeThreadWd.h:124
virtual void exec()
Execute cycle to pet/read/update Watchdog sub-processor.
Definition: laeWd.cxx:188
LaeAlarms m_alarms
alarm monitor
Definition: laeThreadWd.h:125
virtual void update()
Update the energy state for all of the robot&#39;s subsystems.
Definition: laeBatt.cxx:373
double LaeThreadWd::optimizeHz ( const double  fWatchDogTimeout)
static

Optimize thread hertz rate given the watchdog timeout value.

Parameters
fWatchDogTimeoutSeconds.
Returns
Returns hertz.

Definition at line 79 of file laeThreadWd.cxx.

Referenced by laelaps::LaeRobot::startCoreThreads().

80 {
81  double t;
82 
83  t = fWatchDogTimeout / 2.0 - 0.001;
85  {
87  }
88  return t;
89 }
static const double ThreadWdHzDft
default run rate
Definition: laeThreadWd.h:93
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().

100 {
101  int rc;
102 
103  lock();
104 
105  rc = m_hwif.reload(tunes);
106 
107  unlock();
108 
109  return rc;
110 }
LaeWd & m_hwif
hardware interface
Definition: laeThreadWd.h:122
void unlock()
Unlock the I2C bus.
Definition: laeThread.h:235
void lock()
Lock the I2C bus.
Definition: laeThread.h:221
virtual int reload(const LaeTunes &tunes)
Reload with new configuration.
Definition: laeWd.cxx:182

The documentation for this class was generated from the following files: