Fawkes API  Fawkes Development Version
position_3d_thread.h
1 /***************************************************************************
2  * position_3d_thread.h - Publish 3D Position to ROS
3  *
4  * Created: Wed Jul 16 17:04:42 2014
5  * Copyright 2014 Till Hofmann
6  *
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_ROS_POSITION_3D_THREAD_H_
23 #define __PLUGINS_ROS_POSITION_3D_THREAD_H_
24 
25 // TODO check includes
26 #include <core/threading/thread.h>
27 #include <aspect/blocked_timing.h>
28 #include <aspect/logging.h>
29 #include <aspect/blackboard.h>
30 #include <aspect/configurable.h>
31 #include <plugins/ros/aspect/ros.h>
32 #include <blackboard/interface_listener.h>
33 #include <blackboard/interface_observer.h>
34 #include <core/threading/mutex.h>
35 #include <interfaces/Position3DInterface.h>
36 
37 #include <list>
38 
39 // from ROS
40 #include <ros/node_handle.h>
41 
43 : public fawkes::Thread,
45  public fawkes::LoggingAspect,
47  public fawkes::ROSAspect,
50 {
51  public:
53  virtual ~RosPosition3DThread();
54 
55  virtual void init();
56  virtual void finalize();
57 
58  virtual void bb_interface_created(const char *type, const char *id) throw();
59  virtual void bb_interface_writer_removed(fawkes::Interface *interface,
60  unsigned int instance_serial) throw();
61  virtual void bb_interface_reader_removed(fawkes::Interface *interface,
62  unsigned int instance_serial) throw();
63  virtual void bb_interface_data_changed(fawkes::Interface *interface) throw();
64 
65  private:
66  void conditional_close(fawkes::Interface *interface) throw();
67 
68  private:
69  ros::Publisher ros_pub_;
70  std::list<fawkes::Position3DInterface *> ifs_;
71  std::string cfg_ros_topic_;
72 
73 };
74 
75 #endif
RosPosition3DThread()
Constructor.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect to get access to a ROS node handle.
Definition: ros.h:39
virtual ~RosPosition3DThread()
Destructor.
virtual void init()
Initialize the thread.
Thread class encapsulation of pthreads.
Definition: thread.h:42
Thread to publish Position3Ds to ROS.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
virtual void bb_interface_reader_removed(fawkes::Interface *interface, unsigned int instance_serial)
A reading instance has been closed for a watched interface.
virtual void bb_interface_writer_removed(fawkes::Interface *interface, unsigned int instance_serial)
A writing instance has been closed for a watched interface.
virtual void bb_interface_data_changed(fawkes::Interface *interface)
BlackBoard data changed notification.
Thread aspect to log output.
Definition: logging.h:35
BlackBoard interface observer.
Thread aspect to access configuration data.
Definition: configurable.h:35
virtual void bb_interface_created(const char *type, const char *id)
BlackBoard interface created notification.
virtual void finalize()
Finalize the thread.
BlackBoard interface listener.