Fawkes API  Fawkes Development Version
laser_pointcloud_thread.h
1 
2 /***************************************************************************
3  * laser_pointcloud_thread.h - Convert laser data to pointclouds
4  *
5  * Created: Thu Nov 17 10:21:40 2011
6  * Copyright 2011 Tim Niemueller [www.niemueller.de]
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 #ifndef __PLUGINS_LASER_POINTCLOUDS_LASER_POINTCLOUD_THREAD_H_
23 #define __PLUGINS_LASER_POINTCLOUDS_LASER_POINTCLOUD_THREAD_H_
24 
25 // must be first for reliable ROS detection
26 #include <pcl/point_cloud.h>
27 #include <pcl/point_types.h>
28 
29 #include <core/threading/thread.h>
30 #include <aspect/blocked_timing.h>
31 #include <aspect/logging.h>
32 #include <aspect/blackboard.h>
33 #include <aspect/pointcloud.h>
34 #include <blackboard/interface_listener.h>
35 #include <blackboard/interface_observer.h>
36 #include <core/utils/lock_list.h>
37 
38 namespace fawkes {
39  class Interface;
40  class Laser360Interface;
41  class Laser720Interface;
42  class Laser1080Interface;
43 }
44 
46 : public fawkes::Thread,
47  public fawkes::LoggingAspect,
53 {
54  public:
56  virtual ~LaserPointCloudThread();
57 
58  virtual void init();
59  virtual void loop();
60  virtual void finalize();
61 
62  // for BlackBoardInterfaceObserver
63  virtual void bb_interface_created(const char *type, const char *id) throw();
64 
65  // for BlackBoardInterfaceListener
66  virtual void bb_interface_writer_removed(fawkes::Interface *interface,
67  unsigned int instance_serial) throw();
68  virtual void bb_interface_reader_removed(fawkes::Interface *interface,
69  unsigned int instance_serial) throw();
70 
71  private:
72  void conditional_close(fawkes::Interface *interface) throw();
73  std::string interface_to_pcl_name(const char *interface_id);
74 
75  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
76  protected: virtual void run() { Thread::run(); }
77 
78  private:
79  /// @cond INTERNALS
80  typedef struct {
81  std::string id;
82  unsigned int size;
83  union {
87  } interface_typed;
88  fawkes::Interface *interface;
89 
91  } InterfaceCloudMapping;
92  /// @endcond
93 
95 
96  float sin_angles360[360];
97  float cos_angles360[360];
98  float sin_angles720[720];
99  float cos_angles720[720];
100  float sin_angles1080[1080];
101  float cos_angles1080[1080];
102 };
103 
104 #endif
Laser360Interface Fawkes BlackBoard Interface.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Laser1080Interface Fawkes BlackBoard Interface.
Fawkes library namespace.
Thread aspect to provide and access point clouds.
Definition: pointcloud.h:40
virtual void run()
Code to execute in the thread.
Definition: thread.cpp:939
Thread class encapsulation of pthreads.
Definition: thread.h:42
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
Thread aspect to use blocked timing.
Thread aspect to log output.
Definition: logging.h:35
BlackBoard interface observer.
RefPtr<> is a reference-counting shared smartpointer.
Definition: refptr.h:49
virtual void run()
Stub to see name in backtrace for easier debugging.
Thread to exchange transforms between Fawkes and ROS.
Laser720Interface Fawkes BlackBoard Interface.
BlackBoard interface listener.