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 <aspect/blackboard.h>
27 #include <aspect/blocked_timing.h>
28 #include <aspect/logging.h>
29 #include <aspect/pointcloud.h>
30 #include <blackboard/interface_listener.h>
31 #include <blackboard/interface_observer.h>
32 #include <core/threading/thread.h>
33 #include <core/utils/lock_list.h>
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 class Laser1080Interface;
42 } // namespace fawkes
43 
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:
75  virtual void
76  run()
77  {
78  Thread::run();
79  }
80 
81 private:
82  /// @cond INTERNALS
83  typedef struct
84  {
85  std::string id;
86  unsigned int size;
87  union {
91  } interface_typed;
92  fawkes::Interface *interface;
93 
95  } InterfaceCloudMapping;
96  /// @endcond
97 
99 
100  float sin_angles360[360];
101  float cos_angles360[360];
102  float sin_angles720[720];
103  float cos_angles720[720];
104  float sin_angles1080[1080];
105  float cos_angles1080[1080];
106 };
107 
108 #endif
Laser360Interface Fawkes BlackBoard Interface.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:33
Laser1080Interface Fawkes BlackBoard Interface.
Fawkes library namespace.
Thread aspect to provide and access point clouds.
Definition: pointcloud.h:37
virtual void bb_interface_created(const char *type, const char *id)
BlackBoard interface created notification.
virtual void loop()
Code to execute in the thread.
Thread class encapsulation of pthreads.
Definition: thread.h:45
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:78
virtual void init()
Initialize the thread.
Thread aspect to use blocked timing.
virtual void bb_interface_writer_removed(fawkes::Interface *interface, unsigned int instance_serial)
A writing instance has been closed for a watched interface.
Thread aspect to log output.
Definition: logging.h:32
BlackBoard interface observer.
virtual void finalize()
Finalize the thread.
virtual ~LaserPointCloudThread()
Destructor.
RefPtr<> is a reference-counting shared smartpointer.
Definition: refptr.h:49
virtual void run()
Stub to see name in backtrace for easier debugging.
virtual void bb_interface_reader_removed(fawkes::Interface *interface, unsigned int instance_serial)
A reading instance has been closed for a watched interface.
Thread to exchange transforms between Fawkes and ROS.
Laser720Interface Fawkes BlackBoard Interface.
BlackBoard interface listener.