23 #include "sensor_thread.h" 24 #include "acquisition_thread.h" 26 #include <interfaces/Laser360Interface.h> 27 #include <interfaces/Laser720Interface.h> 28 #include <interfaces/Laser1080Interface.h> 46 std::string &cfg_prefix,
48 :
Thread(
"LaserSensorThread",
Thread::OPMODE_WAITFORWAKEUP),
51 set_name(
"LaserSensorThread(%s)", cfg_name.c_str());
53 __cfg_name = cfg_name;
54 __cfg_prefix = cfg_prefix;
63 __laser1080_if = NULL;
65 bool main_sensor =
false;
70 main_sensor =
config->
get_bool((__cfg_prefix +
"main_sensor").c_str());
77 std::string if_id = main_sensor ?
"Laser" : (
"Laser " + __cfg_name);
79 if (__num_values == 360) {
82 __laser360_if->
set_frame(__cfg_frame.c_str());
83 __laser360_if->
write();
84 }
else if (__num_values == 720){
87 __laser720_if->
set_frame(__cfg_frame.c_str());
88 __laser720_if->
write();
89 }
else if (__num_values == 1080){
92 __laser1080_if->
set_frame(__cfg_frame.c_str());
93 __laser1080_if->
write();
95 throw Exception(
"Laser acquisition thread must produce either 360, 720, or 1080 " 114 if (__num_values == 360) {
117 __laser360_if->
write();
118 }
else if (__num_values == 720) {
121 __laser720_if->
write();
122 }
else if (__num_values == 1080) {
125 __laser1080_if->
write();
Laser360Interface Fawkes BlackBoard Interface.
unsigned int get_distance_data_size()
Get distance data size.
void set_frame(const char *new_frame)
Set frame value.
Laser1080Interface Fawkes BlackBoard Interface.
void set_frame(const char *new_frame)
Set frame value.
void set_auto_timestamping(bool enabled)
Enable or disable automated timestamping.
Fawkes library namespace.
virtual bool get_bool(const char *path)=0
Get value from configuration which is of type bool.
virtual void pre_init(fawkes::Configuration *config, fawkes::Logger *logger)=0
Pre initialization.
virtual void init()
Initialize the thread.
Thread class encapsulation of pthreads.
void write()
Write from local copy into BlackBoard memory.
void set_distances(unsigned int index, const float new_distances)
Set distances value at given index.
Logger * logger
This is the Logger member used to access the logger.
void set_distances(unsigned int index, const float new_distances)
Set distances value at given index.
LaserSensorThread(std::string &cfg_name, std::string &cfg_prefix, LaserAcquisitionThread *aqt)
Constructor.
Thread aspect to use blocked timing.
virtual void loop()
Code to execute in the thread.
void set_name(const char *format,...)
Set name of thread.
Base class for exceptions in Fawkes.
virtual void finalize()
Finalize the thread.
const float * get_distance_data()
Get distance data.
void unlock()
Unlock data,.
void set_distances(unsigned int index, const float new_distances)
Set distances value at given index.
const fawkes::Time * get_timestamp()
Get timestamp of data.
void set_frame(const char *new_frame)
Set frame value.
bool lock_if_new_data()
Lock data if fresh.
Configuration * config
This is the Configuration member used to access the configuration.
virtual Interface * open_for_writing(const char *interface_type, const char *identifier, const char *owner=NULL)=0
Open interface for writing.
void set_timestamp(const Time *t=NULL)
Set timestamp.
Laser720Interface Fawkes BlackBoard Interface.
virtual std::string get_string(const char *path)=0
Get value from configuration which is of type string.
BlackBoard * blackboard
This is the BlackBoard instance you can use to interact with the BlackBoard.
virtual void close(Interface *interface)=0
Close interface.