LaserAcquisitionThread Class Reference
Laser acqusition thread. More...
#include <acquisition_thread.h>

Public Member Functions | |
| LaserAcquisitionThread (const char *thread_name) | |
| Constructor. | |
| bool | lock_if_new_data () |
| Lock data if fresh. | |
| void | unlock () |
| Unlock data,. | |
| virtual void | pre_init (fawkes::Configuration *config, fawkes::Logger *logger)=0 |
| Pre initialization. | |
| const float * | get_distance_data () |
| Get distance data. | |
| const float * | get_echo_data () |
| Get echo data. | |
| unsigned int | get_distance_data_size () |
| Get distance data size. | |
| unsigned int | get_echo_data_size () |
| Get echo data size. | |
Protected Member Functions | |
| virtual void | run () |
| Stub to see name in backtrace for easier debugging. | |
Protected Attributes | |
| fawkes::Mutex * | _data_mutex |
| Lock while writing to distances or echoes array or marking new data. | |
| bool | _new_data |
| Set to true in your loop if new data is available. | |
| float * | _distances |
| Allocate a float array and copy your distance values measured in meters here. | |
| float * | _echoes |
| Allocate a float array and copy your echo values here. | |
| unsigned int | _distances_size |
| Assign this the size of the _distances array. | |
| unsigned int | _echoes_size |
| Assign this the size of the _echoes array. | |
Detailed Description
Laser acqusition thread.Interface for different laser types.
Definition at line 37 of file acquisition_thread.h.
Constructor & Destructor Documentation
| LaserAcquisitionThread::LaserAcquisitionThread | ( | const char * | thread_name | ) |
Constructor.
- Parameters:
-
thread_name name of the thread, be descriptive
Definition at line 72 of file acquisition_thread.cpp.
References _data_mutex, _distances, _distances_size, _echoes, _echoes_size, and _new_data.
Member Function Documentation
| const float * LaserAcquisitionThread::get_distance_data | ( | ) |
Get distance data.
- Returns:
- Float array with distance values
Definition at line 120 of file acquisition_thread.cpp.
References _distances, and _new_data.
Referenced by LaserSensorThread::loop().
| unsigned int LaserAcquisitionThread::get_distance_data_size | ( | ) |
Get distance data size.
- Returns:
- size of data float array
Definition at line 142 of file acquisition_thread.cpp.
References _distances_size.
Referenced by LaserSensorThread::init(), and LaserSensorThread::loop().
| const float * LaserAcquisitionThread::get_echo_data | ( | ) |
Get echo data.
- Returns:
- Float array with echo values
Definition at line 131 of file acquisition_thread.cpp.
| unsigned int LaserAcquisitionThread::get_echo_data_size | ( | ) |
Get echo data size.
- Returns:
- size of data float array
Definition at line 152 of file acquisition_thread.cpp.
References _echoes_size.
| bool LaserAcquisitionThread::lock_if_new_data | ( | ) |
Lock data if fresh.
If new data has been received since get_distance_data() or get_echo_data() was called last the data is locked, no new data can arrive until you call unlock(), otherwise the lock is immediately released after checking.
- Returns:
- true if the lock was acquired and there is new data, false otherwise
Definition at line 96 of file acquisition_thread.cpp.
References _data_mutex, _new_data, fawkes::Mutex::lock(), and fawkes::Mutex::unlock().
Referenced by LaserSensorThread::loop().
| void LaserAcquisitionThread::pre_init | ( | fawkes::Configuration * | config, | |
| fawkes::Logger * | logger | |||
| ) | [pure virtual] |
Pre initialization.
This method is called by the sensor thread for pre-initialization. After this method has been executed the methods get_distances_data_size() and get_echo_data_size() must return valid data.
- Parameters:
-
config configuration logger logger instance
Implemented in LaseEdlAcquisitionThread.
Referenced by LaserSensorThread::init().
| virtual void LaserAcquisitionThread::run | ( | ) | [inline, protected, virtual] |
Stub to see name in backtrace for easier debugging.
- See also:
- Thread::run()
Reimplemented from fawkes::Thread.
Definition at line 60 of file acquisition_thread.h.
| void LaserAcquisitionThread::unlock | ( | ) |
Unlock data,.
Definition at line 110 of file acquisition_thread.cpp.
References _data_mutex, and fawkes::Mutex::unlock().
Referenced by LaserSensorThread::loop().
Member Data Documentation
fawkes::Mutex * LaserAcquisitionThread::_data_mutex [protected] |
Lock while writing to distances or echoes array or marking new data.
Definition at line 63 of file acquisition_thread.h.
Referenced by LaserAcquisitionThread(), lock_if_new_data(), and unlock().
float * LaserAcquisitionThread::_distances [protected] |
Allocate a float array and copy your distance values measured in meters here.
Definition at line 66 of file acquisition_thread.h.
Referenced by LaseEdlAcquisitionThread::finalize(), get_distance_data(), LaseEdlAcquisitionThread::init(), and LaserAcquisitionThread().
unsigned int LaserAcquisitionThread::_distances_size [protected] |
Assign this the size of the _distances array.
Definition at line 69 of file acquisition_thread.h.
Referenced by get_distance_data_size(), LaserAcquisitionThread(), and LaseEdlAcquisitionThread::pre_init().
float * LaserAcquisitionThread::_echoes [protected] |
Allocate a float array and copy your echo values here.
Definition at line 67 of file acquisition_thread.h.
Referenced by LaseEdlAcquisitionThread::finalize(), get_echo_data(), LaseEdlAcquisitionThread::init(), and LaserAcquisitionThread().
unsigned int LaserAcquisitionThread::_echoes_size [protected] |
Assign this the size of the _echoes array.
Definition at line 70 of file acquisition_thread.h.
Referenced by get_echo_data_size(), LaserAcquisitionThread(), and LaseEdlAcquisitionThread::pre_init().
bool LaserAcquisitionThread::_new_data [protected] |
Set to true in your loop if new data is available.
Set to false automatically in get_distance_data() and get_echoes_data().
Definition at line 65 of file acquisition_thread.h.
Referenced by get_distance_data(), get_echo_data(), LaserAcquisitionThread(), and lock_if_new_data().
The documentation for this class was generated from the following files:
- src/plugins/laser/acquisition_thread.h
- src/plugins/laser/acquisition_thread.cpp

