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 #include <core/threading/thread.h>
26 #include <aspect/blocked_timing.h>
27 #include <aspect/logging.h>
28 #include <aspect/blackboard.h>
29 #include <aspect/pointcloud.h>
30 #include <blackboard/interface_listener.h>
31 #include <blackboard/interface_observer.h>
32 #include <core/utils/lock_list.h>
33 
34 #include <pcl/point_cloud.h>
35 #include <pcl/point_types.h>
36 
37 namespace fawkes {
38  class Interface;
39  class Laser360Interface;
40  class Laser720Interface;
41 }
42 
44 : public fawkes::Thread,
45  public fawkes::LoggingAspect,
51 {
52  public:
54  virtual ~LaserPointCloudThread();
55 
56  virtual void init();
57  virtual void loop();
58  virtual void finalize();
59 
60  // for BlackBoardInterfaceObserver
61  virtual void bb_interface_created(const char *type, const char *id) throw();
62 
63  // for BlackBoardInterfaceListener
64  virtual void bb_interface_writer_removed(fawkes::Interface *interface,
65  unsigned int instance_serial) throw();
66  virtual void bb_interface_reader_removed(fawkes::Interface *interface,
67  unsigned int instance_serial) throw();
68 
69  private:
70  void conditional_close(fawkes::Interface *interface) throw();
71  std::string interface_to_pcl_name(const char *interface_id);
72 
73  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
74  protected: virtual void run() { Thread::run(); }
75 
76  private:
77  /// @cond INTERNALS
78  typedef struct {
79  std::string id;
80  bool is_360;
81  union {
84  } interface_typed;
85  fawkes::Interface *interface;
86 
88  } InterfaceCloudMapping;
89  /// @endcond
90 
92 
93  float sin_angles360[360];
94  float cos_angles360[360];
95  float sin_angles720[720];
96  float cos_angles720[720];
97 };
98 
99 #endif
Laser360Interface Fawkes BlackBoard Interface.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
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:918
Thread class encapsulation of pthreads.
Definition: thread.h:42
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
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.