Fawkes API  Fawkes Development Version
joint_thread.h
1 
2 /***************************************************************************
3  * joint_thread.h - Thread to publish JointStates to ROS
4  *
5  * Created: Wed Sep 25 18:27:26 2013
6  * Copyright 2013 Till Hofmann
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_JOINT_THREAD_H_
23 #define __PLUGINS_ROS_JOINT_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 <plugins/ros/aspect/ros.h>
31 #include <blackboard/interface_listener.h>
32 #include <blackboard/interface_observer.h>
33 #include <core/threading/mutex.h>
34 #include <interfaces/JointInterface.h>
35 
36 #include <list>
37 
38 // from ROS
39 #include <ros/node_handle.h>
40 
42 : public fawkes::Thread,
43  public fawkes::LoggingAspect,
45  public fawkes::ROSAspect,
48 {
49  public:
51  virtual ~RosJointThread();
52 
53  virtual void init();
54  virtual void finalize();
55 
56  virtual void bb_interface_created(const char *type, const char *id) throw();
57  virtual void bb_interface_writer_removed(fawkes::Interface *interface,
58  unsigned int instance_serial) throw();
59  virtual void bb_interface_reader_removed(fawkes::Interface *interface,
60  unsigned int instance_serial) throw();
61  virtual void bb_interface_data_changed(fawkes::Interface *interface) throw();
62 
63  private:
64  void conditional_close(fawkes::Interface *interface) throw();
65 
66  private:
67  ros::Publisher ros_pub_;
68  std::list<fawkes::JointInterface *> ifs_;
69 
70 };
71 
72 #endif
virtual void bb_interface_created(const char *type, const char *id)
BlackBoard interface created notification.
virtual void init()
Initialize the thread.
virtual void bb_interface_data_changed(fawkes::Interface *interface)
BlackBoard data changed notification.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect to get access to a ROS node handle.
Definition: ros.h:39
Thread class encapsulation of pthreads.
Definition: thread.h:42
Thread to publish JointStates to ROS.
Definition: joint_thread.h:41
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 ~RosJointThread()
Destructor.
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:35
RosJointThread()
Constructor.
BlackBoard interface observer.
BlackBoard interface listener.
virtual void finalize()
Finalize the thread.