Fawkes API
Fawkes Development Version
|
Katana sensor acquisition thread. More...
#include "sensacq_thread.h"
Public Member Functions | |
KatanaSensorAcquisitionThread (fawkes::RefPtr< fawkes::KatanaController > katana, fawkes::Logger *logger) | |
Constructor. | |
void | set_enabled (bool enabled) |
Set whether data acquisition is enabled or not. | |
virtual void | loop () |
Code to execute in the thread. | |
Protected Member Functions | |
virtual void | run () |
Stub to see name in backtrace for easier debugging. |
Katana sensor acquisition thread.
This thread runs continuously and acquires data from the sensor. Since the operation is blocking and may take several miliseconds it is done concurrently to the main loop at specified intervals.
KatanaSensorAcquisitionThread::KatanaSensorAcquisitionThread | ( | fawkes::RefPtr< fawkes::KatanaController > | katana, |
fawkes::Logger * | logger | ||
) |
Constructor.
katana | katana controller base class |
logger | logger |
Definition at line 42 of file sensacq_thread.cpp.
void KatanaSensorAcquisitionThread::loop | ( | ) | [virtual] |
Code to execute in the thread.
Implement this method to hold the code you want to be executed continously. If you do not implement this method, the default is that the thread will exit. This is useful if you choose to only implement once().
Reimplemented from fawkes::Thread.
Definition at line 69 of file sensacq_thread.cpp.
References fawkes::Logger::log_warn(), fawkes::Thread::name(), and fawkes::Exception::what().
virtual void KatanaSensorAcquisitionThread::run | ( | ) | [inline, protected, virtual] |
Stub to see name in backtrace for easier debugging.
Reimplemented from fawkes::Thread.
Definition at line 44 of file sensacq_thread.h.
void KatanaSensorAcquisitionThread::set_enabled | ( | bool | enabled | ) |
Set whether data acquisition is enabled or not.
In general the thread should only be woken up if sensor data can be acquired. But for safety data acqusition can also be turned off to be safe against spurious wakeups. Additionally, this method will acquire the loop mutex, thereby assuring that a possibly running loop has finished.
enabled | true to enable sensor data acquisition, false to disable. |
Definition at line 60 of file sensacq_thread.cpp.
References fawkes::Thread::loop_mutex, fawkes::Mutex::lock(), and fawkes::Mutex::unlock().