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 <aspect/blackboard.h>
27 #include <aspect/blocked_timing.h>
28 #include <aspect/configurable.h>
29 #include <aspect/logging.h>
30 #include <blackboard/interface_listener.h>
31 #include <blackboard/interface_observer.h>
32 #include <core/threading/mutex.h>
33 #include <core/threading/thread.h>
34 #include <interfaces/Position3DInterface.h>
35 #include <plugins/ros/aspect/ros.h>
36 
37 #include <list>
38 
39 // from ROS
40 #include <ros/node_handle.h>
41 
44  public fawkes::LoggingAspect,
46  public fawkes::ROSAspect,
49 {
50 public:
52  virtual ~RosPosition3DThread();
53 
54  virtual void init();
55  virtual void finalize();
56 
57  virtual void bb_interface_created(const char *type, const char *id) throw();
58  virtual void bb_interface_writer_removed(fawkes::Interface *interface,
59  unsigned int instance_serial) throw();
60  virtual void bb_interface_reader_removed(fawkes::Interface *interface,
61  unsigned int instance_serial) throw();
62  virtual void bb_interface_data_changed(fawkes::Interface *interface) throw();
63 
64 private:
65  void conditional_close(fawkes::Interface *interface) throw();
66 
67 private:
68  ros::Publisher ros_pub_;
69  std::list<fawkes::Position3DInterface *> ifs_;
70  std::string cfg_ros_topic_;
71 };
72 
73 #endif
RosPosition3DThread()
Constructor.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:33
Thread aspect to get access to a ROS node handle.
Definition: ros.h:38
virtual ~RosPosition3DThread()
Destructor.
virtual void init()
Initialize the thread.
Thread class encapsulation of pthreads.
Definition: thread.h:45
Thread to publish Position3Ds to ROS.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:78
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:32
BlackBoard interface observer.
Thread aspect to access configuration data.
Definition: configurable.h:32
virtual void bb_interface_created(const char *type, const char *id)
BlackBoard interface created notification.
virtual void finalize()
Finalize the thread.
BlackBoard interface listener.